feat: Gestão moves a printing order to another machine with a reason; the new one resumes from the part being ripped (Rodada 5, D4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 15:03:02 -03:00
parent 030b66c697
commit c2aa1d4937
7 changed files with 185 additions and 0 deletions

View File

@@ -423,6 +423,21 @@ function nextBox(order){
if(can('rev'))main.push(moveBtn('rev'));else cannot();
const p=proofBtn();if(p)more.push(p);
fixBtn();
if(may('manage'))more.push(button('Transferir máquina',()=>{
const family=order.snapshot.items.some(i=>i.mode==='uvfile'||i.mode==='uv')?'uv':'textil';
const choices=(board.machines||[]).filter(m=>m.active&&m.id!==order.machine?.id&&
(!m.products?.length||m.products.includes(family)));
if(!choices.length){say('Nenhuma outra máquina ativa imprime este produto.',true);return;}
const select=node('select');select.required=true;select.setAttribute('aria-label','Máquina que recebe o pedido');
for(const m of choices){const o=node('option',m.name);o.value=m.id;select.append(o);}
const reason=node('input');reason.maxLength=500;reason.required=true;reason.setAttribute('aria-label','Motivo da transferência');
formDialog('Transferir o pedido #'+order.number,{host:$('drawer'),className:'reason',width:540,
text:'O que a máquina atual ainda não pegou sai da pasta dela. A nova recomeça da parte que estava ripando.',
fields:[field('Máquina',select),field('Motivo',reason,'Fica no card para o Revisor conferir a emenda de tom.')],
label:'Transferir',tone:'red',
onsave:async()=>{await api('/orders/'+order.id+'/transfer',{machine_id:select.value,reason:reason.value.trim()});
say('Pedido #'+order.number+' transferido.');await load();}});
},'btn quiet lg'));
}else if(st==='rev'){
if(proofPending(order)){
// Finalizado waits for the proof: printing it and checking it is the next step.