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:
@@ -8,6 +8,7 @@ from uuid import UUID
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
from ..core import db
|
||||
from .. import proof
|
||||
from ..artwork import submit_files
|
||||
from ..core.auth import can, operator
|
||||
from ..core.models import ArtworkSubmission, UploadStart
|
||||
@@ -18,9 +19,14 @@ router = APIRouter()
|
||||
|
||||
@router.post('/api/operator/orders/{oid}/uploads')
|
||||
def begin_final(oid: UUID, body: UploadStart, user=Depends(can('produce'))):
|
||||
if not body.name.lower().endswith('.png'):
|
||||
raise HTTPException(422, 'O arquivo final precisa ser PNG transparente a 300 DPI. Converta PDF/TIFF antes de enviar.')
|
||||
with db.connect() as c:
|
||||
row = c.execute('SELECT state FROM dtf_local.orders WHERE id=%s', (oid,)).fetchone()
|
||||
row = c.execute('SELECT id,state,parent_id,proof_ok_at FROM dtf_local.orders WHERE id=%s', (oid,)).fetchone()
|
||||
if not row: raise HTTPException(404, 'Order not found')
|
||||
if row['parent_id']:
|
||||
raise HTTPException(409, 'A prova recebe o PNG final automaticamente.')
|
||||
proof.require_unlocked(c, row)
|
||||
if row['state'] not in ('rec','cor'): raise HTTPException(409, 'Order is not in artwork review')
|
||||
return begin_upload(body, session_id=operator_identity(user))
|
||||
|
||||
@@ -52,4 +58,7 @@ def final_files(oid: UUID, body: ArtworkSubmission, user=Depends(can('produce'))
|
||||
with db.connect() as c:
|
||||
order = c.execute('SELECT * FROM dtf_local.orders WHERE id=%s FOR UPDATE', (oid,)).fetchone()
|
||||
if not order: raise HTTPException(404, 'Order not found')
|
||||
if order['parent_id']:
|
||||
raise HTTPException(409, 'O arquivo final da prova é gerado automaticamente. Use Gerar de novo se falhar.')
|
||||
proof.require_unlocked(c, order)
|
||||
return submit_files(c,order,body,operator_identity(user),'final',user)
|
||||
|
||||
Reference in New Issue
Block a user