feat: a pasted list in Montar, with the reference printed under each stamp and the skipped lines in the report (Rodada 5, C4)
One line per item, code size quantity reference. Lines with errors are listed with the line and the reason and mounted only after "Montar sem essas N linhas". A reference is drawn 3 mm high right under the stamp, with 1 cm to the next piece on that side; the list is always Interno and the Prumo report names the skipped lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,8 @@ def montador_order(body: MontadorOrder, request: Request, user=Depends(can('asse
|
||||
kinds = set().union(*(MONTADOR_KINDS.get(r, set()) for r in roles_of(request.state.operator)))
|
||||
if body.kind not in kinds:
|
||||
raise HTTPException(403, 'Seu perfil não permite este tipo de pedido.')
|
||||
if body.batch and body.kind != 'interno':
|
||||
raise HTTPException(422, 'A lista colada vira sempre pedido Interno.')
|
||||
with db.connect() as c:
|
||||
if body.kind == 'interno':
|
||||
customer = internal_customer(c)
|
||||
@@ -148,7 +150,8 @@ def montador_order(body: MontadorOrder, request: Request, user=Depends(can('asse
|
||||
# The order's kind and the clothing order it travels with, on the
|
||||
# card and in Tiny's internal note.
|
||||
approved = {**approved, 'kind': body.kind,
|
||||
**({'with_order': body.with_order} if body.with_order else {})}
|
||||
**({'with_order': body.with_order} if body.with_order else {}),
|
||||
**({'batch': body.batch.model_dump()} if body.batch else {})}
|
||||
# A Venda's seller in Tiny is who assembled it, when their user
|
||||
# names one (Marcus, 2026-11-17, app/tiny.py order_payload).
|
||||
if body.kind == 'venda':
|
||||
|
||||
@@ -405,6 +405,15 @@ class QuoteRequest(StrictModel):
|
||||
raise ValueError('The delivery address CEP must be the CEP freight was quoted for')
|
||||
return self
|
||||
|
||||
class SkippedLine(StrictModel):
|
||||
line: int = Field(ge=1, le=10000, strict=True)
|
||||
text: str = Field(max_length=200)
|
||||
reason: str = Field(max_length=200)
|
||||
|
||||
class MontadorBatch(StrictModel):
|
||||
lines: int = Field(ge=0, le=1000, strict=True)
|
||||
skipped: list[SkippedLine] = Field(default_factory=list, max_length=1000)
|
||||
|
||||
class MontadorOrder(StrictModel):
|
||||
"""What the montador sends (fronts 7a.3 and 7a.4): Interno or Venda, loose
|
||||
artwork only; the server prices and approves it as a quote. An Interno
|
||||
@@ -421,6 +430,8 @@ class MontadorOrder(StrictModel):
|
||||
# A Venda with "Envio": the chosen freight service and the full address.
|
||||
freight: Freight | None = None
|
||||
destination: Destination | None = None
|
||||
# The pasted list this order came from: the valid lines and the skipped ones.
|
||||
batch: MontadorBatch | None = None
|
||||
|
||||
@model_validator(mode='after')
|
||||
def order_kind(self):
|
||||
|
||||
@@ -59,6 +59,15 @@ def report(order, uploads):
|
||||
lines = []
|
||||
if snapshot.get('proof_of'):
|
||||
lines.append(f'Prova do pedido #{snapshot["proof_of"]}')
|
||||
batch = snapshot.get('batch') or {}
|
||||
if batch:
|
||||
skipped = batch.get('skipped') or []
|
||||
summary = f'Lista colada: {batch.get("lines", 0)} linhas montadas'
|
||||
if skipped:
|
||||
summary += f', {len(skipped)} puladas'
|
||||
lines.append(summary)
|
||||
for row in skipped:
|
||||
lines.append(f'Linha {row.get("line")} pulada ({row.get("reason")}): {row.get("text")}')
|
||||
multi = len(items) > 1
|
||||
for index, item in enumerate(items):
|
||||
lead = f'Item {index + 1}: ' if multi else ''
|
||||
|
||||
Reference in New Issue
Block a user