From a5cebd3818b043b270ea85a3da6b968cc0168fca Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Mon, 10 Feb 2025 18:51:08 +0800 Subject: [PATCH] =?UTF-8?q?44424=20PCN=EF=BC=9A=E5=B7=A5=E5=8D=95=E5=88=A4?= =?UTF-8?q?=E5=8F=AF=E7=96=91=E7=9A=84=E7=A0=81=EF=BC=8C=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E6=A3=80=E9=AA=8C=E9=80=9A=E8=BF=87=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8=E6=89=AB=E6=8F=8F=E8=A3=85=E9=85=8D=E4=BB=B6?= =?UTF-8?q?=E5=B7=A5=E6=AD=A5=E6=97=B6=E6=89=AB=E6=8F=8F=E5=88=A4=E5=8F=AF?= =?UTF-8?q?=E7=96=91=E7=A0=81=EF=BC=8C=E5=B7=A5=E5=8D=95=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E4=B8=BA=E5=8F=AF=E7=96=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../busi/MesInputDefectRecordService.java | 28 ++++++++++++++++++++-- .../serviceimpl/busi/MesNcProcessingService.java | 27 +++++++++++++++++---- 2 files changed, 48 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 69497d7..52b86e6 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 @@ -500,7 +500,18 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, reworkPackBean); int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); if (count > 0) { - throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); + // 如果是批次还需要移库 + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + String srcNo = configService.getCfgValue(org, "LGORT"); + if (version != null) { + srcNo = version.getReceiveInventoryPoint(); + } + String destLocateNo = getDestLocateNo(model, org); + if(headModel && !Objects.equals(srcNo, destLocateNo)) { + throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); + } } checkProduceSn(produceSn, model.getSn()); @@ -623,7 +634,20 @@ public class MesInputDefectRecordService implements IMesInputDefectRecordService DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"createDatetime"}, reworkPackBean); int count = reworkTaskRepository.findByHqlWhereCount(reworkPackBean); if (count > 0) { - throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); + // 如果是批次还需要移库 + DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(org); + DdlPreparedPack.getStringEqualPack(model.getPartNo(), "partNo", ddlPackBean); + MesProductVersion version = productVersionRepository.getByProperty(ddlPackBean); + String srcNo = configService.getCfgValue(org, "LGORT"); + if (version != null) { + srcNo = version.getReceiveInventoryPoint(); + } + if (headModel ) { + String destLocateNo = getDestLocateNo(model, org); + if (!Objects.equals(srcNo, destLocateNo)) { + throw new ImppBusiException(String.format("【%s】该条码需要完成质检,再重新录入电子化检验", model.getSn())); + } + } } checkProduceSn(produceSn, model.getSn()); 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 60e8156..f8529ec 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 @@ -466,12 +466,15 @@ public class MesNcProcessingService implements IMesNcProcessingService { 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()); - moveRepository.save(move); + moveList.add(move); } + moveRepository.saveAll(moveList); + } else if (headModel) { //移库 转正常、放行:8000移至2000 MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE); @@ -536,11 +539,13 @@ public class MesNcProcessingService implements IMesNcProcessingService { if (!headModel) { if (!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()); - moveRepository.save(move); + moveList.add(move); } + moveRepository.saveAll(moveList); } } else { MesMove move = createMove(model, sourceValue, areaCode, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.RETURN_MOVE); @@ -591,11 +596,15 @@ public class MesNcProcessingService implements IMesNcProcessingService { if (!headModel) { if (!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()); - moveRepository.save(move); + 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); @@ -610,12 +619,16 @@ public class MesNcProcessingService implements IMesNcProcessingService { } 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()); - moveRepository.save(move); + moveList.add(move); } + moveRepository.saveAll(moveList); + } } else { //移库 转报废 根据责任方库区对应关系的主数据,选择哪个责任方,就移动到哪个库区(8000移至8002/8003) @@ -670,12 +683,16 @@ public class MesNcProcessingService implements IMesNcProcessingService { } 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()); - moveRepository.save(move); + moveList.add(move); } + moveRepository.saveAll(moveList); + } else if (headModel) { //移库 转正常、放行:8000移至2000 MesMove move = createMove(model, sourceValue, target, org, null == sn ? workCenterCode : sn.getWorkCenterCode(), MesExtEnumUtil.MOVE_TYPE.NORMAL_MOVE);