@startuml title 滚筒完成后驱动生产子单完成的流程 skinparam shadowing false skinparam activity { BackgroundColor #F8FBFF BorderColor #4C6A92 DiamondBackgroundColor #FFF7E6 DiamondBorderColor #B7791F StartColor #3B82F6 EndColor #64748B BarColor #94A3B8 FontName Noto Sans CJK SC } start :场景开始\n当前节点为“滚筒进行中”; if (是否发生“滚筒完成”动作?) then (是) :系统创建销售品\nshipment.SalesItem; note right 当前实现中,SalesItem 通过 printing_job_id 字段关联 PrintingJob, 不是数据库级 ForeignKey。 end note :写入销售品关联信息\nprinting_job_id + sales_item_id; :发送“销售品已被创建”信号; note right 该信号计划携带: - printing_job_id - sales_item_id 当前信号未实现, 但销售品创建 API 已存在: POST /shipment/sales-items/ end note :信号处理器接收事件; :读取对应 printing.PrintingJob; :统计该 job 关联销售品数量之和; :计算完成比例\nsum(sales_items.quantity) / printing_job.quantity; if (完成比例 >= 90% ?) then (是) :发送“生产子单(printing_job)已完成”信号; note right 完成判定规则: 关联销售品数量之和 大于或约等于 job.quantity 的 90% end note else (否) :不发送完成信号\n等待后续销售品继续创建; endif else (否) :保持“滚筒进行中”; endif stop @enduml