From 3da1c9c11c8c47a0826d1b308ade88e2cc8acbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Wed, 25 Nov 2026 18:06:29 -0300 Subject: [PATCH] fix: a receipt another computer took is no error, and a drop on a card now on another machine says so (DTF-WEB-1N, 1P) Co-Authored-By: Claude Opus 5.5 (1M context) --- web/kanban-board.js | 3 +++ web/kanban.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/web/kanban-board.js b/web/kanban-board.js index 85644dd..d4352a2 100644 --- a/web/kanban-board.js +++ b/web/kanban-board.js @@ -266,6 +266,9 @@ function renderBoard(){ const order=board.orders.find(o=>o.id===e.dataTransfer.getData('text/plain')); const machine=state==='imp'?dropMachine(column,e.clientY):null;markLane(column,null); if(!order)return; + // The card may have moved to another machine since the drag began (the + // board reloaded in between, Sentry DTF-WEB-1P): said, not refused. + if(!mayAct(order)){say('Pedido da '+(order.machine?.name||'outra máquina')+': só quem está nela move o card.');clearDrop();return;} // Above 1 m Finalizado needs the review photo: the drop opens Revisão // instead of a refused move (Sentry DTF-WEB-B). if(state==='fin'&&order.state==='rev'&&needsReviewPhoto(order)){ diff --git a/web/kanban.js b/web/kanban.js index 19d7402..dde7302 100644 --- a/web/kanban.js +++ b/web/kanban.js @@ -669,7 +669,8 @@ async function syncFolder(force=false){ // save goes back for another to take. Written whole, then named .pdf. let printed=0; for(const r of receipts){ - try{await api('/orders/'+r.order+'/receipt/claim',{});}catch(e){if(e.status===409)continue;throw e;} + // Another computer took it first: expected, not reported (Sentry DTF-WEB-1N). + try{await api('/orders/'+r.order+'/receipt/claim',{},{expected:[409]});}catch(e){if(e.status===409)continue;throw e;} await step(r.name,async()=>{try{ const res=await fetchFile('/api/operator/orders/'+r.order+'/receipt'); if(!res.ok||!res.body)throw new Error('não foi possível gerar '+r.name+' (erro '+res.status+').');