| | |
| | | "FX034856": { |
| | | "deviceKey": "FX034856", |
| | | "deviceName": "FX034856", |
| | | "receivedAt": "2026-03-19T09:37:51.077Z", |
| | | "receivedAt": "2026-03-30T03:57:41.675Z", |
| | | "source": { |
| | | "host": "127.0.0.1", |
| | | "host": "192.168.33.1", |
| | | "port": 3021 |
| | | }, |
| | | "params": [ |
| | |
| | | "devices": [ |
| | | { |
| | | "name": "FX034856", |
| | | "host": "127.0.0.1", |
| | | "host": "192.168.33.1", |
| | | "port": 3021 |
| | | } |
| | | ], |
| | |
| | | return p != null ? p.value : undefined; |
| | | }; |
| | | |
| | | // 将 YYYYMMDDHHmmss 格式化为 yyyy-MM-dd HH:mm:ss |
| | | const rawTs = frameData.timestamp || ''; |
| | | const formattedTime = rawTs.length >= 14 |
| | | ? `${rawTs.slice(0,4)}-${rawTs.slice(4,6)}-${rawTs.slice(6,8)} ${rawTs.slice(8,10)}:${rawTs.slice(10,12)}:${rawTs.slice(12,14)}` |
| | | : (rawTs || null); |
| | | |
| | | // 构造与物模型一致的扁平 payload,所有字段在同一层 |
| | | const mqttPayload = { |
| | | ts: Date.now(), // 毫秒时间戳 |
| | | suedtime: frameData.timestamp || null, // 帧原始时间(YYYYMMDDHHmmss) |
| | | deviceId: frameData.deviceName || null, // 设备唯一标识(用name) |
| | | suedtime: formattedTime, // 帧时间(yyyy-MM-dd HH:mm:ss) |
| | | deviceNo: frameData.device || null, // 机器序列号 |
| | | n: frameData.deviceName || null, // 设备名称 (作为 deviceKey 使用) 配置在 gateway.config.json 中device.name字段 |
| | | deviceType: this.config.deviceType || 'Artis', // 设备型号 |
| | | IPAddress: frameData.source?.host || null, // 设备 IP |
| | | zljd: pick(0), // 治疗阶段 |
| | |
| | | "parse:raw": "node parse_raw.js", |
| | | "hex:bin": "node hex_to_bin.js", |
| | | "sim:server": "node sim_server.js", |
| | | "gateway": "node gateway.js", |
| | | "dev": "node gateway.js", |
| | | "build:ncc": "ncc build gateway.js -o dist --minify --no-source-map-register", |
| | | "build:win": "pkg dist/index.js --target node18-win-x64 --output build/gateway-win.exe --compress GZip", |
| | | "build:linux": "pkg dist/index.js --target node18-linux-x64 --output build/gateway-linux --compress GZip", |
| | |
| | | |
| | | function parseArgs(argv) { |
| | | const args = { |
| | | host: '127.0.0.1', |
| | | host: '192.168.33.1', |
| | | port: 3021, |
| | | interval: 1000, |
| | | once: false, |