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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: bill of materials and mes quantity input
Sidwebworks2757082ebcc1
diff --git a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsxindex 4f4940257b..6d8b3b0428 100644--- a/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx+++ b/apps/erp/app/modules/items/ui/Item/BillOfMaterial.tsx@@ -414,7 +414,7 @@ const BillOfMaterial = ({duration: 0.95}}>- <LuSettings2 className="stroke-1 mt-3.5 h-5 w-5 text-foreground/80 hover:stroke-primary/70 " />+ <LuSettings2 className="stroke-1 h-5 w-5 text-foreground/80 hover:stroke-primary/70" /></motion.span>)}</motion.button>diff --git a/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx b/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsxindex 02c0ee94b2..920721baf1 100644--- a/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx+++ b/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx@@ -265,8 +265,6 @@ export function IssueMaterialModal({return Math.max(1, remaining);}, [material, parentIdIsSerialized]);- const [quantity, setQuantity] = useState(initialQuantity);-// Serial numbers selection stateconst [selectedSerialNumbers, setSelectedSerialNumbers] = useState<Array<{ index: number; id: string }>@@ -348,7 +346,6 @@ export function IssueMaterialModal({async (itemId: string) => {setSelectedItemId(itemId);setItemDetails(null);- setQuantity(1);setSelectedSerialNumbers([{ index: 0, id: "" }]);setSelectedBatchNumbers([{ index: 0, id: "", quantity: 1 }]);setSerialErrors({});@@ -931,9 +928,15 @@ export function IssueMaterialModal({materialId: material?.id ?? "",jobOperationId: operationId,itemId: selectedItemId,- quantity:+ // Default to the remaining qty, but never submit zero/negative+ // — that's how this modal ends up posting an invalid form and+ // the server bouncing it silently when a material has been+ // fully issued already.+ quantity: Math.max(+ 1,(material?.estimatedQuantity ?? 0) -- (material?.quantityIssued ?? 0),+ (material?.quantityIssued ?? 0)+ ),adjustmentType: "Negative Adjmt."}}fetcher={inventoryFetcher}@@ -1000,29 +1003,21 @@ export function IssueMaterialModal({</Select></div>)}- <div>- <label className="block text-sm font-medium mb-1">- Quantity- </label>-- <NumberField- value={quantity}- onChange={setQuantity}- minValue={0.01}- >- <NumberInputGroup className="relative">- <NumberInput name="quantity" />- <NumberInputStepper>- <NumberIncrementStepper>- <LuChevronUp size="1em" strokeWidth="3" />- </NumberIncrementStepper>- <NumberDecrementStepper>- <LuChevronDown size="1em" strokeWidth="3" />- </NumberDecrementStepper>- </NumberInputStepper>- </NumberInputGroup>- </NumberField>- </div>+ {/*+ Use the form-aware `<Number>` (FormNumberInput) so+ `name="quantity"` lands on react-aria's NumberField+ and a hidden form input is rendered with the numeric+ value. The previous inline NumberField put `name` on+ NumberInput (the display slot), which react-aria+ ignores — the form submitted with no `quantity` key,+ the server's zod schema rejected it, and the action+ returned a 400 the modal silently swallowed.+ */}+ <FormNumberInput+ name="quantity"+ label="Quantity"+ minValue={0.01}+ /></>)}</div>diff --git a/apps/mes/app/routes/x+/issue.tsx b/apps/mes/app/routes/x+/issue.tsxindex d6a85010de..61c76d7354 100644--- a/apps/mes/app/routes/x+/issue.tsx+++ b/apps/mes/app/routes/x+/issue.tsx@@ -2,9 +2,9 @@ import { assertIsPost, error } from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { getCarbonServiceRole } from "@carbon/auth/client.server";import { flash } from "@carbon/auth/session.server";-import { validator } from "@carbon/form";+import { validationError, validator } from "@carbon/form";import type { ActionFunctionArgs } from "react-router";-import { data, redirect } from "react-router";+import { redirect } from "react-router";import { issueValidator } from "~/services/models";import { path, requestReferrer } from "~/utils/path";@@ -15,8 +15,11 @@ export async function action({ request }: ActionFunctionArgs) {const formData = await request.formData();const validation = await validator(issueValidator).validate(formData);+ // `validationError` is the shape `<ValidatedForm>` recognises — without it+ // a failed submission returns an opaque `{error}` blob the modal silently+ // discards, which is exactly the "Issue button does nothing" symptom.if (validation.error) {- return data({ error: validation.error }, { status: 400 });+ return validationError(validation.error);}const { jobOperationId, materialId, itemId, quantity, adjustmentType } =