fix(pecas): corrigir discrepancia no calculo de peso total da tabela e da importacao

This commit is contained in:
2026-08-21 13:42:18 +00:00
parent 0a274502e7
commit 9d999fe0a5
4 changed files with 8 additions and 10 deletions
+1 -6
View File
@@ -123,12 +123,7 @@ export function ImportarPecasModal({ open, onOpenChange, onImport, pecasExistent
});
convertedData[field] = 0;
} else {
// Para peso_unitario e peso_total, arredondar para integer
if (field === 'peso_unitario' || field === 'peso_total') {
convertedData[field] = Math.round(numValue);
} else {
convertedData[field] = numValue;
}
convertedData[field] = numValue;
}
} else {
convertedData[field] = field.includes('componente') ? 0 : (field === 'quantidade' ? 1 : 0);
+1 -1
View File
@@ -77,7 +77,7 @@ export function TableRow({
</TableCell>
<TableCell className="w-16 px-2 text-right font-medium text-foreground text-xs">
{(peca.quantidade * peca.peso_unitario).toFixed(2)} kg
{(peca.peso_total || (peca.quantidade * peca.peso_unitario)).toFixed(2)} kg
</TableCell>
<TableCell className="w-16 px-2 text-muted-foreground text-xs">