1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 13:59:36 +01:00
effigenix/docs/mvp/ddd/08-procurement-bc.md
Sebastian Frick 4e448afa57 init
2026-02-17 08:25:06 +01:00

83 lines
2.4 KiB
Markdown

# Procurement BC - Detailliertes Domain Model
**Bounded Context:** Procurement
**Domain Type:** CORE
**Verantwortung:** Bedarfsplanung, Bestellwesen, Wareneingangskontrolle, Lieferanten-QM
## Aggregates
### PurchaseOrder (Aggregate Root)
```
PurchaseOrder
├── PurchaseOrderId
├── SupplierId
├── OrderDate
├── RequestedDeliveryDate
├── Status (DRAFT | ORDERED | CONFIRMED | PARTIALLY_RECEIVED | FULLY_RECEIVED | CANCELLED)
├── OrderedBy (UserId)
├── BranchId
├── Items[] (Entity)
│ ├── ArticleId
│ ├── OrderedQuantity
│ ├── ReceivedQuantity - Updated on goods receipt
│ └── UnitPrice
├── TotalAmount - Calculated
└── PaymentTerms
Invariants:
- Status cannot skip states
- TotalAmount = SUM(Items.Quantity * Items.UnitPrice)
- ReceivedQuantity <= OrderedQuantity per item
- FULLY_RECEIVED when all items received
```
### GoodsReceipt (Aggregate Root)
```
GoodsReceipt
├── GoodsReceiptId
├── PurchaseOrderId
├── SupplierId
├── SupplierDeliveryNote
├── ReceivedAt
├── ReceivedBy (UserId)
├── Items[] (Entity)
│ ├── ArticleId
│ ├── OrderedQuantity
│ ├── ReceivedQuantity
│ ├── SupplierBatchNumber - CRITICAL for traceability!
│ ├── ExpiryDate (MHD)
│ └── QualityStatus (ACCEPTED | REJECTED | PENDING_INSPECTION)
├── QualityInspectionId - Reference to Quality BC
├── Documents[] (Entity) - Photos/PDFs
└── Status (PENDING_INSPECTION | ACCEPTED | REJECTED)
Invariants:
- Cannot accept without completed quality inspection
- All items must have SupplierBatchNumber
- Veterinary certificate required for meat
- Triggers StockMovement when accepted
```
### DemandPlan (Aggregate Root)
```
DemandPlan
├── DemandPlanId
├── PlanningPeriod (Week or Month)
├── BranchId
├── GeneratedAt
├── Items[] (Entity)
│ ├── ArticleId
│ ├── CurrentStock - Snapshot from Inventory
│ ├── PlannedConsumption - From ProductionOrders
│ ├── AverageConsumption - Historical
│ ├── SuggestedOrderQuantity - Calculated
│ └── MinimumOrderQuantity - Supplier constraint
└── Status (DRAFT | APPROVED | ORDERED)
Invariants:
- SuggestedOrderQuantity = PlannedConsumption - CurrentStock + SafetyStock
- If < MinimumOrderQuantity, use MinimumOrderQuantity
```