From 203c60072a65f2da652998fd99411a5e18fea957 Mon Sep 17 00:00:00 2001 From: yvan Date: Sat, 26 Jul 2025 11:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BD=9C=E4=BC=8F=E5=BC=8F=E8=B4=A7=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/AmrMapConvert.ts | 57 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/src/utils/AmrMapConvert.ts b/src/utils/AmrMapConvert.ts index 97d7042..279e440 100644 --- a/src/utils/AmrMapConvert.ts +++ b/src/utils/AmrMapConvert.ts @@ -305,17 +305,51 @@ export function AmrMapConvert(from: any): Array { } // 旋转站 - if (_.findIndex(amrNode.propsValues, v => v === 'CellTypePallet') >= 0) { + if (amrNode.constraints) { // 这是一个旋转站, 读取 constraints 所有的 key const agvRotation = [] for (const key of Object.keys(amrNode.constraints)) { agvRotation.push(key) } 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) { @@ -347,6 +381,7 @@ export function AmrMapConvert(from: any): Array { if (amrNode.type !== 'ROAD') { continue } + for (const dg of amrNode.directionGroup) { // 从 dg.startSite 和 dg.endSite 中获取对应的点位 const startNode = amrIdMap.get(dg.startSite) @@ -490,3 +525,21 @@ function convertLinkStoreDistance(direction: string, storeNode: any) { 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) +}