From 2dcddd30632d46f85b09171c6e989cbe94e271fa Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 29 三月 2024 15:27:26 +0800
Subject: [PATCH] #

---
 zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js |    4 ++--
 zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx      |    7 ++++---
 zy-asrs-flow/src/pages/map/utils.js                   |   12 ++++++++++++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
index d78e531..1bd730c 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -66,7 +66,7 @@
 
     initCamera = () => {
         const camera = new THREE.PerspectiveCamera(70, this.getFullWidth() / this.getFullHeight(), 1, 60000);
-        camera.position.set(-300, 300, 300);
+        camera.position.set(-300, 800, 300);
         this.scene.add(camera);
         return camera;
     }
@@ -213,7 +213,7 @@
     scene.add(ambientLight);
 
     const spotLight = new THREE.SpotLight(0xffffff, 8);
-    spotLight.position.set(-300, 300, 0);
+    spotLight.position.set(-300, 1000, 0);
     spotLight.angle = Math.PI / 4;  // 瑙掑害
     spotLight.distance = 800;  // 璺濈
     spotLight.decay = 0;    // 鍏夎“
diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx b/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
index 8688226..98b8ad6 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -75,19 +75,20 @@
             if (res?.data && shelfThree) {
                 shelfThree.generateMesh((scene) => {
                     for (const item of res.data) {
-                        console.log(item);
+                        const { row, bay, lev } = Utils.parseLocNo(item.locNo);
+                        console.log(row, bay, lev);
                         // shelf
                         const shelfMesh = new THREE.Mesh(new THREE.BoxGeometry(100, 40, 100), new THREE.MeshStandardMaterial({
                             color: '#222f3e',
                         }));
-                        shelfMesh.position.set(0, 20, 0);
+                        shelfMesh.position.set(0, 20 + 100 * (lev - 1), 0);
                         scene.add(shelfMesh)
 
                         // pallet
                         const palletMesh = new THREE.Mesh(new THREE.BoxGeometry(100, 60, 100), new THREE.MeshStandardMaterial({
                             color: '#b33939',
                         }));
-                        palletMesh.position.set(0, 70, 0);
+                        palletMesh.position.set(0, 70 + 100 * (lev - 1), 0);
                         scene.add(palletMesh)
                     }
                 });
diff --git a/zy-asrs-flow/src/pages/map/utils.js b/zy-asrs-flow/src/pages/map/utils.js
index f85a38e..b85af4e 100644
--- a/zy-asrs-flow/src/pages/map/utils.js
+++ b/zy-asrs-flow/src/pages/map/utils.js
@@ -566,4 +566,16 @@
     } else {
         return false;
     }
+}
+
+export const parseLocNo = (locNo) => {
+    if (!locNo || typeof locNo !== 'string') {
+        return null;
+    }
+    const locParseArr = locNo.split('-');
+    return {
+        row: locParseArr?.[0],
+        bay: locParseArr?.[1],
+        lev: locParseArr?.[2],
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.1