Files
shanxia2.0/docs/superpowers/specs/2026-07-11-pl-dibang-plan-quantity-accumulation-design.md
T
2026-07-12 12:04:43 +08:00

38 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.
# 地磅月计划量运输联动累加与回减 — 设计文档
> **日期**: 2026-07-11
> **状态**: 待评审
> **OpenSpec**: `openspec/changes/pl-dibang-plan-quantity-accumulation/`
> **前置**: `docs/superpowers/specs/2026-06-20-pl-arrange-dibang-design.md`
## 背景
用户期望:同月同往来单位、同产品的多次运输计划勾选「生成地磅单」时,地磅月计划量应累加;取消或调整运输时应回减已贡献的量。
## 已确认决策
| # | 决策 |
|---|------|
| D1 | 用 `pl_transport_db_link.contributed_qty` 记录单次贡献(吨) |
| D2 | 回减集中在 `revoke_regeneratable_dibang_for_transport`(覆盖调整运输 + 取消计划) |
| D3 | 累加在 `_sync_transport_inventory_links`(新建或复用月计划后 `+=`) |
| D4 | `planned_quantity` 回减下限为 0,不删除月计划行 |
| D5 | 已关联磅单/不可作废出入库单时整单阻断,月计划量不变 |
## 验收场景(摘自 OpenSpec)
| # | 场景 | 预期 |
|---|------|------|
| V1 | A(30) 首次联动 | 月计划量 = 30 |
| V2 | B(31) 同维度再联动 | 月计划量 = 61 |
| V3 | 取消 A | 月计划量 = 31 |
| V4 | 调整 A 30→25 | 月计划量 = 25 |
| V5 | 调整不勾地磅 | 月计划量回减,不新建联动 |
| V6 | 已关联磅单时取消/调整 | 操作失败,月计划量不变 |
## 参考实现位置
- `backend/app/services/pl_dibang_bridge_service.py`
- `backend/app/api/pl/transport.py` → `arrange_transport`
- `backend/app/api/pl/plan.py` → `cancel_plan`