Phase 5: Supervisor and Stall screens, weld map, heat table, clock and CO verification
The shop at parity with the old build. Supervisor screen (department chips, CO headline, numbers, Change orders
on hold, station grid with clocks and CO tags, boards) and Stall screen (station picker, hero, My packets,
Submitted). Shop steps on the packet page: assign with station, welder picker and stamp; pull back; Start, Pause,
Resume; Submit with a PIN signature and the missing steps as links; review with Send to Q.C., Return to station
and Skip Q.C. route; a lead's read-only review. Weld map (pdf.js viewer with pan, pinch, zoom, full screen; marks
with leader lines; weld sheet; weld record with field CAS; carried marks). Heat map (heat table placed, dragged,
sized, removed; legacy amber tags; borrowed heat map read-only). Checklist tab with templates from settings.
VOID stamps on voided pages. Change orders: CO-n labels, supervisor verify with signature, approval copies the
heat table to the new sheet and the BOM merge keeps the shop's values. Server clock of record with VISUAL ticket
hours beside it. Presence per packet over SSE. Migration 0006 (bfx, bfy, carried_from, checklist_templates).
New endpoints /api/shop/board, /api/shop/stations, /api/shop/stall, /api/departments/{code}/people.
Tests: policy oracle for every shop action, role and status; clock arithmetic; concurrent inserts; CO apply;
frontend geometry, heat table, clock, checklist, weld sheet, screens; seven Playwright scenarios. Docs updated.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -504,7 +504,10 @@ def merge_visual_bom(conn: Any, packet_id: int, raw_lines: list[Any]) -> dict[st
|
||||
|
||||
When nothing has been recorded on the lines (no pulled mark, heat, MTR or short) the BOM is replaced through
|
||||
feed.materials.insert_bom, exactly as the feed writes it. Otherwise lines are matched on vkey and updated in
|
||||
place, so pulled marks, heats and shorts stay. New lines are added with the same encoding (item numbers from
|
||||
place, so pulled marks, heats and shorts stay. A line with no vkey match falls back to the same VISUAL item label
|
||||
(cl_item) and part id, as the old coKeepShop did. On a matched line the recorded work wins: heat, N/A, issued,
|
||||
location, pulled, pulled_at, pulled_by, the MTR and the short are kept (heat, pulled and the MTR are never
|
||||
written here). New lines are added with the same encoding (item numbers from
|
||||
feed.materials.db_items, the label in cl_item, cons Y/N, sub Y or NULL). Lines VISUAL dropped are deleted, or
|
||||
marked n/a when they were pulled or have a short.
|
||||
"""
|
||||
@@ -525,6 +528,10 @@ def merge_visual_bom(conn: Any, packet_id: int, raw_lines: list[Any]) -> dict[st
|
||||
counts["removed"] = len(existing)
|
||||
return counts
|
||||
by_vkey = {e["vkey"]: e for e in existing if e["vkey"]}
|
||||
by_label: dict[tuple[str, str], dict[str, Any]] = {}
|
||||
for e in existing:
|
||||
if e["cl_item"] is not None:
|
||||
by_label.setdefault((str(e["cl_item"]), str(e["part_id"] or "")), e)
|
||||
used = {int(e["item"]) for e in existing}
|
||||
wanted = db_items(lines)
|
||||
kept: set[int] = set()
|
||||
@@ -544,13 +551,17 @@ def merge_visual_bom(conn: Any, packet_id: int, raw_lines: list[Any]) -> dict[st
|
||||
sort,
|
||||
)
|
||||
match = by_vkey.get(b.vkey) if b.vkey else None
|
||||
if match is None or int(match["id"]) in kept:
|
||||
match = by_label.get((str(b.item), b.part_id[:60]))
|
||||
if match is not None and int(match["id"]) not in kept:
|
||||
kept.add(int(match["id"]))
|
||||
conn.execute(
|
||||
"UPDATE bom_lines SET qty = %s, part_id = %s, description = %s, loc = %s, whs = %s, comm = %s,"
|
||||
" cons = %s, sub = %s, na = %s, grp = %s, issued = coalesce(%s, issued), sort = %s, cl_item = %s,"
|
||||
"UPDATE bom_lines SET qty = %s, part_id = %s, description = %s,"
|
||||
" loc = coalesce(nullif(loc, ''), %s), whs = %s, comm = %s, cons = coalesce(cons, %s), sub = %s,"
|
||||
" na = CASE WHEN pulled OR heat IS NOT NULL OR na THEN na ELSE %s END, grp = %s,"
|
||||
" issued = coalesce(issued, %s), sort = %s, cl_item = %s, vkey = coalesce(%s, vkey),"
|
||||
" row_version = row_version + 1 WHERE id = %s",
|
||||
(*values, b.item, match["id"]),
|
||||
(*values, b.item, b.vkey or None, match["id"]),
|
||||
)
|
||||
counts["updated"] += 1
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user