From 474d031dd0f9de2e8af2cb8161b711dd82624a1e Mon Sep 17 00:00:00 2001
From: lsh <1>
Date: 星期四, 11 四月 2024 17:02:01 +0800
Subject: [PATCH] #浅库位优先

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   45 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 13 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 6668c7d..da0f484 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -407,16 +407,25 @@
                                 continue;
                             }
                             log.info("涓嬪彂杈撻�佺嚎浠诲姟锛歵askWrk:"+JSON.toJSONString(taskWrk));
-                            R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false);
-                            JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(r));
-                            if (jsonObject.getInteger("code").equals(200)){
+//                            R r = siteController.siteDetlUpdate(Integer.valueOf(taskWrk.getTargetPoint()), taskWrk.getWrkNo().shortValue(), (short) 0, "Y", false, false);
+                            staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue());
+                            staProtocol.setStaNo(staDesc.getCrnStn().shortValue());
+                            boolean offer = false;
+                            try{
+                                offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol));
+                            }catch (Exception e){
+                                log.error("涓嬪彂杈撻�佺嚎浠诲姟澶辫触锛氬紓甯�:"+e);
+                                log.error("涓嬪彂杈撻�佺嚎浠诲姟澶辫触锛氬紓甯�:offer:"+offer);
+                            }
+//                            JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(r));
+                            if (offer){
                                 log.info("涓嬪彂杈撻�佺嚎浠诲姟鎴愬姛锛歵askWrk:"+JSON.toJSONString(taskWrk));
                                 taskWrk.setStatus(5);
                                 taskWrk.setWrkSts(14);
                                 taskWrkService.updateById(taskWrk);
                             }else {
                                 log.error("涓嬪彂杈撻�佺嚎浠诲姟澶辫触锛歵askWrk:"+JSON.toJSONString(taskWrk));
-                                log.error("涓嬪彂杈撻�佺嚎浠诲姟澶辫触锛氬紓甯镐俊鎭�:"+JSON.toJSONString(r));
+//                                log.error("涓嬪彂杈撻�佺嚎浠诲姟澶辫触锛氬紓甯镐俊鎭�:"+JSON.toJSONString(r));
                             }
                         }
                     }catch (Exception e){
@@ -528,7 +537,6 @@
                 taskWrk.setCrnNo(staDesc.getCrnNo());//鍫嗗灈鏈哄彿
                 taskWrk.setModiTime(new Date());
                 taskWrk.setModiUser(9988L);
-                taskWrkService.updateById(taskWrk);
 
 //                //鍙栧嚭鍛戒护
 //                List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo());
@@ -578,6 +586,12 @@
                     log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
                     throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�");
                 }else{
+                    try{
+                        taskWrkService.updateById(taskWrk);
+                    }catch (Exception e){
+                        log.error("淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", taskWrk.getWrkNo());
+                        log.error("淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽紓甯革細"+e);
+                    }
                     try{
                         HashMap<String, Object> headParam = new HashMap<>();
                         headParam.put("taskNo",taskWrk.getTaskNo());
@@ -667,14 +681,6 @@
                             break;
                         }
 
-                        // 淇敼宸ヤ綔妗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());
-                        }
                         CrnCommand command = new CrnCommand();
                         command.setCrnNo(taskWrk.getCrnNo()); // 鍫嗗灈鏈虹紪鍙�
                         command.setTaskNo(taskWrk.getWrkNo().shortValue()); // 宸ヤ綔鍙�
@@ -692,6 +698,19 @@
                             throw new CoolException("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐�");
                         }else{
                             try{
+                                // 淇敼宸ヤ綔妗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());
+                                }
+                            }catch (Exception e){
+                                log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", taskWrk.getWrkNo());
+                                log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽紓甯革細"+e);
+                            }
+                            try{
                                 HashMap<String, Object> headParam = new HashMap<>();
                                 headParam.put("taskNo",taskWrk.getTaskNo());
                                 headParam.put("status",taskWrk.getStatus());

--
Gitblit v1.9.1