2025-11-03 09:35:54 +00:00
|
|
|
|
package tqq9.lc123.cloud.app.plugin.utils;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
|
import kd.bos.util.StringUtils;
|
2025-11-04 09:22:20 +00:00
|
|
|
|
import tqq9.lc123.cloud.app.eip.iscb.impl.LCLogServiceImpl;
|
2025-11-03 09:35:54 +00:00
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
//北广、通天晓关闭、取消、接口
|
|
|
|
|
|
public class BillCloseCancelUtils {
|
2025-11-04 09:22:20 +00:00
|
|
|
|
|
2025-11-03 09:35:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 通天晓单据取消接口
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param orderType 单据类型
|
|
|
|
|
|
* @param warehouseCode 仓库编号
|
|
|
|
|
|
* @param billNo 单据编号
|
2025-11-04 09:22:20 +00:00
|
|
|
|
* @param entityType 单据标识
|
|
|
|
|
|
* @param entityName 单据名称
|
|
|
|
|
|
* @param label 推送标识
|
2025-11-03 09:35:54 +00:00
|
|
|
|
* @return 取消结果
|
|
|
|
|
|
*/
|
2025-11-04 09:22:20 +00:00
|
|
|
|
public static String wmsCancel(String orderType, String warehouseCode, String billNo,String entityType,String entityName,String label) {
|
2025-11-03 09:35:54 +00:00
|
|
|
|
String method = "order.cancel";
|
|
|
|
|
|
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("cancelReason", "");
|
|
|
|
|
|
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);
|
2025-11-04 09:22:20 +00:00
|
|
|
|
String ttx_mainUrl = ConfigUtils.getThirdConfigByNumber("Ttx_MainURL");
|
|
|
|
|
|
String ttx_customerId = ConfigUtils.getThirdConfigByNumber("Ttx_CustomerId");
|
2025-11-03 09:35:54 +00:00
|
|
|
|
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");
|
|
|
|
|
|
|
2025-11-04 09:22:20 +00:00
|
|
|
|
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"));
|
2025-11-03 09:35:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (
|
|
|
|
|
|
IOException e) {
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
}
|
2025-11-04 09:22:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
2025-11-03 09:35:54 +00:00
|
|
|
|
return message;
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-11-04 09:22:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
2025-11-03 09:35:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 北广 收货通知单关闭(采购订单关闭)
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param billNo 单据编号
|
|
|
|
|
|
* @param url 接口地址,北京还是广州
|
2025-11-04 09:22:20 +00:00
|
|
|
|
* @param entityType 单据标识
|
|
|
|
|
|
* @param entityName 单据名称
|
|
|
|
|
|
* @param label 推送标识
|
2025-11-03 09:35:54 +00:00
|
|
|
|
* @return 关闭结果
|
|
|
|
|
|
*/
|
2025-11-04 09:22:20 +00:00
|
|
|
|
public static String BGPurOrderCancel(String billNo, String url,String entityType,String entityName,String label) {
|
2025-11-03 09:35:54 +00:00
|
|
|
|
String message = null;
|
|
|
|
|
|
String method = "/api/PU/Close_PurOrder";
|
|
|
|
|
|
Map<String, Object> bj_map = new HashMap<>();
|
2025-11-04 09:22:20 +00:00
|
|
|
|
bj_map.put("cPOCode", billNo);
|
2025-11-03 09:35:54 +00:00
|
|
|
|
String bjjsonBody = JSON.toJSONString(bj_map);
|
|
|
|
|
|
try {
|
|
|
|
|
|
String result = HttpRequestUtils.postJson(url + method, bjjsonBody, null);
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
JsonNode rootNode = objectMapper.readTree(result);
|
|
|
|
|
|
if (null != rootNode) {
|
|
|
|
|
|
message = String.valueOf(rootNode.get("message"));
|
2025-11-04 09:22:20 +00:00
|
|
|
|
String code = String.valueOf(rootNode.get("code"));
|
|
|
|
|
|
LCLogServiceImpl lcLogService = new LCLogServiceImpl();
|
|
|
|
|
|
lcLogService.savelog(entityName,url,true, code.equals("0"),bjjsonBody,result);
|
|
|
|
|
|
lcLogService.isSuccess(entityType,billNo,"billno",label,code.equals("0"));
|
2025-11-03 09:35:54 +00:00
|
|
|
|
}
|
2025-11-04 09:22:20 +00:00
|
|
|
|
|
2025-11-03 09:35:54 +00:00
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return message;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-04 09:22:20 +00:00
|
|
|
|
/**
|
|
|
|
|
|
* 北广 其他入库申请单取消
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param billNo 单据编号
|
|
|
|
|
|
* @param url 接口地址,北京还是广州
|
|
|
|
|
|
* @param entityType 单据标识
|
|
|
|
|
|
* @param entityName 单据名称
|
|
|
|
|
|
* @param label 推送标识
|
|
|
|
|
|
* @return 关闭结果
|
|
|
|
|
|
*/
|
|
|
|
|
|
public static String BGCloseOtherVouchIn(String billNo, String url,String entityType,String entityName,String label) {
|
|
|
|
|
|
String message = null;
|
|
|
|
|
|
String method = "/api/WMS/Close_OtherVouchIn";
|
|
|
|
|
|
Map<String, Object> bj_map = new HashMap<>();
|
|
|
|
|
|
bj_map.put("cOVCode", billNo);
|
|
|
|
|
|
String bjjsonBody = JSON.toJSONString(bj_map);
|
|
|
|
|
|
try {
|
|
|
|
|
|
String result = HttpRequestUtils.postJson(url + method, bjjsonBody, null);
|
|
|
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
JsonNode rootNode = objectMapper.readTree(result);
|
|
|
|
|
|
if (null != rootNode) {
|
|
|
|
|
|
message = String.valueOf(rootNode.get("message"));
|
|
|
|
|
|
String code = String.valueOf(rootNode.get("code"));
|
|
|
|
|
|
LCLogServiceImpl lcLogService = new LCLogServiceImpl();
|
|
|
|
|
|
lcLogService.savelog(entityName,url,true, code.equals("0"),bjjsonBody,result);
|
|
|
|
|
|
lcLogService.isSuccess(entityType,billNo,"billno",label,code.equals("0"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return message;
|
|
|
|
|
|
}
|
2025-11-03 09:35:54 +00:00
|
|
|
|
|
|
|
|
|
|
}
|