Browse Source

潜伏式货位

jx-test
修宁 5 months ago
parent
commit
203c60072a
  1. 57
      src/utils/AmrMapConvert.ts

57
src/utils/AmrMapConvert.ts

@ -305,17 +305,51 @@ export function AmrMapConvert(from: any): Array<ItemJson> {
} }
// 旋转站 // 旋转站
if (_.findIndex(amrNode.propsValues, v => v === 'CellTypePallet') >= 0) { if (amrNode.constraints) {
// 这是一个旋转站, 读取 constraints 所有的 key // 这是一个旋转站, 读取 constraints 所有的 key
const agvRotation = [] const agvRotation = []
for (const key of Object.keys(amrNode.constraints)) { for (const key of Object.keys(amrNode.constraints)) {
agvRotation.push(key) agvRotation.push(key)
} }
if (agvRotation.length > 0) { if (agvRotation.length > 0) {
lccMap.get(lccId).dt.agvRotation = agvRotation insertNode.dt.agvRotation = agvRotation
} }
} }
} }
// 这是潜伏AGV货位
if(amrNode.type === 'CODE' && amrNode.attribute[0]?.rackTypeId === 3) {
lccMap.set(lccId+'C', {
"id": lccId+'C',
"t": "gstore",
"v": true,
"tf": [
[
new Decimal(amrNode.x).div(d100).toNumber(),
0,
new Decimal(amrNode.y).div(d100).toNumber()
],
[0,0,0],
[0.5,0.01,0.5]
],
"dt": {
"in": [],
"out": [],
"center": [],
"strokeWidth": 0.05
},
"logicX": amrNode.logicX,
"logicY": amrNode.logicY
})
insertNode.dt.linkStore = []
for(let c of amrNode.direction) {
insertNode.dt.linkStore.push({
'item': lccId+'C',
'bay': 0, 'level': 0, 'cell': 0, 'direction': convertDirection(c)
})
}
}
} }
if (insertNode) { if (insertNode) {
@ -347,6 +381,7 @@ export function AmrMapConvert(from: any): Array<ItemJson> {
if (amrNode.type !== 'ROAD') { if (amrNode.type !== 'ROAD') {
continue continue
} }
for (const dg of amrNode.directionGroup) { for (const dg of amrNode.directionGroup) {
// 从 dg.startSite 和 dg.endSite 中获取对应的点位 // 从 dg.startSite 和 dg.endSite 中获取对应的点位
const startNode = amrIdMap.get(dg.startSite) const startNode = amrIdMap.get(dg.startSite)
@ -490,3 +525,21 @@ function convertLinkStoreDistance(direction: string, storeNode: any) {
storeNode.tf[1][1] = 90 // 90 度旋转 storeNode.tf[1][1] = 90 // 90 度旋转
} }
} }
// 根据方向,调整存储位的距离
function convertDirection(directions: string) {
// N=up / S=down / E=right / W=left
if(directions === 'N') {
return 'up'
}
if(directions === 'S'){
return 'down'
}
if(directions === 'E'){
return 'right'
}
if(directions === 'W'){
return 'left'
}
throw new Error('convertDirection error:'+ directions)
}

Loading…
Cancel
Save