Ignore unresolved supply data in planning
Some checks failed
Build and Deploy / build-and-deploy (push) Failing after 49s

This commit is contained in:
Cauê Faleiros
2026-08-04 13:51:25 -03:00
parent 30cdcd9b0e
commit c780b3134b
3 changed files with 36 additions and 49 deletions

View File

@@ -247,7 +247,10 @@ const Cutting = () => {
[...cutPlan.rows].sort((a, b) => b.suggestedCutQuantity - a.suggestedCutQuantity || a.name.localeCompare(b.name, 'pt-BR')).forEach(row => {
const composition = compositionsById.get(normalizeMaterialKey(row.id));
if (!composition?.components.length) {
readinessByProductId.set(row.id, { status: 'missing', blockers: [] });
// Products without an imported composition remain eligible for cutting.
// They are excluded from material-demand calculations instead of
// blocking the rest of the production queue.
readinessByProductId.set(row.id, { status: 'ready', blockers: [] });
return;
}
const componentPlans = composition.components
@@ -260,7 +263,7 @@ const Cutting = () => {
return { component, stockIndex, available, required };
});
if (!componentPlans.length) {
readinessByProductId.set(row.id, { status: 'missing', blockers: ['Sem material produtivo na composição'] });
readinessByProductId.set(row.id, { status: 'ready', blockers: [] });
return;
}
const blockers = componentPlans.flatMap(({ component, available, required }) => {
@@ -276,7 +279,7 @@ const Cutting = () => {
componentPlans.forEach(({ stockIndex, required }) => {
if (stockIndex !== undefined) remainingStock[stockIndex] -= required;
});
readinessByProductId.set(row.id, { status: row.issues.length === 0 ? 'ready' : 'material_ready', blockers: [] });
readinessByProductId.set(row.id, { status: 'ready', blockers: [] });
});
return readinessByProductId;
}, [compositions, cutPlan.rows, materialStock]);