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:
@@ -146,7 +146,9 @@ def run():
|
||||
|
||||
# Interno is refused while Gestão has not completed the customer.
|
||||
stamp = upload_stamp(shipping)
|
||||
interno = {'kind': 'interno', 'items': [montador_item(stamp)]}
|
||||
batch = {'lines': 2, 'skipped': [
|
||||
{'line': 5, 'text': 'NX.999 Z 1 REF', 'reason': 'tamanho não existe na tabela'}]}
|
||||
interno = {'kind': 'interno', 'items': [montador_item(stamp)], 'batch': batch}
|
||||
refused = shipping.call('/operator/montador/orders', {'request_key': str(uuid4()), **interno},
|
||||
expected=409)
|
||||
assert refused['detail'] == INTERNAL_MISSING, refused
|
||||
@@ -164,6 +166,7 @@ def run():
|
||||
assert order_interno['state'] == 'rec' and order_interno['origin'] == 'dropflow', order_interno
|
||||
assert order_interno['snapshot']['kind'] == 'interno', order_interno['snapshot'].get('kind')
|
||||
assert order_interno['snapshot']['customer']['cnpj'] == '11222333000181', order_interno['snapshot']
|
||||
assert order_interno['snapshot']['batch'] == batch, order_interno['snapshot'].get('batch')
|
||||
payment = order_interno['payment']
|
||||
assert (payment['provider'], payment['method'], payment['status']) == ('manual', 'interno', 'paid'), payment
|
||||
with db.connect() as c:
|
||||
@@ -213,6 +216,12 @@ def run():
|
||||
designer.call('/operator/montador/orders', {'request_key': str(uuid4()), **venda}, expected=403)
|
||||
shipping.call('/operator/montador/orders', {'request_key': str(uuid4()), 'kind': 'interno',
|
||||
'items': [montador_item(stamp, 'file')]}, expected=422)
|
||||
# A pasted list only becomes an Interno order.
|
||||
refused = seller.call('/operator/montador/orders', {'request_key': str(uuid4()), 'kind': 'venda',
|
||||
'customer': venda_customer,
|
||||
'items': [montador_item(venda_stamp)],
|
||||
'batch': batch}, expected=422)
|
||||
assert refused['detail'] == 'A lista colada vira sempre pedido Interno.', refused
|
||||
|
||||
# Venda with Envio: the Site's freight, re-quoted by the server.
|
||||
destination = {'recipient': 'Maria Souza', 'street': 'Rua das Flores', 'number': '100',
|
||||
|
||||
@@ -37,6 +37,29 @@ class PrumoReportTests(unittest.TestCase):
|
||||
self.assertIn('Prumo levou 41 s', text)
|
||||
self.assertNotIn('Prumo levou 341 s', text)
|
||||
|
||||
def test_pasted_list_says_how_many_lines_were_mounted(self):
|
||||
order = self.order()
|
||||
order['snapshot']['batch'] = {'lines': 3, 'skipped': []}
|
||||
lines = report(order, {'u1': {'name': 'arte.pdf'}})
|
||||
text = '\n'.join(lines)
|
||||
self.assertIn('Lista colada: 3 linhas montadas', text)
|
||||
self.assertNotIn('puladas', text)
|
||||
# Before the item lines: the designer reads the list first.
|
||||
self.assertLess(text.index('Lista colada'), text.index('Formato detectado'))
|
||||
|
||||
def test_pasted_list_lists_the_skipped_lines(self):
|
||||
order = self.order()
|
||||
order['snapshot']['batch'] = {'lines': 2, 'skipped': [
|
||||
{'line': 4, 'text': 'NX.999 Z 1 REF', 'reason': 'tamanho não existe na tabela'},
|
||||
{'line': 7, 'text': 'NX.226 C 0', 'reason': 'quantidade de 1 a 9999'}]}
|
||||
lines = report(order, {'u1': {'name': 'arte.pdf'}})
|
||||
text = '\n'.join(lines)
|
||||
self.assertIn('Lista colada: 2 linhas montadas, 2 puladas', text)
|
||||
self.assertIn('Linha 4 pulada (tamanho não existe na tabela): NX.999 Z 1 REF', text)
|
||||
self.assertIn('Linha 7 pulada (quantidade de 1 a 9999): NX.226 C 0', text)
|
||||
self.assertLess(text.index('Lista colada'), text.index('Linha 4 pulada'))
|
||||
self.assertLess(text.index('Linha 7 pulada'), text.index('Formato detectado'))
|
||||
|
||||
def test_saved_png_size_says_whether_the_customer_kept_it(self):
|
||||
order = self.order()
|
||||
item = order['snapshot']['items'][0]
|
||||
|
||||
Reference in New Issue
Block a user