From 7993b50ce6d99ba6abc6f979b3fece2490795fde Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期日, 11 五月 2025 15:16:13 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 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 55a8c13..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);
                                             }
@@ -1612,10 +1644,6 @@
                 if (targetPointConvert == null) {
                     return false;
                 }
-                RgvSlave.RgvStn rgvStnEnd = getRgvStnNow(rgvSlave, targetPointConvert);
-                if (rgvStnEnd == null) {
-                    return false;
-                }
 
                 BasDevpPosition basDevpPositionSou = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", rgvStn.getStaNo()));
                 BasDevpPosition basDevpPositionEnd = basDevpPositionService.selectOne(new EntityWrapper<BasDevpPosition>().eq("DEV_NO", targetPointConvert));
@@ -1625,7 +1653,7 @@
                 issuedTake.setTaskNoDirection(issuedTake.gettaskNoDirection$(issuedTake.getTaskNo(), issuedTake.getTaskStatus()));
                 issuedTake.setTargetPosition(basDevpPositionSou.getPlcPosition());
                 issuedTake.setIsRunning(1);
-                issuedTake.setDirection(rgvStn.isDirection());
+                issuedTake.setDirection(basDevpPositionSou.getRgvSign()==1);
 
 
                 issuedPut.setTaskNo(Long.valueOf(taskWrk.getTaskNo()));
@@ -1633,7 +1661,7 @@
                 issuedPut.setTaskNoDirection(issuedPut.gettaskNoDirection$(issuedPut.getTaskNo(), issuedPut.getTaskStatus()));
                 issuedPut.setTargetPosition(basDevpPositionEnd.getPlcPosition());
                 issuedPut.setIsRunning(1);
-                issuedPut.setDirection(rgvStnEnd.isDirection());
+                issuedPut.setDirection(basDevpPositionEnd.getRgvSign()==1);
             } catch (Exception e) {
                 log.error("浠诲姟鐢熸垚澶辫触issued1===銆嬪紓甯镐俊鎭細{}", e.getMessage());
                 return false;

--
Gitblit v1.9.1