diff --git a/data/source/asset-qr.json b/data/source/asset-qr.json new file mode 100644 index 0000000..8a0e3d5 --- /dev/null +++ b/data/source/asset-qr.json @@ -0,0 +1,22 @@ +{ + "TLB01": "1080", + "TLB02": "1009", + "TLB03": "1173", + "TLB04": "1167", + "TLB05": "1120", + "TLB06": "4704", + "TLB07": "1010", + "SS01": "1137", + "SS02": "1008", + "RV01": "1037", + "RV03": "1002", + "RV04": "1006", + "MG01": "1088", + "MG02": "1123", + "CT01": "1976", + "TP601": "1128", + "TP602": "1072", + "WB01": "1103", + "WB02": "1091", + "DT01": "1143" +} diff --git a/scripts/seed.mjs b/scripts/seed.mjs index 9dd93ba..ecfc738 100644 --- a/scripts/seed.mjs +++ b/scripts/seed.mjs @@ -272,6 +272,8 @@ let existingSiteByCode = new Map(); let existingSiteByName = new Map(); // QR text typed into the Plant Register is entered by hand and exists nowhere on disk. const existingQrByCode = new Map(); +// Vehicle sticker numbers from the client's sheet. A value typed in the app wins; this fills the rest. +const sheetQrByCode = JSON.parse(readFileSync(resolve(DATA_DIR, "asset-qr.json"), "utf8")); try { const siteIdToName = new Map(); for (const s of await pb.collection(SITES_COLL).getFullList()) { @@ -333,7 +335,7 @@ for (const a of assets) { on_operator_sheet: operatorSheetCodes.has(a.code), is_active: a.is_active !== false, // default true; only "AEB Plant Versekering" is false site: siteId, - qr_code: existingQrByCode.get(a.code) || "", + qr_code: existingQrByCode.get(a.code) || sheetQrByCode[a.code] || "", // Plant Map — falls back to the shared placeholder pin until the // on-site scan sheet supplies a real coordinate for this machine. latitude: a.latitude ?? DEFAULT_GEO.latitude,