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:
@@ -231,7 +231,6 @@ def create_machine(body: MachineIn, user=Depends(can('users'))):
|
||||
raise HTTPException(409, 'Já existe uma máquina com este nome.')
|
||||
c.execute('INSERT INTO dtf_local.machines(id,name,products,active,limit_metres) VALUES(%s,%s,%s,%s,%s)',
|
||||
(mid, body.name.strip(), sorted(set(body.products)), body.active, body.limit_metres))
|
||||
machines.route(c)
|
||||
audit('machine_created', operator=user, machine=body.name)
|
||||
return {'id': str(mid)}
|
||||
|
||||
@@ -248,20 +247,21 @@ def update_machine(mid: UUID, body: MachineIn, user=Depends(can('users'))):
|
||||
raise HTTPException(404, 'Máquina não encontrada.')
|
||||
if not body.active:
|
||||
release_sessions(c, mid)
|
||||
machines.route(c)
|
||||
audit('machine_updated', operator=user, machine=body.name)
|
||||
return {'ok': True}
|
||||
|
||||
|
||||
@router.post('/api/operator/machines/{mid}/delete')
|
||||
def delete_machine(mid: UUID, user=Depends(can('users'))):
|
||||
"""Its orders go back to the automatic choice; its operators lose it."""
|
||||
"""Its orders lose that machine; its operators lose the session choice."""
|
||||
with db.connect() as c:
|
||||
if c.execute("SELECT 1 FROM dtf_local.orders WHERE machine_id=%s AND state='imp' AND cancelled_at IS NULL LIMIT 1",
|
||||
(mid,)).fetchone():
|
||||
raise HTTPException(409, 'Há pedido imprimindo nesta máquina. Termine ou mova o pedido antes de excluí-la.')
|
||||
release_sessions(c, mid)
|
||||
row = c.execute('DELETE FROM dtf_local.machines WHERE id=%s RETURNING name', (mid,)).fetchone()
|
||||
if not row:
|
||||
raise HTTPException(404, 'Máquina não encontrada.')
|
||||
machines.route(c)
|
||||
audit('machine_deleted', operator=user, machine=row['name'])
|
||||
return {'ok': True}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user