feat: the proof card, machine pull and print file corrections (Dropstar, 05/11)
The proof card owns its final PNG, keeps its parent locked until the seller answers, enters the queue first, and shares one machine with the parent. The board no longer assigns a machine at payment; the puller records it. A stalled print file times out with a card warning and a retry, finished orders sort by completion, and finals are stored as PNG. The original download carries the order number (items 0.1, 0.4 to 0.7 and 0.9).
This commit is contained in:
@@ -136,6 +136,7 @@ CREATE TABLE IF NOT EXISTS dtf_local.print_files (
|
||||
created_at timestamptz NOT NULL DEFAULT now(), finished_at timestamptz,
|
||||
UNIQUE(order_id,item_index)
|
||||
);
|
||||
ALTER TABLE dtf_local.print_files ADD COLUMN IF NOT EXISTS claim_token uuid;
|
||||
|
||||
-- Each run of the off-server database backup (ops/db_backup.py), which the
|
||||
-- Kanban shows so a backup that stopped working does not go unnoticed.
|
||||
@@ -235,6 +236,8 @@ INSERT INTO dtf_local.print_parts(order_id,item_index,part,upload_id)
|
||||
|
||||
-- A movement that undid an earlier one (a mistaken move), shown as such.
|
||||
ALTER TABLE dtf_local.movements ADD COLUMN IF NOT EXISTS back boolean NOT NULL DEFAULT false;
|
||||
CREATE INDEX IF NOT EXISTS movements_finished_latest ON dtf_local.movements(order_id, created_at DESC)
|
||||
WHERE to_state='fin' AND NOT back;
|
||||
|
||||
-- The Kanban lists payment events a person must act on (money without an
|
||||
-- order, or a reversed payment on an existing order) until resolved.
|
||||
@@ -284,11 +287,9 @@ ALTER TABLE dtf_local.operators ADD COLUMN IF NOT EXISTS role text NOT NULL DEFA
|
||||
ALTER TABLE dtf_local.operators DROP CONSTRAINT IF EXISTS operators_role;
|
||||
ALTER TABLE dtf_local.operators ADD CONSTRAINT operators_role
|
||||
CHECK (role IN ('superadmin','admin','gestao','designer','operador','revisor','vendedor','financeiro'));
|
||||
-- The print machines, and which products each prints. An order keeps the
|
||||
-- machine someone chose (machine_chosen) or the one given automatically: the
|
||||
-- active machine of its product with the fewest metres open (app/machines.py).
|
||||
-- limit_metres: the metres open a machine takes before the next order goes to
|
||||
-- another one; NULL is no limit.
|
||||
-- Print machines and which products each prints. An order gets its machine
|
||||
-- when someone pulls it into Imprimindo; no machine is assigned at payment.
|
||||
-- limit_metres remains the load shown for a machine.
|
||||
CREATE TABLE IF NOT EXISTS dtf_local.machines (
|
||||
id uuid PRIMARY KEY, name text UNIQUE NOT NULL, products text[] NOT NULL DEFAULT '{}',
|
||||
active boolean NOT NULL DEFAULT true, created_at timestamptz NOT NULL DEFAULT now()
|
||||
@@ -303,6 +304,15 @@ DO $$ BEGIN
|
||||
INSERT INTO dtf_local.migrations VALUES('machine-chosen-v1');
|
||||
END IF;
|
||||
END $$;
|
||||
-- Remove the old automatic suggestions before printing. Keep real choices
|
||||
-- and machines already printing, whose hot-folder files may be in flight.
|
||||
DO $$ BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM dtf_local.migrations WHERE name='machine-pull-only-v1') THEN
|
||||
UPDATE dtf_local.orders SET machine_id=NULL, machine_chosen=false
|
||||
WHERE NOT machine_chosen AND state IN ('rec','tra','cor');
|
||||
INSERT INTO dtf_local.migrations VALUES('machine-pull-only-v1');
|
||||
END IF;
|
||||
END $$;
|
||||
-- The machines an operator works on; none means every machine.
|
||||
CREATE TABLE IF NOT EXISTS dtf_local.operator_machines (
|
||||
operator_id uuid NOT NULL REFERENCES dtf_local.operators(id) ON DELETE CASCADE,
|
||||
|
||||
Reference in New Issue
Block a user