mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 17:49:57 +01:00
- Move Java backend to backend/ directory - Create frontend/ directory for TypeScript TUI and future WebUI - Update .gitignore for Node.js and worktrees - Update README.md with new repository structure - Copy documentation to backend/
2 KiB
2 KiB
Inventory BC - Detailliertes Domain Model
Bounded Context: Inventory Domain Type: CORE Verantwortung: Chargen-basierte Bestandsführung, Rückverfolgbarkeit, MHD-Tracking
Aggregates
Stock (Aggregate Root)
Stock
├── StockId
├── ArticleId - Reference to Master Data
├── StorageLocationId
├── BranchId
├── StockLevel (Quantity) - Current total
├── Batches[] (Entity) - Batch-level inventory (CRITICAL!)
│ ├── BatchId - ProductionBatchId OR SupplierBatchId
│ ├── BatchType (PRODUCED | PURCHASED)
│ ├── Quantity
│ ├── ExpiryDate (MHD)
│ ├── ReceivedAt
│ └── Status (AVAILABLE | RESERVED | EXPIRED | SOLD)
├── MinimumStockLevel
└── ReorderPoint
Invariants:
- StockLevel = SUM(Batches.Quantity where Status = AVAILABLE)
- Cannot withdraw more than available
- FEFO enforced: oldest expiry first
- Negative stock not allowed
- Expired batches must have Status = EXPIRED
StockMovement (Aggregate Root) - Event Sourcing candidate!
StockMovement
├── StockMovementId
├── ArticleId
├── BatchId - CRITICAL for traceability
├── MovementType (GOODS_RECEIPT | PRODUCTION_OUTPUT | SALE |
│ INTER_BRANCH_TRANSFER | WASTE | ADJUSTMENT)
├── FromLocation, ToLocation
├── FromBranch, ToBranch
├── Quantity
├── MovementDate
├── PerformedBy (UserId)
├── Reason (for WASTE/ADJUSTMENT)
├── ReferenceDocument (GoodsReceiptId, ProductionOrderId, InvoiceId)
└── TraceabilityChain - Link to upstream/downstream
Invariants:
- Quantity must be positive
- GOODS_RECEIPT: FromLocation = null
- SALE/WASTE: ToLocation = null
- INTER_BRANCH_TRANSFER: FromBranch != ToBranch
- All movements must reference a Batch
Domain Events
StockLevelBelowMinimum(ArticleId, BranchId, Quantity)
BatchExpiringSoon(BatchId, ArticleId, ExpiryDate)
StockMovementRecorded(StockMovementId, BatchId, MovementType)