feat: the bobbin footer names the customer and counts the pieces, without price (Rodada 5, C3)
DROPSTAR · Pedido DTF-7 · <cliente> · Item 1/2 · data · metros · N peças (loose arts) or N cópias (a ready sheet repeated). The name is tidied to cp1252 and cut at 24 characters; the proof footer is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -336,11 +336,22 @@ def file_prefix(number, item_index, generation=1):
|
||||
return f'DTF-{number}{version}-item-{item_index + 1}'
|
||||
|
||||
|
||||
def _footer_name(name):
|
||||
"""A customer name for the footer: tidy, printable in cp1252 and at most
|
||||
24 characters, the last one an ellipsis when cut."""
|
||||
cleaned = ' '.join(str(name or '').split())
|
||||
cleaned = cleaned.encode('cp1252', 'ignore').decode('cp1252')
|
||||
cleaned = ' '.join(cleaned.split())
|
||||
if len(cleaned) > 24:
|
||||
cleaned = cleaned[:23] + '…'
|
||||
return cleaned
|
||||
|
||||
|
||||
def footer(job, item):
|
||||
"""The print file's footer line: DROPSTAR · Pedido DTF-123 · Item 1/2 ·
|
||||
21/10/2026 · 0,90 m, and · ESPELHADO when the artwork is mirrored. The
|
||||
order is named by its Kanban number, which Tiny keeps; the length is the
|
||||
one billed."""
|
||||
"""The print file's footer line: DROPSTAR · Pedido DTF-123 · <customer> ·
|
||||
Item 1/2 · 21/10/2026 · 0,90 m · <pieces>, and · ESPELHADO when the
|
||||
artwork is mirrored. The order is named by its Kanban number, which Tiny
|
||||
keeps; the length is the one billed."""
|
||||
count = len(job['snapshot']['items'])
|
||||
day = job['ordered_at'].astimezone(LOCAL).strftime('%d/%m/%Y')
|
||||
billed = f"{Decimal(str(item['billed_metres'])):.2f}".replace('.', ',')
|
||||
@@ -348,11 +359,25 @@ def footer(job, item):
|
||||
if proof_of:
|
||||
return ' · '.join(['DROPSTAR', f'PROVA do #{proof_of}',
|
||||
f'Classe {item.get("stroke_class") or "C3"}', day])
|
||||
fields = ['DROPSTAR', f'Pedido {purchase_order(job["number"])}',
|
||||
f'Item {job["item_index"] + 1}/{count}', day, f'{billed} m']
|
||||
fields = ['DROPSTAR', f'Pedido {purchase_order(job["number"])}']
|
||||
customer = _footer_name((job['snapshot'].get('customer') or {}).get('name'))
|
||||
if customer:
|
||||
fields.append(customer)
|
||||
fields += [f'Item {job["item_index"] + 1}/{count}', day, f'{billed} m']
|
||||
production = item.get('production') or {}
|
||||
sources = production.get('sources') or []
|
||||
placements = production.get('placements') or []
|
||||
if any(source.get('kind') == 'artwork' for source in sources):
|
||||
pieces = len(placements)
|
||||
if pieces:
|
||||
fields.append(f'{pieces} peça' if pieces == 1 else f'{pieces} peças')
|
||||
elif any(source.get('kind') == 'sheet' for source in sources):
|
||||
copies = sum(source.get('copies') or 0 for source in sources)
|
||||
if copies > 1:
|
||||
fields.append(f'{copies} cópias')
|
||||
# A mirrored artwork (UV only) is named on the sheet, for the room to see
|
||||
# before printing (Dropstar, 2026-10-23).
|
||||
if any(source.get('mirrored') for source in item['production']['sources']):
|
||||
if any(source.get('mirrored') for source in sources):
|
||||
fields.append('ESPELHADO')
|
||||
return ' · '.join(fields)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user