Skip to content

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.

6.8 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.

import type {
  InventoryCountSpec,
  InventoryData,
  KanbanItemSpec,
  OpeningStockSpec,
  ShelfLifeSpec,
  StockTransferSpec,
  TrackedStockSpec,
  WarehouseTransferSpec
} from "../../types.ts";

// Opening inventory — realistic quantities for a robot-arm OEM.
// Parts that are bought (Buy replenishment) get stock; Make parts do not.
// Every `shelf` must match a ShelfSpec name in foundation.ts or the row is lost.
export const OPENING_STOCK: OpeningStockSpec[] = [
  { item: "MOT-AC-750W", qty: 4, shelf: "ESD-Cage" },
  { item: "MOT-AC-200W", qty: 9, shelf: "A2-L2" },
  { item: "GBX-HD-80", qty: 5, shelf: "A2-L1" },
  { item: "GBX-HD-50", qty: 8, shelf: "A2-L1" },
  { item: "ENC-ABS-19", qty: 12, shelf: "ESD-Cage" },
  { item: "DRV-SRV-400", qty: 18, shelf: "ESD-Cage" },
  { item: "PCB-BARE-4L", qty: 40, shelf: "ESD-Cage" },
  { item: "SNS-FT-6AX", qty: 3, shelf: "ESD-Cage" },
  { item: "BRG-CRB-100", qty: 16, shelf: "A2-L3" },
  { item: "FST-M8-SS", qty: 600, shelf: "A1-L1" },
  { item: "FST-M5-SS", qty: 400, shelf: "A1-L1" },
  { item: "MAT-AL6061-BIL", qty: 485, shelf: "A3-L1" },
  { item: "MAT-STEEL-SHT", qty: 220, shelf: "A3-L1" },
  { item: "MAT-CBL-16AWG", qty: 800, shelf: "A3-L2" },
  { item: "MAT-CONN-M23", qty: 60, shelf: "A1-L2" },
  { item: "MAT-SOLDER-PST", qty: 4, shelf: "ESD-Cage" },
  { item: "MAT-COAT-UV", qty: 3, shelf: "A1-L3" },
  { item: "CN-COVER-KIT", qty: 5, shelf: "A1-L3" },
  { item: "CN-GREASE-EP", qty: 6, shelf: "A1-L2" }
];

// Backs the tracked slice of the opening stock above.
export const ON_HAND_TRACKED: TrackedStockSpec[] = [
  {
    item: "ENC-ABS-19",
    entities: [
      { readableId: "LOT-ENC-2607", quantity: 8 },
      { readableId: "LOT-ENC-2608", quantity: 4, expiresOffset: 30 },
      { readableId: "LOT-ENC-2609", quantity: 2, status: "On Hold" }
    ]
  },
  {
    item: "MOT-AC-750W",
    entities: [
      { readableId: "MOT750-SN-0051", quantity: 1 },
      { readableId: "MOT750-SN-0052", quantity: 1 },
      { readableId: "MOT750-SN-0053", quantity: 1 },
      { readableId: "MOT750-SN-0054", quantity: 1 }
    ]
  },
  {
    item: "MAT-AL6061-BIL",
    entities: [
      { readableId: "LOT-AL6061-2608", quantity: 300 },
      { readableId: "LOT-AL6061-2609", quantity: 180 },
      { readableId: "LOT-AL6061-2610", quantity: 3, status: "Rejected" },
      {
        readableId: "LOT-AL6061-2604",
        quantity: 5,
        status: "Scrapped",
        scrap: {
          shelf: "A3-L1",
          reason: "Damaged",
          dateOffset: -38,
          comment:
            "Billets corroded after sitting in the wash bay over a weekend"
        }
      }
    ]
  }
];

// LOT-ENC-2608 above expires in 30 days so the expiry chips show amber.
export const SHELF_LIVES: ShelfLifeSpec[] = [{ item: "ENC-ABS-19", days: 365 }];

export const KANBAN_ITEMS: KanbanItemSpec[] = [
  { item: "FST-M8-SS", qty: 200, supplier: "Precision Fasteners Co" },
  { item: "FST-M5-SS", qty: 100, supplier: "Precision Fasteners Co" },
  { item: "PCB-BARE-4L", qty: 10, supplier: "Northgate Electronics" },
  { item: "ARM-BASE-001", qty: 2, replenishmentSystem: "Make" },
  {
    item: "MAT-CBL-16AWG",
    qty: 100,
    replenishmentSystem: "Transfer",
    fromShelf: "A3-L2",
    toShelf: "A1-L2"
  }
];

