1.代码调试
This commit is contained in:
		
							parent
							
								
									6371693c46
								
							
						
					
					
						commit
						f04a7b98e6
					
				|  | @ -170,10 +170,10 @@ public class WMSPurInController { | |||
|             } | ||||
|             //参数值组装 | ||||
|             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 | ||||
|             JSONObject detailObject = new JSONObject(); | ||||
|             for (Object detail : details) { | ||||
|                 JSONObject detailObject = new JSONObject(); | ||||
|                 JSONObject detail1 = (JSONObject) detail; | ||||
|                 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 | ||||
|                 String wmsDetailId = detail1.getString("wmsDetailId");//WMS入库单细单号 | ||||
|  | @ -197,7 +197,8 @@ public class WMSPurInController { | |||
|                 detailObject.put("producer", producer); | ||||
|                 detailObject.put("VoucherType", VoucherType); | ||||
|                 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, "收货通知单_采购入库单_转换规则"); | ||||
|  | @ -274,10 +275,10 @@ public class WMSPurInController { | |||
|             } | ||||
|             //参数值组装 | ||||
|             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 | ||||
|             JSONObject detailObject = new JSONObject(); | ||||
|             for (Object detail : details) { | ||||
|                 JSONObject detailObject = new JSONObject(); | ||||
|                 JSONObject detail1 = (JSONObject) detail; | ||||
|                 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 | ||||
|                 BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量 | ||||
|  | @ -299,7 +300,7 @@ public class WMSPurInController { | |||
|                 detailObject.put("producer", producer); | ||||
|                 detailObject.put("VoucherType", VoucherType); | ||||
|                 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, "采购退货申请_采购入库_转换规则_扩展"); | ||||
|  | @ -376,10 +377,10 @@ public class WMSPurInController { | |||
|             } | ||||
|             //组装参数值 | ||||
|             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 | ||||
|             JSONObject detailObject = new JSONObject(); | ||||
|             for (Object detail : details) { | ||||
|                 JSONObject detailObject = new JSONObject(); | ||||
|                 JSONObject detail1 = (JSONObject) detail; | ||||
|                 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 | ||||
|                 BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量 | ||||
|  | @ -401,7 +402,7 @@ public class WMSPurInController { | |||
|                 detailObject.put("producer", producer); | ||||
|                 detailObject.put("VoucherType", VoucherType); | ||||
|                 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, "其他入库申请_其他入库_转换规则"); | ||||
|  | @ -586,7 +587,7 @@ public class WMSPurInController { | |||
|                 response.setFlag("failure"); | ||||
|                 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 | ||||
|             //参数值组装 | ||||
|             if (orderLines.get("orderLine") instanceof Map) { | ||||
|  | @ -629,7 +630,7 @@ public class WMSPurInController { | |||
|                 detailObject.put("producer", key2); | ||||
|                 detailObject.put("VoucherType", entryOrderType); | ||||
|                 entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); | ||||
|                 param.put(orderLineNo, detailObject); | ||||
|                 param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|             } else { | ||||
|                 JSONArray orderLine = orderLines.getJSONArray("orderLine"); | ||||
|                 for (Object obj : orderLine) { | ||||
|  | @ -672,7 +673,7 @@ public class WMSPurInController { | |||
|                     detailObject.put("producer", key2); | ||||
|                     detailObject.put("VoucherType", entryOrderType); | ||||
|                     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"); | ||||
|                 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 | ||||
|             //参数值组装 | ||||
|             if (orderLines.get("orderLine") instanceof Map) { | ||||
|  | @ -794,7 +795,7 @@ public class WMSPurInController { | |||
|                 detailObject.put("producer", key2); | ||||
|                 detailObject.put("VoucherType", entryOrderType); | ||||
|                 entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); | ||||
|                 param.put(orderLineNo, detailObject); | ||||
|                 param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|             } else { | ||||
|                 JSONArray orderLine = orderLines.getJSONArray("orderLine"); | ||||
|                 for (Object obj : orderLine) { | ||||
|  | @ -837,7 +838,7 @@ public class WMSPurInController { | |||
|                     detailObject.put("producer", key2); | ||||
|                     detailObject.put("VoucherType", entryOrderType); | ||||
|                     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"); | ||||
|                 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 | ||||
|             //参数值组装 | ||||
|             if (orderLines.get("orderLine") instanceof Map) { | ||||
|  | @ -962,7 +963,7 @@ public class WMSPurInController { | |||
|                 detailObject.put("producer", key2); | ||||
|                 detailObject.put("VoucherType", entryOrderType); | ||||
|                 entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); | ||||
|                 param.put(orderLineNo, detailObject); | ||||
|                 param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|             } else { | ||||
|                 JSONArray orderLine = orderLines.getJSONArray("orderLine"); | ||||
|                 for (Object obj : orderLine) { | ||||
|  | @ -1005,7 +1006,7 @@ public class WMSPurInController { | |||
|                     detailObject.put("producer", key2); | ||||
|                     detailObject.put("VoucherType", entryOrderType); | ||||
|                     entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); | ||||
|                     param.put(orderLineNo, detailObject); | ||||
|                     param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|  |  | |||
|  | @ -163,10 +163,10 @@ public class WMSSaleOutController { | |||
|             } | ||||
|             //参数值组装 | ||||
|             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 | ||||
|             JSONObject detailObject = new JSONObject(); | ||||
|             for (Object detail : details) { | ||||
|                 JSONObject detailObject = new JSONObject(); | ||||
|                 JSONObject detail1 = (JSONObject) detail; | ||||
|                 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 | ||||
|                 String wmsDetailId = detail1.getString("wmsDetailId");//WMS入库单细单号 | ||||
|  | @ -190,7 +190,7 @@ public class WMSSaleOutController { | |||
|                 detailObject.put("producer", producer); | ||||
|                 detailObject.put("VoucherType", VoucherType); | ||||
|                 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, "发货通知单_销售出库单_转换规则_扩展"); | ||||
|  | @ -267,10 +267,10 @@ public class WMSSaleOutController { | |||
|             } | ||||
|             //参数值组装 | ||||
|             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 | ||||
|             JSONObject detailObject = new JSONObject(); | ||||
|             for (Object detail : details) { | ||||
|                 JSONObject detailObject = new JSONObject(); | ||||
|                 JSONObject detail1 = (JSONObject) detail; | ||||
|                 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 | ||||
|                 BigDecimal quantity = detail1.getBigDecimal("quantity");//出库数量 | ||||
|  | @ -292,7 +292,8 @@ public class WMSSaleOutController { | |||
|                 detailObject.put("producer", producer); | ||||
|                 detailObject.put("VoucherType", VoucherType); | ||||
|                 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, "销售退货申请单_销售出库单_转换规则_扩展"); | ||||
|  | @ -381,10 +382,10 @@ public class WMSSaleOutController { | |||
|             String rule = BotpParamUtils.getBotpRuleId(TQQ9_OTHEROUTAPPLY, IM_OTHEROUTBILL, rulanema); | ||||
|             //组装参数值 | ||||
|             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 | ||||
|             JSONObject detailObject = new JSONObject(); | ||||
|             for (Object detail : details) { | ||||
|                 JSONObject detailObject = new JSONObject(); | ||||
|                 JSONObject detail1 = (JSONObject) detail; | ||||
|                 String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号 | ||||
|                 BigDecimal quantity = detail1.getBigDecimal("quantity");//出库数量 | ||||
|  | @ -406,7 +407,7 @@ public class WMSSaleOutController { | |||
|                 detailObject.put("producer", producer); | ||||
|                 detailObject.put("VoucherType", VoucherType); | ||||
|                 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); | ||||
|  | @ -586,7 +587,7 @@ public class WMSSaleOutController { | |||
|                 response.setFlag("failure"); | ||||
|                 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 | ||||
|             //参数值组装 | ||||
|             if (orderLines.get("orderLine") instanceof Map) { | ||||
|  | @ -629,7 +630,7 @@ public class WMSSaleOutController { | |||
|                 detailObject.put("producer", key2); | ||||
|                 detailObject.put("VoucherType", orderType); | ||||
|                 entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); | ||||
|                 param.put(orderLineNo, detailObject); | ||||
|                 param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|             } else { | ||||
|                 JSONArray orderLine = orderLines.getJSONArray("orderLine"); | ||||
|                 for (Object obj : orderLine) { | ||||
|  | @ -672,7 +673,7 @@ public class WMSSaleOutController { | |||
|                     detailObject.put("producer", key2); | ||||
|                     detailObject.put("VoucherType", orderType); | ||||
|                     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); | ||||
|             } | ||||
|             //参数值组装 | ||||
|             Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 | ||||
|             Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数 | ||||
|             HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map | ||||
|             if (orderLines.get("orderLine") instanceof Map) { | ||||
|                 JSONObject orderLine = orderLines.getJSONObject("orderLine"); | ||||
|  | @ -794,7 +795,7 @@ public class WMSSaleOutController { | |||
|                 detailObject.put("producer", key2); | ||||
|                 detailObject.put("VoucherType", orderType); | ||||
|                 entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); | ||||
|                 param.put(orderLineNo, detailObject); | ||||
|                 param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|             } else { | ||||
|                 JSONArray orderLine = orderLines.getJSONArray("orderLine"); | ||||
|                 for (Object obj : orderLine) { | ||||
|  | @ -837,7 +838,7 @@ public class WMSSaleOutController { | |||
|                     detailObject.put("producer", key2); | ||||
|                     detailObject.put("VoucherType", orderType); | ||||
|                     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); | ||||
|             //组装参数值 | ||||
|             Map<String, Object> param = new HashMap<>();//传入转换规则处理参数 | ||||
|             Map<String, Set<JSONObject>> param = new HashMap<>();//传入转换规则处理参数 | ||||
|             HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map | ||||
|             if (orderLines.get("orderLine") instanceof Map) { | ||||
|                 JSONObject orderLine = orderLines.getJSONObject("orderLine"); | ||||
|  | @ -973,7 +974,7 @@ public class WMSSaleOutController { | |||
|                 detailObject.put("producer", key2); | ||||
|                 detailObject.put("VoucherType", orderType); | ||||
|                 entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine.getLong("orderLineNo")); | ||||
|                 param.put(orderLineNo, detailObject); | ||||
|                 param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|             } else { | ||||
|                 JSONArray orderLine = orderLines.getJSONArray("orderLine"); | ||||
|                 for (Object obj : orderLine) { | ||||
|  | @ -1016,7 +1017,7 @@ public class WMSSaleOutController { | |||
|                     detailObject.put("producer", key2); | ||||
|                     detailObject.put("VoucherType", orderType); | ||||
|                     entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(orderLine1.getLong("orderLineNo")); | ||||
|                     param.put(orderLineNo, detailObject); | ||||
|                     param.computeIfAbsent(orderLineNo, k -> new HashSet<>()).add(detailObject); | ||||
|                 } | ||||
|             } | ||||
|             //开始下推 | ||||
|  |  | |||
|  | @ -1,24 +1,27 @@ | |||
| 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.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.ExtendedDataEntitySet; | ||||
| import kd.bos.entity.botp.plugin.AbstractConvertPlugIn; | ||||
| import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs; | ||||
| import kd.bos.logging.Log; | ||||
| import kd.bos.logging.LogFactory; | ||||
| import kd.bos.orm.ORM; | ||||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| 
 | ||||
| import java.math.BigDecimal; | ||||
| import java.util.Date; | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
| import java.util.*; | ||||
| 
 | ||||
| /** | ||||
|  * 采购入库转换插件 | ||||
|  | @ -51,23 +54,35 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin | |||
|             //采购入库单 | ||||
|             DynamicObject dataEntity = extendedDataEntity.getDataEntity(); | ||||
|             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"); | ||||
|                 //核心单据号一致,写入数据 | ||||
|                 if (variables.containsKey(srcbillentryid)) { | ||||
|                     String jsonString = variables.get(srcbillentryid); | ||||
|                     Gson gson = new Gson(); | ||||
|                     // 将 JSON 字符串转换为 HashMap | ||||
|                     HashMap<String, Object> jsonMap = gson.fromJson(jsonString, HashMap.class); | ||||
|                     ObjectMapper objectMapper = new ObjectMapper(); | ||||
|                     List<HashMap<String, Object>> jsonList = null; | ||||
|                     try { | ||||
|                         jsonList = objectMapper.readValue(jsonString, objectMapper.getTypeFactory().constructCollectionType(List.class, HashMap.class)); | ||||
|                     } catch (JsonProcessingException ex) { | ||||
|                         throw new RuntimeException(ex); | ||||
|                     } | ||||
|                     if (jsonList != null) { | ||||
|                         for (int i = 0; i < jsonList.size(); i++) { | ||||
|                             HashMap<String, Object> jsonMap = jsonList.get(i); | ||||
|                             String VoucherType = jsonMap.get("VoucherType").toString();//类型 | ||||
|                     Double manufacture = (Double) jsonMap.get("manufactureDate"); | ||||
|                     Double expiration = (Double) jsonMap.get("expirationDate"); | ||||
|                             Date manufactureDate = null; | ||||
|                             Date expirationDate = null; | ||||
|                     if (manufacture != null && expiration != null) { | ||||
|                         manufactureDate = new Date(manufacture.longValue()); //生产日期 | ||||
|                         expirationDate = new Date(expiration.longValue()); //失效期 | ||||
|                     }                    BigDecimal quantity = BigDecimal.ZERO; | ||||
|                             if (jsonMap.get("manufactureDate") instanceof Long) { | ||||
|                                 manufactureDate = new Date((Long) jsonMap.get("manufactureDate")); //生产日期 | ||||
| 
 | ||||
|                             } | ||||
|                             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 { | ||||
|  | @ -82,6 +97,9 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin | |||
|                             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); | ||||
|  | @ -92,11 +110,37 @@ public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin | |||
|                                 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); | ||||
|                             } | ||||
| 
 | ||||
|                         } | ||||
| 
 | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  | @ -1,5 +1,6 @@ | |||
| package tqq9.lc123.cloud.app.plugin.operate.im; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.dataentity.OperateOption; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| 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)}); | ||||
|                 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<>(); | ||||
|                 OperationResult operationResult1 = this.getOperationResult(); | ||||
|                 OperateOption option = this.getOption(); | ||||
|  | @ -66,7 +67,10 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI | |||
|                         String id = entry1.getString("id"); | ||||
|                         if (StringUtils.equals(id, mainbillentryid)) { | ||||
|                             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); | ||||
| 
 | ||||
|                         } | ||||
|                     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| package tqq9.lc123.cloud.app.plugin.utils; | ||||
| 
 | ||||
| import com.alibaba.fastjson.JSON; | ||||
| import com.alibaba.fastjson.JSONObject; | ||||
| import kd.bos.data.BusinessDataReader; | ||||
| import kd.bos.dataentity.entity.DynamicObject; | ||||
| import kd.bos.dataentity.entity.LocaleString; | ||||
|  | @ -74,7 +75,7 @@ public class BotpParamUtils { | |||
|      * @throws KDBizException | ||||
|      */ | ||||
|     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.setSourceEntityNumber(srcEntityNumber);		// 必选,源单标识 | ||||
|         pushArgs.setTargetEntityNumber(targetEntityNumber);		// 必选,目标单标识 | ||||
|  | @ -86,7 +87,7 @@ public class BotpParamUtils { | |||
| 
 | ||||
|         //传递参数 | ||||
|         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())); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue