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

@@ -430,6 +430,10 @@ function cardFlags(order){
if(redo.length)out.push(['bad','Retrabalho',redo.map(r=>'Retrabalho · '+REWORK_CAUSES[r.cause]+' · '+metres(r.metres)+(r.authorized?'':' · aguardando autorização')).join(' · ')]);
if(live&&s.items.some(mirroredItem))out.push(['warn','Espelhada',MIRROR_NOTE]);
if(waitingContact(order))out.push(['warn','Contato','Aguardando contato: '+order.contact_note+' · '+contactWho(order)]);
const transfers=order.transfers||[];
if(live&&transfers.length){const t=transfers[transfers.length-1];
out.push(['warn','Transferido · '+t.from_name+' → '+t.to_name,
'Motivo: '+t.reason+' · '+t.created_by+' em '+when(t.created_at)+(t.resumed_from>1?' · recomeçou da parte '+t.resumed_from:'')+'. Confira a emenda de tom.']);}
if(order.snapshot.treatment){
const n=Number(order.snapshot.treatment.arts)||1;
out.push(['warn','Ajuste Fino · '+n+(n===1?' arte':' artes'),

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.