Wms接口入参调整
This commit is contained in:
		
							parent
							
								
									d7085d552d
								
							
						
					
					
						commit
						715155bcd1
					
				|  | @ -14,12 +14,12 @@ import kd.bos.openapi.common.result.CustomApiResult; | |||
| import kd.bos.orm.query.QCP; | ||||
| import kd.bos.orm.query.QFilter; | ||||
| import kd.bos.servicehelper.BusinessDataServiceHelper; | ||||
| import kd.bos.servicehelper.botp.BFTrackerServiceHelper; | ||||
| import kd.sdk.plugin.Plugin; | ||||
| import tqq9.lc123.cloud.app.api.model.WMSInvoiceQueryModel; | ||||
| import tqq9.lc123.cloud.app.api.utils.Constants; | ||||
| 
 | ||||
| import java.util.*; | ||||
| import java.util.ArrayList; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  * WMS发票接口 | ||||
|  | @ -31,20 +31,21 @@ public class WMSInvoiceQueryController extends AbstractFormPlugin implements Plu | |||
| 
 | ||||
|     @ApiPostMapping(value = "/WMS_InvoiceQuery", desc = "WMS发票查询api接口") | ||||
|     public CustomApiResult<WMSInvoiceQueryModel> WMS_InvoiceQuery | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) { | ||||
|             ( | ||||
|                     @NotNull @ApiParam(value = "发运单号", required = true) String cDPCode, | ||||
|                     @NotNull @ApiParam(value = "归属", required = true) String BelongTo | ||||
|             ) { | ||||
|         WMSInvoiceQueryModel wmsInvoiceQueryModel = new WMSInvoiceQueryModel(); | ||||
|         List<WMSInvoiceQueryModel.ResultBean> result =  new ArrayList<>(); | ||||
|         WMSInvoiceQueryModel.ResultBean resultBean = new WMSInvoiceQueryModel.ResultBean(); | ||||
|         String billno = data.get("cDPCode").toString();//发货通知单编号 | ||||
|         String billno = cDPCode; | ||||
|         String fileurl = null; | ||||
|         QFilter qFilter = new QFilter("billno", QCP.in, billno); | ||||
|         qFilter.and("billstatus", QCP.equals, "C"); | ||||
|         DynamicObject sm_delivernotice = BusinessDataServiceHelper.loadSingle(Constants.SM_DELIVERNOTICE, qFilter.toArray()); | ||||
|         if (sm_delivernotice != null) { | ||||
| //            String mainbillnumber = sm_delivernotice.getString("mainbillnumber");//核心单据编号 | ||||
|             DynamicObjectCollection billentry = sm_delivernotice.getDynamicObjectCollection("billentry");//物料分录 | ||||
|             String mainbillnumber = billentry.get(0).getString("mainbillnumber");//核心单据编号 | ||||
| 
 | ||||
|             DynamicObject sm_salorder = BusinessDataServiceHelper.loadSingle(Constants.SM_SALORDER, new QFilter[]{new QFilter("billno", QCP.equals, mainbillnumber).and("billentry.hasarbusbill", QCP.equals, true)}); | ||||
|             if (sm_salorder != null) { | ||||
|                 DynamicObject sim_original_bil = BusinessDataServiceHelper.loadSingle(Constants.SIM_ORIGINAL_BILL, new QFilter[]{new QFilter("sim_original_bill_item.corebillno", QCP.equals, mainbillnumber)}); | ||||
|  | @ -62,45 +63,4 @@ public class WMSInvoiceQueryController extends AbstractFormPlugin implements Plu | |||
|         wmsInvoiceQueryModel.setResult(result); | ||||
|         return CustomApiResult.success(wmsInvoiceQueryModel); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     /** | ||||
|      * 下查寻找对应类型的所有单据 | ||||
|      * | ||||
|      * @param targetLabel | ||||
|      * @param targetId | ||||
|      * @return | ||||
|      */ | ||||
|     private HashSet<Long> getDocumentsByType(String targetLabel, Long targetId) { | ||||
|         Map<String, HashSet<Long>> srcBills = BFTrackerServiceHelper.findTargetBills(targetLabel, new Long[]{targetId}); | ||||
|         Map<String, HashSet<Long>> nextSrcBills = new HashMap<>(); | ||||
|         HashSet<Long> returnids = new HashSet<>(); | ||||
|         if (srcBills == null && srcBills.isEmpty()) { | ||||
|             return null; | ||||
|         } else { | ||||
|             do { | ||||
|                 for (Map.Entry<String, HashSet<Long>> entry : srcBills.entrySet()) { | ||||
|                     String srcLabel = entry.getKey();  // 获取下单据标识 | ||||
|                     HashSet<Long> srcIds = entry.getValue();  // 获取下游单据ID | ||||
|                     if (StringUtils.equals(srcLabel, "sim_original_bill")) { | ||||
|                         returnids.addAll(srcIds); | ||||
|                     } else { | ||||
|                         Map<String, HashSet<Long>> newSrcBills = BFTrackerServiceHelper.findTargetBills(targetLabel, srcIds.toArray(new Long[srcIds.size()])); | ||||
|                         for (Map.Entry<String, HashSet<Long>> newEntry : newSrcBills.entrySet()) { | ||||
|                             // 如果 nextSrcBills 中已经存在相同的 key,使用 addAll 合并集合 | ||||
|                             if (nextSrcBills.containsKey(newEntry.getKey())) { | ||||
|                                 nextSrcBills.get(newEntry.getKey()).addAll(entry.getValue()); | ||||
|                             } else { | ||||
|                                 // 如果 nextSrcBills 中不存在该 key,直接添加 | ||||
|                                 nextSrcBills.put(entry.getKey(), new HashSet<>(entry.getValue())); | ||||
|                             } | ||||
|                         } | ||||
|                         srcBills = nextSrcBills; | ||||
|                         nextSrcBills.clear(); | ||||
|                     } | ||||
|                 } | ||||
|             } while (srcBills.isEmpty()); | ||||
|         } | ||||
|         return returnids; | ||||
|     } | ||||
| } | ||||
|  | @ -18,7 +18,6 @@ import tqq9.lc123.cloud.app.api.utils.ApiResultExt; | |||
| import tqq9.lc123.cloud.app.api.utils.Constants; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| 
 | ||||
| /** | ||||
|  | @ -28,15 +27,19 @@ import java.util.List; | |||
| 
 | ||||
| public class WMSLogiSyncController { | ||||
|     private final static Log logger = LogFactory.getLog(WMSLogiSyncController.class); | ||||
| 
 | ||||
| 
 | ||||
|     @ApiPostMapping(value = "/WMS_LogiSync", desc = "WMS物流信息同步api插件") | ||||
|     public CustomApiResult<ApiResultExt> WMS_LogiSync | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) { | ||||
|             ( | ||||
|                     @NotNull @ApiParam(value = "发运单号", required = true) String cDPCode, | ||||
|                     @NotNull @ApiParam(value = "快递公司", required = true) String ExpressCompany, | ||||
|                     @NotNull @ApiParam(value = "快递单号", required = true) String cWayBillCode | ||||
|             ) { | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         resultExt.setResult(results); | ||||
|         String billno =  data.get("cDPCode").toString();//发货通知单编号 | ||||
| //        Gson gson = new Gson(); | ||||
| //        HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class); | ||||
|         String billno = cDPCode; | ||||
|         ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|         results.add(resultBean); | ||||
|         JSONObject keys = new JSONObject(); | ||||
|  | @ -52,8 +55,8 @@ public class WMSLogiSyncController { | |||
|         resultBean.setNumber(billno); | ||||
|         resultBean.setType(Constants.TYPE_UPDATE); | ||||
|         String entityType = Constants.IM_PURINBILL; | ||||
|         String ExpressCompany =  data.get("ExpressCompany").toString();//快递公司 | ||||
|         String cWayBillCode =  data.get("cWayBillCode").toString();//快递单号 | ||||
| //        String ExpressCompany =  data.get("ExpressCompany").toString();//快递公司 | ||||
| //        String cWayBillCode =  data.get("cWayBillCode").toString();//快递单号 | ||||
|         //必填项校验 | ||||
|         if (ApiResultExt.validateRequired(billno, "String")) { | ||||
|             errorMsg="传入参数 cDPCode 为空"; | ||||
|  |  | |||
|  | @ -31,13 +31,19 @@ public class WMSPurInCloseController { | |||
| 
 | ||||
|     @ApiPostMapping(value = "/WMSPurInClose", desc = "WMS-入库关闭") | ||||
|     public CustomApiResult<ApiResultExt> WMSPurInClose | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) { | ||||
|             ( | ||||
|                     @NotNull @ApiParam(value = "来源单据号", required = true) String cVouCode, | ||||
|                     @NotNull @ApiParam(value = "单据类型", required = true) String VoucherType, | ||||
|                     @NotNull @ApiParam(value = "归属", required = true) String BelongTo | ||||
|             ) { | ||||
|         //返回值初始化 | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         resultExt.setResult(results); | ||||
|         String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = (String) data.get("cVouCode");//单据编号 | ||||
| //        Gson gson = new Gson(); | ||||
| //        HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class); | ||||
| //        String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = cVouCode;//单据编号 | ||||
|         ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|         results.add(resultBean); | ||||
|         JSONObject key = new JSONObject(); | ||||
|  |  | |||
|  | @ -42,14 +42,23 @@ public class WMSPurInController { | |||
| 
 | ||||
|     @ApiPostMapping(value = "/WMSPushPurIn", desc = "WMS-入库回传") | ||||
|     public CustomApiResult<ApiResultExt> WMS_PurInPush | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) { | ||||
|             ( | ||||
|                     @NotNull @ApiParam(value = "金蝶源头单据号", required = true) String erpOrderCode, | ||||
|                     @NotNull @ApiParam(value = "WMS入库单号", required = true) String wmsOrderCode, | ||||
|                     @NotNull @ApiParam(value = "单据类型", required = true) String VoucherType, | ||||
|                     @NotNull @ApiParam(value = "库区编号", required = true) String wareCode, | ||||
|                     @NotNull @ApiParam(value = "归属", required = true) String companyType, | ||||
|                     @NotNull @ApiParam(value = "明细", required = true) JSONArray details | ||||
|             ) { | ||||
|         //返回值初始化 | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         resultExt.setResult(results); | ||||
|         String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = (String) data.get("erpOrderCode");//收货通知单编号 | ||||
|         JSONArray details = (JSONArray) data.get("details"); | ||||
| //        Gson gson = new Gson(); | ||||
| //        HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class); | ||||
| //        String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = erpOrderCode;//收货通知单编号 | ||||
| //        JSONArray details = (JSONArray) data.get("details"); | ||||
|         ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|         results.add(resultBean); | ||||
|         JSONObject key = new JSONObject(); | ||||
|  |  | |||
|  | @ -19,7 +19,9 @@ import kd.bos.servicehelper.operation.SaveServiceHelper; | |||
| import tqq9.lc123.cloud.app.api.utils.ApiResultExt; | ||||
| import tqq9.lc123.cloud.app.api.utils.Constants; | ||||
| 
 | ||||
| import java.util.*; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| 
 | ||||
| 
 | ||||
| @ApiController(value = "WMSSaleOutCloseController", desc = "WMS-出库关闭") | ||||
|  | @ -30,13 +32,18 @@ public class WMSSaleOutCloseController { | |||
| 
 | ||||
|     @ApiPostMapping(value = "/WMSSaleOutClose", desc = "WMS-出库关闭") | ||||
|     public CustomApiResult<ApiResultExt> WMSSaleOutClose | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) { | ||||
|             ( | ||||
|                     @NotNull @ApiParam(value = "来源单据号", required = true) String cVouCode, | ||||
|                     @NotNull @ApiParam(value = "单据类型", required = true) String VoucherType, | ||||
|                     @NotNull @ApiParam(value = "归属", required = true) String BelongTo            ) { | ||||
|         //返回值初始化 | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         resultExt.setResult(results); | ||||
|         String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = (String) data.get("cVouCode");//单据编号 | ||||
| //        Gson gson = new Gson(); | ||||
| //        HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class); | ||||
| //        String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = cVouCode;//单据编号 | ||||
|         ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|         results.add(resultBean); | ||||
|         JSONObject key = new JSONObject(); | ||||
|  |  | |||
|  | @ -43,14 +43,22 @@ public class WMSSaleOutController { | |||
| 
 | ||||
|     @ApiPostMapping(value = "/WMS_SaleOutnPush", desc = "WMS-出库回传") | ||||
|     public CustomApiResult<ApiResultExt> WMS_SaleOutnPush | ||||
|             (@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) { | ||||
|             ( | ||||
|                     @NotNull @ApiParam(value = "金蝶源头单据号", required = true) String erpOrderCode, | ||||
|                     @NotNull @ApiParam(value = "WMS入库单号", required = true) String wmsOrderCode, | ||||
|                     @NotNull @ApiParam(value = "单据类型", required = true) String VoucherType, | ||||
|                     @NotNull @ApiParam(value = "库区编号", required = true) String wareCode, | ||||
|                     @NotNull @ApiParam(value = "归属", required = true) String companyType, | ||||
|                     @NotNull @ApiParam(value = "明细", required = true) JSONArray details            ) { | ||||
|         //返回值初始化 | ||||
|         ApiResultExt resultExt = new ApiResultExt(); | ||||
|         List<ApiResultExt.ResultBean> results = new ArrayList<>(); | ||||
|         resultExt.setResult(results); | ||||
|         String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = (String) data.get("erpOrderCode");//单据编号 | ||||
|         JSONArray details = (JSONArray) data.get("details"); | ||||
| //        Gson gson = new Gson(); | ||||
| //        HashMap<String, Object> data = gson.fromJson(dataString, HashMap.class); | ||||
| //        String VoucherType = (String) data.get("VoucherType");//单据类型 | ||||
|         String billno = erpOrderCode;//单据编号 | ||||
| //        JSONArray details = (JSONArray) data.get("details"); | ||||
|         ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean(); | ||||
|         results.add(resultBean); | ||||
|         JSONObject key = new JSONObject(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue