feat: the Kanban saves the print queue's files into a folder the operator chose
All checks were successful
Build and deploy / Validate source (push) Successful in 1m26s
Build and deploy / Integration suite on a real stack (push) Successful in 3m31s
Build and deploy / Secret scan and release gate (push) Successful in 11s
Build and deploy / Publish images (push) Successful in 1m27s

The meeting asked that files moved to Fila de impressão land in the print
room's folder by themselves, instead of each one being downloaded from the
cloud. Beside "Baixar" in that column, a folder button lets the operator
pick a folder (FlexiPRINT's, or the internal server's share). While the
Kanban is open in Chrome or Edge, every final file that enters the queue is
saved there, named after its order, written under a temporary name and
renamed only when whole so FlexiPRINT never reads half a file. A file
already saved is not fetched again, even after FlexiPRINT moves it away.
The folder is remembered; after the browser restarts the button turns
orange and one click releases it. A machine's operator gets only that
machine's queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-08 10:42:02 -03:00
parent 2a2a783ff7
commit 1216998914
3 changed files with 116 additions and 9 deletions

View File

@@ -771,13 +771,13 @@ def production_stats(days: int = Query(default=30, ge=7, le=365), user=Depends(o
@router.get('/api/operator/queue/finals')
def queue_finals(request: Request, user=Depends(can('produce'))):
def queue_finals(request: Request, auto: bool = False, user=Depends(can('produce'))):
"""The approved final files of every order in the print queue, in queue
order, each named after its order so a folder of them stays readable. The
browser downloads them straight from storage: a zip of multi-GB sheets
would go through the server."""
with db.connect() as c:
rows = c.execute(f'''SELECT o.number,f.item_index,u.object_key,u.name FROM dtf_local.orders o
rows = c.execute(f'''SELECT o.number,f.item_index,f.upload_id,u.object_key,u.name FROM dtf_local.orders o
JOIN dtf_local.order_files f ON f.order_id=o.id JOIN dtf_local.uploads u ON u.id=f.upload_id
WHERE o.state='fil' AND o.cancelled_at IS NULL AND {FINAL_OK}
ORDER BY COALESCE(o.queue_key, extract(epoch FROM o.created_at)),o.id,f.item_index,f.created_at''').fetchall()
@@ -796,8 +796,10 @@ def queue_finals(request: Request, user=Depends(can('produce'))):
copy += 1
names.add(name)
files.append({'number': row['number'], 'item': row['item_index'] + 1, 'name': name,
'url': storage.download(row['object_key'], name)})
audit('queue_finals_downloaded', operator=user, files=len(files))
'upload_id': str(row['upload_id']), 'url': storage.download(row['object_key'], name)})
# The automatic folder asks whenever the queue changes; only a person's download is logged.
if not auto:
audit('queue_finals_downloaded', operator=user, files=len(files))
return {'files': files}