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)
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 8m22s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 2m1s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-25 18:06:29 -03:00
parent 5db8661a1a
commit 3da1c9c11c
2 changed files with 5 additions and 1 deletions

View File

@@ -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)){

View File

@@ -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+').');