fix: a cancelled order takes its open proof card, a renamed machine keeps its hot folder, a film is approved with all its parts
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 8m8s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m11s

- Cancelling an order left its proof card not yet answered on the board,
  where it could still be pulled and printed. It is cancelled with it.
- The hot folder path was the machine's current name, so renaming a machine
  sent its next files to a folder FlexiPRINT does not watch. Each machine now
  keeps the folder it was created with (migration fills it with today's
  names); no other machine may take that name, and the machine form shows
  the folder.
- A final set with only some parts of a film was accepted, the #130 failure
  through the manual path. The server now refuses it and names the parts
  missing.
- The proof card note says up to 30 cm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-27 15:19:27 -03:00
parent ba85168c09
commit 7454f6b840
9 changed files with 90 additions and 16 deletions

View File

@@ -251,6 +251,13 @@ def run():
# No class measured or chosen: the part waits for one.
assert not [p for p in client.call('/operator/queue/hot', {}, operator=True)['write'] if p['order'] == oid]
client.call('/operator/orders/' + oid + '/contraction', {'item_index': 0, 'value': 'C2'}, operator=True)
# Renamed, the machine keeps its folder, the path FlexiPRINT watches;
# no other machine may then take that folder's name.
client.call('/operator/machines/' + machine, {'name': f'Hot {tag} renomeada', 'products': ['textil']},
operator=True)
listed = next(m for m in client.call('/operator/machines', operator=True)['machines'] if m['id'] == machine)
assert listed['name'] == f'Hot {tag} renomeada' and listed['folder'] == f'Hot {tag}', listed
client.call('/operator/machines', {'name': f'Hot {tag}', 'products': ['textil']}, operator=True, expected=409)
hot = client.call('/operator/queue/hot', {}, operator=True)
due = [p for p in hot['write'] if p['order'] == oid]
assert hot['folder'] == '3. Imprimindo' and [(p['folder'], p['name']) for p in due] == \
@@ -269,7 +276,8 @@ def run():
assert board['hot'] == {'parts': 1, 'taken': 1, 'waiting': 0}, board['hot']
# Which items go again is chosen before Imprimindo, not while printing (#105).
client.call('/operator/orders/' + oid + '/print-items', {'items': [0]}, operator=True, expected=409)
print('PASS: the printing file goes once into its machine\'s hot folder for its class')
print('PASS: the printing file goes once into its machine\'s hot folder for its class, '
'and a renamed machine keeps its folder')
finally:
client.call('/operator/machines/' + machine, {'name': f'Hot {tag}', 'products': ['textil'], 'active': False},
operator=True)
@@ -444,6 +452,36 @@ def run():
(f"{parent['id']}:production_started:tiny",)).fetchone()
print('PASS: a file finished after Prova OK becomes the final, queues the order and tells Tiny')
# Cancelled, an order takes its proof card not yet answered with it: left
# on the board, the card could still be pulled and printed.
readable = upload_bytes(client, artwork(), name='LOCAL-PROOF-CANCEL.png')
parent = paid_order(client, loose_item(readable, copies=1))
with db.connect() as c:
c.execute("UPDATE dtf_local.orders SET snapshot=jsonb_set(snapshot,'{proof}','true') WHERE id=%s",
(parent['id'],))
card = client.call('/operator/orders/' + parent['id'] + '/proof-card', {}, operator=True)
client.call('/operator/orders/' + parent['id'] + '/cancel', {'note': 'cliente desistiu'}, operator=True)
with db.connect() as c:
gone = c.execute('SELECT cancelled_at, cancel_reason FROM dtf_local.orders WHERE id=%s', (card['id'],)).fetchone()
assert gone['cancelled_at'] and 'cliente desistiu' in gone['cancel_reason'], gone
print('PASS: cancelling an order cancels its open proof card')
# A film in parts is approved whole: only some of its parts are refused,
# or the others never reach the machine (#114, #128, #130).
whole = upload_bytes(client, artwork(), name='LOCAL-PARTS.png')
film = paid_order(client, loose_item(whole, copies=1))
_, film_row = wait_print(client, film['id'], 'ready')
second = upload_bytes(client, artwork(), name='LOCAL-PARTS-P2.png')
with db.connect() as c:
c.execute('INSERT INTO dtf_local.print_parts(order_id,item_index,part,upload_id) VALUES(%s,0,2,%s)',
(film['id'], second))
refused = client.call('/operator/orders/' + film['id'] + '/final-files',
{'version': version_of(film['id']), 'note': 'só a primeira',
'files': [{'item_index': 0, 'upload_id': str(film_row['upload_id'])}]},
operator=True, expected=422)
assert 'faltam p2' in refused['detail'], refused
print('PASS: a film in parts is approved with all its parts or not at all')
# Reprinting some items (Marcus, 2026-11-26, #105): an order the machine
# already printed, back in the queue after one item's final changed, sends
# only that item; the pass to Revisão keeps it for the machine's metres and