1
0
Fork 0
mirror of https://github.com/s-frick/effigenix.git synced 2026-03-28 19:10:22 +01:00
effigenix/backend/docs/mvp/ddd/09-filiales-bc.md
Sebastian Frick c2c48a03e8 refactor: restructure repository with separate backend and frontend directories
- 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/
2026-02-17 22:08:51 +01:00

2.2 KiB

Filiales BC - Detailliertes Domain Model

Bounded Context: Filiales Domain Type: CORE Verantwortung: Mehrfilialen-Management, Interfilial-Transfers, zentrale Produktion

Aggregates

Branch (Aggregate Root)

Branch
├── BranchId
├── BranchName
├── BranchType (PRODUCTION_AND_SALES | SALES_ONLY | PRODUCTION_ONLY)
├── Address
├── OpeningHours
├── Status (ACTIVE | INACTIVE | CLOSED)
├── Manager (UserId)
├── ContactInfo
├── Capabilities
│   ├── CanProduce (boolean)
│   ├── CanSell (boolean)
│   └── CanReceiveGoods (boolean)
└── AssignedEmployees[] (UserId)

Invariants:
- BranchType must match Capabilities
- Manager must be in AssignedEmployees
- Cannot close with pending production orders

InterBranchTransfer (Aggregate Root)

InterBranchTransfer
├── TransferId
├── FromBranch (BranchId)
├── ToBranch (BranchId)
├── TransferDate
├── RequestedBy (UserId)
├── Status (REQUESTED | APPROVED | IN_TRANSIT | RECEIVED | CANCELLED)
├── Items[] (Entity)
│   ├── ArticleId
│   ├── BatchId - CRITICAL for traceability!
│   ├── Quantity
│   ├── ExpiryDate
│   └── ReceivedQuantity
├── ShippedAt
├── ReceivedAt
└── TransportDocumentId

Invariants:
- FromBranch != ToBranch
- Status: REQUESTED → APPROVED → IN_TRANSIT → RECEIVED
- ShippedAt < ReceivedAt
- Triggers two StockMovements (out + in)

DistributionPlan (Aggregate Root)

DistributionPlan
├── DistributionPlanId
├── ProductionBatchId - From Production BC
├── ProducingBranch (BranchId)
├── PlannedFor (Date)
├── Status (PLANNED | IN_DISTRIBUTION | COMPLETED)
├── Distributions[] (Entity)
│   ├── TargetBranch (BranchId)
│   ├── AllocatedQuantity
│   ├── TransferId - Link to InterBranchTransfer
│   └── DeliveryStatus (PENDING | SHIPPED | DELIVERED)
├── TotalQuantityProduced
└── RemainingAtCentral

Invariants:
- SUM(AllocatedQuantity) + RemainingAtCentral = TotalQuantityProduced
- ProducingBranch must be PRODUCTION_ONLY or PRODUCTION_AND_SALES