forked from erp-dev/erp
feat: added wecom notify when printing_job production was completed(new status) and shipment was created
This commit is contained in:
BIN
docs/plant/printing-job-completion-flow.png
Normal file
BIN
docs/plant/printing-job-completion-flow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
61
docs/plant/printing-job-completion-flow.puml
Normal file
61
docs/plant/printing-job-completion-flow.puml
Normal file
@@ -0,0 +1,61 @@
|
||||
@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
|
||||
@@ -141,6 +141,7 @@
|
||||
- 并且这些销售品必须全部来自同一个 `printing_order`
|
||||
- 如果存在缺少生产任务、生产任务不存在、或跨生产订单混装,接口会拒绝创建
|
||||
- 新创建的出货单默认状态为 `草稿(未发布)`
|
||||
- 创建成功后会触发 `shipment_created` 领域信号,并通过异步 Celery task 发送企业微信通知
|
||||
|
||||
### 接口信息
|
||||
|
||||
|
||||
Reference in New Issue
Block a user