From fe6e066b0970ed6c1dd23aa17fa65f16edbf513c Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期四, 23 五月 2024 14:05:46 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  100 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 61 insertions(+), 39 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 9a781a5..0ae1e4f 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -196,8 +196,19 @@
                         }
 
                         //StaDesc staDesc1 = staDescService.selectOne(new EntityWrapper<StaDesc>().eq("stn_no",inSta.getBackSta()));
-                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null){
+                        boolean sign = true;
+                        if (inSta.getBarcode() == 7 || inSta.getBarcode() == 8){
+
+                        }else {
+                            if (taskWrk.getCrnNo() != inSta.getBarcode()){
+                                sign = false;
+                            }
+                        }
+                        if (taskWrk.getTargetPoint() != null && taskWrk.getStartPoint() != null && sign){
                             if ( taskWrk.getWrkNo() != null && taskWrk.getWrkNo().shortValue() == workNo ){
+                                continue;
+                            }
+                            if (taskWrk.getStatus() != 2){
                                 continue;
                             }
                             //鑾峰彇鍫嗗灈鏈虹珯鐐�
@@ -258,6 +269,11 @@
                                 taskWrk.setOriginTargetPoint(getWmsDto.getTargetLocationCode());
                                 taskWrk.setTargetPoint(Utils.getWcsLocNo(getWmsDto.getTargetLocationCode()));
                                 taskWrk.setStartPoint(String.valueOf(inSta.getBackSta()));
+                                if (inSta.getBarcode() == 7 || inSta.getBarcode() == 8){
+
+                                }else {
+                                    taskWrk.setCrnNo(inSta.getBarcode());
+                                }
                                 if (!taskWrkService.updateById(taskWrk)){
                                     log.error("淇濆瓨wms搴撲綅鍙峰け璐�");
                                 }
@@ -341,6 +357,8 @@
                                 } else if (taskWrk.getIoType() == 2) {
                                     taskWrk.setWrkSts(14);
                                 }
+                                Date now = new Date();
+                                taskWrk.setCompleteTime(now);
                                 if (!taskWrkService.updateById(taskWrk)){
                                     log.error(taskWrk.getTaskNo()+ " 鍫嗗灈鏈轰换鍔″畬鎴愶紝鏀瑰彉浠诲姟鐘舵�佸け璐�");
                                 }
@@ -448,16 +466,17 @@
                 log.error("杩涘叆淇敼宸ヤ綔妗f祦绋�");
                 Date now = new Date();
                 taskWrk.setWrkSts(3);
+                taskWrk.setExecuteTime(now);
                 taskWrk.setModiTime(now);
                 if (taskWrkMapper.updateById(taskWrk) == 0) {
                     log.error("淇敼宸ヤ綔妗g姸鎬� 2.璁惧涓婅蛋 => 3.鍚婅溅鍏ュ簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", taskWrk.getWrkNo());
                 }
-                TaskWrk taskWrk2 = taskWrkService.selectByWrkNo(staProtocol.getWorkNo().intValue());
+                TaskWrk taskWrk2 = taskWrkService.selectByWrkNo(taskWrk.getWrkNo());
 
                 if (taskWrk2.getWrkSts() != 3){
                     continue;
                 }
-                log.error("杩涘叆淇敼宸ヤ綔妗f祦绋嬪畬鎴�,taskWrk=", JSON.toJSONString(taskWrk));
+                log.error("杩涘叆淇敼宸ヤ綔妗f祦绋嬪畬鎴�,taskWrk=", taskWrk.getWrkNo());
 
 
                 //鍙栧嚭鍛戒护
@@ -626,6 +645,7 @@
                             // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓�
                             Date now = new Date();
                             taskWrk.setWrkSts(12);
+                            taskWrk.setExecuteTime(now);
                             taskWrk.setModiTime(now);
                             if (taskWrkMapper.updateById(taskWrk) == 0) {
                                 log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 12.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", taskWrk.getWrkNo());
@@ -789,27 +809,27 @@
                 }
 
                 //鑾峰彇鎸囦护ID
-                Integer commandId = crnProtocol.getCommandId();
-                CommandInfo commandInfo = new CommandInfo();
-                if (Cools.isEmpty(commandId)){
-                    commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>()
-                            .eq("wrk_no",crnProtocol.getTaskNo())
-                            .eq("device","Crn"));
-                }else {
-                    commandInfo = commandInfoService.selectById(commandId);
-                }
+//                Integer commandId = crnProtocol.getCommandId();
+//                CommandInfo commandInfo = new CommandInfo();
+//                if (Cools.isEmpty(commandId)){
+//                    commandInfo = commandInfoService.selectOne(new EntityWrapper<CommandInfo>()
+//                            .eq("wrk_no",crnProtocol.getTaskNo())
+//                            .eq("device","Crn"));
+//                }else {
+//                    commandInfo = commandInfoService.selectById(commandId);
+//                }
 
 
-                if (commandInfo == null) {
-                    //鎸囦护涓嶅瓨鍦�
-                    continue;
-                }
-                if (commandInfo.getCommandStatus() == 3){
-                    continue;
-                }
-                commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//鎸囦护瀹屾垚
-                commandInfo.setCompleteTime(new Date());//鎸囦护瀹屾垚鏃堕棿
-                if (commandInfoService.updateById(commandInfo)) {//淇敼鎴愬姛鍚庡浣嶅爢鍨涙満
+//                if (commandInfo == null) {
+//                    //鎸囦护涓嶅瓨鍦�
+//                    continue;
+//                }
+//                if (commandInfo.getCommandStatus() == 3){
+//                    continue;
+//                }
+//                commandInfo.setCommandStatus(CommandStatusType.COMPLETE.id);//鎸囦护瀹屾垚
+//                commandInfo.setCompleteTime(new Date());//鎸囦护瀹屾垚鏃堕棿
+//                if (commandInfoService.updateById(commandInfo)) {//淇敼鎴愬姛鍚庡浣嶅爢鍨涙満
                     // 鍫嗗灈鏈哄浣�
                     crnThread.setResetFlag(true);
                     if (taskWrk.getIoType() == 1 || taskWrk.getIoType() == 3){
@@ -817,10 +837,12 @@
                     } else if (taskWrk.getIoType() == 2) {
                         taskWrk.setWrkSts(14);
                     }
+                    Date now = new Date();
+                    taskWrk.setCompleteTime(now);
                     if (!taskWrkService.updateById(taskWrk)){
                         log.error(taskWrk.getTaskNo()+ " 鍫嗗灈鏈轰换鍔″畬鎴愶紝鏀瑰彉浠诲姟鐘舵�佸け璐�");
                     }
-                }
+//                }
             }
         }
     }
