feat: "Abrir e conferir", the print file full screen, in pieces (item 7)
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 4m28s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m17s
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 4m28s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m17s
The card's "Abrir e conferir" opens the order's print file full screen (Dropstar's third round, item 7): zoom up to 100% real (one file pixel, one screen pixel), the position in cm, the order's files one after the other without closing, and the background behind the transparency light, dark or checkered, remembered (Dropstar, 2026-10-30). Closed in Arte recebida, it asks "Está OK?": the class of each item, prefilled with the measure, then "Mover para Arte conferida" (the final approved, the class kept, the card moved) or "Tratar a arte". A 15 m film is loaded like a map: while the PNG is written, its strips of 512 rows go to storage at 100% and at each halving (app/printtiles.py, originals/tiles/<upload>/), and the viewer (web/kanban-viewer.js) fetches only those on screen. They go when their file expires. Storing a print file that fails is now an attempt like a failed render, not a claim held for an hour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1399,6 +1399,47 @@ def print_ready(c, states, only=None, paid_after=None):
|
||||
return rows
|
||||
|
||||
|
||||
@router.get('/api/operator/orders/{uid}/view')
|
||||
def view_files(uid: UUID, user=Depends(operator)):
|
||||
"""What "Abrir e conferir" shows (item 7): each item's generated PNG, part
|
||||
by part, with links to its pieces, then the customer's originals, which
|
||||
have only their picture."""
|
||||
with db.connect() as c:
|
||||
order = c.execute('SELECT snapshot FROM dtf_local.orders WHERE id=%s', (uid,)).fetchone()
|
||||
if not order:
|
||||
raise HTTPException(404, 'Pedido não encontrado.')
|
||||
made = c.execute('''SELECT item_index, detail FROM dtf_local.print_files WHERE order_id=%s AND status='ready'
|
||||
ORDER BY item_index''', (uid,)).fetchall()
|
||||
parts = c.execute('''SELECT p.item_index, p.part, p.upload_id, u.name FROM dtf_local.print_parts p
|
||||
JOIN dtf_local.uploads u ON u.id=p.upload_id WHERE p.order_id=%s AND u.purged_at IS NULL
|
||||
ORDER BY p.item_index, p.part''', (uid,)).fetchall()
|
||||
pictured = {str(r['upload_id']) for r in c.execute(
|
||||
'SELECT upload_id FROM dtf_local.upload_thumbnails WHERE upload_id=ANY(%s)',
|
||||
([UUID(u) for item in order['snapshot']['items'] for u in item['uploads']],)).fetchall()}
|
||||
items = order['snapshot']['items']
|
||||
many = len(items) > 1
|
||||
files = []
|
||||
for row in made:
|
||||
mine = [p for p in parts if p['item_index'] == row['item_index']]
|
||||
details = {d.get('name'): d for d in row['detail'].get('parts') or []}
|
||||
for part in mine:
|
||||
tiles = (details.get(part['name']) or {}).get('tiles')
|
||||
label = (f"Item {row['item_index'] + 1}" if many else 'Arquivo') + \
|
||||
(f" · parte {part['part']}/{len(mine)}" if len(mine) > 1 else '')
|
||||
files.append({'name': part['name'], 'label': label, 'item': row['item_index'],
|
||||
'manifest': tiles and {**tiles, 'urls': [
|
||||
[storage.view(f"originals/tiles/{part['upload_id']}/{k}/{i}.png", 'image/png')
|
||||
for i in range(level['strips'])] for k, level in enumerate(tiles['levels'])]}})
|
||||
for index, item in enumerate(items):
|
||||
for n, upload in enumerate(item['uploads']):
|
||||
files.append({'name': ('Original ' + str(n + 1)) if len(item['uploads']) > 1 else 'Original',
|
||||
'label': (f'Item {index + 1} · ' if many else '') + 'original' +
|
||||
(f' {n + 1}' if len(item['uploads']) > 1 else ''),
|
||||
'item': index, 'manifest': None,
|
||||
'picture': f'/api/operator/uploads/{upload}/thumbnail' if upload in pictured else None})
|
||||
return {'files': files}
|
||||
|
||||
|
||||
@router.get('/api/operator/orders/{uid}/folder-files')
|
||||
def folder_files(uid: UUID, user=Depends(can('produce'))):
|
||||
"""What each item's file is called in the order's stage folder, as the
|
||||
|
||||
Reference in New Issue
Block a user