From 2a2e38283cc97e3c7fd31b26891e05e783c382fe Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期五, 11 三月 2022 08:57:31 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   53 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 23 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 7d46fc0..19d9816 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -428,7 +428,7 @@
                 }
                 if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == null)) {
                     // 鏌ヨ宸ヤ綔妗�
-                    WrkMast wrkMast = wrkMastMapper.selectPakOutStep15(staProtocol.getSiteId());
+                    WrkMast wrkMast = wrkMastMapper.selectPakOutStep16(staProtocol.getSiteId());
                     if (wrkMast == null) {
                         continue;
                     }
@@ -457,14 +457,14 @@
                             continue;
                         }
 
-                        // 鏇存柊宸ヤ綔妗g姸鎬佷负 16.鍑哄簱瀹屾垚
-                        wrkMast.setWrkSts(16L);
+                        // 鏇存柊宸ヤ綔妗g姸鎬佷负 17.鍑哄簱瀹屾垚
+                        wrkMast.setWrkSts(17L);
                         wrkMast.setCrnEndTime(new Date());
                         if (wrkMastMapper.updateById(wrkMast) != 0) {
                             // 澶嶄綅鍫嗗灈鏈�
                             crnThread.setResetFlag(true);
                         } else {
-                            log.error("鏇存柊宸ヤ綔妗g殑宸ヤ綔鐘舵�佷负 16.鍑哄簱瀹屾垚 澶辫触锛侊紒锛� [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
+                            log.error("鏇存柊宸ヤ綔妗g殑宸ヤ綔鐘舵�佷负 17.鍑哄簱瀹屾垚 澶辫触锛侊紒锛� [宸ヤ綔鍙�:{}]", wrkMast.getWrkNo());
                         }
 
                     }
@@ -498,15 +498,19 @@
                             crnProtocol.setLastIo("O");
                         }
                     } else if (basCrnp.getOutEnable().equals("Y")) {
-                        this.locToCrnStn(crn, crnProtocol); //  鍑哄簱
-                        crnProtocol.setLastIo("I");
+                        //  鍑哄簱
+                        if (this.locToCrnStn(crn, crnProtocol)) {
+                            crnProtocol.setLastIo("I");
+                        }
                     }
                 }
                 // 濡傛灉鏈�杩戜竴娆℃槸鍑哄簱妯″紡
                 else if (crnProtocol.getLastIo().equals("O")) {
                     if (basCrnp.getOutEnable().equals("Y")) {
-                        this.locToCrnStn(crn, crnProtocol); //  鍑哄簱
-                        crnProtocol.setLastIo("I");
+                        //  鍑哄簱
+                        if (this.locToCrnStn(crn, crnProtocol)) {
+                            crnProtocol.setLastIo("I");
+                        }
                     } else if (basCrnp.getInEnable().equals("Y")) {
                         //  鍏ュ簱
                         if (this.crnStnToLoc(crn, crnProtocol)) {
@@ -870,16 +874,14 @@
                     continue;
                 }
 
-
-                // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
-                if (wrkMastMapper.selectWorking(slave.getId()) != null) {
-                    continue;
-                }
-
-
                 // 鏈�澶栧眰搴撲綅锛岀洿鎺ュ爢鍨涙満鍑哄簱
                 if (locMastService.isOutMost(wrkMast.getLocNo())) {
-                    // 1.鍫嗗灈鏈哄紑濮嬬Щ鍔�
+                    // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
+                    if (wrkMastMapper.selectWorking(slave.getId()) != null) {
+                        continue;
+                    }
+
+                    // 鍫嗗灈鏈哄嚭搴� 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
                     CrnCommand crnCommand = new CrnCommand();
                     crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
                     crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
@@ -894,13 +896,13 @@
                     if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                         log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                     } else {
-                        // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 15.鍚婅溅鍑哄簱涓�
+                        // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 16.鍚婅溅鍑哄簱涓�
                         Date now = new Date();
-                        wrkMast.setWrkSts(15L);
+                        wrkMast.setWrkSts(16L);
                         wrkMast.setCrnStrTime(now);
                         wrkMast.setModiTime(now);
                         if (wrkMastMapper.updateById(wrkMast) == 0) {
-                            log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 15.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                            log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 16.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
                         }
                         return true;
                     }
@@ -940,7 +942,12 @@
                             }
                         }
                         if (wrkMast.getWrkSts() == 15L) {
-                            // 1.鍫嗗灈鏈哄紑濮嬬Щ鍔�
+                            // 宸茬粡瀛樺湪鍚婅溅鎵ц浠诲姟鏃讹紝鍒欒繃婊�
+                            if (wrkMastMapper.selectWorking(slave.getId()) != null) {
+                                continue;
+                            }
+
+                            // 鍫嗗灈鏈哄嚭搴� 鍛戒护涓嬪彂鍖� --------------------------------------------------------------------------
                             CrnCommand crnCommand = new CrnCommand();
                             crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
                             crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
@@ -955,13 +962,13 @@
                             if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
                                 log.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
                             } else {
-                                // 淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 15.鍚婅溅鍑哄簱涓�
+                                // 淇敼宸ヤ綔妗g姸鎬� 15.绛夊緟鍚婅溅 => 16.鍚婅溅鍑哄簱涓�
                                 Date now = new Date();
-                                wrkMast.setWrkSts(15L);
+                                wrkMast.setWrkSts(16L);
                                 wrkMast.setCrnStrTime(now);
                                 wrkMast.setModiTime(now);
                                 if (wrkMastMapper.updateById(wrkMast) == 0) {
-                                    log.error("淇敼宸ヤ綔妗g姸鎬� 11.鐢熸垚鍑哄簱ID => 15.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                                    log.error("淇敼宸ヤ綔妗g姸鎬� 15.绛夊緟鍚婅溅 => 16.鍚婅溅鍑哄簱涓� 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
                                 }
                                 return true;
                             }

--
Gitblit v1.9.1