From 541ce42f2125112205173829b13f959378266f39 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Thu, 3 Apr 2025 10:01:36 +0800 Subject: [PATCH 01/11] =?UTF-8?q?45858=20=20=09=20MES=EF=BC=9A=E7=94=B5?= =?UTF-8?q?=E5=AD=90=E5=8C=96=E6=A3=80=E9=AA=8C=E5=88=9D=E5=88=A4=E5=92=8C?= =?UTF-8?q?=E7=BB=88=E5=88=A4=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pcn/apiservice/serviceimpl/base/MesReworkTaskServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fd9e154..b55028c 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 @@ -301,7 +301,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { MesPartInspection mesPartInspection = null; if (!StringUtils.isEmpty(mesReworkTask.getId())){ DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); - DdlPreparedPack.getNumEqualPack(mesReworkTask.getId(), "reworkTaskId", packBean); + DdlPreparedPack.getNumEqualPack(mesReworkTask.getPartInspectionId(), "id", packBean); mesPartInspection = mesPartInspectionRepository.getByProperty(packBean); if (!Objects.isNull(mesPartInspection)){ if(!CollectionUtils.isEmpty(requestModel.getAssemblyModelList())){ From 690b21b224ba3270b0fdc03175667f5b83af5669 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Thu, 17 Apr 2025 09:13:08 +0800 Subject: [PATCH 02/11] =?UTF-8?q?45858=20MES=EF=BC=9A=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E5=8C=96=E6=A3=80=E9=AA=8C=E5=88=9D=E5=88=A4=E5=92=8C=E7=BB=88?= =?UTF-8?q?=E5=88=A4=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/busi/MesNcProcessingController.java | 31 ++++ .../serviceimpl/busi/MesNcProcessingService.java | 203 ++++++++++++++++++++- .../ext/mes/pcn/pojo/model/MesNcPersonModel.java | 37 ++++ .../pcn/pojo/model/MesNcProcessingInputModel.java | 3 + 4 files changed, 266 insertions(+), 8 deletions(-) create mode 100644 modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcPersonModel.java 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 c0383ab..ba014c1 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 @@ -3,6 +3,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.controller.busi; import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesNcProcessingService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; +import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcPersonModel; import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesNcProcessingInputModel; import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.base.common.Pager; @@ -110,6 +111,36 @@ public class MesNcProcessingController { } } + @PostMapping("/save-nc-lt") + @ApiOperation(value = "NC处理") + public ResultBean lotSaveNc(@RequestBody MesNcProcessingInputModel model) { + + try { + ValidatorBean.checkNotNull(model.getOrganizeCode(), "工厂不能为空"); + ValidatorBean.checkNotNull(model.getUserName(), "操作人不能为空"); + ValidatorBean.checkNotNull(model.getPartInspection(), "单据不能为空"); + ValidatorBean.checkNotNull(model.getPartInspectionDetailList(), "单据明细不能为空"); + if (CollectionUtils.isEmpty(model.getPersonModelList())) { + throw new ImppBusiException("责任人信息不能为空"); + } + for (MesNcPersonModel mesNcPersonModel : model.getPersonModelList()) { + if (mesNcPersonModel.getNcStatus() == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue() + || mesNcPersonModel.getNcStatus() == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()) { + ValidatorBean.checkNotNull(mesNcPersonModel.getOnlyPerson(), "责任人不能为空"); + } + } + if (CollectionUtils.isEmpty(model.getPartInspectionDetailList())) { + throw new ImppBusiException("不存在可疑信息,请检查数据"); + } + ncProcessingService.saveNc(model, model.getOrganizeCode(), false); + return ResultBean.success("NC处理成功"); + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + @GetMapping("/query-part-inspection-create-user") @ApiOperation(value = "查询检验人(NC-零件检测-单据 表的createUser)") public ResultBean queryPartInspectionCreateUser(String organizeCode) { 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 e6e40e8..1e5c81e 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 @@ -4,10 +4,7 @@ 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.*; 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.model.*; 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; @@ -22,6 +19,7 @@ import cn.estsh.i3plus.pojo.base.util.StringUtil; import cn.estsh.i3plus.pojo.mes.bean.*; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; +import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionPerson; import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTask; import cn.estsh.i3plus.pojo.mes.bean.rework.MesReworkTaskDetail; import cn.estsh.i3plus.pojo.mes.model.GenSerialNoModel; @@ -124,6 +122,10 @@ public class MesNcProcessingService implements IMesNcProcessingService { @Autowired private IMesMoveRuleRepository mesMoveRuleRepository; + @Autowired + private MesPartInspectionPersonRepository mesPartInspectionPersonRepository; + + @Override public ListPager queryPartInspectionByPager(MesPartInspection partInspection, Pager pager) { @@ -204,11 +206,8 @@ public class MesNcProcessingService implements IMesNcProcessingService { //保存数据 saveDate(model, model.getPart(), type, person, org,model.getInventoryLocationCode(),isOrder); } else { - - Integer type = model.getType(); - MesDefectType person = StringUtil.isEmpty(model.getPerson())?new MesDefectType():model.getPerson(); //保存数据 - saveDate(model, model.getPart(), type, person, org,model.getInventoryLocationCode(), isOrder); + saveLotDate(model, model.getPart(), org, isOrder); } } @@ -698,6 +697,194 @@ public class MesNcProcessingService implements IMesNcProcessingService { } } } + + /** + * 保存数据 + * + * @param part + * @param model + * @param org + */ + private void saveLotDate(MesNcProcessingInputModel model, MesPartSap part,String org, boolean isOrder) { + String workCenterCode = null == model.getPartInspection() ? null : model.getPartInspection().getWorkCenterCode(); + assert model.getPartInspection() != null; + model.getPartInspection().setQmsSync(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); + + String refundSource = configService.getCfgValue(org, "REFUND"); + List personList = new ArrayList<>(); + for (MesNcPersonModel mesNcPersonModel : model.getPersonModelList()) { + Integer type = mesNcPersonModel.getNcStatus(); + + if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue()) { + + model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); + model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.NORMAL.getValue()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); + String sourceValue = configService.getCfgValue(org, "UMLGO"); + + if (model.getOptType() == 2) { + sourceValue = refundSource; + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } + + partInspectionRepository.save(model.getPartInspection()); + + String target = configService.getCfgValue(org, "LGORT"); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean); + + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + if (version != null) { + target = version.getReceiveInventoryPoint(); + } + + //移库 转正常、放行:8000移至2000 + MesMove move = createMove(model, sourceValue, target, org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveRepository.save(move); + } + else if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue()) { + + //生成返工单 根据责任方库区对应关系,选择哪个责任方,就移动到哪个库区(8000移至8002/8003); + GenSerialNoModel serialNoModel = new GenSerialNoModel("NC_REWORK"); + serialNoModel.setPartNo(part.getPartNo()); + ResultBean rb = syncFuncService.syncSerialNo(serialNoModel, model.getPartInspection().getModifyUser(), org, 1); + String rework = ""; + if (null != rb && !CollectionUtils.isEmpty(rb.getResultList())) { + rework = (rb.getResultList().get(0)).toString(); + } + MesPartInspectionPerson mesPartInspectionPerson = new MesPartInspectionPerson(); + mesPartInspectionPerson.setQty(Double.valueOf(mesNcPersonModel.getQty())); + mesPartInspectionPerson.setNcStatus(mesNcPersonModel.getNcStatus()); + mesPartInspectionPerson.setSn(model.getPartInspection().getSn()); + + DdlPackBean partyPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(mesNcPersonModel.getOnlyPerson(), "responsibleParty", partyPackBean); + MesOrg mesOrg = mesOrgRDao.getByProperty(partyPackBean); + + mesPartInspectionPerson.setResponsibleParty(mesOrg.getResponsibleParty()); + ConvertBean.serviceModelInitialize(mesPartInspectionPerson, model.getUserName()); + personList.add(mesPartInspectionPerson); + + MesReworkTask reworkTask = new MesReworkTask(); + reworkTask.setQty(model.getPartInspection().getQty()); + reworkTask.setSn(model.getPartInspection().getSn()); + reworkTask.setReworkOrder(rework); + reworkTask.setStatus(MesExtEnumUtil.REWORK_TASK_STATUS.CREATE.getValue()); + reworkTask.setPartNo(model.getPartInspection().getPartNo()); + reworkTask.setPartName(model.getPartInspection().getPartName()); + reworkTask.setPartInspectionId(model.getPartInspection().getId()); + reworkTask.setOrganizeCode(org); + reworkTask.setResponsibleParty(model.getOnlyPerson()); + reworkTask.setDisassembleType(MesPcnExtConstWords.ZERO); + reworkTask.setLotNo(model.getPartInspection().getLotNo()); + reworkTask.setType(model.getPartInspection().getSourceType()); + ConvertBean.serviceModelInitialize(reworkTask, model.getUserName()); + reworkTaskRepository.insert(reworkTask); + + //生成返工单明细 + List taskDetailList = new ArrayList<>(); + for (MesPartInspectionDetail detail : model.getPartInspectionDetailList()) { + + MesReworkTaskDetail taskDetail = new MesReworkTaskDetail(); + taskDetail.setPid(reworkTask.getId()); + taskDetail.setStatus(MesExtEnumUtil.REWORK_TASK_DETAIL_STATUS.REWORK_TASK_DETAIL_STATUS_10.getValue()); + taskDetail.setPartInspectionDetailId(detail.getId()); + taskDetail.setOrganizeCode(org); + ConvertBean.serviceModelInitialize(taskDetail, model.getUserName()); + taskDetailList.add(taskDetail); + + } + + reworkTaskDetailRepository.saveAll(taskDetailList); + + //model.getPartInspection().setDefectTypeId(person.getId()); + model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.REWORK.getValue()); + model.getPartInspection().setReworkTaskId(reworkTask.getId()); + ConvertBean.serviceModelUpdate(model.getPartInspection(),model.getUserName()); + String sourceValue = configService.getCfgValue(org, "UMLGO"); + + if (model.getOptType() == 2) { + sourceValue = refundSource; + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } + partInspectionRepository.save(model.getPartInspection()); + + MesMove move = createMove(model, sourceValue, mesNcPersonModel.getInventoryLocationCode(), org,workCenterCode, MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveRepository.save(move); + + } else if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()) { + //报废时设置责任人 + model.getPartInspection().setResponsibleParty(model.getOnlyPerson()); + //model.getPartInspection().setDefectTypeId(person.getId()); + model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); + model.getPartInspection().setRejectQty(model.getPartInspection().getQty()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); + + if (model.getOptType() == 2) { + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } + + partInspectionRepository.save(model.getPartInspection()); + + MesPartInspectionPerson mesPartInspectionPerson = new MesPartInspectionPerson(); + mesPartInspectionPerson.setQty(Double.valueOf(mesNcPersonModel.getQty())); + mesPartInspectionPerson.setNcStatus(mesNcPersonModel.getNcStatus()); + mesPartInspectionPerson.setSn(model.getPartInspection().getSn()); + + DdlPackBean partyPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(mesNcPersonModel.getOnlyPerson(), "responsibleParty", partyPackBean); + MesOrg mesOrg = mesOrgRDao.getByProperty(partyPackBean); + + mesPartInspectionPerson.setResponsibleParty(mesOrg.getResponsibleParty()); + ConvertBean.serviceModelInitialize(mesPartInspectionPerson, model.getUserName()); + personList.add(mesPartInspectionPerson); + + String sourceValue = configService.getCfgValue(org, "UMLGO"); + if (model.getOptType() == 2) { + sourceValue = refundSource; + } + //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) + MesMove move = createMove(model, sourceValue, mesNcPersonModel.getInventoryLocationCode(), org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); + ConvertBean.serviceModelInitialize(move,model.getUserName()); + moveRepository.save(move); + } else if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue()) { + //更新检验单 + /* if (model.getType() != 10 && model.getType() != 40) { + model.getPartInspection().setDefectTypeId(person.getId()); + }*/ + model.getPartInspection().setInspectionStatus(MesExtEnumUtil.PART_INSPECTION_STATUS.QUALIFIED.getValue()); + model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue()); + ConvertBean.serviceModelUpdate(model.getPartInspection(), model.getUserName()); + String sourceValue = configService.getCfgValue(org, "UMLGO"); + + if (model.getOptType() == 2) { + sourceValue = refundSource; + model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); + } + partInspectionRepository.save(model.getPartInspection()); + + String target = configService.getCfgValue(org, "LGORT"); + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(); + DdlPreparedPack.getStringEqualPack(model.getPart().getPartNo(), "partNo", ddlPackBean); + + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + if (version != null) { + target = version.getReceiveInventoryPoint(); + } + //移库 转正常、放行:8000移至2000 + MesMove move = createMove(model, sourceValue, target, org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + ConvertBean.serviceModelInitialize(move, model.getUserName()); + moveRepository.save(move); + + } + } + mesPartInspectionPersonRepository.saveAll(personList); + } + + + public MesWorkOrder getWorkOrder(String organizeCode, String workOrderNo) { if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(workOrderNo)) return null; return workOrderRepository.getByProperty( diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcPersonModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcPersonModel.java new file mode 100644 index 0000000..af06004 --- /dev/null +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcPersonModel.java @@ -0,0 +1,37 @@ +package cn.estsh.i3plus.ext.mes.pcn.pojo.model; + +import cn.estsh.i3plus.pojo.mes.bean.MesDefectType; +import cn.estsh.i3plus.pojo.mes.bean.MesPartSap; +import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspection; +import cn.estsh.i3plus.pojo.mes.bean.nc.MesPartInspectionDetail; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.annotations.ApiParam; +import lombok.Data; +import org.hibernate.annotations.ColumnDefault; + +import javax.persistence.Column; +import java.util.List; + +/** + * @Description : + * @Reference : + * @Author : + * @CreateDate : 2024-05-09 18:08 + * @Modify: + **/ +@Data +public class MesNcPersonModel { + + + @ApiParam("责任人") + private String onlyPerson; + + @ApiParam("区域代码") + private String inventoryLocationCode; + + @ApiParam("数量") + private Double qty; + + @ApiParam("nc状态-转正常等等 枚举") + private Integer ncStatus; +} diff --git a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java index b6345a9..4c60d14 100644 --- a/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java +++ b/modules/i3plus-ext-mes-pcn-pojo/src/main/java/cn/estsh/i3plus/ext/mes/pcn/pojo/model/MesNcProcessingInputModel.java @@ -58,4 +58,7 @@ public class MesNcProcessingInputModel { @ApiModelProperty("操作人") private String userName; + + @ApiParam("批次责任人信息") + private List personModelList; } From ccd313952d30247fde09e66a891aec3af9a19737 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Fri, 18 Apr 2025 10:19:44 +0800 Subject: [PATCH 03/11] =?UTF-8?q?45858=20MES=EF=BC=9A=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E5=8C=96=E6=A3=80=E9=AA=8C=E5=88=9D=E5=88=A4=E5=92=8C=E7=BB=88?= =?UTF-8?q?=E5=88=A4=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/base/MesReworkTaskServiceImpl.java | 2 +- .../serviceimpl/busi/MesNcProcessingService.java | 41 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) 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 abb24a5..2c09905 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 @@ -303,7 +303,7 @@ public class MesReworkTaskServiceImpl implements IMesReworkTaskService { MesPartInspection mesPartInspection = null; if (!StringUtils.isEmpty(mesReworkTask.getId())){ DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesReworkTask.getOrganizeCode()); - DdlPreparedPack.getNumEqualPack(mesReworkTask.getPartInspectionId(), "id", packBean); + DdlPreparedPack.getNumEqualPack(mesReworkTask.getId(), "reworkTaskId", packBean); mesPartInspection = mesPartInspectionRepository.getByProperty(packBean); if (!Objects.isNull(mesPartInspection)){ if(!CollectionUtils.isEmpty(requestModel.getAssemblyModelList())){ 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 1e5c81e..5b6a4fa 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 @@ -712,6 +712,8 @@ public class MesNcProcessingService implements IMesNcProcessingService { String refundSource = configService.getCfgValue(org, "REFUND"); List personList = new ArrayList<>(); + + MesPartInspection mesPartInspection = model.getPartInspection(); for (MesNcPersonModel mesNcPersonModel : model.getPersonModelList()) { Integer type = mesNcPersonModel.getNcStatus(); @@ -727,7 +729,17 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } - partInspectionRepository.save(model.getPartInspection()); + //partInspectionRepository.save(model.getPartInspection()); + + MesPartInspectionPerson mesPartInspectionPerson = new MesPartInspectionPerson(); + mesPartInspectionPerson.setQty(Double.valueOf(mesNcPersonModel.getQty())); + mesPartInspectionPerson.setNcStatus(mesNcPersonModel.getNcStatus()); + mesPartInspectionPerson.setSn(model.getPartInspection().getSn()); + mesPartInspectionPerson.setOrganizeCode(model.getOrganizeCode()); + mesPartInspectionPerson.setPid(model.getPartInspection().getId()); + ConvertBean.serviceModelInitialize(mesPartInspectionPerson, model.getUserName()); + personList.add(mesPartInspectionPerson); + String target = configService.getCfgValue(org, "LGORT"); DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); @@ -757,6 +769,8 @@ public class MesNcProcessingService implements IMesNcProcessingService { mesPartInspectionPerson.setQty(Double.valueOf(mesNcPersonModel.getQty())); mesPartInspectionPerson.setNcStatus(mesNcPersonModel.getNcStatus()); mesPartInspectionPerson.setSn(model.getPartInspection().getSn()); + mesPartInspectionPerson.setOrganizeCode(model.getOrganizeCode()); + mesPartInspectionPerson.setPid(model.getPartInspection().getId()); DdlPackBean partyPackBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getStringEqualPack(mesNcPersonModel.getOnlyPerson(), "responsibleParty", partyPackBean); @@ -767,7 +781,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { personList.add(mesPartInspectionPerson); MesReworkTask reworkTask = new MesReworkTask(); - reworkTask.setQty(model.getPartInspection().getQty()); + reworkTask.setQty(mesNcPersonModel.getQty()); reworkTask.setSn(model.getPartInspection().getSn()); reworkTask.setReworkOrder(rework); reworkTask.setStatus(MesExtEnumUtil.REWORK_TASK_STATUS.CREATE.getValue()); @@ -808,7 +822,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { sourceValue = refundSource; model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } - partInspectionRepository.save(model.getPartInspection()); + //partInspectionRepository.save(model.getPartInspection()); MesMove move = createMove(model, sourceValue, mesNcPersonModel.getInventoryLocationCode(), org,workCenterCode, MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); ConvertBean.serviceModelInitialize(move, model.getUserName()); @@ -826,12 +840,14 @@ public class MesNcProcessingService implements IMesNcProcessingService { model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } - partInspectionRepository.save(model.getPartInspection()); + //partInspectionRepository.save(model.getPartInspection()); MesPartInspectionPerson mesPartInspectionPerson = new MesPartInspectionPerson(); mesPartInspectionPerson.setQty(Double.valueOf(mesNcPersonModel.getQty())); mesPartInspectionPerson.setNcStatus(mesNcPersonModel.getNcStatus()); mesPartInspectionPerson.setSn(model.getPartInspection().getSn()); + mesPartInspectionPerson.setOrganizeCode(model.getOrganizeCode()); + mesPartInspectionPerson.setPid(model.getPartInspection().getId()); DdlPackBean partyPackBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getStringEqualPack(mesNcPersonModel.getOnlyPerson(), "responsibleParty", partyPackBean); @@ -863,7 +879,19 @@ public class MesNcProcessingService implements IMesNcProcessingService { sourceValue = refundSource; model.getPartInspection().setRefundFlag(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue()); } - partInspectionRepository.save(model.getPartInspection()); + //partInspectionRepository.save(model.getPartInspection()); + + + MesPartInspectionPerson mesPartInspectionPerson = new MesPartInspectionPerson(); + mesPartInspectionPerson.setQty(Double.valueOf(mesNcPersonModel.getQty())); + mesPartInspectionPerson.setNcStatus(mesNcPersonModel.getNcStatus()); + mesPartInspectionPerson.setSn(model.getPartInspection().getSn()); + mesPartInspectionPerson.setOrganizeCode(model.getOrganizeCode()); + mesPartInspectionPerson.setPid(model.getPartInspection().getId()); + + ConvertBean.serviceModelInitialize(mesPartInspectionPerson, model.getUserName()); + personList.add(mesPartInspectionPerson); + String target = configService.getCfgValue(org, "LGORT"); DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(); @@ -880,6 +908,9 @@ public class MesNcProcessingService implements IMesNcProcessingService { } } + mesPartInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SUCCESS.getValue()); + ConvertBean.serviceModelUpdate(mesPartInspection, model.getUserName()); + partInspectionRepository.save(mesPartInspection); mesPartInspectionPersonRepository.saveAll(personList); } From 06cd72a3483c4338b874f0811f165ad30502088a Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Fri, 18 Apr 2025 17:21:10 +0800 Subject: [PATCH 04/11] =?UTF-8?q?45858=20MES=EF=BC=9A=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E5=8C=96=E6=A3=80=E9=AA=8C=E5=88=9D=E5=88=A4=E5=92=8C=E7=BB=88?= =?UTF-8?q?=E5=88=A4=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesInputDefectRecordService.java | 14 ++++++++++---- .../serviceimpl/busi/MesNcProcessingService.java | 8 +++++--- 2 files changed, 15 insertions(+), 7 deletions(-) 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 ba628c2..4119470 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 @@ -42,6 +42,7 @@ import org.springframework.util.StringUtils; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * @Description : @@ -136,7 +137,7 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService //获取NC-零件检测-单据 MesPartInspection partInspection = null; Integer sourceType; - if (!StringUtils.isEmpty(model.getSn())) { + if (!StringUtils.isEmpty(model.getSn()) && StringUtils.isEmpty(model.getLotNo())) { // 数据校验 ValidatorBean.checkNotNull(model.getFrontBack(), "正反面不能为空"); //检查条码 @@ -164,8 +165,11 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService if(!Objects.isNull(model.getId())){ partInspection = getPartInspectionByPartAndLot(model, model.getOrganizeCode()); } - - sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); + if (!StringUtils.isEmpty(model.getSn())) { + sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.IMPORT.getValue(); + } else { + sourceType = MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(); + } } //检查零件类型与图片对应关系 @@ -790,13 +794,15 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService * @return */ private MesPartInspection getPartInspectionByPartAndLot(MesPartInspectionInputModel inputModel, String org) { + + List list = Stream.of(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(),MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.IMPORT.getValue()).collect(Collectors.toList()); //根据扫描的条码查询条码是否存在 DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getNumEqualPack(inputModel.getId(), "id", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getPartNo(), "partNo", packBean); DdlPreparedPack.getStringEqualPack(inputModel.getLotNo(), "lotNo", packBean); DdlPreparedPack.getNegativeNumEqualPack(inputModel.getQty(), "qty", packBean); - DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.LOT.getValue(), "sourceType", packBean); + DdlPreparedPack.getInPackList(list, "sourceType", packBean); DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, packBean); MesPartInspection partInspection = partInspectionRepository.getByProperty(packBean); 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 5b6a4fa..064907f 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 @@ -789,7 +789,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { reworkTask.setPartName(model.getPartInspection().getPartName()); reworkTask.setPartInspectionId(model.getPartInspection().getId()); reworkTask.setOrganizeCode(org); - reworkTask.setResponsibleParty(model.getOnlyPerson()); + reworkTask.setResponsibleParty(mesNcPersonModel.getOnlyPerson()); reworkTask.setDisassembleType(MesPcnExtConstWords.ZERO); reworkTask.setLotNo(model.getPartInspection().getLotNo()); reworkTask.setType(model.getPartInspection().getSourceType()); @@ -830,7 +830,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { } else if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()) { //报废时设置责任人 - model.getPartInspection().setResponsibleParty(model.getOnlyPerson()); + model.getPartInspection().setResponsibleParty(mesNcPersonModel.getOnlyPerson()); //model.getPartInspection().setDefectTypeId(person.getId()); model.getPartInspection().setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.SCRAP.getValue()); model.getPartInspection().setRejectQty(model.getPartInspection().getQty()); @@ -852,7 +852,9 @@ public class MesNcProcessingService implements IMesNcProcessingService { DdlPackBean partyPackBean = DdlPackBean.getDdlPackBean(org); DdlPreparedPack.getStringEqualPack(mesNcPersonModel.getOnlyPerson(), "responsibleParty", partyPackBean); MesOrg mesOrg = mesOrgRDao.getByProperty(partyPackBean); - + if (mesOrg ==null) { + throw new ImppBusiException(String.format("责任人【%s】不存在", mesNcPersonModel.getOnlyPerson())); + } mesPartInspectionPerson.setResponsibleParty(mesOrg.getResponsibleParty()); ConvertBean.serviceModelInitialize(mesPartInspectionPerson, model.getUserName()); personList.add(mesPartInspectionPerson); From 529efb5ea0e4f6eaf8a09030007c4a2f80afb076 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Sat, 19 Apr 2025 13:42:07 +0800 Subject: [PATCH 05/11] =?UTF-8?q?45858=20MES=EF=BC=9A=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E5=8C=96=E6=A3=80=E9=AA=8C=E5=88=9D=E5=88=A4=E5=92=8C=E7=BB=88?= =?UTF-8?q?=E5=88=A4=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/busi/MesNcProcessingService.java | 35 +++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) 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 064907f..b219e37 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 @@ -751,7 +751,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { } //移库 转正常、放行:8000移至2000 - MesMove move = createMove(model, sourceValue, target, org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + MesMove move = createLotMove(model,mesNcPersonModel.getQty(), sourceValue, target, org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); ConvertBean.serviceModelInitialize(move, model.getUserName()); moveRepository.save(move); } @@ -824,7 +824,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { } //partInspectionRepository.save(model.getPartInspection()); - MesMove move = createMove(model, sourceValue, mesNcPersonModel.getInventoryLocationCode(), org,workCenterCode, MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); + MesMove move = createLotMove(model,mesNcPersonModel.getQty(), sourceValue, mesNcPersonModel.getInventoryLocationCode(), org,workCenterCode, MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); ConvertBean.serviceModelInitialize(move, model.getUserName()); moveRepository.save(move); @@ -864,7 +864,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { sourceValue = refundSource; } //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) - MesMove move = createMove(model, sourceValue, mesNcPersonModel.getInventoryLocationCode(), org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); + MesMove move = createLotMove(model,mesNcPersonModel.getQty(), sourceValue, mesNcPersonModel.getInventoryLocationCode(), org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.SCRAP_MOVE); ConvertBean.serviceModelInitialize(move,model.getUserName()); moveRepository.save(move); } else if (type == MesExtEnumUtil.PART_INSPECTION_NC_STATUS.RELEASE.getValue()) { @@ -904,7 +904,7 @@ public class MesNcProcessingService implements IMesNcProcessingService { target = version.getReceiveInventoryPoint(); } //移库 转正常、放行:8000移至2000 - MesMove move = createMove(model, sourceValue, target, org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); + MesMove move = createLotMove(model,mesNcPersonModel.getQty(), sourceValue, target, org, workCenterCode, MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); ConvertBean.serviceModelInitialize(move, model.getUserName()); moveRepository.save(move); @@ -1009,6 +1009,33 @@ public class MesNcProcessingService implements IMesNcProcessingService { return move; } + private MesMove createLotMove(MesNcProcessingInputModel model,double qty, String source, String target, String org, String workCenterCode, MesExtEnumUtil.MOVE_TYPE moveType) { + GenSerialNoModel serialNoModel = new GenSerialNoModel("INPUT_DEFECT_ZRSUM"); + serialNoModel.setPartNo(model.getPart().getPartNo()); + 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(model.getPart().getPartNo()); + move.setOrganizeCode(org); + move.setFactoryCode(org); + move.setLgort(source); + move.setUmlgo(target); + move.setMenge(qty); + 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; + } + 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); From bb33823140bb85101cfd7841fb01e28a86cf7617 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Tue, 22 Apr 2025 22:07:21 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E7=A4=BC=E5=98=89=E5=8F=91=E8=BF=90?= =?UTF-8?q?=E5=8D=95=20=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesLabelTemplateExtController.java | 32 ++++++++++++++++++++++ .../busi/MesPartShippingGroupService.java | 11 +++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java index ebd3a24..4f0eeff 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/controller/busi/MesLabelTemplateExtController.java @@ -4,6 +4,7 @@ import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesTemplateService; import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant; import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords; import cn.estsh.i3plus.mes.pcn.api.iservice.base.IConfigService; +import cn.estsh.i3plus.pojo.mes.bean.MesConfig; import cn.estsh.impp.framework.boot.exception.ImppBusiException; import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder; import cn.estsh.impp.framework.boot.util.ResultBean; @@ -11,12 +12,16 @@ import cn.estsh.impp.framework.boot.util.ValidatorBean; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.Arrays; +import java.util.List; import java.util.Map; +import java.util.Optional; @Api("获取系统配置的模版信息") @RestController @@ -54,4 +59,31 @@ public class MesLabelTemplateExtController { } } + @GetMapping("/label-template/by-module-or-template/get-custom") + @ApiOperation(value = "获取系统配置的模版信息") + public ResultBean queryModuleCodeCfg(String organizeCode, String moduleCode, String chooseCodes, String templateCode) { + try { + ValidatorBean.checkNotNull(organizeCode, "工厂代码不能为空"); + if (StringUtils.isEmpty(moduleCode) && StringUtils.isEmpty(templateCode)) { + ValidatorBean.checkNotNull(moduleCode, "模版配置代码不能为空"); + } + + if (StringUtils.isEmpty(chooseCodes)) return queryMesLabelTemplate(organizeCode, moduleCode, templateCode); + + List chooseCodeList = Arrays.asList(chooseCodes.split(MesPcnExtConstWords.COMMA)); + + List configList = configService.getMesConfigListByCfgCodeKey(moduleCode, MesPcnExtConstWords.CUSTOM_CFG, organizeCode); + Optional optional = CollectionUtils.isEmpty(configList) ? null : + configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValue()) + && !StringUtils.isEmpty(o.getCfgType()) && chooseCodeList.contains(o.getCfgType()))).findFirst(); + + return queryMesLabelTemplate(organizeCode, (null == optional || !optional.isPresent()) ? moduleCode : optional.get().getCfgValue(), templateCode); + + } catch (ImppBusiException imppException) { + return ResultBean.fail(imppException); + } catch (Exception e) { + return ImppExceptionBuilder.newInstance().buildExceptionResult(e); + } + } + } diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java index 6b69b21..94b0094 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/busi/MesPartShippingGroupService.java @@ -28,8 +28,10 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; +import java.util.Arrays; import java.util.List; import java.util.Objects; +import java.util.Optional; @Service @Slf4j @@ -71,7 +73,14 @@ public class MesPartShippingGroupService implements IMesPartShippingGroupService @Override public ResultBean doMesMesShippingOrderManagementPrint(MesShippingOrderManagement bean) { - MesConfig config = configService.getMesConfigByCfgCode(MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE, bean.getOrganizeCode()); + List chooseCodeList = Arrays.asList(bean.getShippingGroupCode().split(MesPcnExtConstWords.COMMA)); + List configList = configService.getMesConfigListByCfgCodeKey(MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE, MesPcnExtConstWords.CUSTOM_CFG, bean.getOrganizeCode()); + Optional optional = CollectionUtils.isEmpty(configList) ? null : + configList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValue()) + && !StringUtils.isEmpty(o.getCfgType()) && chooseCodeList.contains(o.getCfgType()))).findFirst(); + + String templeteCodeCfg = (null == optional || !optional.isPresent()) ? MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE : optional.get().getCfgValue(); + MesConfig config = configService.getMesConfigByCfgCodeKeyOrg(templeteCodeCfg, MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE, bean.getOrganizeCode()); if (null == config || StringUtils.isEmpty(config.getCfgValue())) MesPcnException.throwBusiException("未配置排序发运全局打印配置[%s]", MesPcnExtConstWords.SORT_SHIPPING_PRINT_TEMPLATE); MesLabelTemplate labelTemplate = templateService.getMesLabelTemplate(config.getCfgValue(), bean.getOrganizeCode()); From 7abfa524fd23066918a2a3ffefc8d0fbb3b322ff Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Tue, 22 Apr 2025 22:07:36 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E7=A4=BC=E5=98=89=E5=8F=91=E8=BF=90?= =?UTF-8?q?=E5=8D=95=20=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/estsh/i3plus/ext/mes/pcn/pojo/util/MesPcnExtConstWords.java | 2 ++ 1 file changed, 2 insertions(+) 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 fc0d89a..4d0cb4c 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 @@ -925,6 +925,8 @@ public class MesPcnExtConstWords { public static final String SORT_SHIPPING_PRINT_TEMPLATE = "SORT_SHIPPING_PRINT_TEMPLATE"; //由前端直接渲染模版的标志 public static final String TEMPLATE_CUSTOM_HTML = "TEMPLATE_CUSTOM_HTML"; + //客制化配置 + public static final String CUSTOM_CFG = "CUSTOM_CFG"; //生产过程控制非排序打印机配置【物料级别=1, 默认打印机=2】 public static final String PRODUCTION_CONTROL_NOSORT_PRINTER_CFG = "PRODUCTION_CONTROL_NOSORT_PRINTER_CFG"; From 12cc0a015c2bc65e9a15b53d62dd88604cdae181 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 23 Apr 2025 19:11:01 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E8=8A=9C=E6=B9=96=20=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=8F=AF=E7=96=91=20=E7=B3=BB=E7=BB=9F=E5=BC=82=E5=B8=B8=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/step/MesProductResultErrorHandleStepService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java index c6464d1..f74cee0 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java @@ -115,7 +115,8 @@ public class MesProductResultErrorHandleStepService extends BaseStepService { String defectTypeCode = MesEnumUtil.DEFECT_TYPE_CODE.DETERMIND.getValue(); productionPsOutContextList.forEach(mesProduceSn -> { String productVersion = null; - List mesProductionPartContextList = productionPartContextList.stream().filter(mesProductionPartContext -> Objects.equal(mesProduceSn.getForeignKey(),mesProductionPartContext.getForeignKey())).collect(Collectors.toList()); + List mesProductionPartContextList = CollectionUtils.isEmpty(productionPartContextList) ? null : + productionPartContextList.stream().filter(mesProductionPartContext -> Objects.equal(mesProduceSn.getForeignKey(),mesProductionPartContext.getForeignKey())).collect(Collectors.toList()); if (!CollectionUtils.isEmpty(mesProductionPartContextList)) { productVersion = mesProductionPartContextList.get(0).getProductVersion(); } From d0505ffd72a75b408a2453af715f33e0b874e653 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 23 Apr 2025 19:21:11 +0800 Subject: [PATCH 09/11] =?UTF-8?q?=E8=8A=9C=E6=B9=96=20=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=8F=AF=E7=96=91=20=E7=B3=BB=E7=BB=9F=E5=BC=82=E5=B8=B8=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pcn/apiservice/serviceimpl/busi/MesInputDefectRecordService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ba628c2..31909a3 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 @@ -1235,7 +1235,8 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService partInspection.setNcStatus(MesExtEnumUtil.PART_INSPECTION_NC_STATUS.CREATE.getValue()); partInspection.setOrganizeCode(org); - String defectTypeCodeStr = configService.getCfgValue(org, "MES_SUSPICIOUS_DEFECT_TYPE_CODE") == null ? "QX130" :configService.getCfgValue(org, "MES_SUSPICIOUS_DEFECT_TYPE_CODE"); + MesConfig mesConfig = configService.getMesConfigNoError(org, "MES_SUSPICIOUS_DEFECT_TYPE_CODE"); + String defectTypeCodeStr = (null != mesConfig && !StringUtils.isEmpty(mesConfig.getCfgValue())) ? mesConfig.getCfgValue() : "QX130"; //根据页面上选择的位置 查询位置,若不存在则提示 位置不存在,请检查数据 DdlPackBean packBean = DdlPackBean.getDdlPackBean(org); From 5dec26fcef043791c0ad8b4c1061969576ac9b59 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Wed, 23 Apr 2025 21:14:57 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E8=8A=9C=E6=B9=96=20=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=8F=AF=E7=96=91=20=E7=B3=BB=E7=BB=9F=E5=BC=82=E5=B8=B8=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serviceimpl/step/MesProductResultErrorHandleStepService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java index f74cee0..e680124 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/step/MesProductResultErrorHandleStepService.java @@ -187,7 +187,7 @@ public class MesProductResultErrorHandleStepService extends BaseStepService { inspectModel.setShiftCode(mesProduceSn.getShiftCode()); inspectModel.setProductVersion(productVersion); inspectModel.setUserInfo(reqBean.getUserInfo()); - + inspectModel.setSourceType(MesExtEnumUtil.PART_INSPECTION_SOURCE_TYPE.SINGLE.getValue()); inputDefectRecordService.saveSusPartInspection(inspectModel, reqBean.getOrganizeCode()); } }); From c80472d2e2ae3430406138b3d772e25f612436b9 Mon Sep 17 00:00:00 2001 From: "jhforever.wang@estsh.com" Date: Thu, 24 Apr 2025 10:58:55 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E7=A4=BC=E5=98=89=20=E7=A6=8F=E7=89=B9?= =?UTF-8?q?=E5=B0=8F=E4=BB=B6=E5=8F=91=E8=BF=90=20=E7=AC=AC=E4=BA=8C?= =?UTF-8?q?=E4=B8=AAtable=E7=A9=BA=E7=9A=84=E5=BC=82=E5=B8=B8=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../strategy/CqLjSortShippingPrintStrategyService.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/CqLjSortShippingPrintStrategyService.java b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/CqLjSortShippingPrintStrategyService.java index 74a7b66..675ce42 100644 --- a/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/CqLjSortShippingPrintStrategyService.java +++ b/modules/i3plus-ext-mes-pcn-apiservice/src/main/java/cn/estsh/i3plus/ext/mes/pcn/apiservice/serviceimpl/print/sortshipping/strategy/CqLjSortShippingPrintStrategyService.java @@ -65,6 +65,7 @@ public class CqLjSortShippingPrintStrategyService extends SortShippingDispatchSt //遍历处理每个发运单主表 for (MesShippingOrderManagement shippingOrderManagement : shippingOrderManagementList) { + log.info("工厂{}排序发运打印 --- 遍历 发运单:{} --- {}", bean.getOrganizeCode(), shippingOrderManagement.getShippingCode(), Thread.currentThread().getName()); //一张实体发运单包含三部分信息(顶部的通用数据、中部的第一份表格数据,底部的第二份表格数据) //取出当前发运单的明细信息 List details = null == detailByPidMap ? null : detailByPidMap.get(shippingOrderManagement.getId()); @@ -82,6 +83,7 @@ public class CqLjSortShippingPrintStrategyService extends SortShippingDispatchSt detailList.stream().min(Comparator.comparing(MesShippingOrderManagementDetail::getLogicSeq)); min.ifPresent(mesShippingOrderManagementDetail -> logicSeqAndAssyCodeMap.put(mesShippingOrderManagementDetail.getLogicSeq(), assyCode)); } + log.info("工厂{}排序发运打印 --- 遍历 发运单:{} --- assyCodeList:{} --- logicSeqAndAssyCodeMap:{} --- {}", bean.getOrganizeCode(), shippingOrderManagement.getShippingCode(), assyCodeList.toString(), JSONObject.toJSONString(logicSeqAndAssyCodeMap), Thread.currentThread().getName()); List collect = logicSeqAndAssyCodeMap.keySet().stream().sorted().collect(Collectors.toList()); List newAssyCodeList = new ArrayList<>(); for (Long logicSeq : collect) { @@ -92,10 +94,13 @@ public class CqLjSortShippingPrintStrategyService extends SortShippingDispatchSt .filter(i -> i % 2 == 0) .mapToObj(i -> newAssyCodeList.subList(i, Math.min(i + 2, newAssyCodeList.size()))) .collect(Collectors.toList()); - for (List list : physicalOrderList) { - //生成一张实体发运单 - log.info("工厂{}排序发运打印 --- 生成一张实体发运单:{} --- {}", bean.getOrganizeCode(), list.toString(), Thread.currentThread().getName()); - mainDataList.add(createPhysicalOrder(shippingOrderManagement, list, detailByAssyCodeMap, details)); + if (!CollectionUtils.isEmpty(physicalOrderList)) { + log.info("工厂{}排序发运打印 --- 遍历 发运单:{} --- physicalOrderList:{} --- {}", bean.getOrganizeCode(), shippingOrderManagement.getShippingCode(), JSONObject.toJSONString(physicalOrderList), Thread.currentThread().getName()); + for (List list : physicalOrderList) { + //生成一张实体发运单 + log.info("工厂{}排序发运打印 --- 生成一张实体发运单:{} --- {}", bean.getOrganizeCode(), list.toString(), Thread.currentThread().getName()); + mainDataList.add(createPhysicalOrder(shippingOrderManagement, list, detailByAssyCodeMap, details)); + } } } shippingOrderManagement.setPrintCount(StringUtil.isEmpty(shippingOrderManagement.getPrintCount())? 1 : shippingOrderManagement.getPrintCount()+1); @@ -123,7 +128,8 @@ public class CqLjSortShippingPrintStrategyService extends SortShippingDispatchSt //中部表结构赋值 model.setDetailModelsOne(createDetailList(assyCodeList.get(0), detailByAssyCodeMap, details, shippingOrderManagement.getRackNo())); //底部表结构赋值 - model.setDetailModelsTwo(createDetailList(assyCodeList.get(1), detailByAssyCodeMap, details, shippingOrderManagement.getRackNo())); + if (assyCodeList.size() > 1) model.setDetailModelsTwo(createDetailList(assyCodeList.get(1), detailByAssyCodeMap, details, shippingOrderManagement.getRackNo())); + else model.setDetailModelsTwo(new ArrayList<>()); log.info("工厂{}排序发运打印 --- MesShippingOrderManagementModelForLiJia:{} --- {}", shippingOrderManagement.getOrganizeCode(), JSONObject.toJSONString(model), Thread.currentThread().getName()); return model; }