From 9d71e24e7982f6915e5f832512925bee9b245f35 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 20 八月 2024 16:13:26 +0800
Subject: [PATCH] #

---
 src/core/warehouse.jsx |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/core/warehouse.jsx b/src/core/warehouse.jsx
index b37c8ae..c9b74c3 100644
--- a/src/core/warehouse.jsx
+++ b/src/core/warehouse.jsx
@@ -7,6 +7,7 @@
 import Shelf from '../components/shelf';
 import Box from '../components/box';
 import Agv from '../components/agv';
+import Path from '../components/path'
 
 import tunnelData from '@/assets/data/tunnel';
 import areaData from '@/assets/data/area';
@@ -23,6 +24,7 @@
     const [agv1Data, setAgv1Data] = useState({});
     const [agv2Data, setAgv2Data] = useState({});
     const [boxData, setBoxData] = useState([]);
+    const [pathData, setPathData] = useState([]);
 
     useEffect(() => {
         const websocket = new WebSocketClient('/ws/digitalTwin/websocket');
@@ -40,6 +42,9 @@
                     default:
                         break;
                 }
+            }
+            if (data.type === 'path') {
+                setPathData(data.obj);
             }
         }
 
@@ -93,6 +98,9 @@
         return <Agv key={2} {...agv2Data} />
     }, [agv2Data]);
 
+    const pathEl = useMemo(() => {
+        return pathData.map((data, idx) => <Path key={idx} list={data} />)
+    }, [pathData])
 
     useFrame((state, delta) => {
 
@@ -107,6 +115,7 @@
                 {agv1El}
                 {agv2El}
                 {boxEl}
+                {pathEl}
             </group>
         </>
     )

--
Gitblit v1.9.1