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
feat: warn the user if they forget to issue a tracked part
Brad Barbin3d839fe9f11a
diff --git a/.orcka/config.toml b/.orcka/config.tomlnew file mode 100644index 0000000000..4bdcba0c3f--- /dev/null+++ b/.orcka/config.toml@@ -0,0 +1,23 @@+[project]+name = "carbon"+language = "typescript"++[commands]+test = "npm test"+lint = "npm run lint"+build = "npm run build"++[engine]+name = "opencode"+permission = "full-auto"++[server]+port = 4096+hostname = "127.0.0.1"++[rules]+items = []++[boundaries]+never_touch = []+diff --git a/apps/erp/app/modules/inventory/ui/Inventory/InventoryShelves.tsx b/apps/erp/app/modules/inventory/ui/Inventory/InventoryShelves.tsxindex d32b9979b0..a773998fa6 100644--- a/apps/erp/app/modules/inventory/ui/Inventory/InventoryShelves.tsx+++ b/apps/erp/app/modules/inventory/ui/Inventory/InventoryShelves.tsx@@ -322,7 +322,6 @@ const InventoryShelves = ({<Inputname="readableId"label={isSerial ? "Serial Number" : "Batch Number"}- helperText="A globally unique identifier is generated behind the scenes"/></>)}diff --git a/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx b/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsxindex 4eaadc34a7..1f08380ee0 100644--- a/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx+++ b/apps/mes/app/components/JobOperation/components/IssueMaterialModal.tsx@@ -172,9 +172,11 @@ export function IssueMaterialModal({// Quantity for inventory itemsconst initialQuantity = useMemo(() => {if (!material) return 1;- return parentIdIsSerialized+ const total = parentIdIsSerialized? (material.quantity ?? material.estimatedQuantity ?? 1): (material.estimatedQuantity ?? material.quantity ?? 1);+ const remaining = total - (material.quantityIssued ?? 0);+ return Math.max(1, remaining);}, [material, parentIdIsSerialized]);const [quantity, setQuantity] = useState(initialQuantity);diff --git a/apps/mes/app/components/JobOperation/components/QuantityModal.tsx b/apps/mes/app/components/JobOperation/components/QuantityModal.tsxindex 567bfeb04e..fabd0c8427 100644--- a/apps/mes/app/components/JobOperation/components/QuantityModal.tsx+++ b/apps/mes/app/components/JobOperation/components/QuantityModal.tsx@@ -9,6 +9,7 @@ import {AlertDescription,AlertTitle,Button,+ Checkbox,Modal,ModalBody,ModalContent,@@ -62,6 +63,7 @@ export function QuantityModal({}) {const fetcher = useFetcher<ProductionQuantity>();const [quantity, setQuantity] = useState(parentIsSerial ? 1 : 0);+ const [confirmedUnissued, setConfirmedUnissued] = useState(false);const titleMap = {scrap: `Log scrap for ${operation.itemReadableId}`,@@ -102,16 +104,25 @@ export function QuantityModal({finish: finishValidator};- const hasUnissuedMaterials = useMemo(() => {- return (- parentIsSerial &&- materials.some(- (material) =>- material.jobOperationId === operation.id &&- (material?.quantityIssued ?? 0) < (material?.quantity ?? 0)- )+ const hasUnissuedTrackedMaterials = useMemo(() => {+ const totalPartsAfterCompletion = parentIsSerial+ ? 1+ : operation.quantityComplete + quantity;++ return materials.some(+ (material) =>+ (material.requiresSerialTracking || material.requiresBatchTracking) &&+ material.jobOperationId === operation.id &&+ (material?.quantityIssued ?? 0) <+ (material?.quantity ?? 0) * totalPartsAfterCompletion);- }, [materials, parentIsSerial, operation.id]);+ }, [+ materials,+ operation.id,+ operation.quantityComplete,+ quantity,+ parentIsSerial+ ]);return (<Modal@@ -160,14 +171,26 @@ export function QuantityModal({<Hidden name="laborProductionEventId" /><Hidden name="machineProductionEventId" /><VStack spacing={2}>- {hasUnissuedMaterials && (+ {hasUnissuedTrackedMaterials && type === "complete" && (<Alert variant="destructive"><LuTriangleAlert className="h-4 w-4" />- <AlertTitle>Unissued materials</AlertTitle>+ <AlertTitle>Unissued serial/batch materials</AlertTitle><AlertDescription>- Please issue all materials for this operation before- closing.+ There are serial or batch tracked materials on the bill of+ material that have not been fully issued. Completing without+ issuing may result in incorrect traceability records.</AlertDescription>+ <label className="flex items-center gap-2 mt-2 cursor-pointer">+ <Checkbox+ isChecked={confirmedUnissued}+ onCheckedChange={(checked) =>+ setConfirmedUnissued(checked === true)+ }+ />+ <span className="text-sm">+ I understand and want to complete without issuing+ </span>+ </label></Alert>)}@@ -236,6 +259,11 @@ export function QuantityModal({: "primary"}type="submit"+ disabled={+ type === "complete" &&+ hasUnissuedTrackedMaterials &&+ !confirmedUnissued+ }>{actionButtonMap[type]}</Button>