From ffb6103ea55326bcf419147337a0abc50395a5a4 Mon Sep 17 00:00:00 2001 From: sez Date: Tue, 11 Nov 2025 14:34:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=B4=A7=E9=80=9A=E7=9F=A5=E5=8D=95?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/PmReceiptNoticeFormPlugin.java | 33 +++++++++++ .../result/PmReceiptNoticeListPlugin.java | 37 ++++++++++++ .../plugin/utils/BillCloseCancelUtils.java | 59 +++++++++++++++++++ 3 files changed, 129 insertions(+) diff --git a/lc123/cloud/app/plugin/form/result/PmReceiptNoticeFormPlugin.java b/lc123/cloud/app/plugin/form/result/PmReceiptNoticeFormPlugin.java index 6ae8623..fe874af 100644 --- a/lc123/cloud/app/plugin/form/result/PmReceiptNoticeFormPlugin.java +++ b/lc123/cloud/app/plugin/form/result/PmReceiptNoticeFormPlugin.java @@ -86,5 +86,38 @@ public class PmReceiptNoticeFormPlugin extends AbstractBillPlugIn { } } + else if ("tqq9_partclose".equals(itemKey)) { + String billNo = (String) this.getModel().getValue("billno"); + String message = null; + DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse", + new QFilter[]{new QFilter("billno", QCP.equals, billNo)}); + + String entityType = "pm_receiptnotice"; + String entityName; + String label = "tqq9_ispartclose"; + DynamicObject receiveorg = dataEntity.getDynamicObject("receiveorg");//收货组织 + if (null != receiveorg) { + String number = receiveorg.getString("number"); + if ("SHLC".equals(number)) { + DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry"); + String warehouseCode = null; + for (DynamicObject dynamicObject : billentry) { + DynamicObject warehouse = dynamicObject.getDynamicObject("warehouse"); + if (null != warehouse) { + warehouseCode = warehouse.getString("number"); + } + } + String orderType = "CGRK"; + entityName = "WMS-SH-收货通知单部分取消"; + message = BillCloseCancelUtils.wmsPartClose(orderType, warehouseCode, billNo, entityType, entityName, label); + } + if (StringUtils.isNotEmpty(message)) { + this.getView().showMessage(String.valueOf(message)); + + } + + } + + } } } diff --git a/lc123/cloud/app/plugin/form/result/PmReceiptNoticeListPlugin.java b/lc123/cloud/app/plugin/form/result/PmReceiptNoticeListPlugin.java index 432ac2e..16246c9 100644 --- a/lc123/cloud/app/plugin/form/result/PmReceiptNoticeListPlugin.java +++ b/lc123/cloud/app/plugin/form/result/PmReceiptNoticeListPlugin.java @@ -107,6 +107,43 @@ public class PmReceiptNoticeListPlugin extends AbstractListPlugin { } + } else if ("tqq9_partclose".equals(itemKey)) { + BillList billList = this.getControl("billlistap"); + ListSelectedRowCollection selectedRows = billList.getSelectedRows(); + List billnoList = selectedRows.stream().map(ListSelectedRow::getBillNo).distinct().collect(Collectors.toList()); + for (String billNo : billnoList) { + String message = null; + DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle("pm_receiptnotice", "id,billno,receiveorg,billentry.warehouse", + new QFilter[]{new QFilter("billno", QCP.equals, billNo)}); + + String entityType = "pm_receiptnotice"; + String entityName; + String label = "tqq9_ispartclose"; + DynamicObject receiveorg = dataEntity.getDynamicObject("receiveorg");//收货组织 + if (null != receiveorg) { + String number = receiveorg.getString("number"); + if ("SHLC".equals(number)) { + DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry"); + String warehouseCode = null; + for (DynamicObject dynamicObject : billentry) { + DynamicObject warehouse = dynamicObject.getDynamicObject("warehouse"); + if (null != warehouse) { + warehouseCode = warehouse.getString("number"); + } + } + String orderType = "CGRK"; + entityName = "WMS-SH-收货通知单部分取消"; + message = BillCloseCancelUtils.wmsPartClose(orderType, warehouseCode, billNo, entityType, entityName, label); + } + if (StringUtils.isNotEmpty(message)) { + this.getView().showMessage(String.valueOf(message)); + + } + + } + + } + } } } diff --git a/lc123/cloud/app/plugin/utils/BillCloseCancelUtils.java b/lc123/cloud/app/plugin/utils/BillCloseCancelUtils.java index 03d0585..3b6ac57 100644 --- a/lc123/cloud/app/plugin/utils/BillCloseCancelUtils.java +++ b/lc123/cloud/app/plugin/utils/BillCloseCancelUtils.java @@ -265,4 +265,63 @@ public class BillCloseCancelUtils { } return message; } + + + /** + * 通天晓单据部分关闭 + * + * @param orderType 单据类型 + * @param warehouseCode 仓库编号 + * @param billNo 单据编号 + * @param entityType 单据标识 + * @param entityName 单据名称 + * @param label 推送标识 + * @return 取消结果 + */ + public static String wmsPartClose(String orderType, String warehouseCode, String billNo, String entityType, String entityName, String label) { + String method = "entryorder.close"; + String message = null; + Map request = new HashMap<>(); + request.put("warehouseCode", warehouseCode); + request.put("ownerCode", "LICHI"); + request.put("orderCode", billNo); + request.put("orderId", ""); + request.put("orderType", orderType); + request.put("closeReason", ""); + Map finalMap = new HashMap<>(); + finalMap.put("request", request); + StringBuilder xmlBuilder = new StringBuilder(); + xmlBuilder.append("\n"); + HttpRequestUtils.buildXml(xmlBuilder, finalMap, 0); + String ttx_mainUrl = ConfigUtils.getThirdConfigByNumber("Ttx_MainURL"); + String ttx_customerId = ConfigUtils.getThirdConfigByNumber("Ttx_CustomerId"); + ttx_mainUrl = ttx_mainUrl + "?method=" + method + "&v=2.0&format=xml&customerId=" + ttx_customerId; + Map headMap = new HashMap<>(); + try { + String result = HttpRequestUtils.postXml(ttx_mainUrl, xmlBuilder.toString(), headMap); + if (StringUtils.isNotEmpty(result)) { + JSONObject jsonObject = HttpRequestUtils.xmlToJson(result); + JSONObject response = jsonObject.getJSONObject("response"); + String flag = response.getString("flag"); + String code = response.getString("code"); + message = response.getString("message"); + if ("0".equals(code) || "200".equals(code)) { + message = "部分关闭成功"; + } + LCLogServiceImpl lcLogService = new LCLogServiceImpl(); + lcLogService.savelog(entityName, ttx_mainUrl, true, code.equals("200"), xmlBuilder.toString(), result); + lcLogService.isSuccess(entityType, billNo, "billno", label, code.equals("200")); + } + + } catch ( + IOException e) { + throw new RuntimeException(e); + } + + + return message; + + + } + }