export const INVENTORY_COUNTS: InventoryCountSpec[] = [
  {
    // The first six opening-stock rows.
    key: "q3-draft",
    status: "Draft",
    notes: "Quarterly physical count — Q3",
    lines: [
      {
        item: "MOT-AC-750W",
        shelf: "ESD-Cage",
        snapshotQuantity: 4,
        countedQuantity: 4
      },
      {
        item: "MOT-AC-200W",
        shelf: "A2-L2",
        snapshotQuantity: 9,
        countedQuantity: 9
      },
      {
        item: "GBX-HD-80",
        shelf: "A2-L1",
        snapshotQuantity: 5,
        countedQuantity: 5
      },
      {
        item: "GBX-HD-50",
        shelf: "A2-L1",
        snapshotQuantity: 8,
        countedQuantity: 8
      },
      {
        item: "ENC-ABS-19",
        shelf: "ESD-Cage",
        snapshotQuantity: 12,
        countedQuantity: 12
      },
      {
        item: "DRV-SRV-400",
        shelf: "ESD-Cage",
        snapshotQuantity: 18,
        countedQuantity: 18
      }
    ]
  },
  {
    key: "aug-cycle",
    status: "Posted",
    notes: "Cycle count — fastener & hardware bins",
    postedOffset: -20,
    lines: [
      {
        item: "FST-M8-SS",
        shelf: "A1-L1",
        snapshotQuantity: 600,
        countedQuantity: 597
      },
      {
        item: "FST-M5-SS",
        shelf: "A1-L1",
        snapshotQuantity: 400,
        countedQuantity: 400
      },
      {
        item: "BRG-CRB-100",
        shelf: "A2-L3",
        snapshotQuantity: 16,
        countedQuantity: 18
      },
      {
        item: "MAT-CONN-M23",
        shelf: "A1-L2",
        snapshotQuantity: 60,
        countedQuantity: 60
      },
      {
        item: "CN-GREASE-EP",
        shelf: "A1-L2",
        snapshotQuantity: 6,
        countedQuantity: 6
      }
    ]
  }
];

// Only the Completed move changes stock, so it's dated after the posted count above.
export const STOCK_TRANSFERS: StockTransferSpec[] = [
  {
    key: "st-completed",
    status: "Completed",
    fromShelf: "A1-L1",
    toShelf: "A1-L2",
    dateOffset: -10,
    lines: [{ item: "FST-M8-SS", quantity: 50 }]
  },
  {
    key: "st-released",
    status: "Released",
    fromShelf: "A1-L2",
    toShelf: "A3-L2",
    dateOffset: -1,
    lines: [{ item: "MAT-CONN-M23", quantity: 12 }]
  },
  {
    key: "st-draft",
    status: "Draft",
    fromShelf: "A3-L1",
    toShelf: "A3-L3",
    dateOffset: 0,
    lines: [{ item: "MAT-STEEL-SHT", quantity: 20 }]
  }
];

// HQ has no bins, so completed receipts land shelfless.
export const WAREHOUSE_TRANSFERS: WarehouseTransferSpec[] = [
  {
    key: "wt-completed",
    status: "Completed",
    fromLocation: "Plant",
    toLocation: "HQ",
    dateOffset: -12,
    lines: [{ item: "FST-M5-SS", quantity: 25, fromShelf: "A1-L1" }]
  },
  {
    key: "wt-toship",
    status: "To Ship",
    fromLocation: "Plant",
    toLocation: "HQ",
    dateOffset: 0,
    lines: [{ item: "CN-COVER-KIT", quantity: 2, fromShelf: "A1-L3" }]
  },
  {
    key: "wt-draft",
    status: "Draft",
    fromLocation: "Plant",
    toLocation: "HQ",
    dateOffset: 2,
    lines: [{ item: "BRG-CRB-100", quantity: 4, fromShelf: "A2-L3" }]
  }
];

export const roboticsInventory: InventoryData = {
  openingStock: OPENING_STOCK,
  onHandTracked: ON_HAND_TRACKED,
  kanbanItems: KANBAN_ITEMS,
  inventoryCounts: INVENTORY_COUNTS,
  shelfLives: SHELF_LIVES,
  stockTransfers: STOCK_TRANSFERS,
  warehouseTransfers: WAREHOUSE_TRANSFERS
};