From 214cfc40f7d1d072a6a4fbf0a5858a57ea998828 Mon Sep 17 00:00:00 2001 From: lihao Date: Tue, 28 Oct 2025 16:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E9=AB=98=E5=8E=8Bmes=E4=BC=98=E5=8C=96=E5=8F=96?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AfterApproveSyncHighpressureMesRule.java | 73 ++++++++++--------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncHighpressureMesRule.java b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncHighpressureMesRule.java index d3930d42..8e150bc4 100644 --- a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncHighpressureMesRule.java +++ b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncHighpressureMesRule.java @@ -135,12 +135,30 @@ public class AfterApproveSyncHighpressureMesRule implements IRule { // 日期信息 itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期 // 上级-上一个生产订单的信息 - itemObj.put("bipParentProcessProductionOrderId", null); - itemObj.put("bipParentProcessProductionOrderRowNum", null); - String vsrccode = findPrevOrder(cpmohid, vbillcode); - if (vsrccode != null && !vsrccode.isEmpty()) { - itemObj.put("bipParentProcessProductionOrderId", vsrccode);// 上一个生产订单单号 + + if( null !=item.getVparentbillcode()){ + itemObj.put("bipParentProcessProductionOrderId", item.getVparentbillcode()); + itemObj.put("bipParentProcessProductionOrderRowNum", item.getVparentmorowno()); + }else{ + if (item.getVsrcid() == null) { + itemObj.put("bipParentProcessProductionOrderId", null); + itemObj.put("bipParentProcessProductionOrderRowNum", null); + // itemObj.put("bipParentProcessProductionOrderId", vsrccode);// 上一个生产订单单号 + }else{ + Map vsrccode = findPrevOrder(item.getVsrcid(),item.getVsrctype()); + if(null != vsrccode){ + itemObj.put("bipParentProcessProductionOrderId", vsrccode.get("code")); + itemObj.put("bipParentProcessProductionOrderRowNum", vsrccode.get("rowno")); + }else{ + itemObj.put("bipParentProcessProductionOrderId", null); + itemObj.put("bipParentProcessProductionOrderRowNum", null); + } + + } + } + + // 顶级-源头单据信息 itemObj.put("bipOriginProcessProductionOrderId", item.getVfirstcode()); itemObj.put("bipOriginProcessProductionOrderRowNum", item.getVfirstrowno()); @@ -222,38 +240,25 @@ public class AfterApproveSyncHighpressureMesRule implements IRule { /** * 查询上一个生产订单的信息 * - * @param hid 当前生产订单的ID - * @param vbillcode 当前生产订单的单号 + * @param srcid 来源单据子表 + * @param vsrctrantype 来源单据类型 */ - private String findPrevOrder(String hid, String vbillcode) throws BusinessException { - String preCode = null; - BillFlowModel billFlow = new BillFlowModel(); - LightBillVO vo = billFlow.querySourceBillVO(hid, MMBillType.ProduceOrder.getCode(), LinkQueryType.OnlyQueryBill); - if (vo == null) { + private Map findPrevOrder(String srcid,String vsrctrantype) throws BusinessException { + // 查询计划订单 + Map plo=new HashMap<>(); + while(vsrctrantype.equals("55B4") ) { + String ploSql="SELECT vsrctype,vsrcid,VSRCBID FROM mm_plo WHERE cpoid='"+srcid+"'\n"; + plo = (Map) baseDAO.executeQuery(ploSql, new MapProcessor()); + vsrctrantype = plo.get("vsrctype").toString(); + srcid = plo.get("vsrcid").toString(); + } + if(vsrctrantype.equals("55A3")){ + String ploSql="SELECT vsourcemoid,vsourcemorowcode as rowno,vsourcemocode as code FROM mm_pickm WHERE cpickmid='"+srcid+"'\n"; + plo = (Map) baseDAO.executeQuery(ploSql, new MapProcessor()); + return plo; + }else{ return null; } - LightBillVO[] sourceBillVOs = vo.getSourceBillVOs(); - if (sourceBillVOs == null || sourceBillVOs.length == 0) { - return null; - } - List list = this.dealVO(vo); - if (list == null || list.isEmpty()) { - return null; - } - for (BillFlowVO billFlowVO : list) { - // 判断是否为来源单据 -1来源单据 0本单据 1下游单据 - if ("-1".equals(billFlowVO.getIsForward())) { - LightBillVO lightBillVO = billFlowVO.getLightBillVO(); - String billType = lightBillVO.getType(); - String billCode = lightBillVO.getCode(); - // 不断向下寻找流程生产订单,直到找到最后一个流程生产订单 - if ("55A2".equals(billType) && !billCode.equals(vbillcode)) { - preCode = billCode; - } - } - } - NCCForUAPLogger.debug("preCode = " + preCode); - return preCode; }