From 55204060a168f92059dfad82ec0b80e36d12b833 Mon Sep 17 00:00:00 2001 From: 野心家 <1051256694@qq.com> Date: 星期六, 12 十月 2024 12:08:20 +0800 Subject: [PATCH] 优化完成任务 --- src/main/java/com/zy/asrs/controller/TaskWrkController.java | 48 +++++++++++++++++++++++------------------------- 1 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/TaskWrkController.java b/src/main/java/com/zy/asrs/controller/TaskWrkController.java index 93bb195..df10756 100644 --- a/src/main/java/com/zy/asrs/controller/TaskWrkController.java +++ b/src/main/java/com/zy/asrs/controller/TaskWrkController.java @@ -45,8 +45,8 @@ @Autowired private LocMastService locMastService; - @Value("${wms.taskStatusFeedbackPath}") - private String taskStatusFeedbackPath; + @Value("${wms.TaskExecCallback}") + private String TaskExecCallback; @Autowired private ApiLogService apiLogService; @@ -212,25 +212,24 @@ locMast.setBarcode(taskWrk.getBarcode()); } + String response=""; try{ HashMap<String, Object> headParam = new HashMap<>(); - headParam.put("taskNo",taskWrk.getTaskNo()); - headParam.put("status",taskWrk.getStatus()); - headParam.put("ioType",taskWrk.getIoType()); - headParam.put("barcode",taskWrk.getBarcode()); - headParam.put("reportTime",new Date()); - String response; + headParam.put("TaskNo",taskWrk.getTaskNo()); + headParam.put("Result",1); +// headParam.put("reportTime",new Date()); + log.info("wcs鎵嬪姩瀹屾垚浠诲姟涓婃姤wms={}", taskWrk); response = new HttpHandler.Builder() // .setHeaders(headParam) .setUri(wmsUrl) - .setPath(taskStatusFeedbackPath) + .setPath(TaskExecCallback) .setJson(JSON.toJSONString(headParam)) .build() .doPost(); JSONObject jsonObject = JSON.parseObject(response); - apiLogService.save("wcs娲惧彂鍏ュ簱浠诲姟涓婃姤wms" - ,wmsUrl+taskStatusFeedbackPath + apiLogService.save("wcs鎵嬪姩瀹屾垚浠诲姟涓婃姤wms" + ,wmsUrl+TaskExecCallback ,null ,"127.0.0.1" ,JSON.toJSONString(headParam) @@ -238,8 +237,8 @@ ,true ); }catch (Exception e){ - log.error("wcs鎵嬪姩鍙栨秷浠诲姟涓婃姤wms澶辫触", taskWrk); - throw new CoolException("wcs娲惧彂鍏ュ簱浠诲姟涓婃姤wms澶辫触"); + log.error("wcs鎵嬪姩瀹屾垚浠诲姟涓婃姤wms澶眥},杩斿洖鍊�={}", taskWrk,response); +// throw new CoolException(e); } locMastService.updateById(locMast); taskWrk.setStatus(7);//鎵嬪姩瀹屾垚浠诲姟 @@ -266,25 +265,24 @@ }catch (Exception e){ taskWrk.setModiUser(9999L);//鎿嶄綔鍛� } + String response=""; try{ HashMap<String, Object> headParam = new HashMap<>(); - headParam.put("taskNo",taskWrk.getTaskNo()); - headParam.put("status",taskWrk.getStatus()); - headParam.put("ioType",taskWrk.getIoType()); - headParam.put("barcode",taskWrk.getBarcode()); - headParam.put("reportTime",new Date()); - String response; + headParam.put("TaskNo",taskWrk.getTaskNo()); + headParam.put("Result",0); +// headParam.put("reportTime",new Date()); + + log.info("wcs鎵嬪姩鍙栨秷浠诲姟涓婃姤wm={}", taskWrk); response = new HttpHandler.Builder() // .setHeaders(headParam) .setUri(wmsUrl) - .setPath(taskStatusFeedbackPath) + .setPath(TaskExecCallback) .setJson(JSON.toJSONString(headParam)) .build() .doPost(); - JSONObject jsonObject = JSON.parseObject(response); - apiLogService.save("wcs娲惧彂鍏ュ簱浠诲姟涓婃姤wms" - ,wmsUrl+taskStatusFeedbackPath + apiLogService.save("wcs鎵嬪姩鍙栨秷浠诲姟涓婃姤wms" + ,wmsUrl+TaskExecCallback ,null ,"127.0.0.1" ,JSON.toJSONString(headParam) @@ -292,8 +290,8 @@ ,true ); }catch (Exception e){ - log.error("wcs鎵嬪姩瀹岀粨浠诲姟涓婃姤wms澶辫触", taskWrk); - throw new CoolException("wcs娲惧彂鍏ュ簱浠诲姟涓婃姤wms澶辫触"); + log.error("wcs鎵嬪姩鍙栨秷浠诲姟涓婃姤wms澶辫触={},杩斿洖鍊�={}", taskWrk,response); +// throw new CoolException(e); } taskWrk.setCompleteTime(now);//瀹岀粨鏃堕棿 taskWrkService.updateById(taskWrk); -- Gitblit v1.9.1