diff --git a/hw-ui/src/views/board/model/agv.js b/hw-ui/src/views/board/model/agv.js index eadf0f1..758efe6 100644 --- a/hw-ui/src/views/board/model/agv.js +++ b/hw-ui/src/views/board/model/agv.js @@ -454,19 +454,11 @@ const AGVAnimation = (e, item, type, newLocation = {}, time = 2000) => { } } -setInterval(() => { - - if (isLoading) { - AGVAnimation('2AGV', '2AGV', 'xz', { x: Math.random() * 100, z: Math.random() * 100 }) - AGVAnimation('3AGV', '3AGV', 'xz', { x: Math.random() * 100, z: Math.random() * 100 }) - AGVAnimation('5CCAGV', '5CCAGV', 'xz', { x: Math.random() * 100, z: Math.random() * 100 }) - AGVAnimation('5BFAGV', '5BFAGV', 'xz', { x: Math.random() * 100, z: Math.random() * 100 }) - - AGVAnimation('5CTU', '5CTU', 'x', { x: (7 + Math.random() * 70) }) - } -}, 2500) export { agvData, - AGVAnimation + AGVAnimation, + floorOrigin, + floorData1, + isAGVLoading } diff --git a/hw-ui/src/views/board/model/index.vue b/hw-ui/src/views/board/model/index.vue index 78c36bb..19e5095 100644 --- a/hw-ui/src/views/board/model/index.vue +++ b/hw-ui/src/views/board/model/index.vue @@ -112,11 +112,11 @@ import { storeyHeight, storeyWidth, tuopanLocation, - animationLine + animationLine, isLoading } from './setThree' import { - AGVAnimation, agvData + AGVAnimation, agvData,floorOrigin,floorData1,isAGVLoading } from './agv' const vw = (document.documentElement.clientWidth || document.body.clientWidth) / 100 @@ -134,9 +134,42 @@ export default { } }, mounted() { - getAgvDeviceStatus().then(e=>{ - console.log(e) - }) + setInterval(()=>{ + if(isLoading && isAGVLoading){ + getAgvDeviceStatus().then(e=>{ + console.log(e) + e.data.agvStatusList.forEach(v=>{ + if(v.agvName === "2楼叉车"){ + let x = (v.posX - floorOrigin.floor2Data.x) / floorData1.floor2Data.x + let z = (v.posY - floorOrigin.floor2Data.y) / floorData1.floor2Data.z + console.log({x,z}) + AGVAnimation('2AGV', '2AGV', 'xz', { x: x * 100, z: z * 100 }) + } + if(v.agvName === "3楼叉车"){ + let x = (v.posX - floorOrigin.floor3Data.x) / floorData1.floor3Data.x + let z = (v.posY - floorOrigin.floor3Data.y) / floorData1.floor3Data.z + AGVAnimation('3AGV', '3AGV', 'xz', { x: x * 100, z: z * 100 }) + } + if(v.agvName === "5楼叉车"){ + let x = (v.posX - floorOrigin.floor5Data.x) / floorData1.floor5Data.x + let z = (v.posY - floorOrigin.floor5Data.y) / floorData1.floor5Data.z + AGVAnimation('5CCAGV', '5CCAGV', 'xz', { x: x * 100, z: z * 100 }) + } + if(v.agvName === "5楼背负式"){ + let x = (v.posX - floorOrigin.floor5Data.x) / floorData1.floor5Data.x + let z = (v.posY - floorOrigin.floor5Data.y) / floorData1.floor5Data.z + AGVAnimation('5BFAGV', '5BFAGV', 'xz', { x: x * 100, z: z * 100 }) + } + if(v.agvName === "5楼CTU"){ + let x = (v.posX - floorOrigin.floor5Data.x) / floorData1.floor5Data.x + let z = (v.posY - floorOrigin.floor5Data.y) / floorData1.floor5Data.z + AGVAnimation('5CTU', '5CTU', 'x', { x: x * 100, z: z * 100 }) + } + }) + + }) + } + },2500) this.$refs.threeJs.appendChild(renderer.domElement) // controls.rotateSpeed = -controls.rotateSpeed;