| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.batch; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.bagcode.vo.MesProBagCodeRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.batch.vo.MesProBatchPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.batch.vo.MesProBatchPreGenerateReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.batch.vo.MesProBatchPreGenerateRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.batch.vo.MesProBatchRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.batch.vo.MesProBatchSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.batch.vo.MesProBatchTraceRespVO; |
| | |
| | | private MesProBagCodeService bagCodeService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建生产批次(自动生成批次号)") |
| | | @Operation(summary = "创建生产批次(一次录入业务信息,自动生成批次号)") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-batch:create')") |
| | | public CommonResult<Long> createBatch(@Valid @RequestBody MesProBatchSaveReqVO createReqVO) { |
| | | return success(batchService.createBatch(createReqVO)); |
| | | } |
| | | |
| | | @PostMapping("/pre-generate") |
| | | @Operation(summary = "预生成生产批次二维码(仅生成临时批次码,不录入业务信息)") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-batch:create')") |
| | | public CommonResult<List<MesProBatchPreGenerateRespVO>> preGenerateBatch( |
| | | @Valid @RequestBody MesProBatchPreGenerateReqVO preGenerateReqVO) { |
| | | List<MesProBatchDO> list = batchService.preGenerateBatch(preGenerateReqVO); |
| | | return success(BeanUtils.toBean(list, MesProBatchPreGenerateRespVO.class)); |
| | | } |
| | | |
| | | @PutMapping("/fill-info") |
| | | @Operation(summary = "补录生产批次业务信息(生成正式批次号,仅临时批次可用)") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-batch:update')") |
| | | public CommonResult<Boolean> fillBatchInfo(@Valid @RequestBody MesProBatchSaveReqVO fillReqVO) { |
| | | batchService.fillBatchInfo(fillReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | |
| | | if (pallets.size() + 1 > QrCodeImageUtils.MAX_QR_EXPORT) { |
| | | throw exception(PRO_QR_EXPORT_TOO_MANY); |
| | | } |
| | | QrCodeImageUtils.writeZip(response, "批次二维码-" + batch.getCode(), buildBatchQrLabels(batch, pallets)); |
| | | String qrCode = StrUtil.blankToDefault(batch.getCode(), batch.getTempCode()); |
| | | QrCodeImageUtils.writeZip(response, "批次二维码-" + qrCode, buildBatchQrLabels(batch, pallets)); |
| | | } |
| | | |
| | | // ==================== 拼接 VO ==================== |