From 0d04bc5d8080b82338302fba0a59fccff2eaedfc Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期日, 06 七月 2025 11:28:29 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java |   67 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 3 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 0bfef8e..92cad27 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
@@ -3,14 +3,22 @@
 import com.alibaba.fastjson.JSON;
 import com.zy.asrs.wcs.core.map.entity.MapWsShuttleVo;
 import com.zy.asrs.wcs.core.map.entity.MapWsVo;
+import com.zy.asrs.wcs.core.utils.Utils;
 import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * Created by vincent on 4/3/2024
  */
-@Component
+//@Component
 public class MockScheduler {
+
+    private int row = 1;
+    private int bay = 1;
+    private int lev = 1;
+    private boolean shouldIncreaseBay = true;
 
     @Scheduled(cron = "0/1 * * * * ? ")
     public void mock() {
@@ -19,10 +27,63 @@
         // shuttle
         MapWsShuttleVo shuttleVo = new MapWsShuttleVo();
         shuttleVo.setShuttleNo("1");
-        shuttleVo.setCurLocNo("1-1-1");
+
+
+
+        if (shouldIncreaseBay) {
+            if (bay < 30) {
+                bay++;
+            } else {
+                // bay 杈惧埌 30 鍚庯紝row 鍏堝 1
+                if (row < 10) {
+                    row++;
+                } else {
+                    row = 1;  // 濡傛灉 row 宸茬粡鏄渶澶э紝鍒欏洖鍒拌捣濮嬩綅缃�
+                }
+                shouldIncreaseBay = false;
+            }
+        } else {
+            if (bay > 1) {
+                bay--;
+            } else {
+                // bay 鍑忓埌 1 鍚庯紝鍒� row 鍏堝 1
+                if (row < 10) {
+                    row++;
+                } else {
+                    row = 1;  // 濡傛灉 row 宸茬粡鏄渶澶э紝鍒欏洖鍒拌捣濮嬩綅缃�
+                }
+                shouldIncreaseBay = true;
+            }
+        }
+
+
+        shuttleVo.setCurLocNo(Utils.getLocNo(row, bay, lev));
+        List<String> preTravelPath = generateFullTravelPath(10, 30, lev);
+        shuttleVo.setTravelPath(preTravelPath);
+
+
         wsVo.getShuttleVos().add(shuttleVo);
 
         MapWebSocket.broadcast(JSON.toJSONString(wsVo));
     }
 
+    private List<String> generateFullTravelPath(int maxRow, int maxBay, int currentLev) {
+        List<String> fullPath = new ArrayList<>();
+        boolean increasingBay = true; // 鍋囪浠� bay = 1 寮�濮嬮�掑
+
+        for (int currentRow = 1; currentRow <= maxRow; currentRow++) {
+            if (increasingBay) {
+                for (int currentBay = 1; currentBay <= maxBay; currentBay++) {
+                    fullPath.add(Utils.getLocNo(currentRow, currentBay, currentLev));
+                }
+            } else {
+                for (int currentBay = maxBay; currentBay >= 1; currentBay--) {
+                    fullPath.add(Utils.getLocNo(currentRow, currentBay, currentLev));
+                }
+            }
+            increasingBay = !increasingBay; // 鍒拌揪姣忚鐨勬湯灏炬椂鏀瑰彉bay鐨勯�掑/閫掑噺鏂瑰悜
+        }
+        return fullPath;
+    }
+
 }

--
Gitblit v1.9.1