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
MES Assembly View — scan-to-complete gate
File: apps/mes/app/components/AssemblyView.tsx
Problem
- The standalone "Scan Part" button pre-selects
firstTrackedMaterial, which uses a job-wideremainingToIssue(estimatedQuantity − quantityIssued). A serial parent reportsquantityIssuedper unit, so the remaining never reaches 0 and the button re-opens the same part every click instead of walking to the next. - A step can be completed (Mark done / Record) without its parts ever being issued.
- The "Issue" framing + duplicate scan affordances are confusing.
Decisions (confirmed with user)
- Only tracked (serial/batch) parts assigned to the step gate completion. Non-tracked parts do not gate — loose parts are added to the first step and backflushed when that step is recorded.
- Soft gate: keep the Skip button always enabled; disable the primary Mark done / Record button while the step's tracked parts are unissued, with a hint.
Changes
getIssuedForUnit(material, { unitIndex, issuedIsPerUnit, issuedOverride })— module-level helper returning{ required, issued, fullyIssued }. Replaces the inline math inMaterialRowso the row and the gate share one source of truth.visibleMaterialsWithState— hoist the per-materialstepNumbers/isLoose/issuedIsPerUnit/issuedOverride/ issue-state computation out of the Parts JSX. DerivependingScanMaterials= entries that are tracked and notfullyIssuedfor the current unit;hasPendingScansgates the step. RemoverawMaterials,isTrackedMat,remainingToIssue,firstTrackedMaterial.- Remove the standalone "Scan Part" section and the now-unused
LuQrCodeimport. Scanning is per-part via the existing (clear)MaterialRowcards. - Soft-gate the action row: show a "Scan N part(s)…" hint above the buttons when
hasPendingScans; passdisabled={hasPendingScans}toStepCompleteAction, which disables Mark done / Record. Skip stays enabled.
Verification
pnpm exec turbo run typecheck --filter=@carbon/mes(or the app's package name).- Manual: a step with two serialized parts — primary action disabled + hint until both scanned; each card scans its own part; Skip always works; non-tracked/loose parts never block.