Scan a pane
QR scan endpoint — scan_in, scan_out, qc_pass, qc_fail, laminate survivor merge, and optional auto-remake on QC failure.
Summary
POST /api/panes/{paneNumber}/scan drives the production line. Send the station ObjectId and action. The pane number in the path is the code from the QR label (without the STDPLUS: prefix).
| Action | Typical use |
|---|---|
scan_in, start, complete | Normal station workflow |
scan_out | Hand off after complete (awaiting_scan_out → next station or completed) |
qc_pass | Same as scan_out, but logs qc_pass on PaneLog for QC audit |
qc_fail | Mark pane defected, log reason / description, return remadePane (auto remake) |
laminate | Merge sheets at lamination; sheet QR in path recommended; optional laminateSurvivorPaneNumber; parent path requires that field |
QC fail body
reason (required): broken | chipped | dimension_wrong | scratch | stain | other.
Laminate merge body
Use a sheet pane number in the path (recommended). OptionallaminateSurvivorPaneNumber selects which sheet survives if it differs from the URL pane. If the path is the dormant parent pane number, laminateSurvivorPaneNumber is required (must match an active sheet at the lam station).
laminateSurvivorPaneNumber when the survivor is the same as the pane in the URL.
Dormant parent in the path
If the worker scans the parent row’s number (e.g. for an admin flow),laminateSurvivorPaneNumber is required and must be an active sheet at the lamination station:
Response (laminate)
On success,data includes:
pane— the survivor pane (laminateRole: "single", post-lamrouting,awaiting_scan_outat lamination,laminateMergedAtset)mergedSheets— count of sheets in the mergesurvivorPaneNumber,retiredPaneNumbers,parentRetired
Response (QC fail)
On success,data includes:
pane— the defected pane (currentStatus: "defected")log— the newPaneLog(action: "qc_fail",reason,description)remadePane— the new pane queued for production (remakeOfpoints at the defected pane)
nextStation after scan_out / qc_pass when applicable).
Scan errors (merged_into)
If a worker scans a pane that was retired by laminate merge (currentStatus: merged_into), the API returns 400 with errors.code: MERGED_INTO, errors.survivorPaneNumber, and a Thai message pointing at the survivor QR. The List all panes endpoint omits merged_into rows by default so station UIs stay clean.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The pane number (e.g. PNE-0001). Strip the STDPLUS: prefix from QR codes before sending.
Body
Station ObjectId where the scan is happening (must match the pane's currentStation)
1scan_in — acknowledge arrival, start — begin work, complete — mark work done (awaiting_scan_out), scan_out / qc_pass — advance to next routing station or complete if last (same rules; QC pass logs qc_pass), qc_fail — mark pane defected, log reason/description, auto-create remake pane (requires reason), laminate — merge sheets; one sheet survives (see laminateSurvivorPaneNumber)
scan_in, start, complete, scan_out, laminate, qc_pass, qc_fail Worker ID. Accepted by validation but currently unused — the authenticated user (req.user._id) is always recorded as the worker in the PaneLog.
1Required when action is qc_fail
broken, chipped, dimension_wrong, scratch, stain, other Optional extra detail for qc_fail
Optional station ObjectId to queue the auto-created remake pane; defaults to first station in routing
1For laminate: which sheet pane number survives (defaults to pane in URL if URL is a sheet). Required if URL is the dormant parent pane.
1