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
Consume First: whole assemblies only
Customer feedback on the partial-stock split: a unit that needs 2 of a part must get two of the SAME part. Old stock is used in whole multiples of the per-assembly quantity; the odd part stays on the shelf. Units in a batch may differ from one another; a single unit never mixes old and new.
Tasks
-
- Shared helper
consumableInWholeAssemblies(onHand, perAssembly)inlib/supersession-pick.ts(+RoundingMode.Downin precision.ts), Deno tests.
- Shared helper
-
- get-method: settle pass after insert handles BOTH directions with the per-assembly threshold — pull a successor line back when the predecessor covers ≥ 1 assembly; push a predecessor line to the successor when it covers none.
-
generatePickingList: split at whole assemblies; predecessor "in stock" for Consume First means ≥ 1 assembly of the running balance.
-
- SQL
get_picking_schedule: Consume First predecessor stock test ≥ per-assembly quantity (new migration);openJobMaterialLinesgainsquantityPerParent.
- SQL
-
- Job materials note + Order Status netting round the same way.
-
- Item planning list split rounds per line.
-
- MRP post-explode Consume First pass nets per contributor in whole assemblies.
-
- Pick line notes (ERP + MES) and the materials note say how many assemblies.
-
- Rule doc, lessons, types regenerated, tests, typecheck, lint.
Verification
deno test packages/database/supabase/functions/lib/supersession-pick.test.tspnpm --filter ./apps/erp exec vitest run app/modules/inventory/supersession-pick.test.tspnpm exec turbo run typecheck --filter=erp --filter=mes --filter=@carbon/eepnpm run lint