diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesTemplateService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesTemplateService.java index 114e632..8decb81 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesTemplateService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/base/IMesTemplateService.java @@ -1,8 +1,12 @@ package cn.estsh.i3plus.ext.mes.pcn.api.base; import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplate; +import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplateFieldValue; import io.swagger.annotations.ApiOperation; +import java.util.List; +import java.util.Map; + public interface IMesTemplateService { /** @@ -16,4 +20,6 @@ public interface IMesTemplateService { @ApiOperation(value = "按条件查询", notes = "按条件查询") MesLabelTemplate getLabelTemplate(String templateCode, String organizeCode); + + Map queryMesLabelTemplateParamPartValue(String partNo, String labelTemplate, String organizeCode); } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java index 3f93913..6a1b4d1 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesInputDefectRecordService.java @@ -4,7 +4,6 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; import cn.estsh.i3plus.pojo.mes.bean.MesPartTypeDefect; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; -import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; import io.swagger.annotations.ApiOperation; import java.util.List; @@ -20,14 +19,14 @@ public interface IMesInputDefectRecordService { @ApiOperation(value = "查询页面信息") - MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model, String org); + MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model); @ApiOperation(value = "零件类型缺陷类型对应关系信息") List queryPartTypeDefect(String serialNumber, String defectLocation, boolean flg, Integer frontBack, String org); @ApiOperation(value = "完成质检") - void savePartInspection(MesPartInspectionInputModel model, String org); + void savePartInspection(MesPartInspectionInputModel model); @ApiOperation(value = "客退品") MesProduceSn customerBack(String organizeCode, String sn, String userName); diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java index 8472b8e..93df197 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesNcProcessingService.java @@ -20,21 +20,19 @@ import java.util.List; **/ public interface IMesNcProcessingService { - @ApiOperation(value = "查询NC-零件检测-单据") - public ListPager queryPartInspectionByPager(MesPartInspection partInspection, Pager pager); + ListPager queryPartInspectionByPager(MesPartInspection partInspection, Pager pager); @ApiOperation(value = "查询NC-零件检测-单据") - public MesNcProcessingModel queryPartInspection(MesPartInspection partInspection); + MesNcProcessingModel queryPartInspection(MesPartInspection partInspection); @ApiOperation(value = "查询责任人") - public List queryPerson(String org); + List queryPerson(String org); @ApiOperation(value = "查询标记不良的物料及批次") - public ListPager queryPartLot(String partNo, String lot, String org, Pager pager); + ListPager queryPartLot(String partNo, String lot, String org, Pager pager); @ApiOperation(value = "NC处理") - public void saveNc(MesNcProcessingInputModel model, String org, boolean isOrder); - + void saveNc(MesNcProcessingInputModel model, String org, boolean isOrder); } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPrintedSnLogService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPrintedSnLogService.java index a4b153e..99c9830 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPrintedSnLogService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPrintedSnLogService.java @@ -4,6 +4,8 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel; import cn.estsh.i3plus.pojo.mes.bean.MesPrintedSnLog; import io.swagger.annotations.ApiOperation; +import java.util.Map; + /** * @Description : 条码打印记录表 * @Reference : @@ -16,6 +18,9 @@ public interface IMesPrintedSnLogService { @ApiOperation(value = "条码打印记录表") MesPrintedSnLog getMesPrintedSnLog(String userName, String organizeCode, MesProduceSnPrintDataModel printDataModel); + @ApiOperation(value = "条码打印记录表") + MesPrintedSnLog getMesCustomPrintedSnLog(String userName, String organizeCode, MesProduceSnPrintDataModel printDataModel, Map printContext); + @ApiOperation(value = "写入条码打印记录表") void insertMesPrintedSnLog(MesPrintedSnLog mesPrintedSnLog,String userName); } diff --git a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java index 641acc0..6443ef6 100644 --- a/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java +++ b/modules/i3plus-ext-mes-pcn-api/src/main/java/cn/estsh/i3plus/ext/mes/pcn/api/busi/IMesPullingOrderInfoService.java @@ -24,6 +24,8 @@ public interface IMesPullingOrderInfoService { List doMesPullingOrderInfoPrint(MesPullingOrderInfo mesPullingOrderInfo); + List doMesPullingOrderInfoPrintNew(MesPullingOrderInfo mesPullingOrderInfo); + ListPager queryMesPullingOrderPartInfoByPager(MesPullingOrderInfo mesPullingOrderInfo, Pager pager); List doMesPullingOrderInfoSend(List infoList, String userName); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java index c75ac3b..6957dcb 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/base/MesWhiteController.java @@ -1,20 +1,32 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.base; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.model.MesPictureModel; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesConfigService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi.MesProduceSnExtService; import cn.estsh.impp.framework.boot.util.ResultBean; +import cn.hutool.json.JSONUtil; +import io.swagger.annotations.Api; +import jodd.util.Base64; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.nio.file.Files; @RestController @RequestMapping("/white") +@Api(tags = "白名单") +@Slf4j public class MesWhiteController { @Autowired private MesProduceSnExtService mesProduceSnExtService; + @Autowired + private MesConfigService mesConfigService; + @GetMapping("/mesPartSap/{productSn}/{organizeCode}") public ResultBean getPartNo(@PathVariable String productSn,@PathVariable String organizeCode){ @@ -27,4 +39,24 @@ public class MesWhiteController { return ResultBean.success("查询成功").setResultObject(partNo); } + + @PostMapping("/picture") + public ResultBean savePicture(@RequestBody MesPictureModel model){ + + String localUrl = mesConfigService.getCfgValue(model.getOrganizeCode(), "LOCAL_PICTURE_ABS_URL"); + File file = new File(localUrl+model.getFileName()); + byte[] decode = Base64.decode(model.getFile()); + OutputStream outputStream; + try { + outputStream = Files.newOutputStream(file.toPath()); + outputStream.write(decode); + outputStream.close(); + } catch (IOException e) { + log.error("保存图片出错:{}",e.getMessage()); + log.error("入参为:{}", model); + } + return ResultBean.success("查询成功"); + + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java index 2d41c6f..6891cd8 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesInputDefectRecordController.java @@ -7,7 +7,6 @@ import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; import cn.estsh.i3plus.platform.common.tool.MathOperation; import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; -import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -35,8 +34,8 @@ public class MesInputDefectRecordController { public ResultBean queryPartInspection(@RequestBody MesPartInspectionInputModel model) { try { - String organizeCode = !StringUtils.isEmpty(model.getOrganizeCode()) ? model.getOrganizeCode() : AuthUtil.getOrganize().getOrganizeCode(); - MesPartInspectionViewModel result = inputDefectRecordService.queryPartInspection(model, organizeCode); + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + MesPartInspectionViewModel result = inputDefectRecordService.queryPartInspection(model); String msg = "查询成功"; if (!StringUtils.isEmpty(model.getFrontBack()) && model.getFrontBack().compareTo(10) == 0 && (Objects.isNull(result.getPartTypePicture()) || StringUtils.isEmpty(result.getPartTypePicture().getFrontPictureName()))) msg = "A面图片未维护"; if (!StringUtils.isEmpty(model.getFrontBack()) && model.getFrontBack().compareTo(20) == 0 && (Objects.isNull(result.getPartTypePicture()) || StringUtils.isEmpty(result.getPartTypePicture().getBackPictureName()))) msg = "B面图片未维护"; @@ -50,16 +49,14 @@ public class MesInputDefectRecordController { @GetMapping("/query-part-type-defect") @ApiOperation(value = "查询零件类型缺陷类型对应关系") - public ResultBean queryPartTypeDefect(String partNo, String defectLocation, boolean flg, Integer frontBack,String organizeCode) { + public ResultBean queryPartTypeDefect(String partNo, String defectLocation, boolean flg, Integer frontBack, String organizeCode) { try { - // 数据校验 ValidatorBean.checkNotNull(partNo, "物料号不能为空"); ValidatorBean.checkNotNull(defectLocation, "位置不能为空"); ValidatorBean.checkNotNull(frontBack, "正反面不能为空"); - -// return ResultBean.success("查询成功").setResultList(inputDefectRecordService.queryPartTypeDefect(partNo, defectLocationCode, flg, frontBack, "2031")); - return ResultBean.success("查询成功").setResultList(inputDefectRecordService.queryPartTypeDefect(partNo, defectLocation, flg, frontBack,!StringUtils.isEmpty(organizeCode)?organizeCode:AuthUtil.getOrganizeCode())); + ValidatorBean.checkNotNull(organizeCode, "工厂不能为空"); + return ResultBean.success("查询成功").setResultList(inputDefectRecordService.queryPartTypeDefect(partNo, defectLocation, flg, frontBack, organizeCode)); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); } catch (Exception e) { @@ -72,15 +69,14 @@ public class MesInputDefectRecordController { public ResultBean savePartInspection(@RequestBody MesPartInspectionInputModel model) { try { - + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + ValidatorBean.checkNotNull(model.getUserInfo(), "操作人不能为空"); if (StringUtils.isEmpty(model.getSn()) && (StringUtils.isEmpty(model.getPartNo()) || StringUtils.isEmpty(model.getLotNo()) || StringUtils.isEmpty(model.getQty()) || MathOperation.compareTo(model.getQty(), new Double(0)) == 0)) { - throw new ImppBusiException("条码为空或零件号+批次+数量为空"); } -// inputDefectRecordService.savePartInspection(model, "CK01"); - inputDefectRecordService.savePartInspection(model, !StringUtils.isEmpty(model.getOrganizeCode())?model.getOrganizeCode():AuthUtil.getOrganizeCode()); + inputDefectRecordService.savePartInspection(model); return ResultBean.success("质检已完成,请继续"); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); @@ -94,7 +90,6 @@ public class MesInputDefectRecordController { public ResultBean customerBack(@RequestBody MesPartInspectionInputModel model) { try { -// inputDefectRecordService.savePartInspection(model, "CK01"); MesProduceSn mesProduceSn = inputDefectRecordService.customerBack(model.getOrganizeCode(), model.getSn(), model.getUserInfo()); return ResultBean.success("客退品已完成,请继续").setResultObject(mesProduceSn); } catch (ImppBusiException imppException) { @@ -109,7 +104,6 @@ public class MesInputDefectRecordController { public ResultBean customerBackCommit(@RequestBody MesPartInspectionInputModel model) { try { -// inputDefectRecordService.savePartInspection(model, "CK01"); inputDefectRecordService.customerBackCommit(model.getOrganizeCode(), model.getSn(), model.getUserInfo()); return ResultBean.success("客退品提交已完成,请继续"); } catch (ImppBusiException imppException) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java index cdf87d5..6e6d121 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesNcProcessingController.java @@ -8,7 +8,6 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -36,7 +35,7 @@ public class MesNcProcessingController { public ResultBean queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) { try { - + ValidatorBean.checkNotNull(partInspection.getOrganizeCode(), "工厂不能为空"); partInspection.setOrganizeCode(partInspection.getOrganizeCode()); ListPager partInspectionListPager = ncProcessingService.queryPartInspectionByPager(partInspection, pager); return ResultBean.success("查询成功").setListPager(partInspectionListPager); @@ -52,8 +51,7 @@ public class MesNcProcessingController { public ResultBean queryPartInspection(MesPartInspection partInspection) { try { - - partInspection.setOrganizeCode(!StringUtils.isEmpty(partInspection.getOrganizeCode())?partInspection.getOrganizeCode():AuthUtil.getOrganizeCode()); + ValidatorBean.checkNotNull(partInspection.getOrganizeCode(), "工厂不能为空"); return ResultBean.success("查询成功").setResultObject(ncProcessingService.queryPartInspection(partInspection)); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); @@ -67,8 +65,8 @@ public class MesNcProcessingController { public ResultBean queryPerson(String organizeCode) { try { - - return ResultBean.success("查询成功").setResultList(ncProcessingService.queryPerson(!StringUtils.isEmpty(organizeCode)?organizeCode:AuthUtil.getOrganizeCode())); + ValidatorBean.checkNotNull(organizeCode, "工厂不能为空"); + return ResultBean.success("查询成功").setResultList(ncProcessingService.queryPerson(organizeCode)); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); } catch (Exception e) { @@ -82,7 +80,8 @@ public class MesNcProcessingController { public ResultBean saveNc(@RequestBody MesNcProcessingInputModel model) { try { - // 数据校验 + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + ValidatorBean.checkNotNull(model.getUserName(), "操作人不能为空"); ValidatorBean.checkNotNull(model.getPartInspection(), "单据不能为空"); ValidatorBean.checkNotNull(model.getPartInspectionDetailList(), "单据明细不能为空"); if (model.getType() == MesExtEnumUtil.NC_TYPE.REWORK.getValue() @@ -102,7 +101,7 @@ public class MesNcProcessingController { if (CollectionUtils.isEmpty(model.getPartInspectionDetailList())) { throw new ImppBusiException("不存在可疑信息,请检查数据"); } - ncProcessingService.saveNc(model, !StringUtils.isEmpty(model.getOrganizeCode())? model.getOrganizeCode() : AuthUtil.getOrganizeCode(), false); + ncProcessingService.saveNc(model, model.getOrganizeCode(), false); return ResultBean.success("NC处理成功"); } catch (ImppBusiException imppException) { return ResultBean.fail(imppException); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java index ecc9636..9ff660f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesPullingOrderInfoController.java @@ -113,6 +113,46 @@ public class MesPullingOrderInfoController { return ResultBean.fail(e); } } + @PostMapping(value = "/new/doPrint") + @ApiOperation(value = "打印未打印拉动单后修改状态--带类型") + public ResultBean doMesPullingOrderInfoNewPrint(@RequestBody MesPullingOrderInfo mesPullingOrderInfo) { + try { + + if (StringUtils.isEmpty(mesPullingOrderInfo.getOrganizeCode())) { + throw new ImppBusiException("工厂不能为空"); + } + + if (StringUtils.isEmpty(mesPullingOrderInfo.getWorkCenterCode())) { + throw new ImppBusiException("产线不能为空"); + } + + if (StringUtils.isEmpty(mesPullingOrderInfo.getPullCode())) { + throw new ImppBusiException("拉动组不能为空"); + } + + if (StringUtils.isEmpty(mesPullingOrderInfo.getModifyUser())) { + throw new ImppBusiException("操作人不能为空"); + } + + String moduleKey = new StringJoiner(MesPcnExtConstWords.COLON) + .add(mesPullingOrderInfo.getOrganizeCode()) + .add("PRINT_PULLING_ORDER_INFO") + .add(mesPullingOrderInfo.getWorkCenterCode()).add(mesPullingOrderInfo.getPullCode()).toString(); + + synchronized (moduleKey.intern()) { + + List pullingOrderInfos = mesPullingOrderInfoService.doMesPullingOrderInfoPrint(mesPullingOrderInfo); + + return ResultBean.success(CollectionUtils.isEmpty(pullingOrderInfos) ? "查询暂无可打印数据!!!" : "打印队列查询成功!!!").setResultList(pullingOrderInfos); + + } + + } catch (ImppBusiException e) { + return ResultBean.fail(e).build(); + } catch (Exception e) { + return ResultBean.fail(e); + } + } @GetMapping("/template") @ApiOperation(value = "查询打印模板和明细") public ResultBean queryMesLabelTemplate(MesLabelTemplate labelTemplate ) { diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesPictureModel.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesPictureModel.java new file mode 100644 index 0000000..64d3d49 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/model/MesPictureModel.java @@ -0,0 +1,10 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.model; + +import lombok.Data; + +@Data +public class MesPictureModel { + private String file; + private String fileName; + private String organizeCode; +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java index ea8f679..b463e6a 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java @@ -10,6 +10,7 @@ import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblyNosortContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblySortContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesReworkTaskRequestModel; @@ -142,6 +143,18 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { @Autowired private MesProductVersionRepository productVersionRepository; + @Autowired + private MesProductionRecordRepository productionRecordRepository; + + @Autowired + private IMesMoveRuleRepository mesMoveRuleRepository; + + @Autowired + private MesWorkOrderPartRepository workOrderPartRepository; + + @Autowired + private MesPartProdGroupRepository mesPartProdGroupRao; + @Override public ListPager queryReworkTask(MesReworkTask mesReworkTask, Pager pager) { String organizeCode = !StringUtils.isEmpty(mesReworkTask.getOrganizeCode())?mesReworkTask.getOrganizeCode():AuthUtil.getOrganizeCode(); @@ -297,6 +310,65 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { // ConvertBean.serviceModelUpdate(mesPartInspection, requestModel.getUserName()); mesPartInspectionRepository.update(mesPartInspection); } + // 是否头零件模式 + boolean headModel = true; + if (!StringUtil.isEmpty(requestModel.getSn())) { + // 判断是头零件还是散件 查询加工记录 + DdlPackBean productionPackBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(requestModel.getSn(), "productSn", productionPackBean); + DdlPreparedPack.getNumNOEqualPack(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue(), "reportStatus", productionPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue(), "reportType", productionPackBean); + MesProductionRecord record = productionRecordRepository.getByProperty(productionPackBean); + if (record != null) { + headModel = false; + } + } + // 如果是散件模式,需要查询出对应明细 + List mesPartModels = new ArrayList<>(); + if (!headModel) { + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(requestModel.getSn(), "workOrderNo", partPackBean); + List workOrderParts = workOrderPartRepository.findByHqlWhere(partPackBean); + if (!CollectionUtils.isEmpty(workOrderParts)) { + DdlPackBean partProdBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(mesPartInspection.getWorkCenterCode(), "workCenterCode", partProdBean); + List mesPartProdGroupList = mesPartProdGroupRao.findByHqlTopWhere(partProdBean, 1); + for (MesWorkOrderPart workOrderPart : workOrderParts) { + MesPart partInfo = mesPartService.getMesPartByPartNo(workOrderPart.getPartNo(), mesReworkTask.getOrganizeCode()); + String esd = partInfo.getEsd(); + + // 查询移库规则 + DdlPackBean movePackBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(esd, "srcType", movePackBean); + DdlPreparedPack.getStringEqualPack(mesPartProdGroupList.get(0).getPartProdGroupCode(), "code", movePackBean); + List moveRules = mesMoveRuleRepository.findByHqlWhere(movePackBean); + if (!CollectionUtils.isEmpty(moveRules)) { + MesPartModel mesPartModel = new MesPartModel(); + mesPartModel.setPartNo(workOrderPart.getPartNo()); + mesPartModel.setLocateNo(moveRules.get(0).getErpDestLocateNo()); + mesPartModels.add(mesPartModel); + } + } + } + } + + + + String target = mesConfigService.getCfgValue(requestModel.getOrganizeCode(), "UMLGO"); + String workCenterCode = ""; + if (mesPartInspection != null) { + workCenterCode = mesPartInspection.getWorkCenterCode(); + } + if (MesExtEnumUtil.NC_TYPE.REWORK.getValue() == requestModel.getType()) { + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + String destLocateNo = getDestLocateNo(requestModel.getOrganizeCode(), mesPartInspection.getId()); + for (MesPartModel mesPartModel : mesPartModels) { + doCreateReworkMove(requestModel,destLocateNo, target, workCenterCode, mesPartModel.getPartNo(), mesPartInspection.getId()); + } + } else { + doCreateReworkMove(requestModel, getDestLocateNo(requestModel.getOrganizeCode(), mesPartInspection.getId()), target, workCenterCode, mesReworkTask.getPartNo(), mesPartInspection.getId()); + } + } } if (MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue() == mesReworkTask.getType()) { mesReworkTask.setReworkedQty(requestModel.getReworkedQty()); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesTemplateServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesTemplateServiceImpl.java index 86eaeb7..992c00c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesTemplateServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/base/MesTemplateServiceImpl.java @@ -7,15 +7,25 @@ import cn.estsh.i3plus.platform.common.util.MesPcnConstWords; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; +import cn.estsh.i3plus.pojo.base.util.StringUtil; import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplate; +import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplateFieldInfo; +import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplateFieldValue; import cn.estsh.i3plus.pojo.mes.bean.MesLabelTemplateParam; +import cn.estsh.i3plus.pojo.mes.repository.MesLabelTemplateFieldInfoRepository; +import cn.estsh.i3plus.pojo.mes.repository.MesLabelTemplateFieldValueRepository; import cn.estsh.i3plus.pojo.mes.repository.MesLabelTemplateParamRepository; import cn.estsh.i3plus.pojo.mes.repository.MesLabelTemplateRepository; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import cn.hutool.core.util.ObjectUtil; import org.apache.shiro.util.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.TreeMap; /** * @Description : 打印模板 @@ -33,6 +43,12 @@ public class MesTemplateServiceImpl implements IMesTemplateService { @Autowired private MesLabelTemplateParamRepository mesLabelTemplateParamRDao; + @Autowired + private MesLabelTemplateFieldInfoRepository labelTemplateFieldInfoRDao; + + @Autowired + private MesLabelTemplateFieldValueRepository labelTemplateFieldValueRDao; + @Override public MesLabelTemplate getMesLabelTemplate(String templateCode,String organizeCode) { // 根据标签模板代码,查询【MES_标签模板表】,获取对应的方法代码 @@ -70,4 +86,43 @@ public class MesTemplateServiceImpl implements IMesTemplateService { } return mesLabelTemplate; } + + @Override + public Map queryMesLabelTemplateParamPartValue(String partNo, String labelTemplate, String organizeCode) { + if (StringUtil.isEmpty(labelTemplate)) { + MesPcnException.throwMesBusiException("零件号【%s】未维护\"零件条码匹配模板\"字段值", partNo); + } + + Map result = new HashMap<>(); + List templateFieldInfos = labelTemplateFieldInfoRDao.findByProperty( + new String[]{"templateCode", "templateFieldType", MesPcnConstWords.IS_VALID, MesPcnConstWords.IS_DELETED, MesPcnConstWords.ORGANIZE_CODE}, + new Object[]{labelTemplate, MesExtEnumUtil.LABEL_TEMPLATE_FIELD_TYPE.CUSTOM.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), + CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), organizeCode}); + Map templateFieldInfoMap = new TreeMap<>(); + for (MesLabelTemplateFieldInfo info : templateFieldInfos) { + templateFieldInfoMap.putIfAbsent(info.getTemplateParam(), info); + } + + List fieldValueList = labelTemplateFieldValueRDao.findByProperty( + new String[]{"partNo", "templateCode", MesPcnConstWords.IS_VALID, MesPcnConstWords.IS_DELETED, MesPcnConstWords.ORGANIZE_CODE}, + new Object[]{partNo, labelTemplate, CommonEnumUtil.IS_VAILD.VAILD.getValue(), + CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), organizeCode}); + if (!CollectionUtils.isEmpty(fieldValueList)) { + for (MesLabelTemplateFieldValue fieldValue : fieldValueList) { + if (StringUtil.isEmpty(fieldValue.getTemplateParam())) { + continue; + } + MesLabelTemplateFieldInfo templateFieldInfo = templateFieldInfoMap.remove(fieldValue.getTemplateParam()); + if (templateFieldInfo != null) { + result.put(templateFieldInfo.getTemplateParam(), ObjectUtil.clone(fieldValue.getFieldValue())); + } + } + } + + for (Map.Entry entry : templateFieldInfoMap.entrySet()) { + MesLabelTemplateFieldInfo fieldInfo = entry.getValue(); + result.put(fieldInfo.getTemplateParam(), null); + } + return result; + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java index 67aa103..665dd30 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java @@ -10,6 +10,7 @@ import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartInspectionViewModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; import cn.estsh.i3plus.platform.common.convert.ConvertBean; @@ -27,7 +28,6 @@ import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTaskDetail; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; import cn.estsh.i3plus.pojo.mes.repository.*; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; -import cn.estsh.impp.framework.boot.auth.AuthUtil; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -42,7 +42,6 @@ import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * @Description : @@ -117,55 +116,67 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService @Autowired private MesWorkCenterPartRelationRepository workCenterPartRelationRepository; + @Autowired + private MesProductionRecordRepository productionRecordRepository; + + @Autowired + private IMesMoveRuleRepository mesMoveRuleRepository; + + @Autowired + private MesWorkOrderPartRepository workOrderPartRepository; + + @Autowired + private MesPartProdGroupRepository mesPartProdGroupRao; + @Override - public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel inputModel, String org) { + public MesPartInspectionViewModel queryPartInspection(MesPartInspectionInputModel model) { //检查物料 MesPart part; //获取NC-零件检测-单据 MesPartInspection partInspection = null; - Integer sourceType = null; - if (!StringUtils.isEmpty(inputModel.getSn())) { + Integer sourceType; + if (!StringUtils.isEmpty(model.getSn())) { // 数据校验 - ValidatorBean.checkNotNull(inputModel.getFrontBack(), "正反面不能为空"); + ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空"); //检查条码 - MesProduceSn produceSn = checkProduceSn(inputModel.getSn(), org); + MesProduceSn produceSn = checkProduceSn(model.getSn(), model.getOrganizeCode()); //获取NC-零件检测-单据 - partInspection = getPartInspection(produceSn,inputModel, org); + partInspection = getPartInspection(produceSn, model, model.getOrganizeCode()); //检查物料 - part = checkPart(produceSn, org); + part = checkPart(produceSn, model.getOrganizeCode()); sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue(); } else { // 数据校验 - ValidatorBean.checkNotNull(inputModel.getPartNo(), "物料不能为空"); - ValidatorBean.checkNotNull(inputModel.getLotNo(), "批次不能为空"); - ValidatorBean.checkNotNull(inputModel.getFrontBack(), "正反面不能为空"); - ValidatorBean.checkNotNull(inputModel.getQty(), "数量不能为空"); + ValidatorBean.checkNotNull(model.getPartNo(), "物料不能为空"); + ValidatorBean.checkNotNull(model.getLotNo(), "批次不能为空"); + ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空"); + ValidatorBean.checkNotNull(model.getQty(), "数量不能为空"); //检查物料 - part = checkPartByPartNo(inputModel.getPartNo(), org); + part = checkPartByPartNo(model.getPartNo(), model.getOrganizeCode()); //获取NC-零件检测-单据 - if(!Objects.isNull(inputModel.getId())){ - partInspection = getPartInspectionByPartAndLot(inputModel, org); + if(!Objects.isNull(model.getId())){ + partInspection = getPartInspectionByPartAndLot(model, model.getOrganizeCode()); } sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); } //检查零件类型与图片对应关系 - MesPartTypePicture partTypePicture = checkPartTypePicture(part, org); + MesPartTypePicture partTypePicture = checkPartTypePicture(part, model.getOrganizeCode()); //构造返回信息 - MesPartInspectionViewModel model = getModel(partInspection, part, partTypePicture, inputModel, sourceType, org); - model.setSourceType(sourceType); - model.setTransferFlg(inputModel.isTransferFlg()); + MesPartInspectionViewModel result = getModel(partInspection, part, partTypePicture, model, sourceType); + result.setSourceType(sourceType); + result.setTransferFlg(model.isTransferFlg()); - return model; + return result; } /** @@ -222,12 +233,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService * 完成质检-保存不良记录 * * @param model - * @param org */ @Override - public void savePartInspection(MesPartInspectionInputModel model, String org) { + public void savePartInspection(MesPartInspectionInputModel model) { - MesProduceSn produceSn = getProduceSn(model.getSn(), org); + MesProduceSn produceSn = getProduceSn(model.getSn(), model.getOrganizeCode()); if (null != produceSn && StringUtils.isEmpty(model.getPartNo())) model.setPartNo(produceSn.getPartNo()); //武汉 会输入客户条码 boolean isWorkOrderQcStatus=false; @@ -235,7 +245,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService model.setCustSn(produceSn.getCustSn()); model.setSn(produceSn.getProductSn()); //排序产线 更新工单的 qcStatus - MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(org, produceSn.getWorkCenterCode()); + MesWorkCenter centerDb = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), produceSn.getWorkCenterCode()); if (!StringUtil.isEmpty(centerDb)){ isWorkOrderQcStatus= centerDb.getCenterType() == MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue(); } @@ -245,8 +255,52 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService model.getPartInspection().setQmsSync(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); } if(!Objects.isNull(model.getPart())){ - model.setPart(mesPartService.getMesPartSapByPartNo(model.getPart().getPartNo(), org)); + model.setPart(mesPartService.getMesPartSapByPartNo(model.getPart().getPartNo(), model.getOrganizeCode())); } + + // 是否头零件模式 + boolean headModel = true; + if (!StringUtil.isEmpty(model.getSn())) { + // 判断是头零件还是散件 查询加工记录 + DdlPackBean productionPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", productionPackBean); + DdlPreparedPack.getNumNOEqualPack(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue(), "reportStatus", productionPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue(), "reportType", productionPackBean); + MesProductionRecord record = productionRecordRepository.getByProperty(productionPackBean); + if (record != null) { + headModel = false; + } + } + // 如果是散件模式,需要查询出对应明细 + List mesPartModels = new ArrayList<>(); + if (!headModel) { + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(model.getSn(), "workOrderNo", partPackBean); + List workOrderParts = workOrderPartRepository.findByHqlWhere(partPackBean); + if (!CollectionUtils.isEmpty(workOrderParts)) { + DdlPackBean partProdBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(produceSn.getWorkCenterCode(), "workCenterCode", partProdBean); + List mesPartProdGroupList = mesPartProdGroupRao.findByHqlTopWhere(partProdBean, 1); + for (MesWorkOrderPart workOrderPart : workOrderParts) { + MesPart partInfo = mesPartService.getMesPartByPartNo(workOrderPart.getPartNo(), model.getOrganizeCode()); + String esd = partInfo.getEsd(); + + // 查询移库规则 + DdlPackBean movePackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(esd, "srcType", movePackBean); + DdlPreparedPack.getStringEqualPack(mesPartProdGroupList.get(0).getPartProdGroupCode(), "code", movePackBean); + List moveRules = mesMoveRuleRepository.findByHqlWhere(movePackBean); + if (!CollectionUtils.isEmpty(moveRules)) { + MesPartModel mesPartModel = new MesPartModel(); + mesPartModel.setPartNo(workOrderPart.getPartNo()); + mesPartModel.setLocateNo(moveRules.get(0).getErpDestLocateNo()); + mesPartModels.add(mesPartModel); + } + } + } + } + + //零件检测详情为空,则代表本次校验为合格。 if (CollectionUtils.isEmpty(model.getPartInspectionDetailList())) { MesPartInspection partInspection = null; @@ -257,23 +311,45 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //若检验单为空,则生成新的单据并合格 if (StringUtils.isEmpty(model.getPartInspection())) { - partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue(), org); + partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue(), model.getOrganizeCode()); if (model.getOptType() != null && model.getOptType() == 2) { partInspection.setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } partInspection = partInspectionRepository.save(partInspection); if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { + //已创建返修单 + DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(model.getSn(), "sn", reworkPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_STATUS.FINISH.getValue(), "status", reworkPackBean); + + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, reworkPackBean); + int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); + if (count > 0) { + // 如果是批次还需要移库 + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + String srcNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); + if (version != null) { + srcNo = version.getReceiveInventoryPoint(); + } + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); + if(!model.isTransferFlg() && !Objects.equals(srcNo, destLocateNo)) { + throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); + } + } + checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } @@ -284,7 +360,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //原单据不合格 现合格 if (model.getPartInspection().getInspectionStatus() == MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()) { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserInfo()); if (model.getOptType() != null && model.getOptType() == 2) { model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); @@ -292,13 +368,13 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspectionRepository.save(model.getPartInspection()); //查询当前单据明细 - List resultDetailList = queryResultDetailList(model, org); + List resultDetailList = queryResultDetailList(model, model.getOrganizeCode()); List defectTypeNoExitList = new ArrayList<>(); for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); MesDefectType defectType = defectTypeRepository.getByProperty(packBean); @@ -310,10 +386,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); - detail.setOrganizeCode(org); + detail.setOrganizeCode(model.getOrganizeCode()); detail.setPid(model.getPartInspection().getId()); setSystemSyncStatus(detail); - ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); } if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { @@ -326,38 +402,48 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } } //移库 String srcLocate; - MesMove mesMove = getMesMove(model, org); + MesMove mesMove = getMesMove(model, model.getOrganizeCode()); if(!Objects.isNull(mesMove)){ srcLocate = mesMove.getUmlgo(); }else{ - srcLocate= configService.getCfgValue(org, "UMLGO"); + srcLocate= configService.getCfgValue(model.getOrganizeCode(), "UMLGO"); } if (model.getOptType() != 2) { - //移库 - MesMove move = createMove(model, srcLocate, configService.getCfgValue(org, "LGORT"), org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); - moveRepository.save(move); + + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + for (MesPartModel mesPartModel : mesPartModels) { + //移库 + MesMove move = createMove(model, srcLocate, mesPartModel.getLocateNo(), model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); + moveRepository.save(move); + } + } else { + //移库 + MesMove move = createMove(model, srcLocate, configService.getCfgValue(model.getOrganizeCode(), "LGORT"), model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + moveRepository.save(move); + } + } } } if (model.isTransferFlg() && model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //电子化检验 - String target = configService.getCfgValue(org, "LGORT"); + String target = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); @@ -368,9 +454,16 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (partInspection != null) { model.setPartInspection(partInspection); } - MesMove move = createMove(model, getDestLocateNo(model, org), target, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); - moveRepository.save(move); - + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + String locateNo = getDestLocateNo(model, model.getOrganizeCode()); + for (MesPartModel mesPartModel : mesPartModels) { + MesMove move = createMove(model,locateNo , mesPartModel.getLocateNo(), model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(), mesPartModel.getPartNo()); + moveRepository.save(move); + } + } else { + MesMove move = createMove(model, getDestLocateNo(model, model.getOrganizeCode()), target, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + moveRepository.save(move); + } } } else { //零件检测详情不为空,则代表本次校验为不合格。 @@ -380,7 +473,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (StringUtils.isEmpty(model.getPartInspection())) { - partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), org); + partInspection = createPartInspection(model, MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue(), model.getOrganizeCode()); if (model.getOptType() != null && model.getOptType() == 2) { partInspection.setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); @@ -392,7 +485,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); MesDefectType defectType = defectTypeRepository.getByProperty(packBean); @@ -404,10 +497,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); - detail.setOrganizeCode(org); + detail.setOrganizeCode(model.getOrganizeCode()); detail.setPid(partInspection.getId()); setSystemSyncStatus(detail); - ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); } if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { @@ -420,7 +513,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //若是扫描条码 则判定条码可疑 if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //已创建返修单 - DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getSn(), "sn", reworkPackBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_STATUS.FINISH.getValue(), "status", reworkPackBean); @@ -428,14 +521,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); if (count > 0) { // 如果是批次还需要移库 - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); - String srcNo = configService.getCfgValue(org, "LGORT"); + String srcNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); if (version != null) { srcNo = version.getReceiveInventoryPoint(); } - String destLocateNo = getDestLocateNo(model, org); + if (!headModel) { + srcNo = mesPartModels.get(0).getLocateNo(); + } + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if(!Objects.equals(srcNo, destLocateNo)) { throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); } @@ -443,14 +539,14 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } @@ -459,9 +555,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService // srcLocateNo = getDestLocateNo(model, org); } if (Objects.isNull(srcLocateNo)) { - srcLocateNo = configService.getCfgValue(org, "LGORT"); + srcLocateNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); @@ -472,7 +568,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService String workCenterCode; if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { if (null == produceSn || StringUtils.isEmpty(produceSn.getProcessCode())) { - List workCenterPartRelationList = getWorkCenterPartRelation(org, model.getPartNo()); + List workCenterPartRelationList = getWorkCenterPartRelation(model.getOrganizeCode(), model.getPartNo()); if (CollectionUtils.isEmpty(workCenterPartRelationList) || workCenterPartRelationList.size() > 1 || StringUtils.isEmpty(workCenterPartRelationList.get(0).getWorkCenterCode())) { throw new ImppBusiException(String.format("条码[%s]未查询到有效的来源库位!", model.getSn())); } @@ -484,7 +580,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService workCenterCode = model.getWorkCenterCode(); } - MesWorkCenter workCenter = prodOrgExtService.getWorkCenterDb(org, workCenterCode); + MesWorkCenter workCenter = prodOrgExtService.getWorkCenterDb(model.getOrganizeCode(), workCenterCode); if (null == workCenter) throw new ImppBusiException(String.format("条码[%s]查询来源库位时获取的生产线代码[%s]信息不存在!", model.getSn(), workCenterCode)); if (StringUtils.isEmpty(workCenter.getRawLocate())) throw new ImppBusiException(String.format("条码[%s]查询来源库位时获取的生产线代码[%s]信息未维护[材料库位]!", model.getSn(), workCenterCode)); srcLocateNo = workCenter.getRawLocate(); @@ -494,33 +590,41 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getOptType() != 2) { //移库 //移库 - String dest = configService.getCfgValue(org, "UMLGO"); + String dest = configService.getCfgValue(model.getOrganizeCode(), "UMLGO"); if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()){ - String destLocateNo = getDestLocateNo(model, org); + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if (!StringUtils.isEmpty(destLocateNo) && Objects.equals(dest, destLocateNo)) { return; } } - MesMove move = createMove(model, srcLocateNo, dest, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); - moveRepository.save(move); + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + for (MesPartModel mesPartModel : mesPartModels) { + MesMove move = createMove(model, mesPartModel.getLocateNo(), dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(), mesPartModel.getPartNo()); + moveRepository.save(move); + } + } else{ + MesMove move = createMove(model, srcLocateNo, dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + moveRepository.save(move); + } + } } else { model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue()); - ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserInfo()); if (model.getOptType() != null && model.getOptType() == 2) { model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } partInspectionRepository.save(model.getPartInspection()); //查询当前单据明细 - List resultDetailList = queryResultDetailList(model, org); + List resultDetailList = queryResultDetailList(model, model.getOrganizeCode()); List defectTypeNoExitList = new ArrayList<>(); for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 - DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean packBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(detail.getDefectLocation(), "defectTypeCode", packBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.DEFECT_CATEGORY.POSITION.getValue(), "defectType", packBean); MesDefectType defectType = defectTypeRepository.getByProperty(packBean); @@ -532,10 +636,10 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService detail.setDefectTypeId(defectType.getId()); detail.setId(null); - detail.setOrganizeCode(org); + detail.setOrganizeCode(model.getOrganizeCode()); detail.setPid(model.getPartInspection().getId()); setSystemSyncStatus(detail); - ConvertBean.serviceModelInitialize(detail, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(detail, model.getUserInfo()); } if (!CollectionUtils.isEmpty(defectTypeNoExitList)) { @@ -546,7 +650,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()) { //已创建返修单 - DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean reworkPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getSn(), "sn", reworkPackBean); DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.REWORK_TASK_STATUS.FINISH.getValue(), "status", reworkPackBean); @@ -554,29 +658,29 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); if (count > 0) { // 如果是批次还需要移库 - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); - String srcNo = configService.getCfgValue(org, "LGORT"); + String srcNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); if (version != null) { srcNo = version.getReceiveInventoryPoint(); } - String destLocateNo = getDestLocateNo(model, org); - if(!Objects.equals(srcNo, destLocateNo)) { + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); + if (!Objects.equals(srcNo, destLocateNo)) { throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); } } checkProduceSn(produceSn, model.getSn()); produceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelInitialize(produceSn, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelInitialize(produceSn, model.getUserInfo()); produceSnExtService.update(produceSn); //更新工单对应qcStatus if(isWorkOrderQcStatus){ - MesWorkOrder workOrder = getWorkOrder(org,produceSn.getWorkOrderNo()); + MesWorkOrder workOrder = getWorkOrder(model.getOrganizeCode(), produceSn.getWorkOrderNo()); if (!StringUtil.isEmpty(workOrder)){ workOrder.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue()); - ConvertBean.serviceModelUpdate(workOrder, AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(workOrder, model.getUserInfo()); workOrderRepository.update(workOrder); } } @@ -586,9 +690,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //移库 if (model.getOptType() != 2) { - String srcLocateNo = configService.getCfgValue(org, "LGORT"); + String srcLocateNo = configService.getCfgValue(model.getOrganizeCode(), "LGORT"); - DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(model.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); @@ -596,15 +700,24 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService srcLocateNo = version.getReceiveInventoryPoint(); } //移库 - String dest = configService.getCfgValue(org, "UMLGO"); + String dest = configService.getCfgValue(model.getOrganizeCode(), "UMLGO"); if (model.getSourceType() == MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()){ - String destLocateNo = getDestLocateNo(model, org); + String destLocateNo = getDestLocateNo(model, model.getOrganizeCode()); if (!StringUtils.isEmpty(destLocateNo) && Objects.equals(dest, destLocateNo)) { return; } } - MesMove move = createMove(model, srcLocateNo, dest, org, null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); - moveRepository.save(move); + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + for (MesPartModel mesPartModel : mesPartModels) { + //移库 + MesMove move = createMove(model, mesPartModel.getLocateNo(), dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode(),mesPartModel.getPartNo()); + moveRepository.save(move); + } + } else{ + MesMove move = createMove(model, srcLocateNo, dest, model.getOrganizeCode(), null == produceSn ? model.getWorkCenterCode() : produceSn.getWorkCenterCode()); + moveRepository.save(move); + } + } } @@ -706,7 +819,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService resultDetailList.forEach(k -> { k.setIsDeleted(MesCommonConstant.TRUE_INTEGER); setSystemSyncStatus(k); - ConvertBean.serviceModelUpdate(model.getPartInspection(), AuthUtil.getSessionUser().getUserName()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserInfo()); }); return resultDetailList; @@ -853,10 +966,9 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspection.setWorkCenterCode(model.getWorkCenterCode()); partInspection.setShiftCode(model.getShiftCode()); partInspection.setSourceType(model.getSourceType()); -// ConvertBean.serviceModelInitialize(partInspection, AuthUtil.getSessionUser().getUserName()); //42984 初检创建时修改人和修改时间不能赋值 partInspection.setCreateDatetime(TimeTool.getNowTime(true)); - partInspection.setCreateUser(AuthUtil.getSessionUser().getUserName()); + partInspection.setCreateUser(model.getUserInfo()); partInspection.setIsValid(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); partInspection.setIsDeleted(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); return partInspection; @@ -900,6 +1012,43 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService return move; } + /** + * 移库 + * + * @param model + * @param source 来源 + * @param target 目标 + * @param org + * @return + */ + private MesMove createMove(MesPartInspectionInputModel model, String source, String target, String org, String workCenterCode, String partNo) { + if (StringUtils.isEmpty(model.getUserInfo())) model.setUserInfo("系统"); + GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); + serialNoModel.setPartNo(partNo); + ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, model.getUserInfo(), org, 1); + String zrsum = ""; + if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { + zrsum = (rb.getResultList().get(0)).toString(); + } + + MesMove move = new MesMove(); + move.setMatnr(partNo); + move.setOrganizeCode(org); + move.setFactoryCode(org); + move.setLgort(source); + move.setUmlgo(target); + move.setMenge(model.getQty()); + move.setMeins(model.getPart().getUnit()); + move.setZrsum(zrsum); + move.setPostDate(TimeTool.getToday()); + move.setPostTime(TimeTool.getTimeShortWithColon()); + move.setPartInspectionId(Objects.isNull(model.getPartInspection()) ? 0 : model.getPartInspection().getId()); + move.setMoveType(MesExtEnumUtil.MOVE_TYPE.SUSPICIOUS_MOVE.getValue()); + move.setProductSn(model.getSn()); + move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); + ConvertBean.serviceModelInitialize(move, model.getUserInfo()); + return move; + } private MesPart checkPart(MesProduceSn produceSn, String org) { DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); @@ -995,29 +1144,28 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService return alarmConfigList; } - private MesPartInspectionViewModel getModel(MesPartInspection partInspection, MesPart part,MesPartTypePicture partTypePicture, MesPartInspectionInputModel inputModel , - Integer sourceType, String org) { + private MesPartInspectionViewModel getModel(MesPartInspection partInspection, MesPart part, MesPartTypePicture partTypePicture, MesPartInspectionInputModel model, Integer sourceType) { - Integer frontBack = inputModel.getFrontBack(); + Integer frontBack = model.getFrontBack(); List detailList = new ArrayList<>(); if (!StringUtils.isEmpty(partInspection) && partInspection.getInspectionStatus() != MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()) { - detailList = checkPartInspectionDetail(partInspection, org); + detailList = checkPartInspectionDetail(partInspection, model.getOrganizeCode()); if(!CollectionUtils.isEmpty(detailList)){ //判断是否返工完成 - checkReworkFinished(org, detailList); + checkReworkFinished(model.getOrganizeCode(), detailList); } } //位置 - List locationConfigList = checkLocationConfig(org); + List locationConfigList = checkLocationConfig(model.getOrganizeCode()); List locationCodeList = locationConfigList.stream().map(k -> k.getDefectLocation()).collect(Collectors.toList()); //查询零件类型缺陷类型对应关系 - List partTypeDefectList = checkPartTypeDefect(part, org); + List partTypeDefectList = checkPartTypeDefect(part, model.getOrganizeCode()); List partTypeDefectCodeList = partTypeDefectList.stream().map(k -> k.getDefectTypeCode()).collect(Collectors.toList()); //查询预警数量 - List alarmConfigList = queryDefectAlarmConfigByLocationCodeList(part, frontBack, locationCodeList, partTypeDefectCodeList, org); + List alarmConfigList = queryDefectAlarmConfigByLocationCodeList(part, frontBack, locationCodeList, partTypeDefectCodeList, model.getOrganizeCode()); //根据不良类型+位置 若有数据,则表示需要标黄 Map> alarmConfigMap = alarmConfigList.stream().collect(Collectors.groupingBy(MesDefectWarnConfig::getDefectLocation)); @@ -1039,17 +1187,17 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService } }); - MesPartInspectionViewModel model = new MesPartInspectionViewModel(); - model.setPart(part); + MesPartInspectionViewModel result = new MesPartInspectionViewModel(); + result.setPart(part); if (!StringUtils.isEmpty(partInspection) && partInspection.getInspectionStatus() == MesExtEnumUtil.PART_INSPECTION_STATUS.FAIL.getValue() && partInspection.getNcStatus() == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()) { - model.setPartInspectionDetailList(detailList); - model.setPartInspection(partInspection); + result.setPartInspectionDetailList(detailList); + result.setPartInspection(partInspection); } - model.setPartTypePicture(partTypePicture); - model.setLocationConfigList(locationConfigList); - model.setMesDefectWarnConfigList(alarmConfigList); - return model; + result.setPartTypePicture(partTypePicture); + result.setLocationConfigList(locationConfigList); + result.setMesDefectWarnConfigList(alarmConfigList); + return result; } @@ -1131,7 +1279,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService version = productVersionRepository.getByProperty(ddlPackBean); if (version != null) { - source = version.getShipInventoryPoint(); + source = version.getReceiveInventoryPoint(); } } @@ -1141,9 +1289,64 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if (null != workCenter && !StringUtils.isEmpty(workCenter.getRawLocate())) source = workCenter.getRawLocate(); } - if (StringUtils.isEmpty(source)) MesPcnException.throwBusiException("未找到来源库位!"); - MesMove move = createMove(model, source, target, org, model.getWorkCenterCode()); - moveRepository.insert(move); + + // 是否头零件模式 + boolean headModel = true; + if (!StringUtil.isEmpty(model.getSn())) { + + // 判断是头零件还是散件 查询加工记录 + DdlPackBean productionPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", productionPackBean); + DdlPreparedPack.getNumNOEqualPack(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue(), "reportStatus", productionPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue(), "reportType", productionPackBean); + MesProductionRecord record = productionRecordRepository.getByProperty(productionPackBean); + if (record != null) { + headModel = false; + } + } + // 如果是散件模式,需要查询出对应明细 + List mesPartModels = new ArrayList<>(); + if (!headModel) { + MesProduceSn produceSn = getProduceSn(model.getSn(), org); + + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getSn(), "workOrderNo", partPackBean); + List workOrderParts = workOrderPartRepository.findByHqlWhere(partPackBean); + if (!CollectionUtils.isEmpty(workOrderParts)) { + DdlPackBean partProdBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(produceSn.getWorkCenterCode(), "workCenterCode", partProdBean); + List mesPartProdGroupList = mesPartProdGroupRao.findByHqlTopWhere(partProdBean, 1); + for (MesWorkOrderPart workOrderPart : workOrderParts) { + MesPart partInfo = mesPartService.getMesPartByPartNo(workOrderPart.getPartNo(), org); + String esd = partInfo.getEsd(); + + // 查询移库规则 + DdlPackBean movePackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(esd, "srcType", movePackBean); + DdlPreparedPack.getStringEqualPack(mesPartProdGroupList.get(0).getPartProdGroupCode(), "code", movePackBean); + List moveRules = mesMoveRuleRepository.findByHqlWhere(movePackBean); + if (!CollectionUtils.isEmpty(moveRules)) { + MesPartModel mesPartModel = new MesPartModel(); + mesPartModel.setPartNo(workOrderPart.getPartNo()); + mesPartModel.setLocateNo(moveRules.get(0).getErpDestLocateNo()); + mesPartModels.add(mesPartModel); + } + } + } + } + + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + for (MesPartModel mesPartModel : mesPartModels) { + //移库 + MesMove move = createMove(model, mesPartModel.getLocateNo(),target, org, model.getWorkCenterCode()); + moveRepository.save(move); + } + } else { + //移库 + if (StringUtils.isEmpty(source)) MesPcnException.throwBusiException("未找到来源库位!"); + MesMove move = createMove(model, source, target, org, model.getWorkCenterCode()); + moveRepository.save(move); + } } @ApiOperation(value = "客退品查询") diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java index 624991e..e754a9f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesNcProcessingService.java @@ -2,14 +2,12 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesConfigService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNcProcessingService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService; -import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesWorkOrderExtService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.*; import cn.estsh.i3plus.ext.mes.pcn.apiservice.dao.IMesNcProcessingDao; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingInputModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingPartAndLotModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesPartModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; import cn.estsh.i3plus.platform.common.convert.ConvertBean; @@ -115,7 +113,20 @@ public class MesNcProcessingService implements IMesNcProcessingService { private MesWorkOrderRepository workOrderRepository; @Autowired + private MesWorkOrderPartRepository workOrderPartRepository; + + @Autowired + private MesPartProdGroupRepository mesPartProdGroupRao; + + @Autowired + private MesProductionRecordRepository productionRecordRepository; + + @Autowired private IMesPartService mesPartService; + + @Autowired + private IMesMoveRuleRepository mesMoveRuleRepository; + @Override public ListPager queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) { @@ -351,7 +362,48 @@ public class MesNcProcessingService implements IMesNcProcessingService { isWorkOrderQcStatus= centerDb.getCenterType() == MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue(); } } + // 是否头零件模式 + boolean headModel = true; + if (!StringUtil.isEmpty(model.getSn())) { + // 判断是头零件还是散件 查询加工记录 + DdlPackBean productionPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getSn(), "productSn", productionPackBean); + DdlPreparedPack.getNumNOEqualPack(MesExtEnumUtil.REPORT_STATUS.REPORT_STATUS_30.getValue(), "reportStatus", productionPackBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.MES_REPORT_TYPE.CUSTOMER_SUPPLY_MOVE.getValue(), "reportType", productionPackBean); + MesProductionRecord record = productionRecordRepository.getByProperty(productionPackBean); + if (record != null) { + headModel = false; + } + } + // 如果是散件模式,需要查询出对应明细 + List mesPartModels = new ArrayList<>(); + if (!headModel) { + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getSn(), "workOrderNo", partPackBean); + List workOrderParts = workOrderPartRepository.findByHqlWhere(partPackBean); + if (!CollectionUtils.isEmpty(workOrderParts)) { + DdlPackBean partProdBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(sn.getWorkCenterCode(), "workCenterCode", partProdBean); + List mesPartProdGroupList = mesPartProdGroupRao.findByHqlTopWhere(partProdBean, 1); + for (MesWorkOrderPart workOrderPart : workOrderParts) { + MesPart partInfo = mesPartService.getMesPartByPartNo(workOrderPart.getPartNo(), org); + String esd = partInfo.getEsd(); + + // 查询移库规则 + DdlPackBean movePackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(esd, "srcType", movePackBean); + DdlPreparedPack.getStringEqualPack(mesPartProdGroupList.get(0).getPartProdGroupCode(), "code", movePackBean); + List moveRules = mesMoveRuleRepository.findByHqlWhere(movePackBean); + if (!CollectionUtils.isEmpty(moveRules)) { + MesPartModel mesPartModel = new MesPartModel(); + mesPartModel.setPartNo(workOrderPart.getPartNo()); + mesPartModel.setLocateNo(moveRules.get(0).getErpDestLocateNo()); + mesPartModels.add(mesPartModel); + } + } + } + } String source = configService.getCfgValue(org, "LGORT"); String refundSource = configService.getCfgValue(org, "REFUND"); if (!StringUtils.isEmpty(model.getProductVersion())) { @@ -411,10 +463,24 @@ public class MesNcProcessingService implements IMesNcProcessingService { target = version.getReceiveInventoryPoint(); } - //移库 转正常、放行:8000移至2000 - MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); - ConvertBean.serviceModelInitialize(move,model.getUserName()); - moveRepository.save(move); + + + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + List moveList = new ArrayList<>(); + for (MesPartModel mesPartModel : mesPartModels) { + //移库 转正常、放行:8000移至2000 + MesMove move = createMove(model, sourceValue, mesPartModel.getLocateNo(), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE, mesPartModel.getPartNo()); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveList.add(move); + } + moveRepository.saveAll(moveList); + + } else { + //移库 转正常、放行:8000移至2000 + MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveRepository.save(move); + } } else if (type == MesExtEnumUtil.NC_TYPE.REWORK.getValue()) { @@ -471,11 +537,19 @@ public class MesNcProcessingService implements IMesNcProcessingService { } partInspectionRepository.save(model.getPartInspection()); - - - MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); - ConvertBean.serviceModelInitialize(move,model.getUserName()); - moveRepository.save(move); + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + List moveList = new ArrayList<>(); + for (MesPartModel mesPartModel : mesPartModels) { + MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE, mesPartModel.getPartNo()); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveList.add(move); + } + moveRepository.saveAll(moveList); + } else { + MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveRepository.save(move); + } } else if (type == MesExtEnumUtil.NC_TYPE.SCRAP.getValue()) { //批次不需要校验条码 @@ -518,18 +592,45 @@ public class MesNcProcessingService implements IMesNcProcessingService { sourceValue = refundSource; } - MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "SCRAP"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); - ConvertBean.serviceModelInitialize(move,model.getUserName()); - moveRepository.save(move); + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + List moveList = new ArrayList<>(); + + for (MesPartModel mesPartModel : mesPartModels) { + MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "SCRAP"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE,mesPartModel.getPartNo()); + ConvertBean.serviceModelInitialize(move,model.getUserName()); + moveList.add(move); + } + moveRepository.saveAll(moveList); + } else { + MesMove move = createMove(model, sourceValue, configService.getCfgValue(org, "SCRAP"), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); + moveRepository.save(move); + } + } else { String sourceValue = configService.getCfgValue(org, "UMLGO"); if (model.getOptType() == 2) { sourceValue = refundSource; } - //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) - MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); - ConvertBean.serviceModelInitialize(move,model.getUserName()); - moveRepository.save(move); + if (!headModel) { + if (!CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + List moveList = new ArrayList<>(); + + for (MesPartModel mesPartModel : mesPartModels) { + //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) + MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE, mesPartModel.getPartNo()); + ConvertBean.serviceModelInitialize(move,model.getUserName()); + moveList.add(move); + } + moveRepository.saveAll(moveList); + + } + } else { + //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) + MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); + moveRepository.save(move); + } } } else if (type == MesExtEnumUtil.NC_TYPE.RELEASE.getValue()) { @@ -576,13 +677,24 @@ public class MesNcProcessingService implements IMesNcProcessingService { target = version.getReceiveInventoryPoint(); } - //移库 转正常、放行:8000移至2000 - MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); - ConvertBean.serviceModelInitialize(move,model.getUserName()); - moveRepository.save(move); + if (!headModel && !CollectionUtils.isEmpty(mesPartModels) && mesPartModels.size() > 0) { + List moveList = new ArrayList<>(); - } + for (MesPartModel mesPartModel : mesPartModels) { + //移库 转正常、放行:8000移至2000 + MesMove move = createMove(model, sourceValue, mesPartModel.getLocateNo(), org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE, mesPartModel.getPartNo()); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveList.add(move); + } + moveRepository.saveAll(moveList); + } else { + //移库 转正常、放行:8000移至2000 + MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveRepository.save(move); + } + } } public MesWorkOrder getWorkOrder(String organizeCode, String workOrderNo) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workOrderNo)) return null; @@ -674,4 +786,31 @@ public class MesNcProcessingService implements IMesNcProcessingService { move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); return move; } + + private MesMove createMove(MesNcProcessingInputModel model, String source, String target, String org, String workCenterCode, MesExtEnumUtil.MOVE_TYPE moveType, String partNo) { + GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); + serialNoModel.setPartNo(partNo); + ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, model.getPartInspection().getModifyUser(), org, 1); + String zrsum = ""; + if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { + zrsum = (rb.getResultList().get(0)).toString(); + } + + MesMove move = new MesMove(); + move.setMatnr(partNo); + move.setOrganizeCode(org); + move.setFactoryCode(org); + move.setLgort(source); + move.setUmlgo(target); + move.setMenge(model.getPartInspection().getQty()); + move.setMeins(model.getPart().getUnit()); + move.setZrsum(zrsum); + move.setPostDate(TimeTool.getToday()); + move.setPostTime(TimeTool.getTimeShortWithColon()); + move.setMoveType(moveType.getValue()); + move.setPartInspectionId(model.getPartInspection().getId()); + move.setProductSn(model.getSn()); + move.setWorkCenter(prodOrgExtService.getErpWorkCenterCode(org, workCenterCode)); + return move; + } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPrintedSnLogServiceImpl.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPrintedSnLogServiceImpl.java index 0628087..cd69a60 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPrintedSnLogServiceImpl.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPrintedSnLogServiceImpl.java @@ -13,6 +13,8 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Map; + /** * @Description : 条码打印记录表 * @Reference : @@ -39,6 +41,18 @@ public class MesPrintedSnLogServiceImpl implements IMesPrintedSnLogService { } @Override + public MesPrintedSnLog getMesCustomPrintedSnLog(String userName, String organizeCode, MesProduceSnPrintDataModel printDataModel, Map printContext) { + MesPrintedSnLog snLog = new MesPrintedSnLog(); + BeanUtil.copyProperties(printDataModel, snLog); + snLog.setOrganizeCode(organizeCode); + snLog.setPrintContext(printContext); + snLog.setPrintData(JSONObject.toJSONString(printContext)); + snLog.setPrintType(MesExtEnumUtil.PRINT_LOG_TYPE.PRINT_LOG_TYPE_10.getValue()); + ConvertBean.serviceModelInitialize(snLog, userName); + return snLog; + } + + @Override public void insertMesPrintedSnLog(MesPrintedSnLog mesPrintedSnLog, String userName) { MesPrintedSnLog snLog = new MesPrintedSnLog(); BeanUtil.copyProperties(mesPrintedSnLog, snLog, MesPcnExtConstWords.BASE_BEAN_FIELDS); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java index e85f344..14703a9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesProduceSnPrintService.java @@ -225,8 +225,13 @@ public class MesProduceSnPrintService implements IMesProduceSnPrintService { } MesProduceSnPrintDataModel model = new MesProduceSnPrintDataModel(); BeanUtil.copyProperties(snLog, model); - model.setPrintDate(TimeTool.getNowTime(true)); - mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(model); + if (CollectionUtils.isEmpty(snLog.getPrintContext())) { + model.setPrintDate(TimeTool.getNowTime(true)); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(model); + } else { + snLog.getPrintContext().put(MesPcnExtConstWords.PRINT_DATE, TimeTool.getNowTime(true)); + mesProduceSnPrintModel.getPrintContextList().add(snLog.getPrintContext()); + } //记录打印日志 mesPrintedSnLogService.insertMesPrintedSnLog(snLog, model.getUserName()); return mesProduceSnPrintModel; diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java index e9c7fc1..a4f1f4d 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPullingOrderInfoService.java @@ -30,6 +30,8 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -62,6 +64,9 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { @Autowired private MesCustomerCarModelRepository carModelRepository; + @Autowired + private MesWorkOrderRepository workOrderRao; + @Override public ListPager queryMesPullingOrderInfoByPager(MesPullingOrderInfo bean, Pager pager) { @@ -109,7 +114,6 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { DdlPreparedPack.getStringEqualPack(bean.getPullCode(), "pullCode", packBeanOne); DdlPreparedPack.getStringEqualPack(bean.getPullingOrderNo(), "pullingOrderNo", packBeanOne); DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBeanOne); -// DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.PULL_ORDER_STATUS_10.getValue(), "pullOrderStatus", packBeanOne); MesPullingOrderInfo mesPullingOrderInfo = mesPullingOrderInfoRepository.getByProperty(packBeanOne); if (StringUtil.isEmpty(mesPullingOrderInfo)) { MesPcnException.throwMesBusiException("扫描拉动单号【%s】查询数据为空", bean.getPullingOrderNo()); @@ -129,9 +133,10 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { //修改当前单号之前的为可强过 DdlPackBean packBeanPass = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(bean.getPullCode(), "pullCode", packBeanPass); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.PULL_ORDER_STATUS_10.getValue(), "pullOrderStatus", packBeanOne); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.PULL_ORDER_STATUS_10.getValue(), "pullOrderStatus", packBeanPass); DdlPreparedPack.getStringSmallerNotEqualPack(bean.getPullingOrderNo(), "pullingOrderNo", packBeanPass); DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBeanPass); + DdlPreparedPack.getNumNOEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), "isPassCode", packBeanPass); List mesPullingOrderInfos = mesPullingOrderInfoRepository.findByHqlWhere(packBeanPass); if (!CollectionUtils.isEmpty(mesPullingOrderInfos)) { for (MesPullingOrderInfo pullingOrderInfo : mesPullingOrderInfos) { @@ -196,6 +201,101 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { //把查出来的拉动单打印并修改打印状态为已打印 List snLogList = new ArrayList<>(); for (MesPullingOrderInfo pullingOrderInfo : pullingOrderInfos) { + //查询对应的工单 + DdlPackBean workOrderPackBean = DdlPackBean.getDdlPackBean(pullingOrderInfo.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(pullingOrderInfo.getWorkOrderNo(), MesPcnExtConstWords.WORK_ORDER_NO, workOrderPackBean); + List mesWorkOrders = workOrderRao.findByHqlTopWhere(workOrderPackBean, 1); + MesWorkOrder mesWorkOrder; + if (!CollectionUtils.isEmpty(mesWorkOrders)) { + mesWorkOrder = mesWorkOrders.get(0); + }else { + mesWorkOrder = new MesWorkOrder(); + } + //查询拉动组明细 + DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(pullingOrderInfo.getOrganizeCode()); + DdlPreparedPack.getStringEqualPack(pullingOrderInfo.getPullingOrderNo(), MesPcnExtConstWords.PULLING_ORDER_NO, partPackBean); + List pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean); + if (!CollectionUtils.isEmpty(pullingOrderPartInfos)) { + pullingOrderInfo.setPartCount(pullingOrderPartInfos.size()); + pullingOrderPartInfos.forEach(item->{ + if(!StringUtil.isEmpty(item.getLocation()) && item.getLocation().contains(MesPcnExtConstWords.COMMA)){ + item.setLocatAddr(item.getLocation().split(MesPcnExtConstWords.COMMA)[0]); + item.setLightAddr(item.getLocation().split(MesPcnExtConstWords.COMMA)[1]); + }; + item.setAssemblyPartNo(pullingOrderInfo.getPartNo()); + }); + pullingOrderInfo.setPullingOrderPartInfos(pullingOrderPartInfos); + } + pullingOrderInfo.setWorkOrderNoLast(!StringUtil.isEmpty(pullingOrderInfo.getWorkOrderNo())?pullingOrderInfo.getWorkOrderNo().substring(pullingOrderInfo.getWorkOrderNo().length() - MesPcnExtConstWords.FOUR):""); + pullingOrderInfo.setWorkOrderNoPre(!StringUtil.isEmpty(pullingOrderInfo.getWorkOrderNo())?pullingOrderInfo.getWorkOrderNo().substring(MesPcnExtConstWords.ZERO,pullingOrderInfo.getWorkOrderNo().length() - MesPcnExtConstWords.FOUR):""); + pullingOrderInfo.setCustOrderNoLast(!StringUtil.isEmpty(pullingOrderInfo.getCustOrderNo())?pullingOrderInfo.getCustOrderNo().substring(pullingOrderInfo.getCustOrderNo().length() - MesPcnExtConstWords.FOUR):""); + pullingOrderInfo.setCarModelName((Objects.isNull(mesCustomerCarModelMap) || StringUtil.isEmpty(pullingOrderInfo.getCarModelCode()) || !mesCustomerCarModelMap.containsKey(pullingOrderInfo.getCarModelCode()) ? "" : mesCustomerCarModelMap.get(pullingOrderInfo.getCarModelCode()).iterator().next().getCarModelName())); + + pullingOrderInfo.setPrintTime(TimeTool.getNowTime(true)); + pullingOrderInfo.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); + pullingOrderInfo.setIsPrint(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + pullingOrderInfo.setShiftName(mesWorkOrder.getShiftName()); + pullingOrderInfo.setSummaryQty(mesWorkOrder.getQty()); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + try { + pullingOrderInfo.setPlanStartDate(sdf.format(sdf.parse(mesWorkOrder.getPlanStartTime()))); + } catch (ParseException e) { + log.error("格式化时间错误e:{}", e.getMessage()); + } + pullingOrderInfo.setPlanStartTime(mesWorkOrder.getPlanStartTime()); + pullingOrderInfo.setShiftName(mesWorkOrder.getShiftName()); + pullingOrderInfo.setCarModelCode(mesWorkOrder.getCarModelCode()); + pullingOrderInfo.setCustOrderNo(mesWorkOrder.getCustOrderNo()); + ConvertBean.serviceModelUpdate(pullingOrderInfo, bean.getModifyUser()); + + //10-12 打印补打拉动单新增log表 + MesPrintedSnLog snLog = new MesPrintedSnLog(); + snLog.setBarcode(pullingOrderInfo.getPullingOrderNo()); + snLog.setCustPartNo(pullingOrderInfo.getCustPartNo()); + snLog.setWorkOrderNo(pullingOrderInfo.getWorkOrderNo()); + snLog.setPartNo(pullingOrderInfo.getPartNo()); + snLog.setPartName(pullingOrderInfo.getPartName()); + ConvertBean.serviceModelInitialize(snLog, bean.getModifyUser()); + snLog.setOrganizeCode(bean.getOrganizeCode()); + snLogList.add(snLog); + + } + mesPullingOrderInfoRepository.saveAll(pullingOrderInfos); + //保存打印条码记录 + snLogRao.saveAll(snLogList); + } + return pullingOrderInfos; + } + + @Override + public List doMesPullingOrderInfoPrintNew(MesPullingOrderInfo bean) { + DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode()); + + List pullCodeList = Arrays.asList(bean.getPullCode().split(MesPcnExtConstWords.COMMA)); + List workCenterCodeList = Arrays.asList(bean.getWorkCenterCode().split(MesPcnExtConstWords.COMMA)); + + if (pullCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(pullCodeList.get(0), MesPcnExtConstWords.PULL_CODE, packBean); + else DdlPreparedPack.getInPackList(pullCodeList, MesPcnExtConstWords.PULL_CODE, packBean); + + if (workCenterCodeList.size() == 1) DdlPreparedPack.getStringEqualPack(workCenterCodeList.get(0), MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + else DdlPreparedPack.getInPackList(workCenterCodeList, MesPcnExtConstWords.WORK_CENTER_CODE, packBean); + + DdlPreparedPack.getNumEqualPack(bean.getPullOrderType(),"pullOrderType",packBean); + DdlPreparedPack.getStringEqualPack(bean.getPullingOrderNo(), MesPcnExtConstWords.PULLING_ORDER_NO, packBean); + DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PRINT_STATUS.UNPRINT.getValue(), MesPcnExtConstWords.PRINT_STATUS, packBean); + DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.ASC.getValue()}, new String[]{MesPcnExtConstWords.CUST_ORDER_NO}, packBean); + + List pullingOrderInfos = mesPullingOrderInfoRepository.findByHqlTopWhere(packBean, MesPcnExtConstWords.THREE); + + log.info("打印队列查询 --- 拉动单 --- 查询到打印数据: {} ---", CollectionUtils.isEmpty(pullingOrderInfos) ? "[]" : + pullingOrderInfos.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkOrderNo()))).map(MesPullingOrderInfo::getWorkOrderNo).collect(Collectors.toList()).toString()); + + if (!CollectionUtils.isEmpty(pullingOrderInfos)) { + //根据车型代码查询车型信息 + Map> mesCustomerCarModelMap = getMesCustomerCarModelMap(bean.getOrganizeCode(), pullingOrderInfos.stream().map(MesPullingOrderInfo::getCarModelCode).distinct().collect(Collectors.toList())); + //把查出来的拉动单打印并修改打印状态为已打印 + List snLogList = new ArrayList<>(); + for (MesPullingOrderInfo pullingOrderInfo : pullingOrderInfos) { //查询拉动组明细 DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(pullingOrderInfo.getOrganizeCode()); DdlPreparedPack.getStringEqualPack(pullingOrderInfo.getPullingOrderNo(), MesPcnExtConstWords.PULLING_ORDER_NO, partPackBean); @@ -210,8 +310,8 @@ public class MesPullingOrderInfoService implements IMesPullingOrderInfoService { pullingOrderPartInfos = pullingOrderPartInfos.stream().filter(o -> null != o).sorted(Comparator.comparing(MesPullingOrderPartInfo::getLocatAddr)).collect(Collectors.toList()); pullingOrderInfo.setPullingOrderPartInfos(pullingOrderPartInfos); } - pullingOrderInfo.setWorkOrderNoLast(!StringUtil.isEmpty(pullingOrderInfo.getWorkOrderNo())?pullingOrderInfo.getWorkOrderNo().substring(pullingOrderInfo.getWorkOrderNo().length() - MesPcnExtConstWords.THREE):""); - pullingOrderInfo.setWorkOrderNoPre(!StringUtil.isEmpty(pullingOrderInfo.getWorkOrderNo())?pullingOrderInfo.getWorkOrderNo().substring(MesPcnExtConstWords.ZERO,pullingOrderInfo.getWorkOrderNo().length() - MesPcnExtConstWords.THREE):""); + pullingOrderInfo.setWorkOrderNoLast(!StringUtil.isEmpty(pullingOrderInfo.getWorkOrderNo())?pullingOrderInfo.getWorkOrderNo().substring(pullingOrderInfo.getWorkOrderNo().length() - MesPcnExtConstWords.FOUR):""); + pullingOrderInfo.setWorkOrderNoPre(!StringUtil.isEmpty(pullingOrderInfo.getWorkOrderNo())?pullingOrderInfo.getWorkOrderNo().substring(MesPcnExtConstWords.ZERO,pullingOrderInfo.getWorkOrderNo().length() - MesPcnExtConstWords.FOUR):""); pullingOrderInfo.setCustOrderNoLast(!StringUtil.isEmpty(pullingOrderInfo.getCustOrderNo())?pullingOrderInfo.getCustOrderNo().substring(pullingOrderInfo.getCustOrderNo().length() - MesPcnExtConstWords.FOUR):""); pullingOrderInfo.setCarModelName("车型:" + (Objects.isNull(mesCustomerCarModelMap) || StringUtil.isEmpty(pullingOrderInfo.getCarModelCode()) || !mesCustomerCarModelMap.containsKey(pullingOrderInfo.getCarModelCode()) ? "" : mesCustomerCarModelMap.get(pullingOrderInfo.getCarModelCode()).iterator().next().getCarModelName())); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java index b3c28d4..23e022c 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesSortShippingCheckService.java @@ -695,6 +695,7 @@ public class MesSortShippingCheckService implements IMesSortShippingCheckService if (CollectionUtils.isEmpty(shippingOrderManagementDetails)) { DdlPackBean detailPackBean = DdlPackBean.getDdlPackBean(mesShippingOrderManagement.getOrganizeCode()); DdlPreparedPack.getNumEqualPack(mesShippingOrderManagement.getId(), "pid", detailPackBean); + DdlPreparedPack.getNumberSmallerPack(MesExtEnumUtil.SHIPPING_ORDER_DETAIL_SHIPPING_STATUS.SKIP.getValue(), "status", detailPackBean); shippingOrderManagementDetails = shippingOrderManagementDetailRepository.findByHqlWhere(detailPackBean); } //当前装车单所有发运单明细 需要报工的数据 diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/LiJiaCustCodeNumberRuleStrategyService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/LiJiaCustCodeNumberRuleStrategyService.java new file mode 100644 index 0000000..6edb307 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/LiJiaCustCodeNumberRuleStrategyService.java @@ -0,0 +1,50 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.numberrule; + +import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; +import cn.estsh.i3plus.mes.pcn.api.iservice.base.IPartService; +import cn.estsh.i3plus.mes.pcn.api.iservice.busi.INumberRulePackAttributeStrategyService; +import cn.estsh.i3plus.platform.common.tool.TimeTool; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Map; + +@Component +public class LiJiaCustCodeNumberRuleStrategyService implements INumberRulePackAttributeStrategyService { + @Autowired + private IPartService partService; + + @Override + public GenSerialNoModel execute(GenSerialNoModel genSerialNoModel) { + if (null == genSerialNoModel) { + MesPcnException.throwBusiException("入参缺少[GenSerialNoModel]!"); + } + + Map dataMap = genSerialNoModel.getDataMap(); + MesPart part = (!CollectionUtils.isEmpty(dataMap) && dataMap.containsKey(MesPart.class.getSimpleName())) ? + (MesPart)dataMap.get(MesPart.class.getSimpleName()) : partService.getPartByNo(genSerialNoModel.getOrganizeCode(), genSerialNoModel.getPartNo()); + if (null == part) { + MesPcnException.throwBusiException("请检查零件信息,零件号[%s]信息不存在!", genSerialNoModel.getPartNo()); + } + if (StringUtils.isEmpty(part.getPartSnParam())) { + MesPcnException.throwBusiException("请检查零件信息,零件号[%s]未维护零件条码参数!", part.getPartNo()); + } + + genSerialNoModel.partSnParam(part.getPartSnParam()); + Date date = new Date(); + genSerialNoModel.setYear(getYear(date)); + genSerialNoModel.setMonth(TimeTool.getMonth(date)); + genSerialNoModel.setDay(TimeTool.getDay(date)); + return genSerialNoModel; + } + + private String getYear(Date date) { + return (new SimpleDateFormat("yy")).format(date); + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/LiJiaPartSnParamRuleStrategyService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/LiJiaPartSnParamRuleStrategyService.java new file mode 100644 index 0000000..3f795d4 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/numberrule/LiJiaPartSnParamRuleStrategyService.java @@ -0,0 +1,39 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.numberrule; + +import cn.estsh.i3plus.ext.mes.pcn.apiservice.util.MesPcnException; +import cn.estsh.i3plus.mes.pcn.api.iservice.base.IPartService; +import cn.estsh.i3plus.mes.pcn.api.iservice.busi.INumberRulePackAttributeStrategyService; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.util.Map; + +@Component +public class LiJiaPartSnParamRuleStrategyService implements INumberRulePackAttributeStrategyService { + @Autowired + private IPartService partService; + + @Override + public GenSerialNoModel execute(GenSerialNoModel genSerialNoModel) { + if (null == genSerialNoModel) { + MesPcnException.throwBusiException("入参缺少[GenSerialNoModel]!"); + } + + Map dataMap = genSerialNoModel.getDataMap(); + MesPart part = (!CollectionUtils.isEmpty(dataMap) && dataMap.containsKey(MesPart.class.getSimpleName())) ? + (MesPart)dataMap.get(MesPart.class.getSimpleName()) : partService.getPartByNo(genSerialNoModel.getOrganizeCode(), genSerialNoModel.getPartNo()); + if (null == part) { + MesPcnException.throwBusiException("请检查零件信息,零件号[%s]信息不存在!", genSerialNoModel.getPartNo()); + } + if (StringUtils.isEmpty(part.getPartSnParam())) { + MesPcnException.throwBusiException("请检查零件信息,零件号[%s]未维护零件条码参数!", part.getPartNo()); + } + + genSerialNoModel.partSnParam(part.getPartSnParam()); + return genSerialNoModel; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/CustomFieldPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/CustomFieldPrintStrategy.java new file mode 100644 index 0000000..18a8169 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/CustomFieldPrintStrategy.java @@ -0,0 +1,156 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesCustomerPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPrintedSnLogService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.tool.TimeTool; +import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker; +import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.*; + +/** + * @Description :通用打印方式 + * @Reference : + * @Author : junsheng.li + * @CreateDate 2024/9/26 18:20 + * @Modify: + **/ +@Component +@Slf4j +public class CustomFieldPrintStrategy implements IPrintTemplateStrategyService { + @Autowired + private ISyncFuncService syncFuncService; + + @Autowired + private SnowflakeIdMaker snowflakeIdMaker; + + @Autowired + private IMesPartService mesPartService; + + @Autowired + private IMesPrintedSnLogService mesPrintedSnLogService; + + @Autowired + private IMesCustomerPartService mesCustomerPartService; + + @Autowired + private IMesTemplateService mesTemplateService; + + @Override + public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { + String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); + //物料信息 + MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); + MesCustomerPart customerPart = (!Objects.isNull(genSerialNoModel) && !CollectionUtils.isEmpty(genSerialNoModel.getDataMap()) && genSerialNoModel.getDataMap().containsKey(MesCustomerPart.class.getSimpleName())) ? (MesCustomerPart) genSerialNoModel.getDataMap().get(MesCustomerPart.class.getSimpleName()) : mesCustomerPartService.getMesCustomerPart(organizeCode,mesProduceSnPrintModel.getPartNo()); + Map customParamValue = mesTemplateService.queryMesLabelTemplateParamPartValue(mesPart.getPartNo(), mesPart.getProductLabelTemplate(), organizeCode); + if (!isStep){ + if (!Objects.isNull(customerPart)) { + genSerialNoModel.setCustPartNo(customerPart.getCustPartNo()); + } + for (int i = 0; i < mesProduceSnPrintModel.getPrintQty(); i++) { + //保存条码信息 + MesProduceSn produceSn = generateMesProduceSn(mesPart, syncFuncService.syncSerialNo(genSerialNoModel.partSnParam(mesPart.getPartSnParam()), mesProduceSnPrintModel.getUserName(), organizeCode, 1).getResultList().get(0).toString(), mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(produceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().clear(); + mesProduceSnPrintModel.getMesProduceSnList().add(produceSn); + Map printTemplateData = new HashMap<>(getPrintContextMap(produceSn, customerPart)); + printTemplateData.putAll(customParamValue); + mesProduceSnPrintModel.getPrintContextList().add(printTemplateData); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesCustomPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel, printTemplateData)); + } + }else{ + MesProduceSn mesProduceSn = mesProduceSnPrintModel.getMesProduceSnList().get(0); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(mesProduceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().clear(); + Map printTemplateData = new HashMap<>(getPrintContextMap(mesProduceSn, customerPart)); + printTemplateData.putAll(customParamValue); + List> printDataMapList = new ArrayList<>(); + printDataMapList.add(printTemplateData); + mesProduceSnPrintModel.getPrintContextList().add(packResultMap(mesProduceSnPrintModel, printDataMapList)); + + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesCustomPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel, printTemplateData)); + } + return mesProduceSnPrintModel; + } + + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { + MesProduceSn mesProduceSn = new MesProduceSn(); + mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); + mesProduceSn.setProductSn(sn); + mesProduceSn.setCustSn(sn); + mesProduceSn.setPartNo(mesPart.getPartNo()); + mesProduceSn.setPartName(mesPart.getPartName()); + mesProduceSn.setProcessLabelTemplate(mesPart.getProcessLabelTemplate()); + mesProduceSn.setCustLabelTemplate(mesPart.getCustLabelTemplate()); + mesProduceSn.setProdLabelTemplate(mesPart.getProductLabelTemplate()); + mesProduceSn.setQty(qty); + mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); + mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); + mesProduceSn.setLotNo(TimeTool.getToday()); + mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); + mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); + mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); + ConvertBean.serviceModelInitialize(mesProduceSn, userName); + return mesProduceSn; + } + + private MesProduceSnPrintDataModel getModel(MesProduceSn produceSn, MesCustomerPart customerPart) { + MesProduceSnPrintDataModel mesProduceSnPrintDataModel = new MesProduceSnPrintDataModel(); + mesProduceSnPrintDataModel.setPartNo(produceSn.getPartNo()); + mesProduceSnPrintDataModel.setPartName(produceSn.getPartName()); + if (!Objects.isNull(customerPart)) { + mesProduceSnPrintDataModel.setCustPartNo(customerPart.getCustPartNo()); + } + mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); + mesProduceSnPrintDataModel.setPrintDate(TimeTool.getNowTime(true)); + mesProduceSnPrintDataModel.setUserName(produceSn.getCreateUser()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(), DateUtil.SHORT_FORMAT, "yyyy/MM/dd")); + return mesProduceSnPrintDataModel; + } + + private Map getPrintContextMap(MesProduceSn produceSn, MesCustomerPart customerPart) { + Map result = new HashMap<>(); + result.put(MesPcnExtConstWords.PART_NO, produceSn.getPartNo()); + result.put(MesPcnExtConstWords.PART_NAME, produceSn.getPartName()); + if (!Objects.isNull(customerPart)) { + result.put(MesPcnExtConstWords.CUST_PART_NO, customerPart.getCustPartNo()); + } + result.put(MesPcnExtConstWords.PRINT_BAR_CODE, produceSn.getProductSn()); + result.put(MesPcnExtConstWords.PRINT_DATE, TimeTool.getNowTime(true)); + result.put(MesPcnExtConstWords.USER_NAME, produceSn.getCreateUser()); + return result; + } + + private Map packResultMap(MesProduceSnPrintModel printModel, List> printTemplateDateList) { + Map resultMap = new HashMap<>(); + resultMap.put(MesPcnExtConstWords.LABEL_TEMPLATE, printModel.getMesLabelTemplate()); + resultMap.put(MesPcnExtConstWords.TEMPLATE_DATA, printTemplateDateList); + resultMap.put(MesPcnExtConstWords.TEMPLATE_CODE, printModel.getMesLabelTemplate().getTemplateCode()); + resultMap.put(MesPcnExtConstWords.PRINTER, printModel.getPrinter()); + return resultMap; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaBx1eSnPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaBx1eSnPrintStrategy.java new file mode 100644 index 0000000..190b335 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaBx1eSnPrintStrategy.java @@ -0,0 +1,120 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesCustomerPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPrintedSnLogService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.tool.TimeTool; +import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker; +import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Objects; + +/** + * @Description :礼嘉打印 + * @Reference : + * @Author : jason.niu + * @CreateDate 2025/02/21 09:20 + * @Modify: + **/ +@Component +@Slf4j +public class LiJiaBx1eSnPrintStrategy implements IPrintTemplateStrategyService { + @Autowired + private ISyncFuncService syncFuncService; + + @Autowired + private SnowflakeIdMaker snowflakeIdMaker; + + @Autowired + private IMesPartService mesPartService; + + @Autowired + private IMesPrintedSnLogService mesPrintedSnLogService; + + @Autowired + private IMesCustomerPartService mesCustomerPartService; + + @Override + public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { + String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); + //物料信息 + MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); + MesCustomerPart customerPart = (!Objects.isNull(genSerialNoModel) && !CollectionUtils.isEmpty(genSerialNoModel.getDataMap()) && genSerialNoModel.getDataMap().containsKey(MesCustomerPart.class.getSimpleName())) ? (MesCustomerPart) genSerialNoModel.getDataMap().get(MesCustomerPart.class.getSimpleName()) : mesCustomerPartService.getMesCustomerPart(organizeCode,mesProduceSnPrintModel.getPartNo()); + if (!isStep){ + if (!Objects.isNull(customerPart)) { + genSerialNoModel.setCustPartNo(customerPart.getCustPartNo()); + } + for (int i = 0; i < mesProduceSnPrintModel.getPrintQty(); i++) { + //保存条码信息 + MesProduceSn produceSn = generateMesProduceSn(mesPart, syncFuncService.syncSerialNo(genSerialNoModel.partSnParam(mesPart.getPartSnParam()), mesProduceSnPrintModel.getUserName(), organizeCode, 1).getResultList().get(0).toString(), mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(produceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); + mesProduceSnPrintModel.getMesProduceSnList().add(produceSn); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + } + }else{ + MesProduceSn mesProduceSn = mesProduceSnPrintModel.getMesProduceSnList().get(0); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(mesProduceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + } + return mesProduceSnPrintModel; + } + + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { + MesProduceSn mesProduceSn = new MesProduceSn(); + mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); + mesProduceSn.setProductSn(sn); + mesProduceSn.setCustSn(sn); + mesProduceSn.setPartNo(mesPart.getPartNo()); + mesProduceSn.setPartName(mesPart.getPartName()); + mesProduceSn.setProcessLabelTemplate(mesPart.getProcessLabelTemplate()); + mesProduceSn.setCustLabelTemplate(mesPart.getCustLabelTemplate()); + mesProduceSn.setProdLabelTemplate(mesPart.getProductLabelTemplate()); + mesProduceSn.setQty(qty); + mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); + mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); + mesProduceSn.setLotNo(TimeTool.getToday()); + mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); + mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); + mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); + ConvertBean.serviceModelInitialize(mesProduceSn, userName); + return mesProduceSn; + } + + private MesProduceSnPrintDataModel getModel(MesProduceSn produceSn, MesCustomerPart customerPart) { + MesProduceSnPrintDataModel mesProduceSnPrintDataModel = new MesProduceSnPrintDataModel(); + mesProduceSnPrintDataModel.setPartNo(produceSn.getPartNo()); + mesProduceSnPrintDataModel.setPartName(produceSn.getPartName()); + if (!Objects.isNull(customerPart)) { + mesProduceSnPrintDataModel.setCustPartNo(customerPart.getCustPartNo()); + } + mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); + mesProduceSnPrintDataModel.setPrintDate(TimeTool.getNowTime("HH:mm")); + mesProduceSnPrintDataModel.setUserName(produceSn.getCreateUser()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(), "", DateUtil.SHORT_EN_FORMAT)); + return mesProduceSnPrintDataModel; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaInterPartSnPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaInterPartSnPrintStrategy.java new file mode 100644 index 0000000..334a1f7 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaInterPartSnPrintStrategy.java @@ -0,0 +1,120 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesCustomerPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPrintedSnLogService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.tool.TimeTool; +import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker; +import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Objects; + +/** + * @Description :礼嘉打印 + * @Reference : + * @Author : jason.niu + * @CreateDate 2025/02/21 09:20 + * @Modify: + **/ +@Component +@Slf4j +public class LiJiaInterPartSnPrintStrategy implements IPrintTemplateStrategyService { + @Autowired + private ISyncFuncService syncFuncService; + + @Autowired + private SnowflakeIdMaker snowflakeIdMaker; + + @Autowired + private IMesPartService mesPartService; + + @Autowired + private IMesPrintedSnLogService mesPrintedSnLogService; + + @Autowired + private IMesCustomerPartService mesCustomerPartService; + + @Override + public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { + String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); + //物料信息 + MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); + MesCustomerPart customerPart = (!Objects.isNull(genSerialNoModel) && !CollectionUtils.isEmpty(genSerialNoModel.getDataMap()) && genSerialNoModel.getDataMap().containsKey(MesCustomerPart.class.getSimpleName())) ? (MesCustomerPart) genSerialNoModel.getDataMap().get(MesCustomerPart.class.getSimpleName()) : mesCustomerPartService.getMesCustomerPart(organizeCode,mesProduceSnPrintModel.getPartNo()); + if (!isStep){ + if (!Objects.isNull(customerPart)) { + genSerialNoModel.setCustPartNo(customerPart.getCustPartNo()); + } + for (int i = 0; i < mesProduceSnPrintModel.getPrintQty(); i++) { + //保存条码信息 + MesProduceSn produceSn = generateMesProduceSn(mesPart, syncFuncService.syncSerialNo(genSerialNoModel.partSnParam(mesPart.getPartSnParam()), mesProduceSnPrintModel.getUserName(), organizeCode, 1).getResultList().get(0).toString(), mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(produceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); + mesProduceSnPrintModel.getMesProduceSnList().add(produceSn); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + } + }else{ + MesProduceSn mesProduceSn = mesProduceSnPrintModel.getMesProduceSnList().get(0); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(mesProduceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + } + return mesProduceSnPrintModel; + } + + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { + MesProduceSn mesProduceSn = new MesProduceSn(); + mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); + mesProduceSn.setProductSn(sn); + mesProduceSn.setCustSn(sn); + mesProduceSn.setPartNo(mesPart.getPartNo()); + mesProduceSn.setPartName(mesPart.getPartName()); + mesProduceSn.setProcessLabelTemplate(mesPart.getProcessLabelTemplate()); + mesProduceSn.setCustLabelTemplate(mesPart.getCustLabelTemplate()); + mesProduceSn.setProdLabelTemplate(mesPart.getProductLabelTemplate()); + mesProduceSn.setQty(qty); + mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); + mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); + mesProduceSn.setLotNo(TimeTool.getToday()); + mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); + mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); + mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); + ConvertBean.serviceModelInitialize(mesProduceSn, userName); + return mesProduceSn; + } + + private MesProduceSnPrintDataModel getModel(MesProduceSn produceSn, MesCustomerPart customerPart) { + MesProduceSnPrintDataModel mesProduceSnPrintDataModel = new MesProduceSnPrintDataModel(); + mesProduceSnPrintDataModel.setPartNo(produceSn.getPartNo()); + mesProduceSnPrintDataModel.setPartName(produceSn.getPartName()); + if (!Objects.isNull(customerPart)) { + mesProduceSnPrintDataModel.setCustPartNo(customerPart.getCustPartNo()); + } + mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); + mesProduceSnPrintDataModel.setPrintDate(TimeTool.getNowTime(true)); + mesProduceSnPrintDataModel.setUserName(produceSn.getCreateUser()); + mesProduceSnPrintDataModel.setProductDate(produceSn.getCreateDatetime()); + return mesProduceSnPrintDataModel; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaInterTimeSnPrintStrategy.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaInterTimeSnPrintStrategy.java new file mode 100644 index 0000000..933b007 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/strategy/LiJiaInterTimeSnPrintStrategy.java @@ -0,0 +1,120 @@ +package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.strategy; + +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesCustomerPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesPartService; +import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesPrintedSnLogService; +import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintDataModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; +import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService; +import cn.estsh.i3plus.mes.pcn.util.DateUtil; +import cn.estsh.i3plus.platform.common.convert.ConvertBean; +import cn.estsh.i3plus.platform.common.tool.TimeTool; +import cn.estsh.i3plus.pojo.base.codemaker.SnowflakeIdMaker; +import cn.estsh.i3plus.pojo.mes.bean.MesCustomerPart; +import cn.estsh.i3plus.pojo.mes.bean.MesNumberRule; +import cn.estsh.i3plus.pojo.mes.bean.MesPart; +import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn; +import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; +import cn.estsh.i3plus.pojo.mes.model.StationRequestBean; +import cn.estsh.i3plus.pojo.mes.model.StepResult; +import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.Objects; + +/** + * @Description :礼嘉打印 + * @Reference : + * @Author : jason.niu + * @CreateDate 2025/02/21 09:20 + * @Modify: + **/ +@Component +@Slf4j +public class LiJiaInterTimeSnPrintStrategy implements IPrintTemplateStrategyService { + @Autowired + private ISyncFuncService syncFuncService; + + @Autowired + private SnowflakeIdMaker snowflakeIdMaker; + + @Autowired + private IMesPartService mesPartService; + + @Autowired + private IMesPrintedSnLogService mesPrintedSnLogService; + + @Autowired + private IMesCustomerPartService mesCustomerPartService; + + @Override + public MesProduceSnPrintModel execute(GenSerialNoModel genSerialNoModel, MesProduceSnPrintModel mesProduceSnPrintModel, MesNumberRule numberRule, StepResult stepResult, StationRequestBean reqBean, Boolean isStep) { + String organizeCode = mesProduceSnPrintModel.getOrganizeCode(); + //物料信息 + MesPart mesPart = mesPartService.getMesPartByPartNo(mesProduceSnPrintModel.getPartNo(), organizeCode); + MesCustomerPart customerPart = (!Objects.isNull(genSerialNoModel) && !CollectionUtils.isEmpty(genSerialNoModel.getDataMap()) && genSerialNoModel.getDataMap().containsKey(MesCustomerPart.class.getSimpleName())) ? (MesCustomerPart) genSerialNoModel.getDataMap().get(MesCustomerPart.class.getSimpleName()) : mesCustomerPartService.getMesCustomerPart(organizeCode,mesProduceSnPrintModel.getPartNo()); + if (!isStep){ + if (!Objects.isNull(customerPart)) { + genSerialNoModel.setCustPartNo(customerPart.getCustPartNo()); + } + for (int i = 0; i < mesProduceSnPrintModel.getPrintQty(); i++) { + //保存条码信息 + MesProduceSn produceSn = generateMesProduceSn(mesPart, syncFuncService.syncSerialNo(genSerialNoModel.partSnParam(mesPart.getPartSnParam()), mesProduceSnPrintModel.getUserName(), organizeCode, 1).getResultList().get(0).toString(), mesProduceSnPrintModel.getUserName(), mesProduceSnPrintModel.getQty()); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(produceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); + mesProduceSnPrintModel.getMesProduceSnList().add(produceSn); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + } + }else{ + MesProduceSn mesProduceSn = mesProduceSnPrintModel.getMesProduceSnList().get(0); + //封装打印信息 + MesProduceSnPrintDataModel printDataModel = getModel(mesProduceSn, customerPart); + mesProduceSnPrintModel.getMesProduceSnPrintDataModelList().add(printDataModel); + //保存打印记录 + mesProduceSnPrintModel.getMesPrintedSnLogList().add(mesPrintedSnLogService.getMesPrintedSnLog(mesProduceSnPrintModel.getUserName(), organizeCode, printDataModel)); + } + return mesProduceSnPrintModel; + } + + private MesProduceSn generateMesProduceSn(MesPart mesPart, String sn, String userName, Double qty) { + MesProduceSn mesProduceSn = new MesProduceSn(); + mesProduceSn.setSerialNumber(snowflakeIdMaker.nextId() + ""); + mesProduceSn.setProductSn(sn); + mesProduceSn.setCustSn(sn); + mesProduceSn.setPartNo(mesPart.getPartNo()); + mesProduceSn.setPartName(mesPart.getPartName()); + mesProduceSn.setProcessLabelTemplate(mesPart.getProcessLabelTemplate()); + mesProduceSn.setCustLabelTemplate(mesPart.getCustLabelTemplate()); + mesProduceSn.setProdLabelTemplate(mesPart.getProductLabelTemplate()); + mesProduceSn.setQty(qty); + mesProduceSn.setSnStatus(MesExtEnumUtil.PRODUCE_SN_STATUS.CREATE.getValue()); + mesProduceSn.setQcStatus(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue()); + mesProduceSn.setLotNo(TimeTool.getToday()); + mesProduceSn.setPrintCount(MesPcnExtConstWords.ONE); + mesProduceSn.setPrintStatus(MesExtEnumUtil.PRINT_STATUS.PRINTED.getValue()); + mesProduceSn.setOrganizeCode(mesPart.getOrganizeCode()); + ConvertBean.serviceModelInitialize(mesProduceSn, userName); + return mesProduceSn; + } + + private MesProduceSnPrintDataModel getModel(MesProduceSn produceSn, MesCustomerPart customerPart) { + MesProduceSnPrintDataModel mesProduceSnPrintDataModel = new MesProduceSnPrintDataModel(); + mesProduceSnPrintDataModel.setPartNo(produceSn.getPartNo()); + mesProduceSnPrintDataModel.setPartName(produceSn.getPartName()); + if (!Objects.isNull(customerPart)) { + mesProduceSnPrintDataModel.setCustPartNo(customerPart.getCustPartNo()); + } + mesProduceSnPrintDataModel.setBarcode(produceSn.getProductSn()); + mesProduceSnPrintDataModel.setPrintDate(TimeTool.getNowTime("HH:mm:ss")); + mesProduceSnPrintDataModel.setUserName(produceSn.getCreateUser()); + mesProduceSnPrintDataModel.setProductDate(TimeTool.parseStringFormat(produceSn.getLotNo(), "", DateUtil.SHORT_EN_FORMAT)); + return mesProduceSnPrintDataModel; + } +} diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java index 13604e6..b609510 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyMatchSortStepService.java @@ -67,6 +67,16 @@ public class MesAssemblyMatchSortStepService extends BaseStepService { //存储生产过程上下文对象 productionProcessContextStepService.dispatchProductionProcessContext(reqBean, productionProcessContext); + //获取加工结果 + String productResult = productionDispatchContextStepService.getProductResultContext(reqBean); + if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() + MesPcnExtConstWords.EMPTY) && + (StringUtils.isEmpty(productionProcessContext.getWorkCenter().getIsIgnoreQc()) + || productionProcessContext.getWorkCenter().getIsIgnoreQc().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) != 0)) { + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(), stepResult, + String.format("加工单质量状态标记[%s],当前装配件清单默认跳过!", MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(Integer.parseInt(productResult))), + MesPcnEnumUtil.PROMPT_SOUND.SUCCESS.getValue()); + } + //获取上下文产品加工规则数据信息集合 List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); if (CollectionUtils.isEmpty(prodRuleContextList)) stepExpSendMsgAndThrowEx(reqBean, resultBean.writeDbLog(), "当前不存在非排序加工规则数据,请重置工序!"); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java index f4da625..75558a9 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesAssemblyScanStepService.java @@ -112,7 +112,7 @@ public class MesAssemblyScanStepService extends BaseStepService { productionCustomContextStepService.sendStepContextMessage(reqBean, scanInfo, MesExtEnumUtil.CELL_MESSAGE_SOURCE.SCAN); //封装当前扫描的装配件信息 - List equipVariableCollectContextList = getAssemblySnJson(reqBean, scanInfo); + List equipVariableCollectContextList = getAssemblySnJson(reqBean, productionProcessContext, scanInfo); //从上下文中取出工位当前要使用的设备 MesCellEquipContext cellEquipContext = productionProcessContext.getCurCellEquip(); @@ -153,7 +153,17 @@ public class MesAssemblyScanStepService extends BaseStepService { productionDispatchContextStepService.dispatchScanAssemblySnContext(reqBean, equipVariableCollectContextList); //唯一加工规则场景 默认扫描一次 匹配一次 循环处理直到当前的加工规则全部匹配完毕 - if (busiType == BUSI_TYPE.ONE.value) return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo)); + if (busiType == BUSI_TYPE.ONE.value) { + //排序线可疑码场景下,该数据为空,验证生产线是否忽略质量状态 + if (CollectionUtils.isEmpty(equipVariableCollectContextList)) { + //保存上下文加工结果:可疑 + productionDispatchContextStepService.dispatchProductResultContext(reqBean, MesExtEnumUtil.PRODUCE_QC_STATUS.SUSPICIOUS.getValue() + MesPcnExtConstWords.EMPTY); + this.sendMessage(reqBean, new StationResultBean().writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), "当前扫描信息[排序线可疑码]!", MesPcnEnumUtil.STATION_BUSI_TYPE.MESSAGE, MesPcnEnumUtil.STATION_DATA_TYPE.TEXT); + if (StringUtils.isEmpty(productionProcessContext.getWorkCenter().getIsIgnoreQc()) || productionProcessContext.getWorkCenter().getIsIgnoreQc().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) != 0) return stepResult; + else stepSendGuideAndThrowEx(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), "请扫描装配件条码!"); + } + return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.SCAN.getValue()).scanInfo(scanInfo), stepResult, String.format("当前扫描信息装配件条码[%s]!", scanInfo)); + } String suffix = repeatAssemblySnAmount == 0 ? MesPcnExtConstWords.EMPTY : String.format(",可复用个数[%s]", repeatAssemblySnAmount); @@ -265,7 +275,10 @@ public class MesAssemblyScanStepService extends BaseStepService { } //封装当前扫描的装配件信息 - private List getAssemblySnJson(StationRequestBean reqBean, String scanInfo) { + private List getAssemblySnJson(StationRequestBean reqBean, MesProductionProcessContext productionProcessContext, String scanInfo) { + + //排序线可疑码 + if (productionProcessContext.getWorkCenter().getCenterType().compareTo(MesExtEnumUtil.WORK_CENTER_TYPE.SORT.getValue()) == 0 && scanInfo.equals(productionProcessContext.getSortSuspiciousCode())) return null; List equipVariableCollectContextList = new ArrayList<>(); diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java index 5b6dc9e..d1820ad 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductSnPrintSortStepService.java @@ -4,9 +4,12 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService; import cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.print.IPrintTemplateStrategyService; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProdRuleContext; +import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionAssemblySortContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.context.MesProductionPartContext; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesProduceSnPrintModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; +import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService; import cn.estsh.i3plus.mes.pcn.serviceimpl.fsm.BaseStepService; import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.pojo.base.bean.DdlPackBean; @@ -30,6 +33,7 @@ import org.springframework.util.StringUtils; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.function.Function; import java.util.stream.Collectors; @@ -62,6 +66,9 @@ public class MesProductSnPrintSortStepService extends BaseStepService { @Autowired private IMesTemplateService mesTemplateService; + @Autowired + private IConfigService configService; + @Override public StepResult execute(StationRequestBean reqBean) { // /** @@ -83,6 +90,9 @@ public class MesProductSnPrintSortStepService extends BaseStepService { //1. 获取上下文中生成的主条码 List productionPartContextList = productionDispatchContextStepService.getProductionPartContext(reqBean); + //获取上下文产品加工规则数据信息集合 + List prodRuleContextList = productionDispatchContextStepService.getProdRuleDataContext(reqBean); + // 排除掉空腔的partContext数据 productionPartContextList = CollectionUtils.isEmpty(productionPartContextList) ? null :productionPartContextList.stream().filter(o -> o.getForeignKey() != null).collect(Collectors.toList()); @@ -97,53 +107,67 @@ public class MesProductSnPrintSortStepService extends BaseStepService { // 根据工单号分组 Map workOrderMap = getMesWorkOrderMap(reqBean, productionPartContextList); + //加工规则根据数据关联键分组 + Map prodRuleContextMap = prodRuleContextList.stream().filter(o -> null != o).collect(Collectors.toMap(MesProdRuleContext::getForeignKey, o -> o)); + // 获取零件信息上下文 Map partDataContext = productionProcessContextStepService.getPartDataContext(reqBean); + //默认客户条码编码规则配置代码 + String defaultCustMatchRule = getDefaultCustMatchRule(reqBean.getOrganizeCode()); + List snLogList = new ArrayList<>(); List> resultMap = new ArrayList<>(); - for (MesProductionPartContext sn : productionPartContextList) { + for (MesProductionPartContext productionPartContext : productionPartContextList) { // 根据工单号获取工单信息 - MesWorkOrder workOrder = workOrderMap.get(sn.getWorkOrderNo()); + MesWorkOrder workOrder = workOrderMap.get(productionPartContext.getWorkOrderNo()); - if (null == workOrder) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号:{}无效!", sn.getWorkOrderNo())); + if (null == workOrder) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号:{}无效!", productionPartContext.getWorkOrderNo())); if (CollectionUtils.isEmpty(partDataContext) || !partDataContext.containsKey(workOrder.getPartNo())) - stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]丢失零件信息缓存!", sn.getWorkOrderNo(), sn.getPartNo())); + stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]丢失零件信息缓存!", productionPartContext.getWorkOrderNo(), productionPartContext.getPartNo())); - MesPart mesPart = partDataContext.get(sn.getPartNo()); + MesPart mesPart = partDataContext.get(productionPartContext.getPartNo()); - String custMatchRule = StringUtils.isEmpty(mesPart.getCustMatchRule()) ? "WH_CUST_SN_RULE" : mesPart.getCustMatchRule(); + //验证是否配置客户条码编码规则信息 + String custMatchRule = !StringUtils.isEmpty(mesPart.getCustMatchRule()) ? mesPart.getCustMatchRule() : defaultCustMatchRule; + if (StringUtils.isEmpty(custMatchRule)) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]未维护客户条码编码规则!", productionPartContext.getWorkOrderNo(), productionPartContext.getPartNo())); DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode); DdlPreparedPack.getStringEqualPack(custMatchRule, MesPcnExtConstWords.RULE_CODE, packBean); MesNumberRule numberRule = numberRuleRepository.getByProperty(packBean); + if (null == numberRule) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]客户条码编码规则[%s]无效!", productionPartContext.getWorkOrderNo(), productionPartContext.getPartNo(), custMatchRule)); - if (null == numberRule) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]客户条码编码规则[%s]无效!", sn.getWorkOrderNo(), sn.getPartNo(), custMatchRule)); - - // 从物料信息中获取标签模板 - String labelTemplateCode = partDataContext.get(sn.getPartNo()).getCustLabelTemplate(); + //获取零件表的打印模版和打印机 + String labelTemplateCode = mesPart.getCustLabelTemplate();; + String printer = mesPart.getProductPrinterCode(); + if (StringUtils.isEmpty(labelTemplateCode)) { + //获取工单装配件的打印模版和打印机 + MesProdRuleContext prodRuleContext = prodRuleContextMap.get(productionPartContext.getForeignKey()); + MesProductionAssemblySortContext productionAssemblySortContext = filterPrintInfo(prodRuleContext); + labelTemplateCode = null != productionAssemblySortContext ? productionAssemblySortContext.getPrintTemplate() : null; + printer = null != productionAssemblySortContext ? productionAssemblySortContext.getPrinter() : null; + } - if (null == labelTemplateCode) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]未在ERP物料信息维护打印模板,请检查并修改!", sn.getWorkOrderNo(), sn.getPartNo())); + if (null == labelTemplateCode) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]未在ERP物料信息维护打印模板,请检查并修改!", productionPartContext.getWorkOrderNo(), productionPartContext.getPartNo())); - MesProduceSnPrintModel mesProduceSnPrintModel = new MesProduceSnPrintModel(); // 查模板代码 MesLabelTemplate labelTemplate = mesTemplateService.getLabelTemplate(labelTemplateCode, organizeCode); + if (null == labelTemplate) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]无效,请检查并修改!", productionPartContext.getWorkOrderNo(), productionPartContext.getPartNo(), labelTemplateCode)); - if (null == labelTemplate) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]无效,请检查并修改!", sn.getWorkOrderNo(), sn.getPartNo(), labelTemplateCode)); - + MesProduceSnPrintModel mesProduceSnPrintModel = new MesProduceSnPrintModel(); mesProduceSnPrintModel.setMesLabelTemplate(labelTemplate); - mesProduceSnPrintModel.setPrinter(partDataContext.get(sn.getPartNo()).getProductPrinterCode()); - mesProduceSnPrintModel.setPartNo(sn.getPartNo()); + mesProduceSnPrintModel.setPrinter(printer); + mesProduceSnPrintModel.setPartNo(productionPartContext.getPartNo()); mesProduceSnPrintModel.setOrganizeCode(organizeCode); mesProduceSnPrintModel.setSourceData(workOrder); mesProduceSnPrintModel.setUserName(reqBean.getUserInfo()); //根据反射获取策略类--封装打印数据 String methodCode = labelTemplate.getMethodCode(); //模板信息丢失抛出异常 - if (StringUtils.isEmpty(methodCode)) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]的反射类丢失,请配置!", sn.getWorkOrderNo(), sn.getPartNo(), labelTemplateCode)); + if (StringUtils.isEmpty(methodCode)) stepExpSendMsgAndThrowEx(reqBean, resultBean, String.format("工单号[%s]零件号[%s]的模板代码[%s]的反射类丢失,请配置!", productionPartContext.getWorkOrderNo(), productionPartContext.getPartNo(), labelTemplateCode)); IPrintTemplateStrategyService strategyService = (IPrintTemplateStrategyService) SpringContextsUtil.getBean(methodCode); MesProduceSnPrintModel printModel = strategyService.execute(null, mesProduceSnPrintModel, numberRule, stepResult, reqBean, true); @@ -163,6 +187,12 @@ public class MesProductSnPrintSortStepService extends BaseStepService { return stepSuccessCompleteAndSendMsgReturn(reqBean, resultBean.writeDbLog(MesPcnEnumUtil.WORK_CELL_SCAN_MONITOR_LOG_TYPE.PROCESS.getValue()), stepResult, "打印成功!"); } + //默认客户条码编码规则配置代码 + private String getDefaultCustMatchRule(String organizeCode) { + List configList = configService.doCachedConfigList(MesPcnExtConstWords.DEFAULT_CUST_MATCH_RULE, organizeCode); + return !CollectionUtils.isEmpty(configList) ? configList.get(0).getCfgValue() : null; + } + private MesPrintedSnLog getMesPrintedSnLog(StationRequestBean reqBean, MesWorkOrder workOrder,String printData) { MesPrintedSnLog snLog = new MesPrintedSnLog(); snLog.setBarcode(workOrder.getCustSn()); @@ -191,4 +221,13 @@ public class MesProductSnPrintSortStepService extends BaseStepService { return CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().collect(Collectors.toMap(MesWorkOrder::getWorkOrderNo, Function.identity(), (x, y) -> y)); } + + //过滤打印配置信息 + private MesProductionAssemblySortContext filterPrintInfo(MesProdRuleContext prodRuleContext) { + List productionAssemblySortContextList = prodRuleContext.getSortAssemblyDataContext(); + Optional optional = CollectionUtils.isEmpty(productionAssemblySortContextList) ? null : + productionAssemblySortContextList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPrintTemplate()))).findFirst(); + return (null != optional && optional.isPresent()) ? optional.get() : null; + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java index 763fdd0..b38176f 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesWorkOrderSaveSortStepService.java @@ -17,6 +17,7 @@ import cn.estsh.i3plus.pojo.mes.model.StationResultBean; import cn.estsh.i3plus.pojo.mes.model.StepResult; import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderRepository; import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil; +import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -26,7 +27,9 @@ import org.springframework.util.StringUtils; import javax.persistence.EntityManager; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * @Description : 保存加工单信息工步 【排序】 @@ -89,42 +92,68 @@ public class MesWorkOrderSaveSortStepService extends BaseStepService { private void doHandleWorkOrderData(StationRequestBean reqBean, StationResultBean resultBean, List productionPartContextList, MesWorkCell workCell) { + //获取上下文加工结果 + String productResult = productionDispatchContextStepService.getProductResultContext(reqBean); + + Map propertyMap; + for (MesProductionPartContext productionPartContext : productionPartContextList) { if (null == productionPartContext || StringUtils.isEmpty(productionPartContext.getForeignKey())) continue; + //判断是否末道工位 Boolean isEndWorkCell = (!StringUtils.isEmpty(workCell.getIsEndWorkCell()) && workCell.getIsEndWorkCell().compareTo(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()) == 0) ? true : false; - if (!isEndWorkCell && productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) == 0) continue; - - if (!isEndWorkCell) { - workOrderRepository.updateByPropertiesNoSync( - new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, - new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, - new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, - MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, - MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.START_TIME, MesPcnExtConstWords.ONLINE_TIME}, - new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), - CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesPcnExtConstWords.EMPTY, - MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue(), productionPartContext.getOnlineTime(), productionPartContext.getOnlineTime()}); - } else { - productionPartContext.setOfflineTime(TimeTool.getNowTime(true)); - workOrderRepository.updateByPropertiesNoSync( - new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, - new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, - new String[]{MesPcnExtConstWords.MODIFY_USER, MesPcnExtConstWords.MODIFY_DATE_TIME, - MesPcnExtConstWords.SYSTEM_SYNC_STATUS, MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, - MesPcnExtConstWords.WORK_ORDER_STATUS, MesPcnExtConstWords.COMPLETE_QTY, MesPcnExtConstWords.UN_COMPLETE_QTY, - MesPcnExtConstWords.START_TIME, MesPcnExtConstWords.ONLINE_TIME, MesPcnExtConstWords.END_TIME, MesPcnExtConstWords.OFFLINE_TIME}, - new Object[]{reqBean.getUserInfo(), (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date()), - CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), MesPcnExtConstWords.EMPTY, - MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue(), new Double(1), new Double(0), - productionPartContext.getOnlineTime(), productionPartContext.getOnlineTime(), productionPartContext.getOfflineTime(), productionPartContext.getOfflineTime()}); + propertyMap = new HashMap<>(); + + //质量非合格 + if (!StringUtils.isEmpty(productResult) && !productResult.equals(MesExtEnumUtil.PRODUCE_QC_STATUS.QUALIFIED.getValue() + MesPcnExtConstWords.EMPTY)) { + propertyMap.put(MesPcnExtConstWords.QC_STATUS, Integer.valueOf(productResult)); } - log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:[{}:{}]", - reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), - StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), MesPcnExtConstWords.WORK_ORDER_STATUS, !isEndWorkCell ? MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue() : MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); + //末工位 或者 非加工中 + if (isEndWorkCell || productionPartContext.getWorkOrderStatus().compareTo(MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()) != 0) { + if (!isEndWorkCell) { + propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.PROCESS.getValue()); + propertyMap.put(MesPcnExtConstWords.START_TIME, productionPartContext.getOnlineTime()); + propertyMap.put(MesPcnExtConstWords.ONLINE_TIME, productionPartContext.getOnlineTime()); + } else { + productionPartContext.setOfflineTime(TimeTool.getNowTime(true)); + propertyMap.put(MesPcnExtConstWords.WORK_ORDER_STATUS, MesExtEnumUtil.ORDER_STATUS.COMPLETE.getValue()); + propertyMap.put(MesPcnExtConstWords.START_TIME, productionPartContext.getOnlineTime()); + propertyMap.put(MesPcnExtConstWords.ONLINE_TIME, productionPartContext.getOnlineTime()); + propertyMap.put(MesPcnExtConstWords.END_TIME, productionPartContext.getOfflineTime()); + propertyMap.put(MesPcnExtConstWords.OFFLINE_TIME, productionPartContext.getOfflineTime()); + propertyMap.put(MesPcnExtConstWords.COMPLETE_QTY, new Double(1)); + propertyMap.put(MesPcnExtConstWords.UN_COMPLETE_QTY, new Double(0)); + } + } + + //当存在修改字段的情况下进行修改工单信息 + if (!CollectionUtils.isEmpty(propertyMap) && propertyMap.size() > 0) { + propertyMap.put(MesPcnExtConstWords.MODIFY_USER, reqBean.getUserInfo()); + propertyMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, (new SimpleDateFormat(MesPcnExtConstWords.DATE_FORMAT_SSS)).format(new Date())); + propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_STATUS, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); + propertyMap.put(MesPcnExtConstWords.SYSTEM_SYNC_DATE_TIME, MesPcnExtConstWords.EMPTY); + + String[] propertyName = new String[propertyMap.size()]; + Object[] propertyValue = new Object[propertyMap.size()]; + + Integer index = 0; + for (Map.Entry innerEntry : propertyMap.entrySet()) { + if (null == innerEntry) continue; + propertyName[index] = innerEntry.getKey(); + propertyValue[index] = innerEntry.getValue(); + index ++; + } + + workOrderRepository.updateByPropertiesNoSync(new String[]{MesPcnExtConstWords.ID, MesPcnExtConstWords.ORGANIZE_CODE}, new Object[]{productionPartContext.getId(), reqBean.getOrganizeCode()}, propertyName, propertyValue); + + log.info("工厂{}生产线{}工位{}:FSM STATE DISPATCHER --- DO STEP --- {} EXEC --- ORDER:{} --- UPDATE:{}", + reqBean.getOrganizeCode(), reqBean.getWorkCenterCode(), reqBean.getWorkCellCode(), + StringUtil.toLowerCaseFirst(this.getClass().getSimpleName()), productionPartContext.getWorkOrderNo(), JSONObject.toJSONString(propertyMap)); + + } } } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java index eeb5810..12ff35e 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/context/MesProductionProcessContextStepService.java @@ -114,7 +114,9 @@ public class MesProductionProcessContextStepService extends BaseStepService impl if (isCheckProcess && (StringUtils.isEmpty(productionProcessContext.getProcessCode()) || !productionProcessContext.getProcessCode().equals(reqBean.getProcessCode()))) processContext(reqBean, productionProcessContext); //生产过程上下文对象赋值生产过程控制全局密码 - if (StringUtils.isEmpty(productionProcessContext.getFinishCode()) || StringUtils.isEmpty(productionProcessContext.getCraftJumpCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblySkipCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblyCavitySkipCode())) productionPwdContext(reqBean, productionProcessContext); + if (StringUtils.isEmpty(productionProcessContext.getFinishCode()) || StringUtils.isEmpty(productionProcessContext.getCraftJumpCode()) || + StringUtils.isEmpty(productionProcessContext.getAssemblySkipCode()) || StringUtils.isEmpty(productionProcessContext.getAssemblyCavitySkipCode()) || + StringUtils.isEmpty(productionProcessContext.getSortSuspiciousCode())) productionPwdContext(reqBean, productionProcessContext); return productionProcessContext; @@ -152,7 +154,8 @@ public class MesProductionProcessContextStepService extends BaseStepService impl return productionProcessContext.finishCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.CAVITY_FINISH_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.CAVITY_FINISH_CODE).get(0).getCfgValue() : MesPcnExtConstWords.CAVITY_FINISH_CODE) .craftJumpCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.CRAFT_JUMP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.CRAFT_JUMP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.CRAFT_JUMP_CODE) .assemblySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_SKIP_CODE) - .assemblyCavitySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE); + .assemblyCavitySkipCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE).get(0).getCfgValue() : MesPcnExtConstWords.ASSEMBLY_CAVITY_SKIP_CODE) + .sortSuspiciousCode((!CollectionUtils.isEmpty(cfgKeyMap) && cfgKeyMap.containsKey(MesPcnExtConstWords.SORT_SUSPICIOUS_CODE)) ? cfgKeyMap.get(MesPcnExtConstWords.SORT_SUSPICIOUS_CODE).get(0).getCfgValue() : MesPcnExtConstWords.SORT_SUSPICIOUS_CODE); } //验证组织模型有效性 diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java index c8ba4bb..643d047 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/context/MesProductionProcessContext.java @@ -47,6 +47,9 @@ public class MesProductionProcessContext implements Serializable { @ApiParam("装配件整腔跳过码") private String assemblyCavitySkipCode; + @ApiParam("排序线可疑码") + private String sortSuspiciousCode; + @ApiParam("生产线信息([Json]MesWorkCenter)") private String workCenterJson; @@ -142,6 +145,12 @@ public class MesProductionProcessContext implements Serializable { return this.isNeedCache(); } + //排序线可疑码 + public MesProductionProcessContext sortSuspiciousCode(String sortSuspiciousCode) { + this.sortSuspiciousCode = sortSuspiciousCode; + return this.isNeedCache(); + } + //---------------------- 生产线对象 --------------------------------------- diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartModel.java new file mode 100644 index 0000000..ae847db --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesPartModel.java @@ -0,0 +1,11 @@ +package cn.estsh.i3plus.ext.mes.pcn.pojo.model; + +import lombok.Data; + +@Data +public class MesPartModel { + + private String partNo; + + private String locateNo; +} diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java index e9d756c..076b45f 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java @@ -344,6 +344,9 @@ public class MesPcnExtConstWords { // 扩展字段 public static final String EXTEND = "extend"; + // 默认客户条码编码规则配置代码 + public static final String DEFAULT_CUST_MATCH_RULE = "DEFAULT_CUST_MATCH_RULE"; + // 用户缓存 public static final String USER_INFO_CONTEXT = "USER_INFO_CONTEXT"; // 装箱防错 @@ -386,6 +389,8 @@ public class MesPcnExtConstWords { public static final String ASSEMBLY_SKIP_CODE = "ASSEMBLY_SKIP_CODE"; // 装配件整腔跳过码 public static final String ASSEMBLY_CAVITY_SKIP_CODE = "ASSEMBLY_CAVITY_SKIP_CODE"; + // 排序线可疑码 + public static final String SORT_SUSPICIOUS_CODE = "SORT_SUSPICIOUS_CODE"; // 设备代码[工步参数] public static final String EQUIPMENT_CODE_UC = "EQUIPMENT_CODE"; // 模具号读一模多腔配置[工步参数] @@ -707,6 +712,8 @@ public class MesPcnExtConstWords { public static final String QR_CODE = "qrCode"; //条形码 public static final String BAR_CODE = "barCode"; + //打印条形码 + public static final String PRINT_BAR_CODE = "barcode"; //竖杠 public static final String VERTICAL_BAR = "|"; @@ -736,6 +743,8 @@ public class MesPcnExtConstWords { public static final String PARAM = "param"; //成品零件号 public static final String FG_PART_NO = "fgPartNo"; + // 打印日期 + public static final String PRINT_DATE = "printDate"; // 打印时间 public static final String PRINT_TIME = "printTime"; //替换数