feat: two cards at most in Imprimindo per machine, one printing and one ripping (Dropstar's third round, item 11)
All checks were successful
Build and deploy / Validate source (push) Successful in 7s
Build and deploy / Integration suite on a real stack (push) Successful in 4m14s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m5s

A third pull onto the same machine is refused with "máquina5 já tem 2 em
Imprimindo", and so is changing a printing order to a full machine. On
the board, the first order to enter Imprimindo on its machine is labelled
Imprimindo and the next Ripando; the column shows each machine's count,
as "máquina5 · 2/2".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-29 16:19:04 -03:00
parent 757008566c
commit 9c44cdf2a1
5 changed files with 108 additions and 4 deletions

View File

@@ -593,6 +593,23 @@ const TREATED_NOTE='O arquivo final foi preparado pela equipe, não é a arte qu
// Mirrored by the customer (UV only, web/site-pdf.js): the room checks it before printing.
const mirroredItem=item=>!!item.production?.sources?.some(source=>source.mirrored);
const MIRROR_NOTE='O cliente espelhou a arte: confira antes de imprimir';
// Two places per machine in Imprimindo (app/machines.py): the first to come
// in is printing, the next is being ripped meanwhile.
const PRINTING={imprimindo:['Imprimindo','ok','Já ripou, está rodando'],
ripando:['Ripando','info','O Flexi está ripando enquanto o anterior roda']};
// "máquina5 · 2/2" for each machine that prints, or has an order printing.
// An operator who works on some machines sees those.
function printingRoom(){
const cap=board.printing_cap, mine=ME?.role==='operador'&&ME.machines?.length?ME.machines:null;
const list=(board.machines||[]).filter(m=>(m.active||m.states.imp)&&(!mine||mine.includes(m.id)));
if(!list.length)return null;
const room=node('div',undefined,'col-slots');
room.append(...list.map(m=>{const n=m.states.imp||0;
const chip=node('span',m.name+' · '+n+'/'+cap,'pill '+(n>cap?'bad':n===cap?'warn':'muted'));
chip.title=n>=cap?m.name+' está cheia: abre vaga quando um pedido sair de Imprimindo':m.name+' tem '+(cap-n)+' vaga'+(cap-n===1?'':'s');
return chip;}));
return room;
}
async function proofOk(order){
await api('/orders/'+order.id+'/proof',{});say('Prova do pedido #'+order.number+' conferida.');await load();
}
@@ -712,6 +729,7 @@ function renderBoard(){
sub.append(tools);
}
head.append(line,sub);
if(state==='imp'){const room=printingRoom();if(room)head.append(room);}
column.append(head);
for(const order of orders)column.append(card(order));
if(state==='fin'&&finishedMore&&!Object.values(boardFilter).some(Boolean))moreButton(column,true,loadOlderFinished);
@@ -750,6 +768,7 @@ function card(order){
else if(order.state!=='fin'){
const p=printState(order);
flags.append(badge((p.tone==='ok'?'✓ ':p.tone==='warn'?'! ':'')+p.text,p.tone));
if(order.printing)flags.append(badge(...PRINTING[order.printing]));
if(s.items.some(i=>i.quality_status==='warning'))flags.append(badge('! Ressalva','warn','O cliente aceitou a ressalva de resolução'));
if(s.items.some(mirroredItem))flags.append(badge('Espelhado','bad',MIRROR_NOTE));
if(stalled(order))flags.append(badge('⏱ Parado '+hoursSince(order.updated_at)+' h','bad','Sem mudar de etapa desde '+when(order.updated_at)));