Files
shanxia2.0/openspec/changes/pl-dibang-plan-quantity-accumulation/proposal.md
T
2026-07-12 12:04:43 +08:00

30 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Why
运输计划勾选「生成地磅单」联动地磅月计划时,当前实现仅在**首次创建**月计划时写入 `planned_quantity`,**复用**已有月计划时不更新计划量;取消计划或调整运输作废旧联动时也不回减。导致同月同往来单位、同产品多次运输后,月计划量与真实运输需求不一致。
## What Changes
- `pl_transport_db_link` 新增 `contributed_qty`(吨),记录单次运输联动对月计划的贡献量
- 安排运输勾选地磅时:新建月计划 `planned_quantity = 贡献量`;复用月计划 `planned_quantity += 贡献量`
- 调整运输、取消计划作废旧联动时:`planned_quantity -= contributed_qty`(下限 0)
- 调整运输重建联动时:先回减旧贡献、再按新产品数量累加新贡献
- 新增/补充单元测试覆盖累加、调整、取消三条路径
## Capabilities
| Capability | Spec |
|------------|------|
| 地磅月计划量运输联动累加与回减 | `specs/dibang-plan-quantity/spec.md` |
## Non-goals
- 不修改地磅磅单(`db_weighing_slip`)生成逻辑
- 不自动重算或回写 `executed_quantity`(仍由磅单业务逻辑维护)
- 不删除 `planned_quantity = 0` 的月计划记录
- 不改变「已关联磅单 / 已完成出入库单阻断作废」的现有门禁
## Dependencies
- 现有 `pl_dibang_bridge_service.py`、`POST /transport/order/arrange/{plan_id}`、`POST /transport/plan/{id}/cancel`
- 前置设计:`docs/superpowers/specs/2026-06-20-pl-arrange-dibang-design.md`