流程生产订单修改RZ系统的错误字段映射,修改MES系统的错误字段映射
This commit is contained in:
		
							parent
							
								
									1f3d4f0bfd
								
							
						
					
					
						commit
						069da120aa
					
				|  | @ -51,7 +51,7 @@ public class SignBP implements ISignBP<SaleOutVO>, ISignRuleProvider<SaleOutVO> | |||
|         processor.addAfterRule(new SaleOutProceedsRuleCG()); | ||||
|         processor.addAfterRule(new MobAfterSignMessageRule()); | ||||
|         // 销售出库 签字后 同步到MES金思维系统 | ||||
|         processor.addAfterRule(new AfterSigningSynchronizeRule()); | ||||
|         processor.addAfterRule(new AfterSigningSynchronizeRuleMES()); | ||||
|         // 盘点(审批后传MES) | ||||
| 
 | ||||
|         // 销售出库 签字后 同步到锐制 | ||||
|  |  | |||
|  | @ -3,14 +3,24 @@ package nc.bs.ic.m4c.sign.rule; | |||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.yonyou.cloud.utils.StringUtils; | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.logging.Log; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.vo.bd.cust.CustomerVO; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.material.measdoc.MeasdocVO; | ||||
| import nc.vo.bd.psn.PsndocVO; | ||||
| import nc.vo.bd.rack.RackVO; | ||||
| import nc.vo.bd.supplier.SupplierVO; | ||||
| import nc.vo.ic.m4c.entity.SaleOutBodyVO; | ||||
| import nc.vo.ic.m4c.entity.SaleOutHeadVO; | ||||
| import nc.vo.ic.m4c.entity.SaleOutVO; | ||||
| import nc.vo.org.DeptVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDate; | ||||
| import nc.vo.pubapp.pattern.pub.SqlBuilder; | ||||
| import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; | ||||
| 
 | ||||