@@ -1012,24 +1034,24 @@
     public synchronized void autoCompleteTask() {
         List<TaskWrk> taskWrks = taskWrkMapper.selectWorkingTask();
         for (TaskWrk taskWrk : taskWrks) {
-            //鑾峰彇鍛戒护闆嗗悎
-            List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo());
-            if (taskWrk.getCommandStep() < commandInfos.size()) {
-                continue;//褰撳墠姝ュ簭娌℃湁鍒拌揪鏈�鍚庝竴鏉″懡浠�
-            }
-
-            //鍒ゆ柇鏈鍛戒护鏄惁鎵ц瀹屾垚
-            if (!commandInfos.isEmpty()){
-                CommandInfo commandInfo = commandInfos.get(commandInfos.size() - 1);
-                if (commandInfo.getCommandStatus() != CommandStatusType.COMPLETE.id) {
-                    continue;//鎸囦护鏈畬鎴�
-                }
-            }
+//            //鑾峰彇鍛戒护闆嗗悎
+//            List<CommandInfo> commandInfos = commandInfoService.selectByTaskNo(taskWrk.getTaskNo());
+//            if (taskWrk.getCommandStep() < commandInfos.size()) {
+//                continue;//褰撳墠姝ュ簭娌℃湁鍒拌揪鏈�鍚庝竴鏉″懡浠�
+//            }
+//
+//            //鍒ゆ柇鏈鍛戒护鏄惁鎵ц瀹屾垚
+//            if (!commandInfos.isEmpty()){
+//                CommandInfo commandInfo = commandInfos.get(commandInfos.size() - 1);
+//                if (commandInfo.getCommandStatus() != CommandStatusType.COMPLETE.id) {
+//                    continue;//鎸囦护鏈畬鎴�
+//                }
+//            }
 
 
             Date now = new Date();
             //鎸囦护宸插畬鎴愶紝鏇存柊浠诲姟
-            if (taskWrk.getIoType() == 1) {
+            if (taskWrk.getIoType() == 1 && taskWrk.getWrkSts() == 5) {
                 //鍏ュ簱浠诲姟
 //                taskWrk.setWrkSts(4);//3.鍚婅溅鍏ュ簱涓� => 4.鍏ュ簱瀹屾垚
                 taskWrk.setStatus(TaskStatusType.OVER.id);
@@ -1043,7 +1065,7 @@
                 locMast.setModiTime(now);
                 locMast.setModiUser(9999L);
                 locMastService.updateById(locMast);
-            } else if (taskWrk.getIoType() == 2) {
+            } else if (taskWrk.getIoType() == 2 && taskWrk.getWrkSts() == 15) {
                 //鍑哄簱浠诲姟
 //                taskWrk.setWrkSts(14);//12.鍚婅溅鍑哄簱涓� => 14.鍑哄簱瀹屾垚
                 taskWrk.setStatus(TaskStatusType.OVER.id);
@@ -1057,7 +1079,7 @@
                 locMast.setModiTime(now);
                 locMast.setModiUser(9999L);
                 locMastService.updateById(locMast);
-            } else if (taskWrk.getIoType() == 3) {
+            } else if (taskWrk.getIoType() == 3 && taskWrk.getWrkSts() == 5) {
 
                 //鏇存柊璧峰搴撲綅鐘舵��
                 LocMast locMastStart = locMastService.selectByLocNo(taskWrk.getStartPoint());

--
Gitblit v1.9.1