仓库地图优化

master
zhaoxiaomin 2 years ago
parent 01c8409dc1
commit 173db89e60
  1. 30
      src/api/util/mapDrawing.js
  2. 5
      src/router/index.js
  3. 28
      src/views/libraryManage/mapRouter/index.vue
  4. 37
      src/views/libraryManage/warehouseMap/index.vue

@ -508,6 +508,7 @@ class MapDrawing extends EventEmitter {
var gubeMaterial = new THREE.MeshMatcapMaterial({ var gubeMaterial = new THREE.MeshMatcapMaterial({
color: self.loadColor(info.color) color: self.loadColor(info.color)
}) })
var gubeMesh = new THREE.Mesh(gube, gubeMaterial) var gubeMesh = new THREE.Mesh(gube, gubeMaterial)
// gubeMesh.position.set(info.p3[0], info.p3[1], info.p3[2]) // gubeMesh.position.set(info.p3[0], info.p3[1], info.p3[2])
gubeMesh.nodeId = info.id gubeMesh.nodeId = info.id
@ -746,15 +747,15 @@ class MapDrawing extends EventEmitter {
/** /**
* 绘制仓库 * 绘制仓库
*/ */
drawWarehouses () { async drawWarehouses () {
// console.log('我不知道我调用了几次'); // console.log('我不知道我调用了几次');
//调用一次 //调用一次
let self = this let self = this
Object.keys(this.property.warehouseInfo.storageRack).map(storageRackId => { await Promise.all(Object.keys(this.property.warehouseInfo.storageRack).map(storageRackId => {
let storageRack = this.property.warehouseInfo.storageRack[storageRackId] let storageRack = this.property.warehouseInfo.storageRack[storageRackId]
let stateDictionary = this.property.config.tileStateDictionary[this.property.config.tileStateDictionary.hasOwnProperty(storageRack.state) ? storageRack.state : '0'] let stateDictionary = this.property.config.tileStateDictionary[this.property.config.tileStateDictionary.hasOwnProperty(storageRack.state) ? storageRack.state : '0']
//疑似仓库地图 点位`1 //疑似仓库地图 点位`1
console.log(this.property.layer.levels.nowLevel); // console.log('仓库',this.property.layer.levels.nowLevel);
let storageRackInfo = { let storageRackInfo = {
id: storageRack.id, id: storageRack.id,
@ -782,7 +783,7 @@ class MapDrawing extends EventEmitter {
console.log(2222); console.log(2222);
storageRack.childNodes = self.drawRactangleInParent(storageRackInfo, freightSpaces, dictionary) storageRack.childNodes = self.drawRactangleInParent(storageRackInfo, freightSpaces, dictionary)
} }
}) }))
} }
filterFreightSpace (rowIndex, columnIndex, levelIndex) { filterFreightSpace (rowIndex, columnIndex, levelIndex) {
@ -805,9 +806,10 @@ class MapDrawing extends EventEmitter {
/** /**
* 绘制四向车通路 * 绘制四向车通路
*/ */
drawRoad () { async drawRoad () {
let self = this let self = this
Object.keys(this.property.warehouseInfo.fourwayCarRoad).map(fourwayCarRoadId => { await Promise.all(Object.keys(this.property.warehouseInfo.fourwayCarRoad).map(fourwayCarRoadId => {
// console.log('通道')
let fourwayCarRoad = this.property.warehouseInfo.fourwayCarRoad[fourwayCarRoadId] let fourwayCarRoad = this.property.warehouseInfo.fourwayCarRoad[fourwayCarRoadId]
let stateDictionary = this.property.config.roadStateDictionary[this.property.config.roadStateDictionary.hasOwnProperty(fourwayCarRoad.state) ? fourwayCarRoad.state : '0'] let stateDictionary = this.property.config.roadStateDictionary[this.property.config.roadStateDictionary.hasOwnProperty(fourwayCarRoad.state) ? fourwayCarRoad.state : '0']
@ -834,7 +836,7 @@ class MapDrawing extends EventEmitter {
} else { } else {
fourwayCarRoad.childNodes = self.drawRactangleInParent(fourwayCarRoadInfo, children, dictionary) fourwayCarRoad.childNodes = self.drawRactangleInParent(fourwayCarRoadInfo, children, dictionary)
} }
}) }))
} }
/** /**
@ -1719,25 +1721,25 @@ class MapDrawing extends EventEmitter {
} }
} }
initWarehouse () { initWarehouse () {
if (this.property.warehouseInfo) { if (this.property.warehouseInfo) {
this.drawWarehouses()
if (this.property.config.vehicleType === 1) { if (this.property.config.vehicleType === 1) {
// this.drawPilers()
// this.drawBelt()
} else { } else {
this.drawRoad() this.drawRoad()
} }
this.drawWarehouses()
// this.drawCars() // this.drawCars()
} else { } else {
this.initLight() this.initLight()
} }
this.animate() this.animate()
this.initEvent() this.initEvent()
// if (this.property.grid) {
// this.initGrid(this.property.grid.width, this.property.grid.height, this.property.grid.singleWidth, this.property.grid.singleHeight)
// }
} }
} }
export default MapDrawing export default MapDrawing

@ -106,6 +106,11 @@ export const constantRoutes = [
}, },
], ],
}, },
{
path: "/mapRouter",
component: () => import("@/views/libraryManage/mapRouter/index.vue"),
hidden: true,
},
// { // {
// path: "/", // path: "/",
// component: Layout, // component: Layout,

@ -0,0 +1,28 @@
<script setup>
export default {
name: "mapRouter",
data() {
return {}
},
created() {
this.$router.replace('/libraryManage/warehouseMap');
},
// 使 watch
watch: {
'$route': function(to, from) {
// console.log('////')
this.$router.replace('/libraryManage/warehouseMap');
}
},
}
</script>
<template>
<div>
</div>
</template>
<style scoped lang="scss">
</style>

@ -1,6 +1,8 @@
<template> <template>
<div class="app-container"> <div class="app-container"
v-loading="loading"
>
<div <div
class="dataContainer" class="dataContainer"
@ -377,7 +379,8 @@ export default {
num2: '', num2: '',
num3: '', num3: '',
num4: '' num4: ''
} },
loading: false
} }
}, },
mounted() { mounted() {
@ -388,25 +391,12 @@ export default {
} }
var layerId1 = localStorage.getItem('level') || 'level-1' var layerId1 = localStorage.getItem('level') || 'level-1'
this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7)) this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7))
// this.init('piler')
// var layerId1 = localStorage.getItem('level') || 'level-1'
// this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7))
// console.log(layerId1, this.layer[layerId1], layerId1.slice(6, 7), this.layer)
// getLogicalAreaList({ pageNum: 1, pageSize: 999 }).then((response) => {
// this.LogicalAreaList = response.rows
// // this.paging.total = response.total
// this.loading = false
// })
// // clearInterval(timer)
// var timer = setInterval(() => {
// this.startMap()
// // console.log(2222)
// }, 30000)
}, },
methods: { methods: {
init(type) { init(type) {
let self = this let self = this
this.type = type this.type = type
this.config=JSON.parse(JSON.stringify(sysConfig))
switch (type) { switch (type) {
case 'fourwayCar': case 'fourwayCar':
this.config.mutiLayer = true this.config.mutiLayer = true
@ -420,12 +410,14 @@ export default {
this.config.warehouseType = 1 this.config.warehouseType = 1
break break
} }
let container = document.getElementById('mapContainer') let container=null
container = document.getElementById('mapContainer')
if (container) { if (container) {
this.config.mapWidth = this.config.columnCount * this.config.standardXLength this.config.mapWidth = this.config.columnCount * this.config.standardXLength
this.config.mapHeight = this.config.rowCount * this.config.standardYLength this.config.mapHeight = this.config.rowCount * this.config.standardYLength
this.config.leftOffset = this.config.leftOffset - this.config.mapWidth / 2 - this.config.standardXLength / 2 - this.config.standardXLength * this.config.leftOffsetCell this.config.leftOffset = this.config.leftOffset - this.config.mapWidth / 2 - this.config.standardXLength / 2 - this.config.standardXLength * this.config.leftOffsetCell
this.config.topOffset = this.config.topOffset - this.config.mapHeight / 2 - this.config.standardYLength / 2 - this.config.standardYLength * this.config.topOffsetCell this.config.topOffset = this.config.topOffset - this.config.mapHeight / 2 - this.config.standardYLength / 2 - this.config.standardYLength * this.config.topOffsetCell
this.mapControl =null
this.mapControl = new MapDrawing('mapContainer', { this.mapControl = new MapDrawing('mapContainer', {
width: container.offsetWidth - 10, width: container.offsetWidth - 10,
height: window.innerHeight - 10, height: window.innerHeight - 10,
@ -493,6 +485,7 @@ export default {
} }
} }
this.mapControl.initWarehouse() this.mapControl.initWarehouse()
} else { } else {
this.init() this.init()
} }
@ -898,13 +891,9 @@ export default {
} }
}) })
localStorage.setItem('layerItem', JSON.stringify(this.layer)) localStorage.setItem('layerItem', JSON.stringify(this.layer))
// }
// this.layer[layerId1] // location.reload()
// this.layer[layerId] = !this.layer[layerId] this.$router.replace('/mapRouter');
// this.mapControl.layerControl(layerId1, this.layer[layerId1], layerId1.slice(6, 7))
// this.mapControl.initWarehouse()
// console.log(this.layer[layerId]);
location.reload()
}, },
getPointPosition(tileData) { getPointPosition(tileData) {
// x // x

Loading…
Cancel
Save