fix: a reprint keeps an all-items choice, an undone pass to Revisão prints nothing again, and Prova OK tells Tiny (#105)
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 7m56s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m26s

- Every item ticked was saved as NULL, which also means "not chosen", so the
  pass to the queue replaced it with the suggestion and only the changed
  item went to the machine; the panel showed the suggestion again. The
  choice is now the whole list.
- Undoing a pass to Revisão (back to Imprimindo) started a new round with
  every file, so FlexiPRINT printed the order again. It now writes back only
  what Flexi had not taken, and the reprint choice of that pass returns. A
  pass undone this way no longer counts its film twice in the machine's
  metres (machine log and Números).
- An order entering the queue by Prova OK never sent Tiny's "Preparando
  envio". The stage's Tiny event is now one function, used by the move and
  by the Prova OK.

Integration test follows the real moves: suggestion, all items kept, pull
onto a machine, two undone passes to Revisão, metres counted once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-27 14:48:34 -03:00
parent 194797c412
commit f35a347a28
10 changed files with 166 additions and 49 deletions

View File

@@ -524,12 +524,20 @@ def move(uid: UUID, body: Move, request: Request, user=Depends(operator)):
# again from what changed since.
if printed_items is not None or (body.state == 'fin' and not back):
c.execute('UPDATE dtf_local.orders SET print_items=NULL WHERE id=%s', (uid,))
# Back to Imprimindo from Revisão (a mistaken move undone): the items
# that pass printed are the choice again, and only what Flexi had not
# taken goes back to the folder, never the whole order.
if body.state == 'imp' and back:
undone = c.execute('''SELECT items FROM dtf_local.movements WHERE order_id=%s
AND from_state='imp' AND to_state='rev' AND NOT back ORDER BY id DESC LIMIT 1''', (uid,)).fetchone()
if undone and undone['items'] is not None:
c.execute('UPDATE dtf_local.orders SET print_items=%s WHERE id=%s', (undone['items'], uid))
# Pulled to Imprimindo, its files go to its machine's hot folder; out
# of it, what Flexi did not take leaves (item 10).
if row['state'] == 'imp':
hotfolder.stop(c, uid)
if body.state == 'imp':
hotfolder.start(c, uid)
(hotfolder.resume if back else hotfolder.start)(c, uid)
# A pickup reaching Finalizado has its receipt due (item 14), once.
due = body.state == 'fin' and not back and receipt.is_pickup(row['snapshot'])
changed = c.execute('''UPDATE dtf_local.orders SET state=%s, version=version+1, updated_at=now(),
@@ -538,21 +546,8 @@ def move(uid: UUID, body: Move, request: Request, user=Depends(operator)):
WHERE id=%s RETURNING *''', (body.state, body.state, due, uid)).fetchone()
# Entering the queue (Arte conferida) is Tiny's "Preparando envio";
# Finalizado its "Pronto para envio" (Dropstar's flow, 2026-10-23).
events = {'tra':'production_started','cor':'correction_needed','fin':'ready'}
if body.state in events and not back and payments.in_tiny(row):
# "Production started" and "ready" reach the customer once per order,
# even if a mistaken move is undone and made again. Each correction
# is a new request, so it keeps one message per movement.
once = body.state in ('tra','fin')
event = {'order_id':str(uid), 'number':row['number'], 'event':events[body.state], 'reason':body.reason,
'customer_path': f'/portal.html?order={uid}'}
# Tiny needs the order (customer, pickup or delivery) and, once the
# sale reached it, its id, to set the situação without a search.
sale = c.execute("SELECT receipt FROM dtf_local.outbox WHERE event_key=%s AND delivered_at IS NOT NULL",
(f'{uid}:paid:tiny',)).fetchone()
tiny = {**event, 'order': row['snapshot'], 'tiny_id': ((sale or {}).get('receipt') or {}).get('tiny_id')}
key = f'{uid}:{events[body.state]}:tiny' if once else f'{uid}:{changed["version"]}:tiny'
enqueue(c, key, 'tiny', tiny)
if not back:
payments.stage_event(c, row, body.state, body.reason, changed['version'])
return changed
class PrintItems(StrictModel):
@@ -574,7 +569,9 @@ def choose_print_items(uid: UUID, body: PrintItems, user=Depends(can('produce'))
items = sorted(set(body.items))
if any(i < 0 or i >= count for i in items):
raise HTTPException(422, 'Item do pedido inválido.')
chosen = None if len(items) == count else items
# Every item is kept as the whole list, not NULL: NULL is "not chosen
# yet", which the pass to the queue would replace with the suggestion.
chosen = items
c.execute('UPDATE dtf_local.orders SET print_items=%s, version=version+1, updated_at=now() WHERE id=%s',
(chosen, uid))
audit('order_print_items', order=row['number'], items=','.join(str(i + 1) for i in items), operator=user)

View File

@@ -15,7 +15,8 @@ the same file and Flexi never prints it twice. A claim that did not finish
goes back to the queue. A written part that is gone from its folder was
taken by Flexi, and is never written again. A card that leaves Imprimindo
(Revisão, Correção, a step back, a cancellation) withdraws what Flexi has not
taken yet, and its computer deletes it.
taken yet, and its computer deletes it. A step back from Revisão to
Imprimindo writes again only what Flexi had not taken (resume()).
Each part's life is one row of dtf_local.hot_parts:
queued -> claimed -> written -> consumed, or withdraw -> gone.
@@ -70,6 +71,19 @@ 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 resume(c, order_id):
"""A step back from Revisão to Imprimindo, undoing a move made by
mistake: the parts of the last round Flexi had not taken go back to the
folder, in their order; what it took was printed and is never written
again (start() would send the whole order to the machine once more)."""
last = c.execute('SELECT max(round) AS r FROM dtf_local.hot_parts WHERE order_id=%s', (order_id,)).fetchone()['r']
if last is None:
return
c.execute('''INSERT INTO dtf_local.hot_parts(order_id,round,seq,item_index,upload_id,name)
SELECT order_id, round + 1, row_number() OVER (ORDER BY seq), item_index, upload_id, name
FROM dtf_local.hot_parts WHERE order_id=%s AND round=%s AND state<>'consumed' ''', (order_id, last))
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."""

View File

@@ -58,12 +58,20 @@ def one_decimal(value):
return f'{Decimal(str(value)):.1f}'.replace('.', ',')
# A pass to Revisão undone at once (a mistaken move, back to Imprimindo):
# the pass after the undo counts the film, so this one must not, or the
# machine's metres count it twice. `m` is the pass in dtf_local.movements.
NOT_UNDONE = """NOT EXISTS (SELECT 1 FROM dtf_local.movements u WHERE u.order_id=m.order_id AND u.back
AND u.from_state='rev' AND u.to_state='imp'
AND u.id=(SELECT min(n.id) FROM dtf_local.movements n WHERE n.order_id=m.order_id AND n.id>m.id))"""
def printed_since(c, machine_id, since):
"""Film metres the machine printed after `since` (None: ever), as Decimal."""
from .proof import PROOF_SHEET_CM
rows = c.execute('''SELECT o.snapshot, m.items FROM dtf_local.movements m
rows = c.execute(f'''SELECT o.snapshot, m.items FROM dtf_local.movements m
JOIN dtf_local.orders o ON o.id=m.order_id
WHERE o.machine_id=%s AND m.from_state='imp' AND m.to_state='rev' AND NOT m.back
WHERE o.machine_id=%s AND m.from_state='imp' AND m.to_state='rev' AND NOT m.back AND {NOT_UNDONE}
AND (%s::timestamptz IS NULL OR m.created_at > %s::timestamptz)''',
(machine_id, since, since)).fetchall()
total = Decimal(0)

View File

@@ -33,7 +33,7 @@ from datetime import datetime, time
from decimal import Decimal, ROUND_HALF_UP
from zoneinfo import ZoneInfo
from .machine_log import SUPPLIES
from .machine_log import NOT_UNDONE, SUPPLIES
SAO_PAULO = ZoneInfo('America/Sao_Paulo')
# The five inks Números lists, in the order the sheet knows them.
@@ -119,9 +119,9 @@ def ratios(printed, hours_running=None, supplies_cents=0, parts_cents=0, rolls=N
def _printed_orders(c, machine_id, start, end):
"""The orders that left Imprimindo for Revisão on the machine in the
period, with what is needed to count film and what they sold."""
return c.execute('''SELECT o.id, o.snapshot, o.parent_id, o.cancelled_at, o.payment, m.items
return c.execute(f'''SELECT o.id, o.snapshot, o.parent_id, o.cancelled_at, o.payment, m.items
FROM dtf_local.movements m JOIN dtf_local.orders o ON o.id=m.order_id
WHERE o.machine_id=%s AND m.from_state='imp' AND m.to_state='rev' AND NOT m.back
WHERE o.machine_id=%s AND m.from_state='imp' AND m.to_state='rev' AND NOT m.back AND {NOT_UNDONE}
AND m.created_at>=%s AND m.created_at<%s''', (machine_id, start, end)).fetchall()
@@ -278,9 +278,9 @@ def report(c, month=None):
'''SELECT DISTINCT machine_id FROM dtf_local.machine_entries
WHERE created_at>=%s AND created_at<%s''', (start, end)).fetchall()}
printed = {str(row['machine_id']) for row in c.execute(
'''SELECT DISTINCT o.machine_id FROM dtf_local.movements m
f'''SELECT DISTINCT o.machine_id FROM dtf_local.movements m
JOIN dtf_local.orders o ON o.id=m.order_id
WHERE m.from_state='imp' AND m.to_state='rev' AND NOT m.back
WHERE m.from_state='imp' AND m.to_state='rev' AND NOT m.back AND {NOT_UNDONE}
AND m.created_at>=%s AND m.created_at<%s''', (start, end)).fetchall()}
result = []
for machine in machines:

View File

@@ -77,6 +77,34 @@ def in_tiny(order):
return not is_test(order) and not order.get('parent_id')
# What a stage tells Tiny: entering the queue (Arte conferida) is its
# "Preparando envio", Finalizado its "Pronto para envio" (Dropstar's flow,
# 2026-10-23); a correction has no situação and is only recorded.
STAGE_EVENTS = {'tra': 'production_started', 'cor': 'correction_needed', 'fin': 'ready'}
def stage_event(c, order, state, reason, version):
"""Queue Tiny's event for an order that entered `state` (not by a step
back), whoever moved it: a card dragged, or the Prova OK that puts the
order in the queue (app/proof.py). `order` is its row before the move,
`version` its version after."""
if state not in STAGE_EVENTS or not in_tiny(order):
return
# "Production started" and "ready" reach the customer once per order,
# even if a mistaken move is undone and made again. Each correction is a
# new request, so it keeps one message per movement.
once = state in ('tra', 'fin')
event = {'order_id': str(order['id']), 'number': order['number'], 'event': STAGE_EVENTS[state],
'reason': reason, 'customer_path': f"/portal.html?order={order['id']}"}
# Tiny needs the order (customer, pickup or delivery) and, once the sale
# reached it, its id, to set the situação without a search.
sale = c.execute("SELECT receipt FROM dtf_local.outbox WHERE event_key=%s AND delivered_at IS NOT NULL",
(f"{order['id']}:paid:tiny",)).fetchone()
tiny = {**event, 'order': order['snapshot'], 'tiny_id': ((sale or {}).get('receipt') or {}).get('tiny_id')}
key = f"{order['id']}:{STAGE_EVENTS[state]}:tiny" if once else f"{order['id']}:{version}:tiny"
enqueue(c, key, 'tiny', tiny)
# How long a file is kept while nothing has been paid for it. A cart's files
# are uploaded before payment, so the price and the security check are done on
# the file itself; a cart that is never paid must not keep them for 30 days.

View File

@@ -149,8 +149,12 @@ def approve_parent(c, parent, operator):
WHERE f.order_id=%s AND f.item_index=%s AND {FINAL_OK} {treatment_clause} LIMIT 1''',
(parent['id'], i)).fetchone() for i in range(len(parent['snapshot']['items'])))
if ready:
c.execute('''UPDATE dtf_local.orders SET state='tra', version=version+1, updated_at=now()
WHERE id=%s''', (parent['id'],))
version = c.execute('''UPDATE dtf_local.orders SET state='tra', version=version+1, updated_at=now()
WHERE id=%s RETURNING version''', (parent['id'],)).fetchone()['version']
c.execute('''INSERT INTO dtf_local.movements(order_id,from_state,to_state,operator,reason)
VALUES(%s,'rec','tra',%s,'Prova OK')''', (parent['id'], operator))
# Entering the queue this way is Tiny's "Preparando envio" too, as a
# card moved by hand: orders with a proof skipped it.
from .payments import stage_event
stage_event(c, parent, 'tra', 'Prova OK', version)
return ready

View File

@@ -398,7 +398,13 @@ def run():
final = c.execute('''SELECT note,created_by FROM dtf_local.order_files
WHERE order_id=%s AND kind='final' AND active''', (parent['id'],)).fetchone()
assert final['created_by'] == 'Prumo' and 'prova' in final['note'].lower(), final
print('PASS: Prova OK turns Prumo\'s full file into the parent final and queues it')
# Entering the queue by Prova OK is Tiny's "Preparando envio", as a card
# moved by hand (orders with a proof skipped it).
with db.connect() as c:
started = c.execute("SELECT payload FROM dtf_local.outbox WHERE event_key=%s",
(f"{parent['id']}:production_started:tiny",)).fetchone()
assert started and started['payload']['event'] == 'production_started', started
print('PASS: Prova OK turns Prumo\'s full file into the parent final, queues it and tells Tiny')
# Prova OK while the parent's file is still being generated (#81, 91,5 m,
# 2026-11-24): the parent waits in Arte recebida and enters the queue on
@@ -433,7 +439,10 @@ def run():
moved = c.execute('''SELECT operator,reason FROM dtf_local.movements
WHERE order_id=%s AND to_state='tra' ORDER BY id DESC LIMIT 1''', (parent['id'],)).fetchone()
assert (moved['operator'], moved['reason']) == ('Prumo', 'Prova OK'), moved
print('PASS: a file finished after Prova OK becomes the final and queues the order')
with db.connect() as c:
assert c.execute("SELECT 1 FROM dtf_local.outbox WHERE event_key=%s",
(f"{parent['id']}:production_started:tiny",)).fetchone()
print('PASS: a file finished after Prova OK becomes the final, queues the order and tells Tiny')
# 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
@@ -472,30 +481,69 @@ def run():
{'item_index': 1, 'upload_id': corrected}]}, operator=True)['version']
board_order = next(o for o in client.call('/operator/board', operator=True)['orders'] if o['id'] == rid)
assert board_order['printed_before'] and board_order['print_suggested'] == [1], board_order.get('print_suggested')
client.call('/operator/orders/' + rid + '/move', {'state': 'tra', 'version': v}, operator=True)
from app import hotfolder
v = client.call('/operator/orders/' + rid + '/move', {'state': 'tra', 'version': v}, operator=True)['version']
def print_items():
with db.connect() as c:
return c.execute('SELECT print_items FROM dtf_local.orders WHERE id=%s', (rid,)).fetchone()['print_items']
def version():
return next(o for o in client.call('/operator/board', operator=True)['orders'] if o['id'] == rid)['version']
assert print_items() == [1], print_items()
# Every item ticked by hand in Arte recebida is a choice too: entering the
# queue keeps it, the suggestion does not take its place.
client.call('/operator/orders/' + rid + '/move', {'state': 'rec', 'version': v, 'reason': 'teste'}, operator=True)
assert client.call('/operator/orders/' + rid + '/print-items', {'items': [0, 1]}, operator=True)['print_items'] == [0, 1]
client.call('/operator/orders/' + rid + '/move', {'state': 'tra', 'version': version()}, operator=True)
assert print_items() == [0, 1], print_items()
# Back to only the corrected item, then pulled onto a machine for real.
assert client.call('/operator/orders/' + rid + '/print-items', {'items': [1]}, operator=True)['print_items'] == [1]
machine = client.call('/operator/machines', {'name': f'Reprint {uuid4().hex[:6]}', 'products': ['textil']},
operator=True)['id']
v = client.call('/operator/orders/' + rid + '/move', {'state': 'imp', 'version': version(), 'machine_id': machine},
operator=True)['version']
with db.connect() as c:
assert c.execute('SELECT print_items FROM dtf_local.orders WHERE id=%s', (rid,)).fetchone()['print_items'] == [1]
hotfolder.start(c, rid)
queued = c.execute('SELECT item_index,upload_id FROM dtf_local.hot_parts WHERE order_id=%s AND round=2',
(rid,)).fetchall()
assert [(q['item_index'], str(q['upload_id'])) for q in queued] == [(1, corrected)], queued
c.execute("UPDATE dtf_local.hot_parts SET state='consumed' WHERE order_id=%s AND round=2", (rid,))
c.execute("UPDATE dtf_local.orders SET state='imp' WHERE id=%s", (rid,))
v = c.execute('SELECT version FROM dtf_local.orders WHERE id=%s', (rid,)).fetchone()['version']
client.call('/operator/orders/' + rid + '/move', {'state': 'rev', 'version': v}, operator=True)
assert [(q['item_index'], str(q['upload_id'])) for q in queued] == [(1, corrected)], queued
# Sent to Revisão by mistake before Flexi took the file, and undone: the
# file goes back to the folder, alone, and the choice is the same.
v = client.call('/operator/orders/' + rid + '/move', {'state': 'rev', 'version': v}, operator=True)['version']
assert print_items() is None
v = client.call('/operator/orders/' + rid + '/move', {'state': 'imp', 'version': v, 'reason': 'engano'},
operator=True)['version']
assert print_items() == [1], print_items()
with db.connect() as c:
moved = c.execute('''SELECT items FROM dtf_local.movements WHERE order_id=%s AND to_state='rev'
ORDER BY id DESC LIMIT 1''', (rid,)).fetchone()
left = c.execute('SELECT print_items FROM dtf_local.orders WHERE id=%s', (rid,)).fetchone()['print_items']
assert moved['items'] == [1] and left is None, (moved, left)
# Chosen by hand: every item means all, as on a first print.
again = c.execute('SELECT item_index,upload_id,state FROM dtf_local.hot_parts WHERE order_id=%s AND round=3',
(rid,)).fetchall()
assert [(r['item_index'], str(r['upload_id']), r['state']) for r in again] == [(1, corrected, 'queued')], again
c.execute("UPDATE dtf_local.hot_parts SET state='consumed' WHERE order_id=%s AND round=3", (rid,))
# Flexi took it: undoing a later pass to Revisão writes nothing again.
v = client.call('/operator/orders/' + rid + '/move', {'state': 'rev', 'version': v}, operator=True)['version']
v = client.call('/operator/orders/' + rid + '/move', {'state': 'imp', 'version': v, 'reason': 'engano'},
operator=True)['version']
with db.connect() as c:
assert not c.execute('SELECT 1 FROM dtf_local.hot_parts WHERE order_id=%s AND round>3', (rid,)).fetchone()
client.call('/operator/orders/' + rid + '/move', {'state': 'rev', 'version': v}, operator=True)
from app import machine_log
with db.connect() as c:
moved = c.execute("SELECT items FROM dtf_local.movements WHERE order_id=%s AND to_state='rev' "
"ORDER BY id DESC LIMIT 1", (rid,)).fetchone()
item = c.execute('SELECT snapshot FROM dtf_local.orders WHERE id=%s', (rid,)).fetchone()['snapshot']['items'][1]
metres = machine_log.printed_since(c, machine, None)
assert moved['items'] == [1] and print_items() is None, moved
# Three passes to Revisão, two of them undone: item 2's film, once.
expected = Decimal(str(item['metres'] if item.get('metres') is not None else item.get('billed_metres') or 0))
assert metres == expected, (metres, expected)
# Chosen by hand: every item, or some; never an item the order lacks.
with db.connect() as c:
c.execute("UPDATE dtf_local.orders SET state='rec' WHERE id=%s", (rid,))
assert client.call('/operator/orders/' + rid + '/print-items', {'items': [0, 1]}, operator=True)['print_items'] is None
assert client.call('/operator/orders/' + rid + '/print-items', {'items': [1, 0, 1]}, operator=True)['print_items'] == [0, 1]
assert client.call('/operator/orders/' + rid + '/print-items', {'items': [0]}, operator=True)['print_items'] == [0]
client.call('/operator/orders/' + rid + '/print-items', {'items': [5]}, operator=True, expected=422)
print('PASS: a reprint sends only the item whose final changed, and the choice ends with the print')
print('PASS: a reprint sends only the items chosen, keeps an all-items choice, and an undone pass to Revisão '
'neither writes again what Flexi took nor counts the film twice')
# A CDR cannot be decoded by the worker. The designer prepares the full
# parent PNG, then the worker automatically cuts the child's proof from it.

View File

@@ -23,7 +23,7 @@ class Database:
"""Just the reads and writes approve_parent makes."""
def __init__(self, parts, active):
self.parts, self.active, self.inserted = parts, active, []
self.parts, self.active, self.inserted, self.outbox = parts, active, [], []
def execute(self, sql, params=()):
text = ' '.join(sql.split())
@@ -37,10 +37,17 @@ class Database:
return Rows([{'upload_id': u} for u in self.active])
if text.startswith('INSERT INTO dtf_local.order_files'):
self.inserted.append(params[2])
if text.startswith('UPDATE dtf_local.orders SET state'):
return Rows([{'version': 2}])
if 'FROM dtf_local.outbox' in text:
return Rows([])
if text.startswith('INSERT INTO dtf_local.outbox'):
self.outbox.append((params[0], params[2].obj['event']))
return Rows([{'ok': 1}])
ORDER = {'id': 'o', 'state': 'rec', 'cancelled_at': None, 'snapshot': {'items': [{'mode': 'file'}]}}
ORDER = {'id': 'o', 'number': 131, 'state': 'rec', 'cancelled_at': None, 'payment': {'provider': 'mercadopago'},
'snapshot': {'items': [{'mode': 'file'}]}}
class ProofPartsTests(unittest.TestCase):
@@ -54,6 +61,13 @@ class ProofPartsTests(unittest.TestCase):
approve_parent(db, ORDER, 'Prumo')
self.assertEqual(db.inserted, ['p2'])
def test_entering_the_queue_by_prova_ok_tells_tiny(self):
# Tiny's "Preparando envio", as for a card moved by hand: orders with
# a proof skipped it.
db = Database(['p1'], set())
self.assertTrue(approve_parent(db, ORDER, 'Prumo'))
self.assertEqual(db.outbox, [('o:production_started:tiny', 'production_started')])
def test_a_final_someone_prepared_stays(self):
db = Database(['p1', 'p2'], {'treated'})
approve_parent(db, ORDER, 'Prumo')

View File

@@ -427,7 +427,8 @@ function cardFlags(order){
const dots=s.items.reduce((t,i)=>t+(i.residue_accepted||0),0);
if(live&&dots)out.push(['warn','Resíduo','O cliente aceitou imprimir com '+residueNote({residue_accepted:dots})]);
// A reprint: only some items go to the machine again (#105).
if(live&&order.print_items?.length)out.push(['warn','Reimpressão','Vão para a máquina só: '+order.print_items.map(i=>'item '+(i+1)).join(', ')]);
// Every item ticked is a choice too, but no reprint of some: no flag.
if(live&&order.print_items?.length&&order.print_items.length<s.items.length)out.push(['warn','Reimpressão','Vão para a máquina só: '+order.print_items.map(i=>'item '+(i+1)).join(', ')]);
// A ready sheet with pieces closer than 5 mm (Marcus, 2026-11-26, #81).
const close=s.items.reduce((t,i)=>t+(i.close_pieces||0),0);
if(live&&close)out.push(['warn','Peças coladas',closeNote(close)]);

View File

@@ -1144,7 +1144,10 @@ function reprintChoice(order){
const input=node('input');input.checked=chosen.has(index);input.disabled=!may('produce');
box.append(checkbox('Item '+(index+1)+', '+productName(item),input));return input;
});
box.append(node('small',order.print_items?'Só os itens marcados vão para a máquina.'
// A saved choice is the whole list when every item goes (never NULL, which
// is "not chosen yet" and would show the suggestion again).
const all=order.print_items?.length===order.snapshot.items.length;
box.append(node('small',order.print_items?(all?'Todos os itens vão para a máquina.':'Só os itens marcados vão para a máquina.')
:order.print_suggested?'Marcados os itens cujo arquivo mudou desde a última impressão.'
:'O pedido já foi impresso: marque só os itens que precisam sair de novo.'));
if(may('produce')){