From 94f53c5d70e9150b09de00480060b2afe2f6c099 Mon Sep 17 00:00:00 2001
From: TQS <56479841@qq.com>
Date: 星期三, 12 四月 2023 07:57:41 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   67 ++++++++++++++++++++++++---------
 1 files changed, 49 insertions(+), 18 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 5f2d121..61d1eba 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -326,15 +326,20 @@
                         continue;
                     }
                     short staNo;
+                    List<BasDevp> basDevps1 = basDevpMapper.getLoading(103);
+                    List<BasDevp> basDevps2 = basDevpMapper.getLoading(203);
+
                     switch (wrkMast.getSourceStaNo()) {
                         case 104:
                         case 108:
                             staNo = 103;
-                            List<BasDevp> basDevps1 = basDevpMapper.getLoading(103);
-                            if (basDevps1.size()!=0){
+                            if (basDevps1.size()!=0 && basDevps2.size()!=0){
                                 continue;
+                            } else if (basDevps1.size()!=0){
+                                staNo = 203;
                             }
-                            List<WrkMast> wrkMasts1 = wrkMastMapper.selectWrkStsAndIoType(103);
+
+                            List<WrkMast> wrkMasts1 = wrkMastMapper.selectWrkStsAndIoType((int)staNo);
                             if (wrkMasts1.size()!=0){
                                 boolean flag = false;
                                 for (WrkMast wrkMast1:wrkMasts1){
@@ -352,11 +357,16 @@
                         case 204:
                         case 208:
                             staNo = 203;
-                            List<BasDevp> basDevps2 = basDevpMapper.getLoading(203);
-                            if (basDevps2.size()!=0){
+                            if (basDevps1.size()!=0 && basDevps2.size()!=0){
                                 continue;
+                            } else if (basDevps2.size()!=0){
+                                staNo = 103;
                             }
-                            List<WrkMast> wrkMasts2 = wrkMastMapper.selectWrkStsAndIoType(203);
+
+//                            if (basDevps2.size()!=0){
+//                                continue;
+//                            }
+                            List<WrkMast> wrkMasts2 = wrkMastMapper.selectWrkStsAndIoType((int)staNo);
                             if (wrkMasts2.size()!=0){
                                 boolean flag = false;
                                 for (WrkMast wrkMast1:wrkMasts2){
@@ -1066,11 +1076,11 @@
             if (wrkMast.getCrnNo().equals(2)){
                 if (wrkMast.getStaNo() == 103 && devpThread.ioModeOf1F != IoModeType.PAKOUT_MODE) {
                     News.error("MainServiceImpl  locToCrnStn"+"103闈炲嚭搴撴ā寮忥紝绂佹鍑哄簱銆備换鍔″彿:{}锛侊紒锛�",wrkMast.getWrkNo());
-                    continue;
+                    return false;
                 }
                 if (wrkMast.getStaNo() == 203 && devpThread.ioModeOf2F != IoModeType.PAKOUT_MODE) {
                     News.error("MainServiceImpl  locToCrnStn"+"203闈炲嚭搴撴ā寮忥紝绂佹鍑哄簱銆備换鍔″彿:{}锛侊紒锛�",wrkMast.getWrkNo());
-                    continue;
+                    return false;
                 }
 
                 if (wrkMast.getWrkSts() == 11 && (wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107)){
@@ -1078,7 +1088,7 @@
                     List<WrkMast> wrkMasts = wrkMastMapper.selectWrkStsAndIoType0(sour);
                     if (wrkMasts.size() > 0){
                         News.error("MainServiceImpl  1028琛�"+"瀛樺湪鎹℃枡銆佺洏鐐规湭鍏ュ簱璐х墿锛�2鍙峰爢鍨涙満鏆傛椂绂佹鍑哄簱锛侊紒锛�");
-                        continue;
+                        return false;
                     }
                 }
 
@@ -1087,7 +1097,7 @@
                     List<WrkMast> wrkMasts = wrkMastMapper.selectWrkStsAndIoType1(sour);
                     if (wrkMasts.size() > 0){
                         News.error("MainServiceImpl  1028琛�"+"204瀛樺湪鍏ㄦ澘鍑哄簱涓揣鐗╋紝2鍙峰爢鍨涙満鏆傛椂绂佹鍏ㄦ澘鍑哄簱锛侊紒锛�");
-                        continue;
+                        return false;
                     }
                 }
             }
@@ -1188,7 +1198,7 @@
                 }
             }
             if(flag){
-                continue;
+                return false;
             }
 
             // 宸ヤ綔妗g姸鎬佸垽鏂�
@@ -2335,18 +2345,35 @@
                     crnCommand.setDestinationPosX(Utils.getGroupRow(locMast.getLocNo()).shortValue());     // 鐩爣搴撲綅鎺�
                     crnCommand.setDestinationPosY(locMast.getBay1().shortValue());     // 鐩爣搴撲綅鍒�
                     crnCommand.setDestinationPosZ(locMast.getLev1().shortValue());     // 鐩爣搴撲綅灞�
-                    if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
-                        News.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
-                    } else {
+
+                    if( crnCommand.getSourcePosX() == crnCommand.getDestinationPosX()
+                        && crnCommand.getSourcePosY() == crnCommand.getDestinationPosY()
+                        && crnCommand.getSourcePosZ() == crnCommand.getDestinationPosZ()){
+                        //鎵撹ˉ涓侊紝濡傛灉鍑虹幇婧愭帓鍒楀眰 鍜岀洰鏍囨帓鍒楀眰瀹屽叏鐩稿悓鏃讹紝涓嶇粰鍫嗗灈鏈哄彂浠诲姟锛岀姸鎬佺洿鎺ョ敱3 ==>> 6
                         // 淇敼绌挎杞﹁繍琛屼腑鎺掑垪灞�
                         steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo()), locMast.getBay1(), locMast.getLev1());
-                        // 淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 4.杩佸叆灏忚溅
+                        // 淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 6.灏忚溅寰呭叆
                         Date now = new Date();
-                        wrkMast.setWrkSts(4L);
+                        wrkMast.setWrkSts(6L);
                         wrkMast.setCrnStrTime(now);
                         wrkMast.setModiTime(now);
                         if (wrkMastMapper.updateById(wrkMast) == 0) {
-                            News.error("淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 4.杩佸叆灏忚溅 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                            News.error("淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 6.灏忚溅寰呭叆 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                        }
+                    } else {
+                        if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(2, crnCommand))) {
+                            News.error("鍫嗗灈鏈哄懡浠や笅鍙戝け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", wrkMast.getCrnNo(), JSON.toJSON(crnCommand));
+                        } else {
+                            // 淇敼绌挎杞﹁繍琛屼腑鎺掑垪灞�
+                            steThread.modifyPos(Utils.getGroupRow(locMast.getLocNo()), locMast.getBay1(), locMast.getLev1());
+                            // 淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 4.杩佸叆灏忚溅
+                            Date now = new Date();
+                            wrkMast.setWrkSts(4L);
+                            wrkMast.setCrnStrTime(now);
+                            wrkMast.setModiTime(now);
+                            if (wrkMastMapper.updateById(wrkMast) == 0) {
+                                News.error("淇敼宸ヤ綔妗g姸鎬� 3.灏忚溅寰呮惉 => 4.杩佸叆灏忚溅 澶辫触锛侊紒锛屽伐浣滃彿={}", wrkMast.getWrkNo());
+                            }
                         }
                     }
                 // 鍑哄簱鎼�
@@ -3879,7 +3906,11 @@
                     boolean success = true;
                     List<String> insideLoc = Utils.getGroupInsideLoc(one.getLocNo());
                     for (String inside : insideLoc) {
-                        if (locMastService.selectById(inside).getLocSts().equals("P")
+                        LocMast locMast = locMastService.selectById(inside);
+                        if(Cools.isEmpty(locMast)){
+                            continue;
+                        }
+                        if (locMast.getLocSts().equals("P")
                                 || locMastService.selectById(inside).getLocSts().equals("R")
                                 || locMastService.selectById(inside).getLocSts().equals("S")
                                 || locMastService.selectById(inside).getLocSts().equals("Q")) {

--
Gitblit v1.9.1