| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.process.vo.MesProProcessPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.process.vo.MesProProcessRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.process.vo.MesProProcessSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.process.vo.MesProProcessImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.process.vo.MesProProcessImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.process.MesProProcessDO; |
| | | import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得生产工序") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-process:query')") |
| | | public CommonResult<MesProProcessRespVO> getProcess(@RequestParam("id") Long id) { |
| | | MesProProcessDO process = processService.getProcess(id); |
| | | return success(BeanUtils.toBean(process, MesProProcessRespVO.class)); |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得生产工序分页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-process:query')") |
| | | public CommonResult<PageResult<MesProProcessRespVO>> getProcessPage(@Valid MesProProcessPageReqVO pageReqVO) { |
| | | PageResult<MesProProcessDO> pageResult = processService.getProcessPage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, MesProProcessRespVO.class)); |
| | |
| | | ExcelUtils.write(response, "生产工序.xls", "数据", MesProProcessRespVO.class, data); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "下载工序导入模板") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-process:import')") |
| | | public void importTemplate(HttpServletResponse response) throws IOException { |
| | | MesProProcessImportExcelVO example = new MesProProcessImportExcelVO(); |
| | | example.setCode("PROCESS001"); |
| | | example.setName("示例工序"); |
| | | example.setBillingType(2); |
| | | example.setWageRate(new java.math.BigDecimal("12.50")); |
| | | example.setStdTimeModeName("未启用"); |
| | | example.setStatus(CommonStatusEnum.ENABLE.getStatus()); |
| | | ExcelUtils.write(response, "工序导入模板.xls", "工序设置", MesProProcessImportExcelVO.class, List.of(example)); |
| | | } |
| | | |
| | | @PostMapping("/import") |
| | | @Operation(summary = "导入工序") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-process:import')") |
| | | public CommonResult<MesProProcessImportRespVO> importProcess(@RequestParam("file") MultipartFile file, |
| | | @RequestParam(value = "updateSupport", defaultValue = "false") boolean updateSupport) throws IOException { |
| | | return success(processService.importProcessList(ExcelUtils.read(file, MesProProcessImportExcelVO.class), updateSupport)); |
| | | } |
| | | |
| | | } |