For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: 列表导出与归档导出的「品牌」列改为按 pl_plan_product_brand_qty 填充;多品牌拆成多行,实际量取品牌量;无明细时品牌留空。
Architecture: 在 pl_brand_archive.py 增加 resolve_export_brand_qty_rows(段级优先、回退计划级)。列表导出(plan.py)与归档导出(pl_plan_archive_export.py)构建「段×产品」行后,若有正数量品牌明细则按品牌复制行并改写 brandName/actualQty(及归档单价)。
Tech Stack: Python 3.9、SQLAlchemy、pytest、现有 load_brand_qtys_by_*
Spec: docs/superpowers/specs/2026-10-21-pl-archive-export-brand-split-design.md
Files:
backend/app/services/pl_brand_archive.pyCreate/Modify: backend/tests/test_pl_brand_archive.py
[x] 增加 resolve_export_brand_qty_rows(stop_product_id, plan_product_id, by_stop_id, by_plan_product_id)
[x] 单测:有段级只用段级;无段级回退计划级;皆无返回 []
Files:
backend/app/api/pl/plan.py(_build_plan_list_export_rows 及填充逻辑)Modify: backend/tests/test_pl_plan_list_export.py
[x] 批量加载 stop / plan 级 brand_qty
[x] 段产品与 legacy 产品:有明细则拆行;无明细 brandName=""
[x] 更新原「required → 君正」断言为 brand_qty 驱动;新增多品牌拆行用例
Files:
backend/app/services/pl_plan_archive_export.pyModify: backend/tests/test_pl_plan_archive_export.py
[x] build_plan_archive_export_rows / legacy 同样拆行
[x] 有 unitPrice 时改写单价与金额
[x] 更新单测
pytest … → 30 passed