From 6e290c1f423adf3823c109cc76f0c8f05d767e89 Mon Sep 17 00:00:00 2001 From: "xiangwei.zhang" <752558143@qq.com> Date: Mon, 10 Feb 2025 16:39:45 +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 | 61 ++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 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 49c20e6..69497d7 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 @@ -1246,9 +1246,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 (headModel) { + //移库 + if (StringUtils.isEmpty(source)) MesPcnException.throwBusiException("未找到来源库位!"); + MesMove move = createMove(model, source, target, org, model.getWorkCenterCode()); + moveRepository.save(move); + } } @ApiOperation(value = "客退品查询")