流程生产订单审批后推送高压MES

This commit is contained in:
lihao 2025-09-08 09:02:03 +08:00
parent 6b95f2e078
commit e90bce565a
1 changed files with 21 additions and 18 deletions

View File

@ -44,7 +44,7 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
if (ArrayUtil.isEmpty(pmoAggVOS)) {
return;
}
configParams = MyHelper.getConfigParams("xb-config", null);
configParams = MyHelper.getConfigParams("gy-config", null);
try {
@ -65,9 +65,9 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
// 判断物料的业务单元是否是箱变公司不是则跳过
String pkOrg = vo.getParentVO().getPk_org();
String orgCode = MyHelper.transferField(OrgVO.getDefaultTableName(), OrgVO.CODE, OrgVO.PK_ORG, pkOrg);
if (checkIfOrg(orgCode, configParams)) {
continue;
}
// if (checkIfOrg(orgCode, configParams)) {
// continue;
// }
JSONObject singleObj = new JSONObject();
PMOHeadVO pmoHeadVO = vo.getParentVO();
PMOItemVO[] itemVOS = vo.getChildrenVO();
@ -75,10 +75,13 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
singleObj.put("bipProcessProductionOrderId", pmoHeadVO.getVbillcode());
singleObj.put("bipId", pmoHeadVO.getCpmohid());// 主键ID
// singleObj.put("orderQuantity", pmoHeadVO.getPlanQuantity()); // 订单数量计划数量
singleObj.put("billDate", pmoHeadVO.getDbilldate()); // 单据日期
singleObj.put("billDate", pmoHeadVO.getDbilldate().toString()); // 单据日期
singleObj.put("orderVersion", pmoHeadVO.getVersion()); // 版本号
singleObj.put("orderTranType", pmoHeadVO.getVtrantypecode()); // 订单交易类型
singleObj.put("bipCreateBy", pmoHeadVO.getCreator()); // 创建人ID
String sql1 = " select user_code from sm_user where cuserid = '" + pmoHeadVO.getCreator() + "' ";
String bipCreateBy= (String) baseDAO.executeQuery(sql1, new ColumnProcessor());
singleObj.put("bipCreateBy", bipCreateBy); // 创建人ID
// 创建子项数组
JSONArray contentArray = new JSONArray();
@ -107,7 +110,7 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
itemObj.put("bipDeptId", tr.get("code")); // 生产部门编码
// 日期信息
itemObj.put("requiredDate", item.getTrequiredate()); // 需用日期
itemObj.put("requiredDate", item.getTrequiredate().toString()); // 需用日期
itemObj.put("bipParentProcessProductionOrderId", item.getVparentbillcode());
itemObj.put("bipParentProcessProductionOrderRowNum", item.getVparentmorowno());
@ -115,7 +118,7 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
itemObj.put("bipOriginProcessProductionOrderRowNum", item.getVsrcrowno());
// 物料信息
String mrlsql = "select code,name,graphid,pk_measdoc from bd_material where pk_material = '" + item.getCmaterialvid() + "' ";
String mrlsql = "select code,name,graphid,pk_measdoc,materialspec from bd_material where pk_material = '" + item.getCmaterialvid() + "' ";
Map<String, Object> mrl = (Map<String, Object>) baseDAO.executeQuery(mrlsql, new MapProcessor());
itemObj.put("materialCode", mrl.get("code")); // 物料编码
itemObj.put("materialName",mrl.get("name")); // 物料名称
@ -126,16 +129,16 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
itemObj.put("unit", unit); // 单位 pk_measdoc
// 生产信息
// itemObj.put("intervalModel", item.getCmaterialvid()); // 产品类型 物料分类
itemObj.put("processCode", item.getProcedures()); // 工序编码
itemObj.put("intervalModel", mrl.get("materialspec")); // 产品类型
// itemObj.put("processCode", item.getProcedures()); // 工序编码
itemObj.put("lineNumber", String.valueOf(item.getVrowno())); // 行号
// 库存信息
itemObj.put("demandInventoryOrganization", item.getCrequireorg()); // 需求库存组织
itemObj.put("plannedInputQuantity", item.getNplanputastnum()); // 计划投入量
itemObj.put("plannedOutputQuantity", item.getNmmastnum()); // 计划产出量
itemObj.put("plannedStartTime", item.getTplanstarttime()); // 计划开工时间
itemObj.put("plannedCompletionTime", item.getTplanendtime()); // 计划完工时间
itemObj.put("plannedInputQuantity", item.getNplanputastnum().doubleValue()); // 计划投入量
itemObj.put("plannedOutputQuantity", item.getNmmastnum().doubleValue()); // 计划产出量
itemObj.put("plannedStartTime", item.getTplanstarttime().toString()); // 计划开工时间
itemObj.put("plannedCompletionTime", item.getTplanendtime().toString()); // 计划完工时间
itemObj.put("customerMaterialCode", item.getCcustmaterialid()); // 客户物料编码
itemObj.put("productionBatch", item.getCbatchid()); // 生产批次(按BIP格式)
itemObj.put("productionBatchNumber", item.getVbatchcode()); // 生产批次号(按BIP格式)
@ -203,10 +206,10 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
SerializerFeature.WriteNullStringAsEmpty
);
// logDl.error("QMS-Material-param = " + jsonStr);
// String baseUrl = configParams.get("qmsBaseUrl");
// String requestUrl = baseUrl + configParams.get("pomInsertUrl");
String baseUrl = configParams.get("mesBaseUrl");
String requestUrl = baseUrl + configParams.get("productionOrderAdd");
// logDl.error("QMS-Material-url = " + requestUrl);
String requestUrl ="http://192.168.223.115:8087/bip/order/productionOrderAdd";
// String requestUrl ="/bip/order/productionOrderAdd";
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
JSONObject resultObj = JSONObject.parseObject(result);
logDl.error("QMS-Material-res = " + result);
@ -218,7 +221,7 @@ public class AfterApproveSyncHighpressureMesRule implements IRule<PMOAggVO> {
}
private boolean checkIfOrg(String code, Map<String, String> configParams) throws BusinessException {
String targetCode = configParams.get("xbOrg");
String targetCode = configParams.get("gyOrg");
if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) {
throw new BusinessException("未配置组织参数");
}