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
Storage Units CSV Import
Add a CSV import tool for Storage Units (requested by Heaviside), mirroring the
existing workCenter import path, plus two sample CSVs (perfect + mixed edge cases).
Key schema facts
storageUnitcols:id(default),name(req),locationId(req, FK location),parentId(nullable self-FK),storageTypeIds TEXT[],workCenterId,active, audit. UNIQUE("name","locationId")→ names unique per location.- DB interceptors enforce: parent same-location, no locationId change with children, no parent cycles (raise → abort). So resolve parents within same location and set parent as a resilient second pass.
storageType:id,name,companyId, audit. No unique-name constraint.- Storage-unit create/update route permission =
inventory.
Fields imported
id (Unique ID, req), name (req), locationId (Location, req, enum+fetcher),
parentName (optional, resolved by name within location), storageTypeNames
(optional, comma-separated, resolved/created), active (optional boolean).
Changes
apps/erp/app/modules/shared/imports.models.ts— addstorageUnittofieldMappings,importPermissions(→inventory),importSchemas.packages/database/supabase/functions/import-csv/index.ts— addstorageUnitto thetableenum,CsvEntityType,fetchLiveEntityIds, and acase "storageUnit"handler:- match/dedup by
(locationId, lower(name))natural key + csv external id; - resolve/create storage types by name;
- insert/update inside one txn, then a second pass sets
parentId(per-row try/catch, row errors instead of a full rollback).
- match/dedup by
apps/erp/app/modules/inventory/ui/StorageUnits/StorageUnitsTable.tsx— addimportCSV={[{ table: "storageUnit", label: "Storage Units" }]}.- Docs sync:
.claude/rules/csv-import-system.md, inventoryAGENTS.md. - Deliverables:
storage-units-perfect.csv,storage-units-mixed.csv.
Verify
pnpm exec turbo run typecheck --filter=erp- Deno check of the edge function file.
- Biome lint on changed files.