1.代码调试

This commit is contained in:
龚豆豆 2025-10-31 14:46:12 +08:00
parent 6371693c46
commit f04a7b98e6
5 changed files with 133 additions and 82 deletions

View File

@ -170,10 +170,10 @@ public class WMSPurInController {
} }
//参数值组装 //参数值组装
Long id = receiptnotice.getLong("id"); Long id = receiptnotice.getLong("id");
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject detailObject = new JSONObject();
for (Object detail : details) { for (Object detail : details) {
JSONObject detailObject = new JSONObject();
JSONObject detail1 = (JSONObject) detail; JSONObject detail1 = (JSONObject) detail;
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
String wmsDetailId = detail1.getString("wmsDetailId");//WMS入库单细单号 String wmsDetailId = detail1.getString("wmsDetailId");//WMS入库单细单号
@ -197,7 +197,8 @@ public class WMSPurInController {
detailObject.put("producer", producer); detailObject.put("producer", producer);
detailObject.put("VoucherType", VoucherType); detailObject.put("VoucherType", VoucherType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
param.put(entryId, detailObject); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
} }
//开始下推 //开始下推
String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则"); String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则");
@ -274,10 +275,10 @@ public class WMSPurInController {
} }
//参数值组装 //参数值组装
Long id = pm_purrefundapplybill.getLong("id"); Long id = pm_purrefundapplybill.getLong("id");
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject detailObject = new JSONObject();
for (Object detail : details) { for (Object detail : details) {
JSONObject detailObject = new JSONObject();
JSONObject detail1 = (JSONObject) detail; JSONObject detail1 = (JSONObject) detail;
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量 BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量
@ -299,7 +300,7 @@ public class WMSPurInController {
detailObject.put("producer", producer); detailObject.put("producer", producer);
detailObject.put("VoucherType", VoucherType); detailObject.put("VoucherType", VoucherType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
param.put(entryId, detailObject); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
} }
//开始下推 //开始下推
String rule = BotpParamUtils.getBotpRuleId(PM_PURREFUNDAPPLYBILL, PURINBILL, "采购退货申请_采购入库_转换规则_扩展"); String rule = BotpParamUtils.getBotpRuleId(PM_PURREFUNDAPPLYBILL, PURINBILL, "采购退货申请_采购入库_转换规则_扩展");
@ -376,10 +377,10 @@ public class WMSPurInController {
} }
//组装参数值 //组装参数值
Long id = tqq9_otherinapply.getLong("id"); Long id = tqq9_otherinapply.getLong("id");
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject detailObject = new JSONObject();
for (Object detail : details) { for (Object detail : details) {
JSONObject detailObject = new JSONObject();
JSONObject detail1 = (JSONObject) detail; JSONObject detail1 = (JSONObject) detail;
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量 BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量
@ -401,7 +402,7 @@ public class WMSPurInController {
detailObject.put("producer", producer); detailObject.put("producer", producer);
detailObject.put("VoucherType", VoucherType); detailObject.put("VoucherType", VoucherType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
param.put(entryId, detailObject); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
} }
//开始下推 //开始下推
String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHERINAPPLY, IM_OTHERINBILL, "其他入库申请_其他入库_转换规则"); String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHERINAPPLY, IM_OTHERINBILL, "其他入库申请_其他入库_转换规则");
@ -586,7 +587,7 @@ public class WMSPurInController {
response.setFlag("failure"); response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn); return CustomApiResult.success(wmsXmlReturn);
} }
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
//参数值组装 //参数值组装
if (orderLines.get("orderLine") instanceof Map) { if (orderLines.get("orderLine") instanceof Map) {
@ -629,7 +630,7 @@ public class WMSPurInController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", entryOrderType); detailObject.put("VoucherType", entryOrderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} else { } else {
JSONArray orderLine = orderLines.getJSONArray("orderLine"); JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) { for (Object obj : orderLine) {
@ -672,7 +673,7 @@ public class WMSPurInController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", entryOrderType); detailObject.put("VoucherType", entryOrderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} }
} }
//开始下推 //开始下推
@ -751,7 +752,7 @@ public class WMSPurInController {
response.setFlag("failure"); response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn); return CustomApiResult.success(wmsXmlReturn);
} }
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
//参数值组装 //参数值组装
if (orderLines.get("orderLine") instanceof Map) { if (orderLines.get("orderLine") instanceof Map) {
@ -794,7 +795,7 @@ public class WMSPurInController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", entryOrderType); detailObject.put("VoucherType", entryOrderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} else { } else {
JSONArray orderLine = orderLines.getJSONArray("orderLine"); JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) { for (Object obj : orderLine) {
@ -837,7 +838,7 @@ public class WMSPurInController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", entryOrderType); detailObject.put("VoucherType", entryOrderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} }
} }
@ -919,7 +920,7 @@ public class WMSPurInController {
response.setFlag("failure"); response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn); return CustomApiResult.success(wmsXmlReturn);
} }
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
//参数值组装 //参数值组装
if (orderLines.get("orderLine") instanceof Map) { if (orderLines.get("orderLine") instanceof Map) {
@ -962,7 +963,7 @@ public class WMSPurInController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", entryOrderType); detailObject.put("VoucherType", entryOrderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} else { } else {
JSONArray orderLine = orderLines.getJSONArray("orderLine"); JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) { for (Object obj : orderLine) {
@ -1005,7 +1006,7 @@ public class WMSPurInController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", entryOrderType); detailObject.put("VoucherType", entryOrderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} }
} }

View File

@ -163,10 +163,10 @@ public class WMSSaleOutController {
} }
//参数值组装 //参数值组装
Long id = sm_delivernotice.getLong("id"); Long id = sm_delivernotice.getLong("id");
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject detailObject = new JSONObject();
for (Object detail : details) { for (Object detail : details) {
JSONObject detailObject = new JSONObject();
JSONObject detail1 = (JSONObject) detail; JSONObject detail1 = (JSONObject) detail;
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
String wmsDetailId = detail1.getString("wmsDetailId");//WMS入库单细单号 String wmsDetailId = detail1.getString("wmsDetailId");//WMS入库单细单号
@ -190,7 +190,7 @@ public class WMSSaleOutController {
detailObject.put("producer", producer); detailObject.put("producer", producer);
detailObject.put("VoucherType", VoucherType); detailObject.put("VoucherType", VoucherType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
param.put(entryId, detailObject); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
} }
//开始下推 //开始下推
String rule = BotpParamUtils.getBotpRuleId(SM_DELIVERNOTICE, IM_SALOUTBILL, "发货通知单_销售出库单_转换规则_扩展"); String rule = BotpParamUtils.getBotpRuleId(SM_DELIVERNOTICE, IM_SALOUTBILL, "发货通知单_销售出库单_转换规则_扩展");
@ -267,10 +267,10 @@ public class WMSSaleOutController {
} }
//参数值组装 //参数值组装
Long id = sm_returnapply.getLong("id"); Long id = sm_returnapply.getLong("id");
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject detailObject = new JSONObject();
for (Object detail : details) { for (Object detail : details) {
JSONObject detailObject = new JSONObject();
JSONObject detail1 = (JSONObject) detail; JSONObject detail1 = (JSONObject) detail;
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
BigDecimal quantity = detail1.getBigDecimal("quantity");//出库数量 BigDecimal quantity = detail1.getBigDecimal("quantity");//出库数量
@ -292,7 +292,8 @@ public class WMSSaleOutController {
detailObject.put("producer", producer); detailObject.put("producer", producer);
detailObject.put("VoucherType", VoucherType); detailObject.put("VoucherType", VoucherType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
param.put(entryId, detailObject); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
} }
//开始下推 //开始下推
String rule = BotpParamUtils.getBotpRuleId(SM_RETURNAPPLY, IM_SALOUTBILL, "销售退货申请单_销售出库单_转换规则_扩展"); String rule = BotpParamUtils.getBotpRuleId(SM_RETURNAPPLY, IM_SALOUTBILL, "销售退货申请单_销售出库单_转换规则_扩展");
@ -381,10 +382,10 @@ public class WMSSaleOutController {
String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, rulanema); String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, rulanema);
//组装参数值 //组装参数值
Long id = tqq9_otheroutapply.getLong("id"); Long id = tqq9_otheroutapply.getLong("id");
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject detailObject = new JSONObject();
for (Object detail : details) { for (Object detail : details) {
JSONObject detailObject = new JSONObject();
JSONObject detail1 = (JSONObject) detail; JSONObject detail1 = (JSONObject) detail;
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
BigDecimal quantity = detail1.getBigDecimal("quantity");//出库数量 BigDecimal quantity = detail1.getBigDecimal("quantity");//出库数量
@ -406,7 +407,7 @@ public class WMSSaleOutController {
detailObject.put("producer", producer); detailObject.put("producer", producer);
detailObject.put("VoucherType", VoucherType); detailObject.put("VoucherType", VoucherType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
param.put(entryId, detailObject); param.computeIfAbsent(entryId, k -> new HashSet<>()).add(detailObject);
} }
//开始下推 //开始下推
PushArgs pushArgs = BotpParamUtils.getPushArgs(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, BILLENTRY, param, entitypkMap, rule); PushArgs pushArgs = BotpParamUtils.getPushArgs(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, BILLENTRY, param, entitypkMap, rule);
@ -586,7 +587,7 @@ public class WMSSaleOutController {
response.setFlag("failure"); response.setFlag("failure");
return CustomApiResult.success(wmsXmlReturn); return CustomApiResult.success(wmsXmlReturn);
} }
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
//参数值组装 //参数值组装
if (orderLines.get("orderLine") instanceof Map) { if (orderLines.get("orderLine") instanceof Map) {
@ -629,7 +630,7 @@ public class WMSSaleOutController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", orderType); detailObject.put("VoucherType", orderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} else { } else {
JSONArray orderLine = orderLines.getJSONArray("orderLine"); JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) { for (Object obj : orderLine) {
@ -672,7 +673,7 @@ public class WMSSaleOutController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", orderType); detailObject.put("VoucherType", orderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} }
} }
//开始下推 //开始下推
@ -752,7 +753,7 @@ public class WMSSaleOutController {
return CustomApiResult.success(wmsXmlReturn); return CustomApiResult.success(wmsXmlReturn);
} }
//参数值组装 //参数值组装
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
if (orderLines.get("orderLine") instanceof Map) { if (orderLines.get("orderLine") instanceof Map) {
JSONObject orderLine = orderLines.getJSONObject("orderLine"); JSONObject orderLine = orderLines.getJSONObject("orderLine");
@ -794,7 +795,7 @@ public class WMSSaleOutController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", orderType); detailObject.put("VoucherType", orderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} else { } else {
JSONArray orderLine = orderLines.getJSONArray("orderLine"); JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) { for (Object obj : orderLine) {
@ -837,7 +838,7 @@ public class WMSSaleOutController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", orderType); detailObject.put("VoucherType", orderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} }
} }
//开始下推 //开始下推
@ -931,7 +932,7 @@ public class WMSSaleOutController {
} }
String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, rulanema); String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, rulanema);
//组装参数值 //组装参数值
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
if (orderLines.get("orderLine") instanceof Map) { if (orderLines.get("orderLine") instanceof Map) {
JSONObject orderLine = orderLines.getJSONObject("orderLine"); JSONObject orderLine = orderLines.getJSONObject("orderLine");
@ -973,7 +974,7 @@ public class WMSSaleOutController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", orderType); detailObject.put("VoucherType", orderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} else { } else {
JSONArray orderLine = orderLines.getJSONArray("orderLine"); JSONArray orderLine = orderLines.getJSONArray("orderLine");
for (Object obj : orderLine) { for (Object obj : orderLine) {
@ -1016,7 +1017,7 @@ public class WMSSaleOutController {
detailObject.put("producer", key2); detailObject.put("producer", key2);
detailObject.put("VoucherType", orderType); detailObject.put("VoucherType", orderType);
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo"));
param.put(orderLineNo, detailObject); param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject);
} }
} }
//开始下推 //开始下推

View File

@ -1,24 +1,27 @@
package tqq9.lc123.cloud.app.plugin.operate.im; package tqq9.lc123.cloud.app.plugin.operate.im;
import com.google.gson.Gson; import com.alibaba.nacos.common.utils.StringUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.utils.StringUtils; import kd.bos.dataentity.metadata.IDataEntityProperty;
import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection;
import kd.bos.entity.EntityMetadataCache;
import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.ExtendedDataEntitySet; import kd.bos.entity.ExtendedDataEntitySet;
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn; import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs; import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
import kd.bos.logging.Log; import kd.bos.logging.Log;
import kd.bos.logging.LogFactory; import kd.bos.logging.LogFactory;
import kd.bos.orm.ORM;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin; import kd.sdk.plugin.Plugin;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.Map;
/** /**
* 采购入库转换插件 * 采购入库转换插件
@ -51,50 +54,91 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin
//采购入库单 //采购入库单
DynamicObject dataEntity = extendedDataEntity.getDataEntity(); DynamicObject dataEntity = extendedDataEntity.getDataEntity();
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("billentry"); DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("billentry");
for (DynamicObject entry : dynamicObjectCollection) { ListIterator<DynamicObject> iterator = dynamicObjectCollection.listIterator();
while (iterator.hasNext()) {
DynamicObject entry = iterator.next();
String srcbillentryid = entry.getString("srcbillentryid"); String srcbillentryid = entry.getString("srcbillentryid");
//核心单据号一致写入数据 //核心单据号一致写入数据
if (variables.containsKey(srcbillentryid)) { if (variables.containsKey(srcbillentryid)) {
String jsonString = variables.get(srcbillentryid); String jsonString = variables.get(srcbillentryid);
Gson gson = new Gson(); ObjectMapper objectMapper = new ObjectMapper();
// JSON 字符串转换为 HashMap List<HashMap<String, Object>> jsonList = null;
HashMap<String, Object> jsonMap = gson.fromJson(jsonString, HashMap.class); try {
String VoucherType = jsonMap.get("VoucherType").toString();//类型 jsonList = objectMapper.readValue(jsonString, objectMapper.getTypeFactory().constructCollectionType(List.class, HashMap.class));
Double manufacture = (Double) jsonMap.get("manufactureDate"); } catch (JsonProcessingException ex) {
Double expiration = (Double) jsonMap.get("expirationDate"); throw new RuntimeException(ex);
Date manufactureDate = null; }
Date expirationDate = null; if (jsonList != null) {
if (manufacture != null && expiration != null) { for (int i = 0; i < jsonList.size(); i++) {
manufactureDate = new Date(manufacture.longValue()); //生产日期 HashMap<String, Object> jsonMap = jsonList.get(i);
expirationDate = new Date(expiration.longValue()); //失效期 String VoucherType = jsonMap.get("VoucherType").toString();//类型
} BigDecimal quantity = BigDecimal.ZERO; Date manufactureDate = null;
if (StringUtils.equals("pm_receiptnotice", VoucherType)) { Date expirationDate = null;
quantity = new BigDecimal(jsonMap.get("quantity").toString());//入库数量 if (jsonMap.get("manufactureDate") instanceof Long) {
} else { manufactureDate = new Date((Long) jsonMap.get("manufactureDate")); //生产日期
quantity = new BigDecimal(jsonMap.get("quantity").toString()).negate();//入库数量
}
if (jsonMap.get("expirationDate") instanceof Long) {
expirationDate = new Date((Long) jsonMap.get("expirationDate")); //生产日期
}
BigDecimal quantity = BigDecimal.ZERO;
if (StringUtils.equals("pm_receiptnotice", VoucherType)) {
quantity = new BigDecimal(jsonMap.get("quantity").toString());//入库数量
} else {
quantity = new BigDecimal(jsonMap.get("quantity").toString()).negate();//入库数量
}
String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次
String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id
String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码
String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号
String licenceCode = jsonMap.get("licenceCode") != null ? jsonMap.get("licenceCode").toString() : null; // 生产许可证号
String producer = jsonMap.get("producer") != null ? jsonMap.get("producer").toString() : null; // 生产厂商
DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.number", QCP.equals, uniqueCode).and("tqq9_isauto", QCP.equals, true)});
DynamicObject tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", new QFilter[]{new QFilter("number", QCP.equals, registrationCode)});
DynamicObject tqq9_proxyandfactory = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", new QFilter[]{new QFilter("number", QCP.equals, producer)});
// 处理第一次逻辑
if (i == 0) {
// 第一次直接赋值
entry.set("qty", quantity);
entry.set("baseqty", quantity);
entry.set("tqq9_goods", tqq9_goodspackage);
entry.set("producedate", manufactureDate);
entry.set("expirydate", expirationDate);
entry.set("lotnumber", batch);
entry.set("tqq9_wmsdetailid", wmsDetailId);
entry.set("tqq9_licenseno", licenceCode);
entry.set("tqq9_registration", tqq9_registration);
entry.set("tqq9_proxyandfactory", tqq9_proxyandfactory);
} else {
DataEntityPropertyCollection properties = entry.getDataEntityType().getProperties();
// 后续循环复制entry并赋值
DynamicObject newEntry = new DynamicObject(dynamicObjectCollection.getDynamicObjectType());
for (IDataEntityProperty property : properties) {
newEntry.set(property.getName(), entry.get(property.getName()));
}
ORM orm = ORM.create();
Long id = orm.genLongId(EntityMetadataCache.getDataEntityType("im_purinbill"));
newEntry.set("id",id);
newEntry.set("qty", quantity);
newEntry.set("baseqty", quantity);
newEntry.set("tqq9_goods", tqq9_goodspackage);
newEntry.set("producedate", manufactureDate);
newEntry.set("expirydate", expirationDate);
newEntry.set("lotnumber", batch);
newEntry.set("tqq9_wmsdetailid", wmsDetailId);
newEntry.set("tqq9_licenseno", licenceCode);
newEntry.set("tqq9_registration", tqq9_registration);
newEntry.set("tqq9_proxyandfactory", tqq9_proxyandfactory);
// 处理完新entry后的逻辑比如加入集合或其他操作
iterator.add(newEntry);
}
}
} }
String batch = jsonMap.get("batch") != null ? jsonMap.get("batch").toString() : null; // 批次
String wmsDetailId = jsonMap.get("wmsDetailId") != null ? jsonMap.get("wmsDetailId").toString() : null; // WMS分录id
String uniqueCode = jsonMap.get("uniqueCode") != null ? jsonMap.get("uniqueCode").toString() : null; // 商品编码
String registrationCode = jsonMap.get("registrationCode") != null ? jsonMap.get("registrationCode").toString() : null; // 注册证号
String licenceCode = jsonMap.get("licenceCode") != null ? jsonMap.get("licenceCode").toString() : null; // 生产许可证号
String producer = jsonMap.get("producer") != null ? jsonMap.get("producer").toString() : null; // 生产厂商
DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.number", QCP.equals, uniqueCode).and("tqq9_isauto", QCP.equals, true)});
DynamicObject tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", new QFilter[]{new QFilter("number", QCP.equals, registrationCode)});
DynamicObject tqq9_proxyandfactory = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", new QFilter[]{new QFilter("number", QCP.equals, producer)});
entry.set("qty", quantity);
entry.set("baseqty", quantity);
entry.set("tqq9_goods", tqq9_goodspackage);
entry.set("producedate", manufactureDate);
entry.set("expirydate", expirationDate);
entry.set("lotnumber", batch);
entry.set("tqq9_wmsdetailid", wmsDetailId);
entry.set("tqq9_licenseno", licenceCode);
entry.set("tqq9_registration", tqq9_registration);
entry.set("tqq9_proxyandfactory", tqq9_proxyandfactory);
} }
} }
} }
} }

View File

@ -1,5 +1,6 @@
package tqq9.lc123.cloud.app.plugin.operate.im; package tqq9.lc123.cloud.app.plugin.operate.im;
import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
@ -49,7 +50,7 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI
//采购入库单 //采购入库单
DynamicObject im_purinbill = BusinessDataServiceHelper.loadSingle("im_purinbill", new QFilter[]{new QFilter("billno", QCP.equals, billno)}); DynamicObject im_purinbill = BusinessDataServiceHelper.loadSingle("im_purinbill", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
DynamicObjectCollection billentry = im_purinbill.getDynamicObjectCollection("billentry"); DynamicObjectCollection billentry = im_purinbill.getDynamicObjectCollection("billentry");
Map<String, Object> param = new HashMap<>(); Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>(); HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();
OperationResult operationResult1 = this.getOperationResult(); OperationResult operationResult1 = this.getOperationResult();
OperateOption option = this.getOption(); OperateOption option = this.getOption();
@ -66,7 +67,10 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI
String id = entry1.getString("id"); String id = entry1.getString("id");
if (StringUtils.equals(id, mainbillentryid)) { if (StringUtils.equals(id, mainbillentryid)) {
entitypkMap.computeIfAbsent(pm_purorderbill.getLong("id"), k -> new HashSet<>()).add(entry1.getLong("id")); entitypkMap.computeIfAbsent(pm_purorderbill.getLong("id"), k -> new HashSet<>()).add(entry1.getLong("id"));
param.put(id, qty); JSONObject jsonObject = new JSONObject();
jsonObject.put("qty",qty);
param.computeIfAbsent(id, k -> new HashSet<>()).add(jsonObject);
} }
} }

View File

@ -1,6 +1,7 @@
package tqq9.lc123.cloud.app.plugin.utils; package tqq9.lc123.cloud.app.plugin.utils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import kd.bos.data.BusinessDataReader; import kd.bos.data.BusinessDataReader;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.LocaleString; import kd.bos.dataentity.entity.LocaleString;
@ -74,7 +75,7 @@ public class BotpParamUtils {
* @throws KDBizException * @throws KDBizException
*/ */
public static PushArgs getPushArgs(String srcEntityNumber, String targetEntityNumber, String srcEntryEntity, public static PushArgs getPushArgs(String srcEntityNumber, String targetEntityNumber, String srcEntryEntity,
Map<String, Object> param, HashMap<Long, Set<Long>> entitypkMap, String rule) throws KDBizException{ Map<String, Set<JSONObject>> param, HashMap<Long, Set<Long>> entitypkMap, String rule) throws KDBizException{
PushArgs pushArgs = new PushArgs(); PushArgs pushArgs = new PushArgs();
pushArgs.setSourceEntityNumber(srcEntityNumber); // 必选源单标识 pushArgs.setSourceEntityNumber(srcEntityNumber); // 必选源单标识
pushArgs.setTargetEntityNumber(targetEntityNumber); // 必选目标单标识 pushArgs.setTargetEntityNumber(targetEntityNumber); // 必选目标单标识
@ -86,7 +87,7 @@ public class BotpParamUtils {
//传递参数 //传递参数
if(param != null) { if(param != null) {
for(Map.Entry<String, Object> obj : param.entrySet()) { for(Map.Entry<String, Set<JSONObject>> obj : param.entrySet()) {
pushArgs.getCustomParams().put(obj.getKey(),JSON.toJSONString(obj.getValue())); pushArgs.getCustomParams().put(obj.getKey(),JSON.toJSONString(obj.getValue()));
} }
} }