feat(bom): 添加 BOM同步到艾普 MES 的功能
This commit is contained in:
		
							parent
							
								
									6d66c26bc6
								
							
						
					
					
						commit
						96120e7799
					
				|  | @ -252,6 +252,10 @@ public class BomInsertBP { | |||
|         rule = new BomAddAfterEventRule(); | ||||
|         processer.addAfterRule(rule); | ||||
| 
 | ||||
|         // BOMÍÆËͰ¬ÆÕMES | ||||
|         IRule<AggBomVO> eventRrule = new BomSaveAfterEpicMesRule(); | ||||
|         processer.addAfterRule(eventRrule); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     public void setCheckEcn(boolean checkEcn) { | ||||
|  |  | |||
|  | @ -340,8 +340,8 @@ public class BomUpdateBP { | |||
|         ICompareRule<AggBomVO> updateBmrtRule = new BomUpdateBmrtVersionRule(); | ||||
|         processer.addBeforeRule(updateBmrtRule); | ||||
| 
 | ||||
|         // 注册事件源 | ||||
|         IRule<AggBomVO> eventRrule = new BomUpdateAfterEventRule(); | ||||
|         // BOMÍÆËͰ¬ÆÕMES | ||||
|         IRule<AggBomVO> eventRrule = new BomSaveAfterEpicMesRule(); | ||||
|         processer.addAfterRule(eventRrule); | ||||
| 
 | ||||
|     } | ||||
|  |  | |||
|  | @ -9,12 +9,14 @@ import nc.bs.uapbd.util.MyHelper; | |||
| import nc.bs.uapbd.util.ThirdPartyPostRequestUtil; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.util.mmf.framework.base.MMValueCheck; | ||||
| import nc.vo.bc.pmpub.project.ProjectHeadVO; | ||||
| import nc.vo.bd.bom.bom0202.entity.AggBomVO; | ||||
| import nc.vo.bd.bom.bom0202.entity.BomItemVO; | ||||
| import nc.vo.bd.bom.bom0202.entity.BomVO; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.material.marbasclass.MarBasClassVO; | ||||
| import nc.vo.org.OrgVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.CircularlyAccessibleValueObject; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nccloud.baseapp.core.log.NCCForUAPLogger; | ||||
| 
 | ||||
|  | @ -26,10 +28,10 @@ import java.util.Map; | |||
|  * @author mzr | ||||
|  * @date 2025/08/29 | ||||
|  */ | ||||
| public class BomUpdateAfterEpicMesRule implements IRule<AggBomVO> { | ||||
| public class BomSaveAfterEpicMesRule implements IRule<AggBomVO> { | ||||
|     private static final String LOG_INFO_NAME = "dldzlog"; | ||||
|     private static final Log logDl = Log.getInstance(LOG_INFO_NAME); | ||||
|     private static final String reqUrl = ""; | ||||
|     private static final String reqUrl = "/prj-v5-web/ext/api/bom"; | ||||
|     private Map<String, String> configParams; | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -62,17 +64,26 @@ public class BomUpdateAfterEpicMesRule implements IRule<AggBomVO> { | |||
|             if (MMValueCheck.isEmpty(childrenVOs)) { | ||||
|                 continue; | ||||
|             } | ||||
|             String hcmaterialid = hvo.getHcmaterialid();// 物料编码 | ||||
|             String hfmaterialid = hvo.getHfmaterialid();// 父项物料编码 | ||||
|             String hcprojectid = hvo.getHcprojectid();// 项目 | ||||
|             String hversion = hvo.getHversion();// BOM版本号 | ||||
| 
 | ||||
|             String mitm = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.CODE, | ||||
|                     MaterialVO.PK_MATERIAL + " = '" + hcmaterialid + "'"); | ||||
|             for (BomItemVO childrenVO : childrenVOs) { | ||||
|                 String cmaterialid = childrenVO.getCmaterialid(); | ||||
|                 String cprojectid = childrenVO.getCprojectid(); | ||||
|                 String sitm = MyHelper.getStrValByCondition(MaterialVO.getDefaultTableName(), MaterialVO.CODE, | ||||
|                         MaterialVO.PK_MATERIAL + " = '" + cmaterialid + "'"); | ||||
|                 String projectCode = MyHelper.getStrValByCondition(ProjectHeadVO.getDefaultTableName(), ProjectHeadVO.PROJECT_CODE, | ||||
|                         ProjectHeadVO.PK_PROJECT + " = '" + cprojectid + "'"); | ||||
|                 // 组装数据 | ||||
|                 JSONObject singleObj = new JSONObject(); | ||||
|                 singleObj.put("mitm", ""); // 制造物料编码(ERP父项物料编码) | ||||
|                 singleObj.put("sitm", ""); // 子物料编码 | ||||
|                 singleObj.put("orderNum", ""); // 合同号(ERP项目) | ||||
|                 singleObj.put("qana", childrenVO.getNassitemnum()); // 数量(ERP子项数量) | ||||
|                 singleObj.put("mitm", mitm); // 制造物料编码(ERP父项物料编码) | ||||
|                 singleObj.put("sitm", sitm); // 子物料编码 | ||||
|                 singleObj.put("orderNum", projectCode); // 合同号(ERP项目) | ||||
|                 singleObj.put("qana", childrenVO.getNassitemnum().toString()); // 数量(ERP子项数量) | ||||
|                 singleObj.put("ver", hversion); // BOM版本号 | ||||
|                 singleObj.put("remark", childrenVO.getVnote()); // 备注 | ||||
|                 data.add(singleObj); | ||||
|  | @ -104,14 +115,14 @@ public class BomUpdateAfterEpicMesRule implements IRule<AggBomVO> { | |||
|                 SerializerFeature.WriteNullStringAsEmpty | ||||
|         ); | ||||
|         logDl.error("EpicMes-BOM-param = " + jsonStr); | ||||
|         NCCForUAPLogger.debug("EpicMes-BOM-param = " + jsonStr); | ||||
|         // NCCForUAPLogger.debug("EpicMes-BOM-param = " + jsonStr); | ||||
|         String baseUrl = configParams.get("epicMesUrl"); | ||||
|         String requestUrl = baseUrl + reqUrl; | ||||
|         logDl.error("EpicMes-BOM-url = " + requestUrl); | ||||
|         String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr); | ||||
|         JSONObject resultObj = JSONObject.parseObject(result); | ||||
|         logDl.error("EpicMes-BOM-res = " + result); | ||||
| 
 | ||||
|         // NCCForUAPLogger.debug("EpicMes-BOM-result = " + result); | ||||
|         if (!"1".equals(resultObj.getString("flag"))) { | ||||
|             // throw new BusinessException("EpicMes-BOM-error:" + resultObj.getString("msg")); | ||||
|             logDl.error("EpicMes-BOM-error,result[" + resultObj.toJSONString() + "]"); | ||||
		Loading…
	
		Reference in New Issue