Phase 4: Warehouse screen, pull table, shorts, MTRs and the upload pipeline
The Warehouse home with the numbers, the Open shorts table, the find bar and the five-column task board (waiting, being pulled, on hold, pulled, released in the last 3 days) with buttons, hold reasons and drag. Every role sees the warehouse stage on a packet as the WH pill and the line under it. The pull table on the Materials tab: Pulled with auto-start, issued, location, heat with Enter to the next line, shorts with receipts, N/A, MTR per line with a viewer. Send back to Clerical with a reason. Release to supervisor stays blocked until every line is pulled or short and every pulled line has a heat. Server: the heats_recorded precondition on WH_RELEASE, receive by custody, server-validated hold and short reasons, the old packet history texts, GET /api/warehouse/board, cards with the warehouse stage and pull counts. Uploads typed by content per kind (drawing, mtr, document, bom with XLSX and CSV), limits per kind, optional ClamAV behind the clamav compose profile, a storage quota alert on the new notification_events table (migration 0005) shown on the Admin Storage tab. Tests: every warehouse action as every role, the release gate, the short-receive exception, the heat pattern, upload sniffing and limits, the ClamAV path with a fake scanner, the quota alert; frontend board and pull table tests; Playwright scenarios for the board and the pull flow. Verified on docker-1 in the CI stack: 3557 server tests, 106 frontend tests, 17 Playwright scenarios. Docs updated; D5 closed. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -57,7 +57,7 @@ LABELS: dict[policy.Action, str] = {
|
||||
A.SEND_DRAFT_TO_QC: "Sent straight to Q.C.",
|
||||
A.WH_SEND_BACK: "Sent back to Clerical",
|
||||
A.RETURN_TO_CLERICAL: "Sent back to Clerical",
|
||||
A.WH_RELEASE: "Released to the shop",
|
||||
A.WH_RELEASE: "Released to supervisor",
|
||||
A.SEND_BACK_TO_WAREHOUSE: "Sent back to the warehouse",
|
||||
A.ASSIGN: "Sent to a station",
|
||||
A.UNASSIGN: "Taken off the station",
|
||||
@@ -528,6 +528,41 @@ def _seal_key(w: Write) -> bytes:
|
||||
return key
|
||||
|
||||
|
||||
def qty_text(value: Any) -> str:
|
||||
"""A quantity without trailing zeros: 4, 2.5."""
|
||||
if value is None:
|
||||
return "0"
|
||||
try:
|
||||
f = float(value)
|
||||
except (TypeError, ValueError):
|
||||
return str(value)
|
||||
return str(int(f)) if f.is_integer() else f"{f:g}"
|
||||
|
||||
|
||||
def _release_text(w: Write) -> None:
|
||||
"""The old release label and note.
|
||||
|
||||
Label "Released to supervisor", or "... with {n} short"; note "{heats} heats recorded", plus " · SHORT: ..."
|
||||
when shorts are open.
|
||||
"""
|
||||
lines = packets.rows(
|
||||
w.conn,
|
||||
"SELECT b.item, b.heat, s.qty_open, s.reason FROM bom_lines b LEFT JOIN bom_shorts s"
|
||||
" ON s.bom_line_id = b.id AND s.closed_at IS NULL WHERE b.packet_id = %s ORDER BY b.item",
|
||||
(w.id,),
|
||||
)
|
||||
heats = sum(1 for b in lines if str(b["heat"] or "").strip())
|
||||
shorts = [b for b in lines if b["qty_open"] is not None]
|
||||
note = f"{heats} heats recorded"
|
||||
if shorts:
|
||||
note += " · SHORT: " + ", ".join(
|
||||
f"item {b['item']} ×{qty_text(b['qty_open'])} ({b['reason'] or ''})" for b in shorts
|
||||
)
|
||||
w.log(f"{LABELS[A.WH_RELEASE]} with {len(shorts)} short", note)
|
||||
else:
|
||||
w.log(LABELS[A.WH_RELEASE], note)
|
||||
|
||||
|
||||
def apply_transition(w: Write) -> None:
|
||||
"""Set status, status_at and dept, write the packet_transitions row and run the action's side effects."""
|
||||
if w.transitioned:
|
||||
@@ -569,6 +604,7 @@ def apply_transition(w: Write) -> None:
|
||||
_set_packet(w, "return_note = %s", (reason,))
|
||||
_close_stage(w)
|
||||
elif a is A.WH_RELEASE:
|
||||
_release_text(w)
|
||||
_wh_close(w)
|
||||
_close_stage(w)
|
||||
_open_stage(w, to_dept)
|
||||
|
||||
Reference in New Issue
Block a user