From 715155bcd1ad150233c37e4552b5760fd7fc1eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9A=E8=B1=86=E8=B1=86?= <13356128+sunandmoon60@user.noreply.gitee.com> Date: Fri, 26 Sep 2025 17:42:35 +0800 Subject: [PATCH] =?UTF-8?q?Wms=E6=8E=A5=E5=8F=A3=E5=85=A5=E5=8F=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WMSInvoiceQueryController.java | 54 +++---------------- .../api/controller/WMSLogiSyncController.java | 17 +++--- .../controller/WMSPurInCloseController.java | 12 +++-- .../api/controller/WMSPurInController.java | 17 ++++-- .../controller/WMSSaleOutCloseController.java | 15 ++++-- .../api/controller/WMSSaleOutController.java | 16 ++++-- 6 files changed, 62 insertions(+), 69 deletions(-) diff --git a/lc123/cloud/app/api/controller/WMSInvoiceQueryController.java b/lc123/cloud/app/api/controller/WMSInvoiceQueryController.java index c7a98a9..b56a59e 100644 --- a/lc123/cloud/app/api/controller/WMSInvoiceQueryController.java +++ b/lc123/cloud/app/api/controller/WMSInvoiceQueryController.java @@ -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 WMS_InvoiceQuery - (@NotNull @ApiParam(value = "入参", example = "") HashMap data) { + ( + @NotNull @ApiParam(value = "发运单号", required = true) String cDPCode, + @NotNull @ApiParam(value = "归属", required = true) String BelongTo + ) { WMSInvoiceQueryModel wmsInvoiceQueryModel = new WMSInvoiceQueryModel(); List 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 getDocumentsByType(String targetLabel, Long targetId) { - Map> srcBills = BFTrackerServiceHelper.findTargetBills(targetLabel, new Long[]{targetId}); - Map> nextSrcBills = new HashMap<>(); - HashSet returnids = new HashSet<>(); - if (srcBills == null && srcBills.isEmpty()) { - return null; - } else { - do { - for (Map.Entry> entry : srcBills.entrySet()) { - String srcLabel = entry.getKey(); // 获取下单据标识 - HashSet srcIds = entry.getValue(); // 获取下游单据ID - if (StringUtils.equals(srcLabel, "sim_original_bill")) { - returnids.addAll(srcIds); - } else { - Map> newSrcBills = BFTrackerServiceHelper.findTargetBills(targetLabel, srcIds.toArray(new Long[srcIds.size()])); - for (Map.Entry> 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; - } } \ No newline at end of file diff --git a/lc123/cloud/app/api/controller/WMSLogiSyncController.java b/lc123/cloud/app/api/controller/WMSLogiSyncController.java index 5a00da5..2f68dc6 100644 --- a/lc123/cloud/app/api/controller/WMSLogiSyncController.java +++ b/lc123/cloud/app/api/controller/WMSLogiSyncController.java @@ -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 WMS_LogiSync - (@NotNull @ApiParam(value = "入参", example = "") HashMap 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 results = new ArrayList<>(); resultExt.setResult(results); - String billno = data.get("cDPCode").toString();//发货通知单编号 +// Gson gson = new Gson(); +// HashMap 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 为空"; diff --git a/lc123/cloud/app/api/controller/WMSPurInCloseController.java b/lc123/cloud/app/api/controller/WMSPurInCloseController.java index a564ae4..e8f8d8e 100644 --- a/lc123/cloud/app/api/controller/WMSPurInCloseController.java +++ b/lc123/cloud/app/api/controller/WMSPurInCloseController.java @@ -31,13 +31,19 @@ public class WMSPurInCloseController { @ApiPostMapping(value = "/WMSPurInClose", desc = "WMS-入库关闭") public CustomApiResult WMSPurInClose - (@NotNull @ApiParam(value = "入参", example = "") HashMap 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 results = new ArrayList<>(); resultExt.setResult(results); - String VoucherType = (String) data.get("VoucherType");//单据类型 - String billno = (String) data.get("cVouCode");//单据编号 +// Gson gson = new Gson(); +// HashMap 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(); diff --git a/lc123/cloud/app/api/controller/WMSPurInController.java b/lc123/cloud/app/api/controller/WMSPurInController.java index 2422f48..8faca2e 100644 --- a/lc123/cloud/app/api/controller/WMSPurInController.java +++ b/lc123/cloud/app/api/controller/WMSPurInController.java @@ -42,14 +42,23 @@ public class WMSPurInController { @ApiPostMapping(value = "/WMSPushPurIn", desc = "WMS-入库回传") public CustomApiResult WMS_PurInPush - (@NotNull @ApiParam(value = "入参", example = "") HashMap 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 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 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(); diff --git a/lc123/cloud/app/api/controller/WMSSaleOutCloseController.java b/lc123/cloud/app/api/controller/WMSSaleOutCloseController.java index 66f9be8..5684e1c 100644 --- a/lc123/cloud/app/api/controller/WMSSaleOutCloseController.java +++ b/lc123/cloud/app/api/controller/WMSSaleOutCloseController.java @@ -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 WMSSaleOutClose - (@NotNull @ApiParam(value = "入参", example = "") HashMap 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 results = new ArrayList<>(); resultExt.setResult(results); - String VoucherType = (String) data.get("VoucherType");//单据类型 - String billno = (String) data.get("cVouCode");//单据编号 +// Gson gson = new Gson(); +// HashMap 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(); diff --git a/lc123/cloud/app/api/controller/WMSSaleOutController.java b/lc123/cloud/app/api/controller/WMSSaleOutController.java index 73cb4b8..91ce99b 100644 --- a/lc123/cloud/app/api/controller/WMSSaleOutController.java +++ b/lc123/cloud/app/api/controller/WMSSaleOutController.java @@ -43,14 +43,22 @@ public class WMSSaleOutController { @ApiPostMapping(value = "/WMS_SaleOutnPush", desc = "WMS-出库回传") public CustomApiResult WMS_SaleOutnPush - (@NotNull @ApiParam(value = "入参", example = "") HashMap 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 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 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();