Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: subtract quantity reworked when we 'complete all'

Brad Barbin00bcdf3d100f
diff --git a/apps/mes/app/components/JobOperation/components/QuantityModal.tsx b/apps/mes/app/components/JobOperation/components/QuantityModal.tsx
index 13a5c1b3e0..e8b57fd4db 100644
--- a/apps/mes/app/components/JobOperation/components/QuantityModal.tsx
+++ b/apps/mes/app/components/JobOperation/components/QuantityModal.tsx
@@ -250,7 +250,8 @@ export function QuantityModal({
onClick={() =>
setQuantity(
operation.operationQuantity -
- operation.quantityComplete
+ operation.quantityComplete -
+ (operation.quantityReworked ?? 0)
)
}
>
diff --git a/apps/mes/app/routes/x+/end.$operationId.tsx b/apps/mes/app/routes/x+/end.$operationId.tsx
index ad0ba5c728..09f350bcc6 100644
--- a/apps/mes/app/routes/x+/end.$operationId.tsx
+++ b/apps/mes/app/routes/x+/end.$operationId.tsx
@@ -89,7 +89,12 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
0;
const quantityToComplete = completeAll
- ? Math.max(0, (jobOperation.data.operationQuantity ?? 0) - currentQuantity)
+ ? Math.max(
+ 0,
+ (jobOperation.data.operationQuantity ?? 0) -
+ currentQuantity -
+ (jobOperation.data.quantityReworked ?? 0)
+ )
: 1;
const willBeFinished =