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: set initial qty to `0` when adding quantity to job operation

Sidwebworks174596141ecf
diff --git a/apps/mes/app/components/JobOperation/components/QuantityModal.tsx b/apps/mes/app/components/JobOperation/components/QuantityModal.tsx
index 8b60a317d1..2178b8462e 100644
--- a/apps/mes/app/components/JobOperation/components/QuantityModal.tsx
+++ b/apps/mes/app/components/JobOperation/components/QuantityModal.tsx
@@ -61,7 +61,7 @@ export function QuantityModal({
onClose: () => void;
}) {
const fetcher = useFetcher<ProductionQuantity>();
- const [quantity, setQuantity] = useState(type === "finish" ? 0 : 1);
+ const [quantity, setQuantity] = useState(0);
const titleMap = {
scrap: `Log scrap for ${operation.itemReadableId}`,
@@ -133,7 +133,7 @@ export function QuantityModal({
parentIsSerial || parentIsBatch ? trackedEntityId : undefined,
jobOperationId: operation.id,
// @ts-ignore
- quantity: type === "finish" ? undefined : 1,
+ quantity: type === "finish" ? undefined : 0,
setupProductionEventId: setupProductionEvent?.id,
laborProductionEventId: laborProductionEvent?.id,
machineProductionEventId: machineProductionEvent?.id
@@ -198,7 +198,7 @@ export function QuantityModal({
value={quantity}
onChange={setQuantity}
isReadOnly={parentIsSerial}
- minValue={1}
+ minValue={0}
/>
</>
)}