| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.production.dto.BomImportDto; |
| | | import com.ruoyi.technology.bean.dto.BomImportDto; |
| | | import com.ruoyi.technology.bean.dto.TechnologyBomDto; |
| | | import com.ruoyi.technology.bean.vo.TechnologyBomVo; |
| | | import com.ruoyi.technology.pojo.TechnologyBom; |
| | | import com.ruoyi.technology.service.TechnologyBomService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/technologyBom") |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "基础BOM") |
| | | @Tag(name = "基础BOM") |
| | | public class TechnologyBomController { |
| | | |
| | | private final TechnologyBomService technologyBomService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "Technology BOM page", businessType = BusinessType.OTHER) |
| | | @ApiOperation("BOM分页查询") |
| | | @Operation(summary = "BOM分页查询") |
| | | public R<IPage<TechnologyBomVo>> listPage(Page<TechnologyBomDto> page, TechnologyBomDto technologyBomDto) { |
| | | return R.ok(technologyBomService.listPage(page, technologyBomDto)); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "Add technology BOM", businessType = BusinessType.INSERT) |
| | | @ApiOperation("新增BOM") |
| | | @Operation(summary = "新增BOM") |
| | | public R add(@RequestBody TechnologyBom technologyBom) { |
| | | return technologyBomService.add(technologyBom); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Log(title = "Update technology BOM", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改BOM") |
| | | @Operation(summary = "修改BOM") |
| | | public R update(@RequestBody TechnologyBom technologyBom) { |
| | | return technologyBomService.update(technologyBom); |
| | | } |
| | | |
| | | @DeleteMapping("/batchDelete") |
| | | @Log(title = "Delete technology BOM", businessType = BusinessType.DELETE) |
| | | @ApiOperation("批量删除BOM") |
| | | public R batchDelete(@RequestBody List<Integer> ids) { |
| | | @Operation(summary = "批量删除BOM") |
| | | public R batchDelete(@RequestBody List<Long> ids) { |
| | | return R.ok(technologyBomService.batchDelete(ids)); |
| | | } |
| | | |
| | | @GetMapping("/getByModel") |
| | | @Log(title = "List BOM by model", businessType = BusinessType.OTHER) |
| | | @ApiOperation("根据规格查询BOM") |
| | | @Operation(summary = "根据规格查询BOM") |
| | | public R<List<TechnologyBomVo>> getByModel(Long productModelId) { |
| | | return R.ok(technologyBomService.listByModel(productModelId)); |
| | | } |
| | |
| | | @PostMapping("/uploadBom") |
| | | @PreAuthorize("@ss.hasPermi('product:bom:import')") |
| | | @Log(title = "根据Excel导入BOM", businessType = BusinessType.IMPORT) |
| | | @ApiOperation("根据Excel导入BOM") |
| | | @Operation(summary = "根据Excel导入BOM") |
| | | public R uploadBom(@RequestParam("file") MultipartFile file) { |
| | | return technologyBomService.uploadBom(file); |
| | | } |
| | | |
| | | @PostMapping("/exportBom") |
| | | @PreAuthorize("@ss.hasPermi('product:bom:export')") |
| | | @ApiOperation("导出BOM文件") |
| | | @Operation(summary = "导出BOM文件") |
| | | @Log(title = "导出BOM文件", businessType = BusinessType.EXPORT) |
| | | public void exportBom(HttpServletResponse response, @RequestParam Integer bomId) { |
| | | technologyBomService.exportBom(response, bomId); |
| | |
| | | |
| | | @GetMapping("/downloadTemplate") |
| | | @Log(title = "下载BOM导入模板", businessType = BusinessType.EXPORT) |
| | | @ApiOperation("下载BOM导入模板") |
| | | @Operation(summary = "下载BOM导入模板") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil<BomImportDto> excelUtil = new ExcelUtil<>(BomImportDto.class); |
| | | excelUtil.importTemplateExcel(response, "BOM导入模板"); |