From 6deef91299e7216963bd4e00766c92ee6f8956d0 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期二, 01 四月 2025 13:54:17 +0800
Subject: [PATCH] 给堆垛机下任务

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index aea5740..6d68728 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -722,6 +722,7 @@
                     continue;
                 }
 
+
                 // 鑾峰彇宸ヤ綔鐘舵�佷负2锛堣澶囦笂璧帮級鐨勫叆搴撳伐浣滄。
                 TaskWrk taskWrk = taskWrkMapper.selectPakIn(slave.getId(), staProtocol.getWorkNo().intValue(), staDesc.getStnNo().toString());
                 if (null == taskWrk) {
@@ -977,15 +978,15 @@
                     // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
                     Date now = new Date();
                     taskWrk.setWrkSts(12);
-                    taskWrk.setStatus(2);
                     taskWrk.setModiTime(now);
                     if (taskWrkMapper.updateById(taskWrk) == 0) {
                         log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", taskWrk.getWrkNo());
                     }
+                    String response = "";
+                    Boolean bool=false;
+                    HashMap<String, Object> headParam = new HashMap<>();
+                    headParam.put("TaskNo", taskWrk.getTaskNo());
                     try {
-                        HashMap<String, Object> headParam = new HashMap<>();
-                        headParam.put("TaskNo", taskWrk.getTaskNo());
-                        String response;
                         response = new HttpHandler.Builder()
                                 // .setHeaders(headParam)
                                 .setUri(wmsUrl)
@@ -994,17 +995,24 @@
                                 .build()
                                 .doPost();
                         JSONObject jsonObject = JSON.parseObject(response);
+                        if(jsonObject.get("ReturnStatus").equals(0)){
+                            bool = true;
+                            taskWrk.setStatus(2);
+                            taskWrkMapper.updateById(taskWrk);
+                        }
+
+                    } catch (Exception e) {
+                        log.error("wcs娲惧彂绉诲簱搴撲换鍔′笂鎶ms澶辫触", taskWrk);
+//                        throw new CoolException("wcs娲惧彂绉诲簱搴撲换鍔′笂鎶ms澶辫触");
+                    }finally {
                         apiLogService.save("wcs娲惧彂绉诲簱浠诲姟涓婃姤wms"
                                 , wmsUrl + taskStatusFeedbackPath
                                 , null
                                 , "127.0.0.1"
                                 , JSON.toJSONString(headParam)
                                 , response
-                                , true
+                                , bool
                         );
-                    } catch (Exception e) {
-                        log.error("wcs娲惧彂绉诲簱搴撲换鍔′笂鎶ms澶辫触", taskWrk);
-//                        throw new CoolException("wcs娲惧彂绉诲簱搴撲换鍔′笂鎶ms澶辫触");
                     }
 
                 }

--
Gitblit v1.9.1