| import java.text.SimpleDateFormat; | ||||
|  | @ -19,13 +29,14 @@ import java.text.SimpleDateFormat; | |||
| /** | ||||
|  * 销售出库(签字后传MES金思维系统) | ||||
|  */ | ||||
| public class AfterSigningSynchronizeRule implements IRule<SaleOutVO> { | ||||
| public class AfterSigningSynchronizeRuleMES implements IRule<SaleOutVO> { | ||||
|     private static final String SALE_OUT_URL = "/GTHINKING/AjaxService/N_MISPRO/SaleOrderOutbound.ashx/SaveData"; // 销售出库登记接口 | ||||
|     private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||||
|     private static final String logginfo = "OALOG"; | ||||
|     private static final Log obmlog = Log.getInstance(logginfo); | ||||
|     private static BaseDAO dao = new BaseDAO(); | ||||
| 
 | ||||
|     public AfterSigningSynchronizeRule() { | ||||
|     public AfterSigningSynchronizeRuleMES() { | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -59,7 +70,7 @@ public class AfterSigningSynchronizeRule implements IRule<SaleOutVO> { | |||
|      * 构建符合金思维系统接口规范的请求数据 | ||||
|      * 按照NCC/YonBIP字段映射到金思维系统字段 | ||||
|      */ | ||||
|     private JSONObject buildSyncData(SaleOutHeadVO hvo, SaleOutBodyVO[] bvos) { | ||||
|     private JSONObject buildSyncData(SaleOutHeadVO hvo, SaleOutBodyVO[] bvos) throws BusinessException { | ||||
|         obmlog.debug("AfterSigningSynchronizeRule-开始处理销售出库单: " + hvo.getVbillcode()); | ||||
|         if (!hvo.getPk_org().equals("0001A110000000000677")) { | ||||
|             obmlog.debug("AfterSigningSynchronizeRule-跳过处理销售出库单,因为此单据组织非电缆: " + hvo.getVbillcode()); | ||||
|  | @ -73,43 +84,33 @@ public class AfterSigningSynchronizeRule implements IRule<SaleOutVO> { | |||
|         info.put("orderNo", hvo.getVbillcode());                   // 提货单ID - 单据号(vbillcode) | ||||
|         // 日期格式转换 | ||||
|         UFDate dbilldate = hvo.getDbilldate(); | ||||
|         String billDateStr = dateTimeFormat.format(dbilldate.toDate()); | ||||
|         info.put("orderDate", billDateStr);                        // 提单日期 - 单据日期(dbilldate) | ||||
|         info.put("planDate", billDateStr);                         // 计划日期 - 使用同样的单据日期 | ||||
|         info.put("actureDate", billDateStr); | ||||
|         // 生成方式可能存储在自定义字段中 | ||||
|         String genType = getStringValue(hvo.getVdef1()); | ||||
|         info.put("genType", null);    // 生成方式 - 默认N | ||||
|         info.put("type", "XSCK");                                  // 默认事务类型XSCK | ||||
|         info.put("departmentId", hvo.getCdptvid());                // 部门ID - 部门(cdptvid) | ||||
|         info.put("storeId", hvo.getCwarehouseid());                // 仓库ID - 仓库(cwarehouseid) | ||||
|         // 汇率默认为1 | ||||
|         info.put("orderDate", dbilldate.toString());                        // 提单日期 - 单据日期(dbilldate) | ||||
|         info.put("planDate", dbilldate.toString());                         // 计划日期 - 使用同样的单据日期 | ||||
|         info.put("actureDate", dbilldate.toString()); | ||||
|         info.put("genType", null); | ||||
|         info.put("type", "XSCK"); | ||||
|         // 部门ID - 部门(cdptvid) | ||||
|         info.put("departmentId", transferCodeByPk(DeptVO.getDefaultTableName(), DeptVO.CODE, DeptVO.PK_DEPT, hvo.getCdptvid())); | ||||
|         // 仓库ID - 仓库(cwarehouseid) | ||||
|         info.put("storeId", transferCodeByPk(RackVO.getDefaultTableName(), RackVO.CODE, RackVO.PK_RACK, hvo.getCwarehouseid())); | ||||
|         // TODO | ||||
|         info.put("exRate", null); | ||||
|         info.put("sType", "N");                                    // 发出默认值 | ||||
|         info.put("billing", "Y");                                  // 出具发票默认值 | ||||
|         info.put("billingBasis", "S");                             // 开票依据默认值 | ||||
| 
 | ||||
|         // 有效日期可能为空,可能存储在其他字段或自定义字段中 | ||||
|         String effDateStr = getStringValue(hvo.getVdef2()); | ||||
|         if (StringUtils.isNotEmpty(effDateStr)) { | ||||
|             try { | ||||
|                 UFDate effDate = new UFDate(effDateStr); | ||||
|                 info.put("effDate", dateTimeFormat.format(effDate.toDate())); | ||||
|             } catch (Exception e) { | ||||
|                 obmlog.error("解析有效日期出错: " + e.getMessage()); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         info.put("effDate", null); | ||||
|         info.put("consignStoreId", null);          // 寄售仓库ID | ||||
|         info.put("consignType", null);             // 寄售事务类型 | ||||
|         info.put("operatorNo", null);                          // 经办人工号 - 制单人(billmaker) | ||||
|         info.put("operatorName", null);            // 经办人 - 可能是自定义字段 | ||||
|         info.put("storeKeeper", hvo.getCwhsmanagerid());                     // 保管员 - 库管员(cwhsmanagerid) | ||||
|         info.put("cwhsmanagerid", hvo.getCwhsmanagerid());                   // 保管员ID - 库管员(cwhsmanagerid) | ||||
|         info.put("customId", hvo.getCcustomerid());                          // 客户ID - 订单客户(ccustomerid) | ||||
|         info.put("operatorName", null);            // 经办人 | ||||
|         // 保管员 - 库管员(cwhsmanagerid) | ||||
|         info.put("storeKeeper", transferCodeByPk(PsndocVO.getDefaultTableName(), PsndocVO.CODE, PsndocVO.PK_PSNDOC, hvo.getCwhsmanagerid())); | ||||
|         // 保管员ID - 库管员(cwhsmanagerid) | ||||
|         info.put("cwhsmanagerid", transferCodeByPk(PsndocVO.getDefaultTableName(), PsndocVO.CODE, PsndocVO.PK_PSNDOC, hvo.getCwhsmanagerid())); | ||||
|         // 客户ID - 订单客户(ccustomerid) | ||||
|         info.put("customId", transferCodeByPk(CustomerVO.getDefaultTableName(), CustomerVO.CODE, CustomerVO.PK_CUSTOMER, hvo.getCcustomerid())); | ||||
|         info.put("mark", "Y");                                               // 生成标志默认值 | ||||
|         info.put("remark", hvo.getVnote());                                  // 备注 - 备注(vnote) | ||||
| 
 | ||||
|         // 构建details明细数组 | ||||
|         JSONArray details = new JSONArray(); | ||||
|         if (bvos != null) { | ||||
|  | @ -117,32 +118,32 @@ public class AfterSigningSynchronizeRule implements IRule<SaleOutVO> { | |||
|                 JSONObject detail = new JSONObject(); | ||||
|                 detail.put("orderNo", hvo.getVbillcode());                     // 提货单ID - 单据号(vbillcode) | ||||
|                 detail.put("sequenceNum", bvo.getCrowno()); | ||||
| 
 | ||||
|                 // 来源单据信息 - 根据字典正确映射 | ||||
|                 detail.put("saleOrderNo", null);   // SOID - 来源单据号(vsourcebillcode) | ||||
|                 detail.put("saleSequenceNum", null);   // SO序号 - 来源单据行号(vsourcerowno) | ||||
|                 detail.put("allocationNum", null); // 分配号 | ||||
| 
 | ||||
|                 // 物料相关 - 使用正确的字段名 | ||||
|                 detail.put("materialId", bvo.getCmaterialoid());               // 物料ID - 物料(cmaterialoid) | ||||
|                 detail.put("unit", bvo.getCunitid());                          // 计量单位 - 主单位(cunitid) | ||||
|                 detail.put("productNum", null);                          // 制令号 - 可能是自定义字段 | ||||
| 
 | ||||
|                 detail.put("storageId", bvo.getClocationid());                 // 库位 - 货位(clocationid) | ||||
|                 detail.put("batchNum", bvo.getVbatchcode());                   // 物料批号 - 批次号(vbatchcode) | ||||
|                 // 物料ID - 物料(cmaterialoid) | ||||
|                 detail.put("materialId", transferCodeByPk(MaterialVO.getDefaultTableName(), MaterialVO.CODE, MaterialVO.PK_MATERIAL, bvo.getCmaterialoid())); | ||||
|                 // 计量单位 - 主单位(cunitid) | ||||
|                 detail.put("unit", transferCodeByPk(MeasdocVO.getDefaultTableName(), MeasdocVO.CODE, MeasdocVO.PK_MEASDOC, bvo.getCunitid())); | ||||
|                 detail.put("productNum", null); | ||||
|                 // 库位 - 货位(clocationid) | ||||
|                 detail.put("storageId", transferCodeByPk(RackVO.getDefaultTableName(), RackVO.CODE, RackVO.PK_RACK, bvo.getClocationid())); | ||||
|                 // 物料批号 - 批次号(vbatchcode) | ||||
|                 detail.put("batchNum", bvo.getVbatchcode()); | ||||
|                 detail.put("scaleFactor", bvo.getVchangerate()); | ||||
| 
 | ||||
|                 // 应发数量和实发数量 | ||||
|                 detail.put("issuedQty", bvo.getNshouldassistnum()); // 应发数量(nshouldassistnum) | ||||
|                 detail.put("mIssuedQty", bvo.getNshouldnum());             // 主应发数量(nshouldnum) | ||||
|                 detail.put("actQry", bvo.getNassistnum());             // 实发数量(nassistnum) | ||||
|                 detail.put("mActQry", bvo.getNnum());                         // 主实发数量(nnum) | ||||
|                 detail.put("assistActQry", null);             // 辅助实发数量(nassistnum) | ||||
| 
 | ||||
|                 // 客户信息 | ||||
|                 detail.put("customId", getStringValue(bvo.getCasscustid()));     // 客户ID - 客户(casscustid) | ||||
|                 // 客户ID - 客户(casscustid) | ||||
|                 detail.put("customId", transferCodeByPk(CustomerVO.getDefaultTableName(), CustomerVO.CODE, CustomerVO.PK_CUSTOMER, bvo.getCasscustid())); | ||||
|                 // 供应商信息 | ||||
|                 detail.put("supplierId", getStringValue(bvo.getCvendorid()));    // 供应商ID - 供应商(cvendorid) | ||||
|                 // 供应商ID - 供应商(cvendorid) | ||||
|                 detail.put("supplierId", transferCodeByPk(SupplierVO.getDefaultTableName(), SupplierVO.CODE, SupplierVO.PK_SUPPLIER, bvo.getCvendorid())); | ||||
|                 detail.put("color", null); | ||||
|                 // 生产日期 | ||||
|                 detail.put("manufactureDate", null); // 生产日期(dproducedate) | ||||
|  | @ -196,4 +197,21 @@ public class AfterSigningSynchronizeRule implements IRule<SaleOutVO> { | |||
|             obmlog.error("AfterSigningSynchronizeRule-处理响应异常: " + e.getMessage(), e); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     private String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException { | ||||
|         if (nc.vo.cmp.util.StringUtils.isEmpty(pk)) { | ||||
|             return null; | ||||
|         } | ||||
|         SqlBuilder sqlBuilder = new SqlBuilder(); | ||||
|         sqlBuilder.append(" select " + selectField); | ||||
|         sqlBuilder.append(" from " + tableName); | ||||
|         sqlBuilder.append(" where "); | ||||
|         sqlBuilder.append(pkField, pk); | ||||
|         Object o = dao.executeQuery(sqlBuilder.toString(), new ColumnProcessor()); | ||||
|         if (o == null) { | ||||
|             throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】"); | ||||
|         } | ||||
|         return o.toString(); | ||||
|     } | ||||
| } | ||||
|  | @ -1,6 +1,6 @@ | |||
| package nc.bs.ic.m4r.approve; | ||||
| 
 | ||||
| import nc.bs.ic.m4r.approve.rule.AfterApprovingSynchronizeRule; | ||||
| import nc.bs.ic.m4r.approve.rule.AfterApprovingSynchronizeRuleMES; | ||||
| import nc.bs.ic.m4r.approve.rule.PushInOutBills; | ||||
| import nc.bs.ic.m4r.base.BPPluginPoint; | ||||
| import nc.bs.ic.m4r.insert.rule.InvcountDataCheck; | ||||
|  | @ -23,7 +23,7 @@ public class ApproveBP implements IApproveBP<InvCountBillVO>, IApproveRuleProvid | |||
|     public void addApproveAfterRule(ICAroundProcesser<InvCountBillVO> processor) { | ||||
|         processor.addAfterRule(new PushInOutBills()); | ||||
|         // 盘点(审批后传MES) | ||||
|         processor.addAfterRule(new AfterApprovingSynchronizeRule()); | ||||
|         processor.addAfterRule(new AfterApprovingSynchronizeRuleMES()); | ||||
|     } | ||||
| 
 | ||||
|     public void addApproveBeforeRule(ICAroundProcesser<InvCountBillVO> processor) { | ||||
|  |  | |||
|  | @ -4,15 +4,22 @@ package nc.bs.ic.m4r.approve.rule; | |||
| import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import com.yonyou.cloud.utils.StringUtils; | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.logging.Log; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.vo.bd.cust.CustomerVO; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.rack.RackVO; | ||||
| import nc.vo.bd.supplier.SupplierVO; | ||||
| import nc.vo.ic.m4r.entity.InvCountBillVO; | ||||
| import nc.vo.ic.m4r.entity.InvCountBodyVO; | ||||
| import nc.vo.ic.m4r.entity.InvCountHeaderVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDate; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pubapp.pattern.pub.SqlBuilder; | ||||
| import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; | ||||
| 
 | ||||
| import java.text.SimpleDateFormat; | ||||
|  | @ -21,13 +28,14 @@ import java.text.SimpleDateFormat; | |||
| /** | ||||
|  * 盘点(审批后传MES) | ||||
|  */ | ||||
| public class AfterApprovingSynchronizeRule implements IRule<InvCountBillVO> { | ||||
| public class AfterApprovingSynchronizeRuleMES implements IRule<InvCountBillVO> { | ||||
|     private static final String INV_COUNT_URL = "/GTHINKING/AjaxService/N_MISPRO/InvCount.ashx/SaveData"; // 盘点单同步接口 | ||||
|     private static final SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||||
|     private static final String logginfo = "OALOG"; | ||||
|     private static final Log obmlog = Log.getInstance(logginfo); | ||||
|     private static final BaseDAO dao = new BaseDAO(); | ||||
| 
 | ||||
|     public AfterApprovingSynchronizeRule() { | ||||
|     public AfterApprovingSynchronizeRuleMES() { | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -107,29 +115,24 @@ public class AfterApprovingSynchronizeRule implements IRule<InvCountBillVO> { | |||
|         if (bvos != null) { | ||||
|             for (InvCountBodyVO bvo : bvos) { | ||||
|                 JSONObject detail = new JSONObject(); | ||||
| 
 | ||||
|                 // 必填字段 | ||||
|                 // 序号 - 转换为浮点数 | ||||
|                 detail.put("sequenceNum", bvo.getCrowno()); // 序号(crowno) - 必填 | ||||
|                 detail.put("materialId", getStringValue(bvo.getCmaterialvid())); // 物料ID(cmaterialvid) - 必填 | ||||
|                 detail.put("storageId", getStringValue(bvo.getClocationid()));   // 库位(clocationid) - 必填 | ||||
|                 detail.put("batchNum", getStringValue(bvo.getVbatchcode()));     // 物料批号(vbatchcode) - 必填 | ||||
| 
 | ||||
|                 detail.put("sequenceNum", bvo.getCrowno()); | ||||
|                 // 物料ID(cmaterialvid) - 必填 | ||||
|                 detail.put("materialId", transferCodeByPk(MaterialVO.getDefaultTableName(), MaterialVO.PK_MATERIAL, MaterialVO.CODE, bvo.getCmaterialvid())); | ||||
|                 // 库位(clocationid) - 必填 | ||||
|                 detail.put("storageId", transferCodeByPk(RackVO.getDefaultTableName(), RackVO.CODE, RackVO.PK_RACK, bvo.getClocationid())); | ||||
|                 // 物料批号(vbatchcode) - 必填 | ||||
|                 detail.put("batchNum", getStringValue(bvo.getVbatchcode())); | ||||
|                 // 盘存数量 - 使用实盘主数量 | ||||
|                 UFDouble countNum = bvo.getNcountnum(); | ||||
|                 if (countNum != null) { | ||||
|                     detail.put("panQty", countNum.doubleValue()); // 盘存数量(ncountnum) - 必填 | ||||
|                 } else { | ||||
|                     throw new BusinessException("盘存数量不能为空"); | ||||
|                 } | ||||
| 
 | ||||
|                 detail.put("customId", getStringValue(bvo.getCasscustid()));    // 客户ID | ||||
|                 detail.put("supplierId", getStringValue(bvo.getCvendorid()));   // 供应商ID | ||||
| 
 | ||||
|                 detail.put("panQty", countNum.doubleValue()); // 盘存数量(ncountnum) - 必填 | ||||
|                 // 客户ID | ||||
|                 detail.put("customId", transferCodeByPk(CustomerVO.getDefaultTableName(), CustomerVO.CODE, CustomerVO.PK_CUSTOMER, bvo.getCasscustid())); | ||||
|                 // 供应商ID | ||||
|                 detail.put("supplierId", transferCodeByPk(SupplierVO.getDefaultTableName(), SupplierVO.CODE, SupplierVO.PK_SUPPLIER, bvo.getCvendorid())); | ||||
|                 // 生产日期处理 | ||||
|                 detail.put("manufactureDate", null); // 如果没有,传入null | ||||
|                 detail.put("manufactureDate", null); | ||||
|                 detail.put("color", null); | ||||
| 
 | ||||
|                 // 包装信息(可能来自自定义属性) | ||||
|                 detail.put("packLen", null); | ||||
|                 detail.put("packSize", null); | ||||
|  | @ -182,4 +185,20 @@ public class AfterApprovingSynchronizeRule implements IRule<InvCountBillVO> { | |||
|             obmlog.error("AfterApprovingSynchronizeRule-处理响应异常: " + e.getMessage(), e); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException { | ||||
|         if (nc.vo.cmp.util.StringUtils.isEmpty(pk)) { | ||||
|             return null; | ||||
|         } | ||||
|         SqlBuilder sqlBuilder = new SqlBuilder(); | ||||
|         sqlBuilder.append(" select " + selectField); | ||||
|         sqlBuilder.append(" from " + tableName); | ||||
|         sqlBuilder.append(" where "); | ||||
|         sqlBuilder.append(pkField, pk); | ||||
|         Object o = dao.executeQuery(sqlBuilder.toString(), new ColumnProcessor()); | ||||
|         if (o == null) { | ||||
|             throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】"); | ||||
|         } | ||||
|         return o.toString(); | ||||
|     } | ||||
| } | ||||
|  | @ -49,7 +49,7 @@ public class PMOApproveBP { | |||
|         processer.addAfterRule(new PMOCreatePSCPlanRule()); | ||||
|         ICompareRule<PMOAggVO> auditSupplyRule = new PMOApproveAuditSupplyRule(); | ||||
|         processer.addAfterRule(auditSupplyRule); | ||||
|         // 审批后推送到睿智系统 | ||||
|         // 审批后推送到RZ系统 | ||||
|         processer.addAfterRule(new AfterApprovingSynchronizeRuleRZ()); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,21 +8,25 @@ import nc.bs.uapbd.util.ThirdPartyPostRequestUtil; | |||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.jdbc.framework.processor.ColumnProcessor; | ||||
| import nc.pubitf.para.SysInitQuery; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.stordoc.StordocVO; | ||||
| import nc.vo.cmp.util.StringUtils; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOHeadVO; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO; | ||||
| import nc.vo.org.DeptVO; | ||||
| import nc.vo.org.OrgVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.pubapp.pattern.pub.SqlBuilder; | ||||
| import nc.vo.rum.stocks.StocksVO; | ||||
| import nc.vo.scmpub.util.ArrayUtil; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * 流程生产订单审批后推送睿智 | ||||
|  * 流程生产订单审批后推送RZ | ||||
|  */ | ||||
| public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> { | ||||
|     private static final Log log = Log.getInstance("rzmomlog"); | ||||
|  | @ -40,10 +44,10 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> { | |||
|                 return; | ||||
|             } | ||||
| 
 | ||||
|             // 推送到睿智系统 | ||||
|             // 推送到RZ系统 | ||||
|             pushToRZMOM(filteredOrders.toArray(new PMOAggVO[0])); | ||||
|         } catch (Exception e) { | ||||
|             log.error("同步生产订单到睿智系统失败: " + e.getMessage(), e); | ||||
|             log.error("同步生产订单到RZ系统失败: " + e.getMessage(), e); | ||||
|             ExceptionUtils.wrappException(e); | ||||
|         } | ||||
|     } | ||||
|  | @ -55,7 +59,7 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> { | |||
|         List<PMOAggVO> aggvoList = new ArrayList<>(); | ||||
|         for (PMOAggVO aggvo : pmoAggVOS) { | ||||
|             String pkOrg = aggvo.getParentVO().getPk_org(); | ||||
|             String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), pkOrg); | ||||
|             String orgCode = transferCodeByPk(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg); | ||||
|             if ("30401".equals(orgCode)) { | ||||
|                 aggvoList.add(aggvo); | ||||
|             } | ||||
|  | @ -64,14 +68,13 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> { | |||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 推送数据到睿智MOM系统 | ||||
|      * 推送数据到RZMOM系统 | ||||
|      */ | ||||
|     private void pushToRZMOM(PMOAggVO[] pmoAggVOS) throws BusinessException { | ||||
|         String rzwmsip = SysInitQuery.getParaString("GLOBLE00000000000000", "RZWMSIP"); | ||||
| 
 | ||||
|         JSONObject jsonObject = new JSONObject(); | ||||
|         jsonObject.put("dataflow", "泰开BIP→RZMOMv6"); | ||||
|         jsonObject.put("actionCode", "scdd");  // 生产订单的action code | ||||
|         jsonObject.put("actionCode", "jhxmb");  // 生产订单的action code | ||||
| 
 | ||||
|         JSONObject dataIn = new JSONObject(); | ||||
|         JSONObject dataIn2 = new JSONObject(); | ||||
|  | @ -107,68 +110,31 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> { | |||
| 
 | ||||
|         for (PMOItemVO body : bodys) { | ||||
|             JSONObject detailItem = new JSONObject(); | ||||
| 
 | ||||
|             // 根据映射表设置字段 | ||||
|             detailItem.put("jhmx_wbid", vbillcode);  // 第三方系统主键id | ||||
|             detailItem.put("scjh_wbid", vbillcode);  // 计划ID | ||||
|             detailItem.put("operate", 1);  // 操作状态:1新增/修改 | ||||
|             detailItem.put("scbh", vbillcode);  // 计划编号 | ||||
| 
 | ||||
|             // 计划序号,有则使用实际值,无则设为1 | ||||
|             String rowno = body.getVrowno(); | ||||
|             detailItem.put("jhxh", StringUtils.isEmpty(rowno) ? 1 : Integer.parseInt(rowno)); | ||||
| 
 | ||||
|             // 第三方系统计划类别id | ||||
|             detailItem.put("jhlb_wbid", head.getVtrantypecode()); | ||||
| 
 | ||||
|             // 第三方系统产品ID | ||||
|             detailItem.put("wlbm_wbid", body.getCmaterialvid()); | ||||
| 
 | ||||
|             // 计划数量 | ||||
|             if (body.getNmmastnum() != null) { | ||||
|                 detailItem.put("jhsl", body.getNmmastnum().doubleValue()); | ||||
|             } | ||||
|             detailItem.put("jhlx", null); | ||||
|             // 计划员 | ||||
|             detailItem.put("jhy_wbid", null); | ||||
| 
 | ||||
|             // 上线日期 - 计划开工日期 | ||||
|             if (body.getTplanstarttime() != null) { | ||||
|                 detailItem.put("sxrq", body.getTplanstarttime().toString()); | ||||
|             } | ||||
| 
 | ||||
|             // 完成日期 - 计划完工日期 | ||||
|             if (body.getTplanendtime() != null) { | ||||
|                 detailItem.put("wcrq", body.getTplanendtime().toString()); | ||||
|             } | ||||
| 
 | ||||
|             // 第三方系统产品ID 物料ID | ||||
|             detailItem.put("wlbm_wbid", transferCodeByPk(MaterialVO.getDefaultTableName(), MaterialVO.CODE, MaterialVO.PK_MATERIAL, body.getCmaterialvid())); | ||||
|             // 预计开工日期 | ||||
|             detailItem.put("sxrq", body.getTplanstarttime().toString()); | ||||
|             // 预计完工日期 | ||||
|             detailItem.put("wcrq", body.getTplanendtime().toString()); | ||||
|             detailItem.put("gdbj", body.getFitemstatus()); | ||||
|             // 计划产出数量 | ||||
|             detailItem.put("jhsl", body.getNmmastnum().doubleValue()); | ||||
|             // 入库仓库 | ||||
|             detailItem.put("sdck", transferCodeByPk(StordocVO.getDefaultTableName(), StordocVO.CODE, StordocVO.PK_STORDOC, body.getCinwarehouseid())); | ||||
|             detailItem.put("wlzdycs01", transferCodeByPk(StordocVO.getDefaultTableName(), StordocVO.CODE, StordocVO.PK_STORDOC, body.getCinwarehouseid())); | ||||
|             // 工作中心 生产部门ID | ||||
|             detailItem.put("scgc_wbid", transferCodeByPk(DeptVO.getDefaultTableName(), DeptVO.CODE, DeptVO.PK_DEPT, body.getCdeptid())); | ||||
|             // 订单序号 | ||||
|             detailItem.put("ddbh", body.getVsalebillcode()); | ||||
|             // 订单序号 | ||||
|             detailItem.put("khddh", null); | ||||
|             detailItem.put("ddxh", null); | ||||
|             // 备注说明 | ||||
|             detailItem.put("bzsm", head.getVnote()); | ||||
| 
 | ||||
|             // 签发标记 - 行状态 | ||||
|             detailItem.put("qfbj", body.getFitemstatus()); | ||||
| 
 | ||||
|             // 送达地点 - 入库仓库 | ||||
|             detailItem.put("sdck", body.getCinwarehouseid()); | ||||
| 
 | ||||
|             detailItem.put("bzsm", body.getVnote()); | ||||
|             // 项目编号 | ||||
|             detailItem.put("wlzdycs06", body.getVdef1()); | ||||
| 
 | ||||
|             // 固定值设置 | ||||
|             detailItem.put("zdscjhlyb", 1);  // 自动生成计划来源表 | ||||
|             detailItem.put("jhbhzdsc", 0);   // 计划号重新生成 | ||||
|             detailItem.put("bomsdbj", 1);    // 生产BOM锁定 | ||||
|             detailItem.put("bsbj", 1);       // 包装Bom表锁定 | ||||
| 
 | ||||
|             // 其他字段映射 | ||||
|             detailItem.put("khbh_wbid", body.getCcustomerid());  // 第三方系统客户id | ||||
|             detailItem.put("cjbz_wbid", body.getCdeptid());      // 第三方系统车间工段ID | ||||
| 
 | ||||
|             // 销售订单相关 | ||||
|             detailItem.put("xsdd_wbid", body.getVfirstid());   // 第三方系统销售订单主表ID | ||||
|             detailItem.put("ddbh", body.getVsalebillcode());   // 订单编号 | ||||
|             detailItem.put("ddxh", body.getVfirstrowno());     // 订单序号 | ||||
| 
 | ||||
|             detailItem.put("htbz,wlzdycs06", body.getVdef1()); | ||||
|             details.add(detailItem); | ||||
|         } | ||||
|     } | ||||
|  | @ -176,15 +142,15 @@ public class AfterApprovingSynchronizeRuleRZ implements IRule<PMOAggVO> { | |||
|     /** | ||||
|      * 根据主键查询编码 | ||||
|      */ | ||||
|     private String transferCodeByPk(String tableName, String pk) throws BusinessException { | ||||
|     private String transferCodeByPk(String tableName, String selectField, String pkField, String pk) throws BusinessException { | ||||
|         if (StringUtils.isEmpty(pk)) { | ||||
|             return null; | ||||
|         } | ||||
|         SqlBuilder sqlBuilder = new SqlBuilder(); | ||||
|         sqlBuilder.append(" select " + OrgVO.CODE); | ||||
|         sqlBuilder.append(" select " + selectField); | ||||
|         sqlBuilder.append(" from " + tableName); | ||||
|         sqlBuilder.append(" where "); | ||||
|         sqlBuilder.append(OrgVO.PK_ORG, pk); | ||||
|         sqlBuilder.append(pkField, pk); | ||||
|         Object o = dao.executeQuery(sqlBuilder.toString(), new ColumnProcessor()); | ||||
|         if (o == null) { | ||||
|             throw new BusinessException("未查询到编码信息,sql【" + sqlBuilder + "】"); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue