From 033b100768dab566c313a1835d886f08f79fd137 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 四月 2024 16:39:32 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/utils.js |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index bbf26ab..3d68464 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -631,26 +631,29 @@
     // shuttleVo
     for (const shuttleVo of mapVo.shuttleVos) {
         // path
-        drawTravelPath(shuttleVo.travelPath, shuttleVo.shuttleNo, curFloor);
+        drawTravelPath(shuttleVo, curFloor);
         // shuttle
-        showShuttle(shuttleVo.shuttleNo, shuttleVo.curLocNo, curFloor, setCurSPrite);
+        showShuttle(shuttleVo, curFloor, setCurSPrite);
     }
 }
 
-export const drawTravelPath = (path, shuttleNo, curFloor) => {
+export const drawTravelPath = (shuttleVo, curFloor) => {
+    const { shuttleNo, curLocNo, travelPath: path } = shuttleVo;
     if (!mapContainer) {
         return;
     }
     const pathLineName = 'preTravelPath-' + shuttleNo;
     let pathLine = mapContainer.getChildByName(pathLineName);
-    if (pathLine) mapContainer.removeChild(pathLine);
+    if (pathLine) {
+        mapContainer.removeChild(pathLine);
+    }
 
     pathLine = new PIXI.Graphics();
     pathLine.name = pathLineName;
     pathLine.lineStyle(3 * (1 / mapContainer.scale.x), 0x3498db, 1);
     pathLine.zIndex = SENSOR_ZINDEX.TRAVEL_PATH;
     let firstNode = true;
-    for (let i = 0; i < path.length; i++) {
+    for (let i = path.indexOf(curLocNo) - 1; i < path.length; i++) {
         const { row, bay, lev } = parseLocNo(path[i]);
         if (Number(lev) !== curFloor) { continue }
         const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay);
@@ -669,23 +672,25 @@
     mapContainer.addChild(pathLine);
 }
 
-export const showShuttle = (shuttleNo, curLocNo, curFloor, setCurSPrite) => {
+export const showShuttle = (shuttleVo, curFloor, setCurSPrite) => {
+    const { shuttleNo, curLocNo } = shuttleVo;
     if (!curLocNo) { return }
     const { row, bay, lev } = parseLocNo(curLocNo);
     if (Number(lev) !== curFloor) { return }
+
+    const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay);
+    if (!shelf) { return }
 
     let shuttle = querySprite(SENSOR_TYPE.SHUTTLE, shuttleNo);
     if (!shuttle) {
         shuttle = generateSprite(SENSOR_TYPE.SHUTTLE);
         initSprite(shuttle, SENSOR_TYPE.SHUTTLE);
         shuttle.data.no = shuttleNo;
+        shuttle.position.set(shelf.position.x, shelf.position.y);
         mapContainer.addChild(shuttle);
         viewFeature(shuttle, setCurSPrite);
     }
-
-    const shelf = querySprite(SENSOR_TYPE.SHELF, row + '-' + bay);
-    if (!shelf) { return }
-
+ 
     new TWEEDLE.Tween(shuttle?.position).easing(TWEEDLE.Easing.Linear.None).to({
         x: shelf.position.x,
         y: shelf.position.y

--
Gitblit v1.9.1