← back to Dw Photo Capture
FM lookup dash-agnostic + printed-code-first: wallpaper-details tries raw+dashless forms on both combo-sku and Mfr-Pattern (CHC-217203 ⇄ CHC217203 auto), and the scan keys the FM lookup off the PRINTED OCR code first (the model# on the label) plus the resolved dw_sku
6eb90139f9addab7156229e80cd972d91d6479b9 · 2026-07-08 15:05:19 -0700 · Steve Abrams
Files touched
M public/index.htmlM server.js
Diff
commit 6eb90139f9addab7156229e80cd972d91d6479b9
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Wed Jul 8 15:05:19 2026 -0700
FM lookup dash-agnostic + printed-code-first: wallpaper-details tries raw+dashless forms on both combo-sku and Mfr-Pattern (CHC-217203 ⇄ CHC217203 auto), and the scan keys the FM lookup off the PRINTED OCR code first (the model# on the label) plus the resolved dw_sku
---
public/index.html | 4 +++-
server.js | 12 ++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/public/index.html b/public/index.html
index 2cc7536..b3f194f 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1552,7 +1552,9 @@ async function fbIdentify(){
// WALLPAPER lookup: trust a CODE/QR identify; but a VISUAL-only match doesn't beat the printed model# —
// so prefer the OCR'd label code for the file lookup, falling back to the identified code.
const byCode=(r.source==='code'||r.source==='qr');
- loadWallpaperDetails({ dw_sku: byCode?p.dw_sku:'', mfr_code: byCode?(p.mfr_code||p.mfr_sku):(ocrTop||p.mfr_code||p.mfr_sku), _ocr: ocrTop });
+ // Always key the FM lookup off the PRINTED code (ocrTop) first — that's the model# on the label —
+ // plus the resolved dw_sku when we code-matched. The endpoint tries every dashed/dashless form.
+ loadWallpaperDetails({ dw_sku: byCode?p.dw_sku:'', mfr_code: ocrTop||p.mfr_code||p.mfr_sku, _ocr: ocrTop });
if(!_fbLookup){ matchIncoming(p); checkSampleRequest(p.dw_sku||p.mfr_code, p.mfr_code); } // Check-Sample-In: flag the incoming match + print popup; pure Look-Up SKU skips both
}catch(e){ $('#fbNote').textContent='Failed: '+e.message; }
$('#fbGo').disabled=false;
diff --git a/server.js b/server.js
index 5bfd855..63d6a90 100644
--- a/server.js
+++ b/server.js
@@ -1559,11 +1559,15 @@ const appHandler = (req, res) => {
['width','Width'],['repeat','Repeat'],['retail','Retail Price'],['net','Net Price'],['cost','Cost'],
['supplier','Supplier'],['roll_size','HP Roll Size'],['minimum','Minimum'],['border','Border'],
['five_ten','Five Ten Code'],['line','Line'],['internal_desc','Internal Description'],['combo_sku','combo sku']];
+ // FileMaker stores combo sku DASHLESS (CHC217203) but scans read it dashed (CHC-217203). So try
+ // BOTH the raw AND the alphanumeric-stripped form, on BOTH the combo-sku and Mfr-Pattern fields,
+ // in one OR-query — auto-recovering the dash mismatch. (`==` = exact-whole-field match.)
+ const dedupe = a => [...new Set(a.filter(Boolean))];
+ const forms = dedupe([sku, sku.replace(/[^A-Za-z0-9]/g, ''), code, code.replace(/[^A-Za-z0-9]/g, '')]);
+ const q = []; for (const v of forms) { q.push({ 'combo sku': '==' + v }); q.push({ 'Mfr Pattern': '==' + v }); }
let recs = [];
- try {
- if (sku) { const r = await FM.fmFind(FM_DB, LAYOUT2, [{ 'combo sku': '==' + sku }], { limit: 20, portal: [] }); recs = r.records || []; }
- if (!recs.length && code) { const r = await FM.fmFind(FM_DB, LAYOUT2, [{ 'Mfr Pattern': '==' + code }], { limit: 20, portal: [] }); recs = r.records || []; }
- } catch (e) { return send(res, 200, { ok: false, err: e.message }); }
+ try { const r = await FM.fmFind(FM_DB, LAYOUT2, q, { limit: 20, portal: [] }); recs = r.records || []; }
+ catch (e) { return send(res, 200, { ok: false, err: e.message }); }
if (!recs.length) return send(res, 200, { ok: true, found: false, details: null, matched: 0 });
const details = {};
for (const [key, fld] of MAP) { // coalesce: first non-empty value across matches
← c473b21 dwphoto: add SSRF-guarded CORS-scoped /apps/similar proxy ro
·
back to Dw Photo Capture
·
Fix iOS camera freeze on Look Up SKU: stop auto-clicking the ef6656d →