From a1af77bc74bd98bd2ac6670f056180f333527b61 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 03 四月 2024 16:31:22 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/utils.js                                             |   20 +++++++++++++++++++-
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/websocket/MockScheduler.java |   20 +++++++++++++++++++-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index f25e436..3188b8f 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -113,6 +113,17 @@
     };
 }
 
+export const querySprite = (type, no) => {
+    if (!mapContainer) {
+        return;
+    }
+    for (const sprite of mapContainer.children) {
+        if (sprite.data?.type === type && sprite.data?.no === no) {
+            return sprite;
+        }
+    }
+}
+
 // show sprite feature from sprite click event
 export const viewFeature = (sprite, setCurSPrite) => {
     sprite.off('pointerup');
@@ -588,6 +599,13 @@
     const mapVo = JSON.parse(data);
     // shuttle
     for (const shuttleVo of mapVo.shuttleVos) {
-        console.log(shuttleVo);
+        const shuttle = querySprite(SENSOR_TYPE.SHUTTLE, shuttleVo.shuttleNo);
+        if (!shuttle && !shuttleVo.curLocNo) { continue; }
+        const { row, bay, lev } = parseLocNo(shuttleVo.curLocNo);
+        const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay);
+        new TWEEDLE.Tween(shuttle.position).easing(TWEEDLE.Easing.Linear.None).to({
+            x: shelf.position.x,
+            y: shelf.position.y
+        }, 1000).start();
     }
 }
\ No newline at end of file
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..9396a06 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,6 +3,7 @@
 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;
 
@@ -12,6 +13,10 @@
 @Component
 public class MockScheduler {
 
+    private int row = 1;
+    private int bay = 1;
+    private int lev = 1;
+
     @Scheduled(cron = "0/1 * * * * ? ")
     public void mock() {
         MapWsVo wsVo = new MapWsVo();
@@ -19,7 +24,20 @@
         // shuttle
         MapWsShuttleVo shuttleVo = new MapWsShuttleVo();
         shuttleVo.setShuttleNo("1");
-        shuttleVo.setCurLocNo("1-1-1");
+
+
+        if (bay < 30) {
+            bay ++;
+        } else {
+            bay = 1;
+            if (row < 10) {
+                row ++;
+            } else {
+                row = 1;
+            }
+        }
+
+        shuttleVo.setCurLocNo(Utils.getLocNo(row, bay, lev));
         wsVo.getShuttleVos().add(shuttleVo);
 
         MapWebSocket.broadcast(JSON.toJSONString(wsVo));

--
Gitblit v1.9.1