From fe4c6c0439e0dc00f0b09d1818735065d38d3078 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 05 十一月 2024 17:11:07 +0800
Subject: [PATCH] #

---
 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
index a0a6f4d..4e66ed4 100644
--- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
+++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/RetreatNavigateService.java
@@ -31,7 +31,7 @@
 
     private final RedisSupport redis = RedisSupport.defaultRedisSupport;
 
-    public static final int WEIGHT_CALC_COEFFICIENT = 1000;
+    public static final int WEIGHT_CALC_COEFFICIENT = 10000;
 
     @Autowired
     private CodeService codeService;
@@ -168,7 +168,8 @@
 
             RetreatNavigateNode availablePointOfTurn = null;
             List<String> availablePointWaveScopeOfTurn = new ArrayList<>();
-            int actuallyLanesOfTurn = 0;
+            int actualLanesOfTurn = 0;
+            int filterPointOfTurnTimes = 0;
 
             while (openQueue.size() > 0 && null == finialNode) {
 
@@ -181,14 +182,16 @@
                 if (null == availablePointOfTurn) {
                     // 璁$畻鏄惁涓哄彲鐢ㄨ浆寮偣
                     if (neighborNodes.size() >= 2 && !isSame(start, currentNode)) {
+                        filterPointOfTurnTimes ++;
+                        if (filterPointOfTurnTimes > 2) { break; }
+
                         for (RetreatNavigateNode node : neighborNodes) {
                             // lane
                             Lane lane = laneService.search(node.getCodeData());
                             if (null != lane) {
                                 Set<String> lanVehicleSet = new HashSet<>();
 
-                                List<String> laneCodes = lane.getCodes();
-                                for (String laneCodeData : laneCodes) {
+                                for (String laneCodeData : lane.getCodes()) {
                                     int[] laneCodeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(null, laneCodeData);
                                     // scan dynamicMatrix or WaveMatrix
                                     DynamicNode laneDynamicNode = dynamicMatrix[laneCodeMatrixIdx[0]][laneCodeMatrixIdx[1]];
@@ -197,7 +200,7 @@
                                     if (!laneVehicle.equals(DynamicNodeType.ACCESS.val)) {
                                         if (!laneVehicle.equals(agvNo)) {
                                             lanVehicleSet.add(laneVehicle);
-    //                                redis.setObject(RedisConstant.AGV_TO_STANDBY_FLAG, laneVehicle, true, 30);
+//                                            redis.setObject(RedisConstant.AGV_TO_STANDBY_FLAG, laneVehicle, true, 30);
                                         }
                                     }
                                 }
@@ -207,14 +210,16 @@
                                 }
                             }
 
-                            actuallyLanesOfTurn ++;
+                            actualLanesOfTurn ++;
                         }
 
                         // 鏈変袱鏉′互涓婂彲璧板贩閬擄紝鍒欒涓烘湁鏁堣浆寮偣
-                        if (actuallyLanesOfTurn >= 2) {
+                        if (actualLanesOfTurn >= 2) {
                             availablePointOfTurn = currentNode;
                             availablePointWaveScopeOfTurn = mapService.getWaveScopeByCode(lev, availablePointOfTurn.getCodeData(), avoidDistance)
                                     .stream().map(NavigateNode::getCodeData).distinct().collect(Collectors.toList());
+                        } else {
+                            actualLanesOfTurn = 0;
                         }
                     }
                 }
@@ -235,10 +240,9 @@
                             }
                             if (1 < mapDataDispatcher.queryCodeListFromDynamicNode(lev, otherWave).size()) {
 
-                                if (null != availablePointOfTurn && actuallyLanesOfTurn > 0) {
-                                    actuallyLanesOfTurn --;
+                                if (null != availablePointOfTurn && actualLanesOfTurn > 0) {
+                                    actualLanesOfTurn --;
                                 }
-
                                 continue label;
                             } else {
                                 weight += WEIGHT_CALC_COEFFICIENT;
@@ -259,10 +263,10 @@
                     existNodes.add(node);
                 }
 
-                if (actuallyLanesOfTurn < 2) {
+                if (actualLanesOfTurn < 2) {
                     availablePointOfTurn = null;
                     availablePointWaveScopeOfTurn = new ArrayList<>();
-                    actuallyLanesOfTurn = 0;
+                    actualLanesOfTurn = 0;
                 } else {
                     if (!Cools.isEmpty(enableNodes)) {
                         Collections.sort(enableNodes);

--
Gitblit v1.9.1