From 111316dd3c9db874a24a4126b2b754f0e1b7bd6a Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 11 四月 2024 16:13:31 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java |   44 +++++++++++++-------------------------------
 1 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java
index 1978188..6ef51dc 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java
@@ -59,8 +59,8 @@
 
 
         shuttleVo.setCurLocNo(Utils.getLocNo(row, bay, lev));
-        List<String> preTravelPath = generatePreTravelPath(row, bay, lev, shouldIncreaseBay, 10);
-        shuttleVo.setPreTravelPath(preTravelPath);
+        List<String> preTravelPath = generateFullTravelPath(10, 30, lev);
+        shuttleVo.setTravelPath(preTravelPath);
 
 
         wsVo.getShuttleVos().add(shuttleVo);
@@ -68,41 +68,23 @@
         MapWebSocket.broadcast(JSON.toJSONString(wsVo));
     }
 
-    private List<String> generatePreTravelPath(int currentRow, int currentBay, int currentLev, boolean increasingBay, int pathLength) {
-        List<String> path = new ArrayList<>();
-        int tempRow = currentRow;
-        int tempBay = currentBay;
-        boolean tempIncreaseBay = increasingBay;
+    private List<String> generateFullTravelPath(int maxRow, int maxBay, int currentLev) {
+        List<String> fullPath = new ArrayList<>();
+        boolean increasingBay = true; // 鍋囪浠� bay = 1 寮�濮嬮�掑
 
-        for (int i = 0; i < pathLength; i++) {
-            if (tempIncreaseBay) {
-                if (tempBay < 30) {
-                    tempBay++;
-                } else {
-                    if (tempRow < 10) {
-                        tempRow++;
-                    } else {
-                        tempRow = 1;  // 濡傛灉 row 宸茬粡鏄渶澶э紝鍒欏洖鍒拌捣濮嬩綅缃�
-                    }
-                    tempIncreaseBay = false;
+        for (int currentRow = 1; currentRow <= maxRow; currentRow++) {
+            if (increasingBay) {
+                for (int currentBay = 1; currentBay <= maxBay; currentBay++) {
+                    fullPath.add(Utils.getLocNo(currentRow, currentBay, currentLev));
                 }
             } else {
-                if (tempBay > 1) {
-                    tempBay--;
-                } else {
-                    if (tempRow < 10) {
-                        tempRow++;
-                    } else {
-                        tempRow = 1;  // 濡傛灉 row 宸茬粡鏄渶澶э紝鍒欏洖鍒拌捣濮嬩綅缃�
-                    }
-                    tempIncreaseBay = true;
+                for (int currentBay = maxBay; currentBay >= 1; currentBay--) {
+                    fullPath.add(Utils.getLocNo(currentRow, currentBay, currentLev));
                 }
             }
-            // 灏嗙敓鎴愮殑搴撲綅鍙峰姞鍏ヨ矾寰勫垪琛�
-            path.add(Utils.getLocNo(tempRow, tempBay, currentLev));
+            increasingBay = !increasingBay; // 鍒拌揪姣忚鐨勬湯灏炬椂鏀瑰彉bay鐨勯�掑/閫掑噺鏂瑰悜
         }
-
-        return path;
+        return fullPath;
     }
 
 }

--
Gitblit v1.9.1