@startuml production_states
[*] --> Planned : потребность пополнения склада
Planned --> Planned : ожидание сырья
Planned --> Running : проверка остатков / передача в работу
Running --> Completed : все строки выпуска приняты
Running --> Cancelled : возврат до фактической обработки
Completed --> [*]
Cancelled --> [*]
note right of Planned
Заказ клиента необязателен.
План не меняет остатки.
end note
@enduml

@startuml domain
class Receipt
class ReceiptLine
class Material
class CostLayer
class ProductionPlan
class ProductionRun
class RunLine
class SourceAllocation
class OutputLine
class Movement
class CustomerOrder
Receipt "1" *-- "1..*" ReceiptLine
ReceiptLine "*" --> "1" Material
ReceiptLine --> CostLayer
ProductionPlan "1" --> "0..*" ProductionRun
ProductionRun "1" *-- "1..*" RunLine
RunLine --> SourceAllocation
SourceAllocation --> CostLayer
RunLine --> OutputLine
OutputLine --> CostLayer
Movement --> Material
CustomerOrder "0..*" --> "0..*" ProductionPlan : возможное основание
@enduml
