Files
dtf-system/app/migrations/202611111530_label-prints.sql
Cauê Faleiros 223bd61798 feat: the 10x15 label at Finalizado (Marcus 10/11, point 10)
When an order reaches Finalizado, the Kanban on the computer that opted in
(Integrações > Etiqueta 10x15) prints a 10x15 label rendered by the server:
the Tiny order number in large type (DTF-<n> when there is none), customer,
DTF · N folhas · X m, the delivery line, date and time, the Revisor and a
QR with the number. One automatic print per order (label_prints, claimed
once); Revisor, Expedição, Gestão and the administrators can reprint.
Chrome with --kiosk-printing prints without the dialog.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-11 11:32:27 -03:00

13 lines
657 B
SQL

-- Front 10: the 10x15 cm label at Finalizado (Marcus, 2026-11-10). One 'auto'
-- print per order, decided by the unique partial index, so two computers
-- asking at once cannot both print it; a reprint is always another row.
CREATE TABLE IF NOT EXISTS dtf_local.label_prints (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
order_id uuid NOT NULL REFERENCES dtf_local.orders(id) ON DELETE CASCADE,
reason text NOT NULL CHECK (reason IN ('auto','reprint')),
printed_by text NOT NULL,
printed_at timestamptz NOT NULL DEFAULT now()
);
CREATE UNIQUE INDEX IF NOT EXISTS label_prints_one_auto
ON dtf_local.label_prints(order_id) WHERE reason='auto';