feat: a reprint sends only the items chosen to the machine (Marcus, 2026-11-26, #105)
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m34s
All checks were successful
Build and deploy / Validate source (push) Successful in 11s
Build and deploy / Integration suite on a real stack (push) Successful in 7m55s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m34s
An order the machine already printed, back in Arte conferida, sends again only the items whose final changed since the machine took them; the panel's "Vai para a máquina" shows and changes the choice, and the card says "Reimpressão". The order stays one card. The pass to Revisão keeps the items printed, so the machine's metres count only those. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,10 +52,13 @@ def folder_class(order, index):
|
||||
|
||||
def start(c, order_id):
|
||||
"""The order entered Imprimindo: its approved finals queue for its
|
||||
machine's folder, item by item, part by part."""
|
||||
machine's folder, item by item, part by part; on a reprint only the items
|
||||
chosen to go again (orders.print_items)."""
|
||||
files = c.execute('''SELECT f.item_index, f.upload_id, u.name FROM dtf_local.order_files f
|
||||
JOIN dtf_local.uploads u ON u.id=f.upload_id
|
||||
WHERE f.order_id=%s AND f.kind='final' AND f.active ORDER BY f.item_index, u.name''', (order_id,)).fetchall()
|
||||
JOIN dtf_local.uploads u ON u.id=f.upload_id JOIN dtf_local.orders o ON o.id=f.order_id
|
||||
WHERE f.order_id=%s AND f.kind='final' AND f.active
|
||||
AND (o.print_items IS NULL OR f.item_index = ANY(o.print_items))
|
||||
ORDER BY f.item_index, u.name''', (order_id,)).fetchall()
|
||||
round_ = c.execute('SELECT COALESCE(max(round), 0) + 1 AS r FROM dtf_local.hot_parts WHERE order_id=%s',
|
||||
(order_id,)).fetchone()['r']
|
||||
for seq, row in enumerate(files, 1):
|
||||
@@ -63,6 +66,27 @@ def start(c, order_id):
|
||||
VALUES(%s,%s,%s,%s,%s,%s)''', (order_id, round_, seq, row['item_index'], row['upload_id'], row['name']))
|
||||
|
||||
|
||||
def printed(c, order_ids):
|
||||
"""The files each order's machine has already taken, {order id: {upload
|
||||
ids}}: an order in it was printed before."""
|
||||
rows = c.execute('''SELECT order_id, upload_id FROM dtf_local.hot_parts
|
||||
WHERE order_id=ANY(%s) AND state IN ('written','consumed')''', (list(order_ids),)).fetchall()
|
||||
out = {}
|
||||
for row in rows:
|
||||
out.setdefault(row['order_id'], set()).add(row['upload_id'])
|
||||
return out
|
||||
|
||||
|
||||
def reprint_default(finals, taken, count):
|
||||
"""The items to print again: those whose current final the machine has
|
||||
not taken. `finals` is [(item, upload id)]; None when all go (never printed,
|
||||
or nothing new)."""
|
||||
if not taken:
|
||||
return None
|
||||
changed = sorted({item for item, upload in finals if upload not in taken})
|
||||
return changed if changed and len(changed) < count else None
|
||||
|
||||
|
||||
def stop(c, order_id):
|
||||
"""The order left Imprimindo or was cancelled: what is not written stays
|
||||
unwritten, and what Flexi has not taken is withdrawn from the folder."""
|
||||
|
||||
Reference in New Issue
Block a user