修改4F agv

yangwl
夜笙歌 2 weeks ago
parent c93aa37262
commit 2d0d1e6f97

@ -101,7 +101,7 @@
<div :class="`${i.isGoods? 'agv2':'agv1'}`" v-for="i in agvData" <div :class="`${i.isGoods? 'agv2':'agv1'}`" v-for="i in agvData"
:style="`${getLocation(i.x,i.y)}transform: rotate(${parseFloat(i.rotate )- 90}deg);`"></div> :style="`${getLocation(i.x,i.y)}transform: rotate(${parseFloat(i.rotate )- 180}deg);`"></div>
</div> </div>
</div> </div>
</template> </template>
@ -277,8 +277,8 @@ export default {
equipmentData: [], equipmentData: [],
agvData: [], agvData: [],
siteData: { siteData: {
x:250000, x: 121000,
y:200000 y: 82000
} }
} }
}, },
@ -293,11 +293,12 @@ export default {
getAgvLocation() { getAgvLocation() {
let agvArr = [] let agvArr = []
getAgvData().then(e => { getAgvData().then(e => {
console.log(Math.max(...e.Data.map(v => v.X)), Math.max(...e.Data.map(v => v.Y)))
e.Data.forEach(v => { e.Data.forEach(v => {
agvArr.push({ agvArr.push({
id: v.AgvId, id: v.AgvId,
x: Math.random() || v.X/this.siteData.x, x: (v.X - 126000) / this.siteData.x,
y: Math.random() || v.Y/this.siteData.y, y: (72000 - (v.Y - 116000)) / this.siteData.y,
rotate: v.Angle, rotate: v.Angle,
isGoods: false, isGoods: false,
}) })
@ -309,12 +310,18 @@ export default {
getAgvData().then(e => { getAgvData().then(e => {
e.Data.forEach(v => { e.Data.forEach(v => {
if (this.agvData.filter(r => r.id === v.AgvId).length >= 1) { if (this.agvData.filter(r => r.id === v.AgvId).length >= 1) {
new TWEEN.Tween(this.agvData.find(r=>r.id===v.AgvId)).to({x:v.X/this.siteData.x, y: v.Y/this.siteData.y}, time).start() new TWEEN.Tween(this.agvData.find(r => r.id === v.AgvId)).to({
rotate: v.Angle,
}, 100).start()
new TWEEN.Tween(this.agvData.find(r => r.id === v.AgvId)).to({
x: (v.X - 126000) / this.siteData.x,
y: (72000 - (v.Y - 116000)) / this.siteData.y,
}, time - 100).start()
} else { } else {
this.agvData.push({ this.agvData.push({
id: v.AgvId, id: v.AgvId,
x: Math.random() || v.X/this.siteData.x, x: (v.X - 126000) / this.siteData.x,
y: Math.random() || v.Y/this.siteData.y, y: (72000 - (v.Y - 116000)) / this.siteData.y,
rotate: v.Angle, rotate: v.Angle,
isGoods: false, isGoods: false,
}) })
@ -340,13 +347,15 @@ export default {
mounted() { mounted() {
this.getData() this.getData()
this.getAgvLocation() this.getAgvLocation()
let time = 2 * 1000
setInterval(() => { setInterval(() => {
this.updateAGVLocation(5*1000) this.updateAGVLocation(time)
},5*1000) }, time)
setInterval(() => { setInterval(() => {
this.loopIndex = (this.loopIndex + 1) % 26 this.loopIndex = (this.loopIndex + 1) % 26
}, 1000 * 5) }, 1000 * 5)
function animate() { function animate() {
requestAnimationFrame(animate) requestAnimationFrame(animate)
TWEEN.update() TWEEN.update()

Loading…
Cancel
Save