refactor(mmpac): 重构 MES 同步接口构建 properties 数组
- 提取 buildProperties 方法,用于构建 MES 同步所需的 properties 数组 - 添加 addProperty 方法,简化单个 property 的添加过程 - 新增 SXZF22、SXZF23、SXZF24 字段的同步- 优化代码结构,提高可读性和可维护性
This commit is contained in:
parent
14c86ec4d3
commit
4cac17c8bd
|
@ -302,22 +302,7 @@ public class AfterApproveRuleSyncMes implements IRule<PMOAggVO> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 通过自定义属性传
|
// 通过自定义属性传
|
||||||
JSONArray properties = new JSONArray();
|
JSONArray properties = buildProperties(head, item);
|
||||||
JSONObject SXZF16 = new JSONObject();
|
|
||||||
JSONObject SXZF17 = new JSONObject();
|
|
||||||
JSONObject SXZF18 = new JSONObject();
|
|
||||||
|
|
||||||
SXZF16.put("propertyFiled", "SXZF16");
|
|
||||||
SXZF17.put("propertyFiled", "SXZF17");
|
|
||||||
SXZF18.put("propertyFiled", "SXZF18");
|
|
||||||
|
|
||||||
SXZF16.put("propertyValue", item.getVparentbillcode());
|
|
||||||
SXZF17.put("propertyValue", item.getVparentmorowno());
|
|
||||||
SXZF18.put("propertyValue", head.getVtrantypecode());
|
|
||||||
|
|
||||||
properties.add(SXZF16);
|
|
||||||
properties.add(SXZF17);
|
|
||||||
properties.add(SXZF18);
|
|
||||||
|
|
||||||
data.put("properties", properties);
|
data.put("properties", properties);
|
||||||
JSONObject requestPayload = new JSONObject();
|
JSONObject requestPayload = new JSONObject();
|
||||||
|
@ -334,6 +319,51 @@ public class AfterApproveRuleSyncMes implements IRule<PMOAggVO> {
|
||||||
obmlog.info("生产订单 " + vbillcode + " 行 " + itemRow + " 已成功发送到MES系统或特定错误已被记录。");
|
obmlog.info("生产订单 " + vbillcode + " 行 " + itemRow + " 已成功发送到MES系统或特定错误已被记录。");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建MES同步所需的properties数组
|
||||||
|
*
|
||||||
|
* @param head 生产订单表头
|
||||||
|
* @param item 生产订单明细
|
||||||
|
* @return JSONArray properties数组
|
||||||
|
*/
|
||||||
|
private JSONArray buildProperties(PMOHeadVO head, PMOItemVO item) {
|
||||||
|
JSONArray properties = new JSONArray();
|
||||||
|
|
||||||
|
// SXZF16 - 上级生产订单号
|
||||||
|
addProperty(properties, "SXZF16", item.getVparentbillcode());
|
||||||
|
|
||||||
|
// SXZF17 - 上级生产订单行号
|
||||||
|
addProperty(properties, "SXZF17", item.getVparentmorowno());
|
||||||
|
|
||||||
|
// SXZF18 - 生产订单交易类型编码
|
||||||
|
addProperty(properties, "SXZF18", head.getVtrantypecode());
|
||||||
|
|
||||||
|
// SXZF22 - 生产订单交易类型编码
|
||||||
|
addProperty(properties, "SXZF22", head.getVtrantypecode());
|
||||||
|
|
||||||
|
// SXZF23 - 生产订单主键
|
||||||
|
addProperty(properties, "SXZF23", head.getCpmohid());
|
||||||
|
|
||||||
|
// SXZF24 - 生产订单明细主键
|
||||||
|
addProperty(properties, "SXZF24", item.getCmoid());
|
||||||
|
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加单个property到properties数组
|
||||||
|
*
|
||||||
|
* @param properties JSONArray数组
|
||||||
|
* @param propertyField 属性字段名
|
||||||
|
* @param propertyValue 属性值
|
||||||
|
*/
|
||||||
|
private void addProperty(JSONArray properties, String propertyField, String propertyValue) {
|
||||||
|
JSONObject property = new JSONObject();
|
||||||
|
property.put("propertyFiled", propertyField);
|
||||||
|
property.put("propertyValue", propertyValue);
|
||||||
|
properties.add(property);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键查询编码
|
* 根据主键查询编码
|
||||||
|
|
Loading…
Reference in New Issue