From 9a07fed7b55d37d5e15df449b54b8c4b7e9a8e68 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期日, 11 五月 2025 17:25:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   40 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 36 insertions(+), 4 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 7918153..3559858 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -463,7 +463,7 @@
                     // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
                     if (staProtocol.isAutoing() && staProtocol.isLoading()
 //                            && staProtocol.isInEnable()
-                            && (workNo == 0 || (workNo>9000 && workNo<10000))
+//                            && (workNo == 0 || (workNo>9000 && workNo<10000))
                             && staProtocol.isPakMkWalk()
                     ) {
                         if (inSta.isBarcodeSign()){
@@ -1372,6 +1372,32 @@
         }
         return true;
     }
+    public boolean rgvOtherIDLE(RgvSlave slave) {
+        RgvProtocol rgvProtocol = RgvStatusCache.getRgvStatus(slave.getId());
+        RgvTaskProtocol rgvTaskProtocol = RgvTaskCache.getRgvStatus(slave.getId());
+
+        if (rgvProtocol == null || rgvTaskProtocol == null) {
+            return false;
+        }
+        if (!rgvProtocol.getModeType().equals(RgvModeType.AUTO) || rgvProtocol.getRgvPos().equals(0L) || rgvTaskProtocol.getAvoid() == -1
+                || (!rgvProtocol.getStatusType().equals(RgvStatusType.IDLE) && !rgvProtocol.getStatusType().equals(RgvStatusType.ROAM))) {
+            return false;
+        }
+        RgvProtocol rgvProtocolOther = RgvStatusCache.getRgvStatus(slave.getOtherId());
+        RgvTaskProtocol rgvTaskProtocolOther = RgvTaskCache.getRgvStatus(slave.getOtherId());
+
+        if (rgvProtocolOther == null) {
+            return true;
+        }
+        if (rgvProtocolOther.statusEnable) {
+            if (rgvProtocolOther.getModeType().equals(RgvModeType.AUTO)
+                    && rgvProtocolOther.getStatusType().equals(RgvStatusType.IDLE)
+                    && rgvProtocolOther.getLoaded()==0) {
+                return false;
+            }
+        }
+        return true;
+    }
 
     public TaskWrk deviceDetection(RgvSlave.RgvStn inSta) {
 
@@ -1455,7 +1481,7 @@
                                 if (rgvStn.getStaNo().equals(staNoNow)) {
                                     TaskWrk taskWrk = deviceDetection(rgvStn);
                                     if (taskWrk != null) {
-                                        BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", taskWrk.getTargetPointConvert()));
+                                        BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", BarcodeUtils.getOutStaNo(taskWrk.getOriginTargetPoint())));
                                         if (RouteUtils.CheckIfItIsWithinTheRange(rangeList, basDevpPosition.getPlcPosition(), basDevpPositions, itSmall)) {
                                             sign = taskGenerate(rgvSlave, rgvStn, 0);
                                         }
@@ -1482,13 +1508,19 @@
                             }
                         }
 
+                        if (!sign){
+                            if (!rgvOtherIDLE(rgvSlave)){
+                                sign=true;
+                            }
+                        }
+
                         if (!sign) {
                             for (Integer staNoNow : rangeList) {
                                 for (RgvSlave.RgvStn rgvStn : rgvSlave.getRgvInSta()) {
                                     if (rgvStn.getStaNo().equals(staNoNow)) {
                                         TaskWrk taskWrk = deviceDetection(rgvStn);
                                         if (taskWrk != null) {
-                                            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", taskWrk.getTargetPointConvert()));
+                                            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", BarcodeUtils.getOutStaNo(taskWrk.getOriginTargetPoint())));
                                             if (RouteUtils.CheckIfItIsWithinTheRange(rangeList, basDevpPosition.getPlcPosition(), basDevpPositions, itSmall)) {
                                                 sign = taskGenerate(rgvSlave, rgvStn, 0);
                                             }
@@ -1522,7 +1554,7 @@
                                     if (rgvStn.getStaNo().equals(staNoNow)) {
                                         TaskWrk taskWrk = deviceDetection(rgvStn);
                                         if (taskWrk != null) {
-                                            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", taskWrk.getTargetPointConvert()));
+                                            BasDevpPosition basDevpPosition = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", BarcodeUtils.getOutStaNo(taskWrk.getOriginTargetPoint())));
                                             if (RouteUtils.CheckIfItIsWithinTheRange(rangeList, basDevpPosition.getPlcPosition(), basDevpPositions, itSmall)) {
                                                 sign = taskGenerate(rgvSlave, rgvStn, 0);
                                             }

--
Gitblit v1.9.1