From b552f79856b00b5b38313baac41562151895602d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 23 四月 2024 09:12:17 +0800
Subject: [PATCH] #

---
 src/core/warehouse.jsx |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/core/warehouse.jsx b/src/core/warehouse.jsx
index 0443611..402571f 100644
--- a/src/core/warehouse.jsx
+++ b/src/core/warehouse.jsx
@@ -9,33 +9,37 @@
 import { INTERVAL_TIME } from '@/config/setting'
 
 let index = 0;
+let coords = { x: 0, y: 0, z: 0 };
 
 const Warehouse = (props) => {
 
     const [agvData, setAgvData] = useState([
         {}
     ]);
-
     const [boxData, setBoxData] = useState([
         {}
     ])
 
     useEffect(() => {
+        const agvRealData = agvRealDataList[0];
+
         const timer = setInterval(() => {
-            const agvRealData = agvRealDataList[index];
-            if (agvRealData) {
-                setAgvData((state) => {
-                    return agvRealData;
-                });
-            }
+            coords.x++;
+            agvRealData[0].position = [coords.x, coords.y, coords.z];
+            // console.log(agvRealData);
+            setAgvData(agvRealData);
             index++;
-        }, INTERVAL_TIME);
+        }, 1000);
 
         return () => {
             clearInterval(timer);
         }
     }, [])
 
+    useEffect(() => {
+        console.log(agvData);
+    }, [agvData])
+
     const tunnelEl = useMemo(() => {
         return tunnelData.map((tunnel, index) => <Tunnel key={index} {...tunnel} />)
     }, []);

--
Gitblit v1.9.1