fix(viewer3d): correspondencia estrita de processos fabris e isolamento do detalhamento

This commit is contained in:
2026-09-21 18:21:43 +00:00
parent ec57edf713
commit af6a258d28
2 changed files with 58 additions and 51 deletions
+17 -7
View File
@@ -149,6 +149,7 @@ export default function Visualizador3D() {
processColor: '#64748b',
processOrdem: 0,
processesCompleted: [] as string[],
processPointedQtds: {} as Record<string, number>,
};
uniqueItems.push(item);
@@ -188,15 +189,24 @@ export default function Visualizador3D() {
if (existing) {
const qty = Number(ap.quantidade_produzida || 0);
const procRaw = String(ap.processo?.nome || '').trim();
const procNorm = procRaw.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase();
// Detalhamento é um processo de engenharia prévio, não fabril
const isDetalhamento = procNorm.includes('detalh');
if (qty > 0) {
existing.pointedQtd = Math.max(existing.pointedQtd, qty);
const procNome = String(ap.processo?.nome || '').trim();
if (procNome && !existing.processesCompleted.includes(procNome.toLowerCase())) {
existing.processesCompleted.push(procNome.toLowerCase());
existing.processPointedQtds[procNorm] = (existing.processPointedQtds[procNorm] || 0) + qty;
if (!isDetalhamento) {
existing.pointedQtd = Math.max(existing.pointedQtd, qty);
if (!existing.processesCompleted.includes(procNorm)) {
existing.processesCompleted.push(procNorm);
}
existing.currentProcessName = procRaw || existing.currentProcessName;
existing.processColor = ap.processo?.cor || PROCESS_COLORS[procRaw] || '#10b981';
existing.processOrdem = Math.max(existing.processOrdem, Number(ap.processo?.ordem || 0));
}
existing.currentProcessName = procNome || existing.currentProcessName;
existing.processColor = ap.processo?.cor || PROCESS_COLORS[procNome] || '#10b981';
existing.processOrdem = Math.max(existing.processOrdem, Number(ap.processo?.ordem || 0));
}
}
}