备料计划同步高压MES改异步调用
This commit is contained in:
parent
0bed9a4556
commit
27b6562053
|
|
@ -253,7 +253,7 @@ public class SyncGyMesPickmUtil {
|
||||||
}
|
}
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
logger.error("gyMes-Pickm-领料修改备料计划开始同步高压MES");
|
logger.error("gyMes-Pickm-领料修改备料计划开始同步高压MES");
|
||||||
pushData(list);
|
pushDataAsync(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -308,9 +308,9 @@ public class SyncGyMesPickmUtil {
|
||||||
private void pushDataAsync(JSONObject param) {
|
private void pushDataAsync(JSONObject param) {
|
||||||
// 异步调用线程池
|
// 异步调用线程池
|
||||||
final ExecutorService asyncExecutor = Executors.newFixedThreadPool(1);
|
final ExecutorService asyncExecutor = Executors.newFixedThreadPool(1);
|
||||||
// 复制配置参数,避免异步任务执行时configParams被修改
|
String baseUrl = configParams.get("mesBaseUrl");
|
||||||
final Map<String, String> configParamsCopy = new HashMap<>(configParams);
|
String requestUrl = baseUrl + configParams.get("materialRequirementsUpdate");
|
||||||
|
logger.error("gyMes-Pickm-url = " + requestUrl);
|
||||||
// 提交异步任务,立即返回,不等待结果
|
// 提交异步任务,立即返回,不等待结果
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
try {
|
try {
|
||||||
|
|
@ -321,10 +321,6 @@ public class SyncGyMesPickmUtil {
|
||||||
SerializerFeature.WriteNullStringAsEmpty
|
SerializerFeature.WriteNullStringAsEmpty
|
||||||
);
|
);
|
||||||
logger.error("gyMes-Pickm-param = " + jsonStr);
|
logger.error("gyMes-Pickm-param = " + jsonStr);
|
||||||
String baseUrl = configParamsCopy.get("mesBaseUrl");
|
|
||||||
String requestUrl = baseUrl + configParamsCopy.get("materialRequirementsUpdate");
|
|
||||||
logger.error("gyMes-Pickm-url = " + requestUrl);
|
|
||||||
|
|
||||||
// 这里会阻塞异步线程,但不会阻塞主线程
|
// 这里会阻塞异步线程,但不会阻塞主线程
|
||||||
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
String result = ThirdPartyPostRequestUtil.sendPostRequest(requestUrl, jsonStr);
|
||||||
JSONObject resultObj = JSONObject.parseObject(result);
|
JSONObject resultObj = JSONObject.parseObject(result);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue