将CHEJIA车架夹具默认扫描方案关联到四站逐层工具Z90度Y退50低位版,保留其他夹具和已冻结任务。 归档已发布的大车架304/308站点调整及长边X余量50毫米维护入口和核对说明。 JDK17编译及6项默认映射检查通过,维护脚本语法和差异检查通过;不包含手持功能运行代码。
50 lines
2.9 KiB
JavaScript
50 lines
2.9 KiB
JavaScript
import fs from 'node:fs'
|
|
import assert from 'node:assert/strict'
|
|
|
|
// Change navigation destinations and their captions only. Retain input keys so
|
|
// copied task parameters continue to match; never publish or operate equipment.
|
|
const [sourcePath, outputPath] = process.argv.slice(2)
|
|
if (!sourcePath || !outputPath) throw new Error('Usage: node build_large_frame_mixed_stations.mjs <large-frame-V1-snapshot.json> <flow.json>')
|
|
const source = JSON.parse(fs.readFileSync(sourcePath, 'utf8').replace(/^\uFEFF/, ''))
|
|
assert.equal(source.published.id, '263269a4367e55308a8549ff9ebeb6af')
|
|
const original = JSON.parse(source.published.flowData), graph = structuredClone(original)
|
|
const mapping = { LM404: 'LM304', LM408: 'LM308' }
|
|
const caption = value => typeof value === 'string' ? value.replace(/LM40[48]/g, station => mapping[station]) : value
|
|
const navigation = graph.nodes.filter(n => n.properties?.action === 'AGV_MOVE_TO_STATION')
|
|
const station = n => n.properties.nodeParams.find(p => p.name === 'stationId')
|
|
assert.deepEqual(navigation.map(n => station(n).input), ['LM402', 'LM404', 'LM406', 'LM408'])
|
|
for (const node of graph.nodes) {
|
|
const p = node.properties
|
|
if (!p) continue
|
|
p.name = caption(p.name)
|
|
if (node.type === 'start') for (const input of p.inputParams || []) {
|
|
if (typeof input.desc === 'string') input.desc = caption(input.desc)
|
|
if (typeof input.label === 'string') input.label = caption(input.label)
|
|
}
|
|
if (p.action !== 'AGV_MOVE_TO_STATION') continue
|
|
const parameter = station(node)
|
|
parameter.input = mapping[parameter.input] || parameter.input
|
|
for (const option of parameter.selectOptions || []) {
|
|
option.value = caption(option.value)
|
|
option.label = caption(option.label)
|
|
}
|
|
}
|
|
assert.deepEqual(navigation.map(n => station(n).input), ['LM402', 'LM304', 'LM406', 'LM308'])
|
|
// Prove the allowlist: restore only navigation/captions, then compare the whole graph.
|
|
const restored = structuredClone(graph)
|
|
for (let index = 0; index < original.nodes.length; index++) {
|
|
const before = original.nodes[index], after = restored.nodes[index]
|
|
after.properties.name = before.properties.name
|
|
if (before.type === 'start') after.properties.inputParams = structuredClone(before.properties.inputParams)
|
|
if (before.properties.action === 'AGV_MOVE_TO_STATION') {
|
|
after.properties.nodeParams = structuredClone(before.properties.nodeParams)
|
|
}
|
|
}
|
|
assert.deepEqual(restored, original, 'Unexpected geometry, SDK, resource or parameter change')
|
|
const start = g => g.nodes.find(n => n.type === 'start')
|
|
assert.deepEqual(start(graph).properties.inputParams.map(({ desc, label, ...input }) => input),
|
|
start(original).properties.inputParams.map(({ desc, label, ...input }) => input))
|
|
fs.writeFileSync(outputPath, JSON.stringify(graph, null, 2))
|
|
console.log(JSON.stringify({ nodes: graph.nodes.length, stations: navigation.map(n => station(n).input),
|
|
inputKeysAndValuesUnchanged: true, geometryAndDeviceParametersUnchanged: true, published: false, deviceCommandsSent: 0 }))
|