Rewrite tag path mapping from actual Excel device suffixes

Derived all suffix->path mappings from the devices-manifest.json:
- VFD, EPC → VFD/APF
- TPE, BDS*_R/S, TS*_R/S → Sensor/Tracking
- LPE → Sensor/Long_Range
- JPE → Sensor/Jam
- FPE → Sensor/Full
- PS → Sensor/Pressure
- FIOM → Network_Node/FIO
- FIOH → Network_Node/HUB
- SIO → Network_Node/SIO
- DPM → Network_Node/DPM
- SS*_SPB/STPB → Station/Start_Stop
- CH*_EN*_PB → Station/Jam_Reset_Chute_Bank
- JR*_PB → Station/Jam_Reset
- S*_PB → Station/Start
- BCN → Beacon
- SOL, DIV*_SOL → Solenoid
- DIV*_LS → Diverter
- PDP → PDP

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
igurielidze 2026-03-30 23:43:57 +04:00
parent eb0b346e1a
commit 006623c43d

View File

@ -112,50 +112,42 @@ export function exportJSON() {
} }
/** Build Ignition tag path from device label and MCM name. /** Build Ignition tag path from device label and MCM name.
* Format: System/{MCM}/{Category}/{SubCategory}/{Label} */ * Format: System/{MCM}/{Category}/{SubCategory}/{Label}
* Mappings derived from Excel device manifest suffixes. */
function getIgnitionTagPath(label: string, mcm: string): string | null { function getIgnitionTagPath(label: string, mcm: string): string | null {
if (!label) return null; if (!label) return null;
const upper = label.toUpperCase();
// VFD drives (conveyors, spurs, curves, inductions) // VFD / EPC
if (/_VFD\d*$/i.test(label)) return `System/${mcm}/VFD/APF/${label}`; if (/_VFD\d*$/i.test(label)) return `System/${mcm}/VFD/APF/${label}`;
// EPC controllers
if (/_EPC\d*$/i.test(label)) return `System/${mcm}/VFD/APF/${label}`; if (/_EPC\d*$/i.test(label)) return `System/${mcm}/VFD/APF/${label}`;
// Network nodes
if (/_FIOM\d*$/i.test(label) || /_FIO\d*$/i.test(label)) return `System/${mcm}/Network_Node/FIO/${label}`;
if (/_FIOH\d*$/i.test(label)) return `System/${mcm}/Network_Node/HUB/${label}`;
if (/_SIO\d*$/i.test(label)) return `System/${mcm}/Network_Node/SIO/${label}`;
if (/_DPM\d*$/i.test(label)) return `System/${mcm}/Network_Node/DPM/${label}`;
// Sensors // Sensors
if (/_TPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Tracking/${label}`; if (/_TPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Tracking/${label}`;
if (/_LPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Long_Range/${label}`; if (/_LPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Long_Range/${label}`;
if (/_FPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Full/${label}`;
if (/_JPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Jam/${label}`; if (/_JPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Jam/${label}`;
if (/_FPE\d*$/i.test(label)) return `System/${mcm}/Sensor/Full/${label}`;
if (/_PS\d*$/i.test(label)) return `System/${mcm}/Sensor/Pressure/${label}`; if (/_PS\d*$/i.test(label)) return `System/${mcm}/Sensor/Pressure/${label}`;
// Controls / Station if (/_BDS\d+_[RS]$/i.test(label)) return `System/${mcm}/Sensor/Tracking/${label}`;
if (/_JR\d*_PB$/i.test(label) || /_JR\d*$/i.test(label)) return `System/${mcm}/Station/Jam_Reset/${label}`; if (/_TS\d+_[RS]$/i.test(label)) return `System/${mcm}/Sensor/Tracking/${label}`;
if (/_SS\d*_PB$/i.test(label)) return `System/${mcm}/Station/Start_Stop/${label}`; // Network nodes
if (/_S\d*_PB$/i.test(label)) return `System/${mcm}/Station/Start/${label}`; if (/_FIOM\d*$/i.test(label)) return `System/${mcm}/Network_Node/FIO/${label}`;
if (/_FIOH\d*$/i.test(label)) return `System/${mcm}/Network_Node/HUB/${label}`;
if (/_SIO\d*$/i.test(label)) return `System/${mcm}/Network_Node/SIO/${label}`;
if (/_DPM\d*$/i.test(label)) return `System/${mcm}/Network_Node/DPM/${label}`;
// Station — order matters: longer patterns first
if (/_SS\d+_S(?:T)?PB$/i.test(label)) return `System/${mcm}/Station/Start_Stop/${label}`;
if (/_CH\d*_EN\d*_PB$/i.test(label)) return `System/${mcm}/Station/Jam_Reset_Chute_Bank/${label}`;
if (/_JR\d*_PB$/i.test(label)) return `System/${mcm}/Station/Jam_Reset/${label}`;
if (/_S\d+_PB$/i.test(label)) return `System/${mcm}/Station/Start/${label}`;
// Beacon // Beacon
if (/_BCN\d*$/i.test(label)) return `System/${mcm}/Beacon/${label}`; if (/_BCN\d*$/i.test(label)) return `System/${mcm}/Beacon/${label}`;
// Solenoid // Solenoid (including DIV*_SOL)
if (/_SOL\d*$/i.test(label)) return `System/${mcm}/Solenoid/${label}`; if (/_SOL\d*$/i.test(label)) return `System/${mcm}/Solenoid/${label}`;
// Chute (by suffix) // Diverter (DIV*_LS)
if (/_CHT\d*$/i.test(label)) return `System/${mcm}/Chute/Conveyance/${label}`; if (/_DIV\d+_LS\d*$/i.test(label)) return `System/${mcm}/Diverter/${label}`;
// Tipper
if (/_TIP\d*$/i.test(label)) return `System/${mcm}/Tipper/${label}`;
// Diverter
if (/_DIV\d*$/i.test(label) || /_LS\d*$/i.test(label)) return `System/${mcm}/Diverter/${label}`;
// Extendo
if (/_EXT\d*$/i.test(label)) return `System/${mcm}/Extendo/${label}`;
// Chute Enable
if (/_EN\d*_PB$/i.test(label)) return `System/${mcm}/Station/Jam_Reset_Chute_Bank/${label}`;
// Package Release
if (/_PR\d*_PB$/i.test(label)) return `System/${mcm}/Station/Emergency_Pull_Cord/${label}`;
// PDP // PDP
if (/^PDP/i.test(label)) return `System/${mcm}/PDP/${label}`; if (/^PDP\d*/i.test(label)) return `System/${mcm}/PDP/${label}`;
// MCM // MCM
if (/^MCM/i.test(label)) return null; if (/^MCM\d*/i.test(label)) return null;
return null; return null;
} }