生产订单推送高压mes优化取值

This commit is contained in:
lihao 2025-10-28 16:14:21 +08:00
parent 9d13298270
commit 214cfc40f7
1 changed files with 39 additions and 34 deletions

View File

@ -135,12 +135,30 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
// 日期信息 // 日期信息
itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期 itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期
// 上级-上一个生产订单的信息 // 上级-上一个生产订单的信息
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<String,Object> 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("bipParentProcessProductionOrderId", null);
itemObj.put("bipParentProcessProductionOrderRowNum", null); itemObj.put("bipParentProcessProductionOrderRowNum", null);
String vsrccode = findPrevOrder(cpmohid, vbillcode);
if (vsrccode != null && !vsrccode.isEmpty()) {
itemObj.put("bipParentProcessProductionOrderId", vsrccode);// 上一个生产订单单号
} }
}
}
// 顶级-源头单据信息 // 顶级-源头单据信息
itemObj.put("bipOriginProcessProductionOrderId", item.getVfirstcode()); itemObj.put("bipOriginProcessProductionOrderId", item.getVfirstcode());
itemObj.put("bipOriginProcessProductionOrderRowNum", item.getVfirstrowno()); itemObj.put("bipOriginProcessProductionOrderRowNum", item.getVfirstrowno());
@ -222,38 +240,25 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
/** /**
* 查询上一个生产订单的信息 * 查询上一个生产订单的信息
* *
* @param hid 当前生产订单的ID * @param srcid 来源单据子表
* @param vbillcode 当前生产订单的单号 * @param vsrctrantype 来源单据类型
*/ */
private String findPrevOrder(String hid, String vbillcode) throws BusinessException { private Map<String,Object> findPrevOrder(String srcid,String vsrctrantype) throws BusinessException {
String preCode = null; // 查询计划订单
BillFlowModel billFlow = new BillFlowModel(); Map<String,Object> plo=new HashMap<>();
LightBillVO vo = billFlow.querySourceBillVO(hid, MMBillType.ProduceOrder.getCode(), LinkQueryType.OnlyQueryBill); while(vsrctrantype.equals("55B4") ) {
if (vo == null) { String ploSql="SELECT vsrctype,vsrcid,VSRCBID FROM mm_plo WHERE cpoid='"+srcid+"'\n";
plo = (Map<String, Object>) 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<String, Object>) baseDAO.executeQuery(ploSql, new MapProcessor());
return plo;
}else{
return null; return null;
} }
LightBillVO[] sourceBillVOs = vo.getSourceBillVOs();
if (sourceBillVOs == null || sourceBillVOs.length == 0) {
return null;
}
List<BillFlowVO> 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;
} }