收货通知单部分关闭

This commit is contained in:
sez 2025-11-11 14:34:54 +08:00
parent 24b35f19b8
commit ffb6103ea5
3 changed files with 129 additions and 0 deletions

View File

@ -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));
}
}
}
}
}

View File

@ -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<String> 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));
}
}
}
}
}
}

View File

@ -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<String, Object> 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<String, Object> finalMap = new HashMap<>();
finalMap.put("request", request);
StringBuilder xmlBuilder = new StringBuilder();
xmlBuilder.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\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<String, String> 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;
}
}