提交
This commit is contained in:
1 parent
c8cec132bf
commit
19c5aaa8f5
95 files changed
+309129
-9838
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# 合同详情 · 运输计划联动 Implementation Plan
|
||||
|
||||
> **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:** 合同详情展示关联运输计划与产品安排数量,安排运输时自动将已审批合同开始执行。
|
||||
|
||||
**Architecture:** 后端按 `pl_plan_contract`(含遗留 `pl_plan.contract_id`)聚合计划列表与按产品 `plan_qty`;前端在 `ContractDetailDialog`/`detail.vue` 增加 Tab 与三列;`arrange_transport` 后幂等 `start_execute`。
|
||||
|
||||
**Tech Stack:** FastAPI + SQLAlchemy · Vue 3 + Element Plus · 现有 `flattenPlanListRows` / `PlPlanViewDialog`
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Backend — product plan qty aggregation
|
||||
|
||||
**Files:**
|
||||
- Create: `backend/app/services/pl_contract_plan_qty.py`
|
||||
- Test: `backend/tests/test_pl_contract_plan_qty.py`
|
||||
- Modify: contract detail serialization to attach qty fields on products
|
||||
|
||||
- [ ] Write unit tests for archived / unarchived-arranged / total
|
||||
- [ ] Implement aggregation service
|
||||
- [ ] Attach fields on contract detail products (`archivedQty`, `arrangedUnarchivedQty`, `arrangedTotalQty`)
|
||||
|
||||
### Task 2: Backend — list plans by contract
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/app/api/pl/plan.py`, schemas as needed
|
||||
- Modify: `web-admin/src/api/pl/index.ts`
|
||||
|
||||
- [ ] `GET /transport/plan/by-contract/{contractId}` page list reusing plan detail shaping
|
||||
- [ ] Frontend API wrapper
|
||||
|
||||
### Task 3: Backend — arrange auto start_execute
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/app/api/pl/transport.py` (or arrange service)
|
||||
- Test: `backend/tests/test_pl_arrange_auto_start_execute.py`
|
||||
|
||||
- [ ] After successful arrange, start_execute all linked contracts with status `approved`
|
||||
- [ ] Idempotent when already `executing`
|
||||
|
||||
### Task 4: Frontend — product columns + 运输计划 tab
|
||||
|
||||
**Files:**
|
||||
- Modify: `ContractDetailDialog.vue`, `detail.vue`
|
||||
- Possibly extract small helper for plan list span in dialog
|
||||
|
||||
- [ ] Three green columns after 税费
|
||||
- [ ] New tab with merge-cell list + open PlPlanViewDialog on planNo click
|
||||
|
||||
### Task 5: Verify
|
||||
|
||||
- [ ] Run relevant pytest
|
||||
- [ ] `./scripts/update-graph.sh` for touched projects
|
||||
@@ -0,0 +1,39 @@
|
||||
# 门户首页侧栏选中项会话记忆 — 实现计划
|
||||
|
||||
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
||||
|
||||
**Goal:** 会话内记住门户首页侧栏选中项;关标签页 / 退出登录后重置为「收藏」。
|
||||
|
||||
**Architecture:** `sessionStorage` 存 `activeModule` key;首页读写;登出与换用户时清除。
|
||||
|
||||
**Tech Stack:** Vue 3、sessionStorage、现有 `user.ts` 登出清理路径。
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 读写工具
|
||||
|
||||
**Files:**
|
||||
- Create: `web-admin/src/utils/navigation/portal-home-active-module.ts`
|
||||
|
||||
- [ ] 提供 `get` / `set` / `clear`,key 固定为 `portal-home-active-module`
|
||||
|
||||
### Task 2: 首页接入
|
||||
|
||||
**Files:**
|
||||
- Modify: `web-admin/src/views/portal/home/index.vue`
|
||||
|
||||
- [ ] 初始化 `activeModule` 时读 session
|
||||
- [ ] `watch(activeModule)` 写入 session
|
||||
- [ ] 沿用 `ensureActiveModule` 失效回退「收藏」
|
||||
|
||||
### Task 3: 登出 / 换用户清理
|
||||
|
||||
**Files:**
|
||||
- Modify: `web-admin/src/store/modules/user.ts`
|
||||
|
||||
- [ ] `logOut` 与 `checkAndClearWorktabs`(不同用户)调用 `clearPortalHomeActiveModule`
|
||||
|
||||
### Task 4: 手工验证
|
||||
|
||||
- [ ] 选中「CRM管理」→ 进入子页 → 回首页:仍为 CRM
|
||||
- [ ] 退出登录再登录:默认「收藏」
|
||||
@@ -0,0 +1,42 @@
|
||||
# 合同详情 · 运输计划联动 Design
|
||||
|
||||
**Date:** 2026-08-30
|
||||
**Demo:** `docs/fresh-mint-crm-contract-detail-plan-tab-demo.html`
|
||||
**Primary UI:** `ContractDetailDialog.vue`(合同管理列表打开详情的主路径)
|
||||
|
||||
## Goals
|
||||
|
||||
1. 合同详情新增 Tab「运输计划」:列表样式对齐运输计划页(合并单元格),点击计划编号打开只读详情。
|
||||
2. 「合同信息」产品明细在「税费(元)」后新增三列(绿色字):已归档数量、未归档已安排、已安排合计。
|
||||
3. 安排运输时,若关联合同状态为 `approved`,自动开始执行(`executing`)。
|
||||
|
||||
## Quantity rules
|
||||
|
||||
关联计划:`pl_plan_contract.contract_id = :cid` ∪ 遗留 `pl_plan.contract_id`;排除 `follow_status=cancelled`、`del_flag=1`。
|
||||
|
||||
按**该合同挂接的停靠段**汇总 `plan_qty`(按 `product_id` 对齐合同产品行):
|
||||
|
||||
| 字段 | 条件 |
|
||||
|------|------|
|
||||
| `archivedQty` | `archive_status = archived` |
|
||||
| `arrangedUnarchivedQty` | `transport_status = arranged`(或 follow 为 arranged/completed)且 `archive_status ≠ archived`,且非 wait_notice/pending_arrange/cancelled |
|
||||
| `arrangedTotalQty` | `archivedQty + arrangedUnarchivedQty` |
|
||||
|
||||
无 `stop_id` 的旧关联:取该计划全部装/送货段产品 `plan_qty`(与计数 API 一致优先并入遗留合同)。
|
||||
|
||||
## APIs
|
||||
|
||||
- `GET /transport/plan/by-contract/{contractId}`:分页列表,响应用现有计划详情结构(含 load/deliveries),便于复用 `flattenPlanListRows`。
|
||||
- 合同详情 `products[]` 增加三数量字段,或独立 `GET .../contract-product-plan-qty?contractId=`;优先嵌在合同详情以免二次请求。
|
||||
- `POST .../arrange/{plan_id}` 成功后:对关联且 `status=approved` 的合同调用内部 `start_execute`(已 executing 跳过)。
|
||||
|
||||
## UI
|
||||
|
||||
- Tab 复用 `flattenPlanListRows` + span-method + `PlPlanViewDialog`;不复刻整页工具栏/筛选。
|
||||
- 三列样式:表头浅绿底、字色 `#059669`。
|
||||
- 全页 `detail.vue` 本期一并补齐,避免双入口不一致。
|
||||
|
||||
## Out of scope
|
||||
|
||||
- 合同侧编辑计划、从合同直接新增计划。
|
||||
- 改动运输计划列表页本身。
|
||||
@@ -0,0 +1,40 @@
|
||||
# 运输计划保存同步地磅日期 + 已安排禁仅保存
|
||||
|
||||
**日期:** 2026-08-30
|
||||
**状态:** 已确认(方案 A + B)
|
||||
**范围:** `backend` 运输计划更新接口 + 地磅桥接服务;`web-admin` 计划表单底栏按钮
|
||||
|
||||
## 1. 背景
|
||||
|
||||
编辑已安排运输计划(仅「保存」)会更新计划/段次,但地磅出入库的日期、往来单位等不会完整联动,导致两侧数据不一致(如 PO20260830002)。
|
||||
|
||||
## 2. 决策
|
||||
|
||||
### 方案 A(前端流程)
|
||||
|
||||
| 项 | 决策 |
|
||||
|----|------|
|
||||
| 已安排计划 | 隐藏「保存」,只保留「保存并安排」或「调整运输」 |
|
||||
| 未安排 / 新建 | 仍可「保存」或「创建」 |
|
||||
|
||||
### 方案 B(后端兜底)
|
||||
|
||||
| 项 | 决策 |
|
||||
|----|------|
|
||||
| 触发点 | `PUT` 更新计划,`commit` 前,存在有效 `pl_transport_db_link` 时 |
|
||||
| 日期算法 | 与安排时一致:装货 `load_time`、送货 `delivery_time`,否则回退计划日期 |
|
||||
| 可回写条件 | 出入库状态可作废集合 + 无有效过磅单 |
|
||||
| 不可回写 | 计划仍保存成功,经 `warnings` 提示 |
|
||||
| 同月 | 仅更新 `db_inbound_outbound.date` |
|
||||
| 跨月 | 回减旧月计划量 → 查找/新建新月计划 → 改挂出入库与 link |
|
||||
|
||||
## 3. 非目标
|
||||
|
||||
- 不重建批次号、不改已过磅单据
|
||||
- 方案 B 不覆盖往来单位/车辆等全量字段(依赖方案 A 走安排链路)
|
||||
|
||||
## 4. 实现要点
|
||||
|
||||
- 前端:`pl-plan-form-dialog` 增加 `showSaveButton`(`transportStatus !== 'arranged'`)
|
||||
- 后端:`sync_linked_dibang_dates_for_plan`;`update_plan` 合并 warnings
|
||||
- 单测:同月改日、跨月改挂、已过磅跳过
|
||||
@@ -0,0 +1,27 @@
|
||||
# 门户首页侧栏选中项会话记忆
|
||||
|
||||
## 背景与目标
|
||||
|
||||
门户首页(`web-admin/src/views/portal/home/index.vue`)侧栏 `activeModule` 默认「收藏」。组件重建(KeepAlive 挤出、刷新等)后会丢失上次选中的业务模块(如「CRM管理」)。目标:在**当前浏览器会话**内记住侧栏选中项。
|
||||
|
||||
## 已确认决策
|
||||
|
||||
| 项 | 决策 |
|
||||
|----|------|
|
||||
| 持久范围 | 仅 sessionStorage;关标签页自动清空 |
|
||||
| 退出登录 | 清除该 key;下次登录仍默认「收藏」 |
|
||||
| 换用户登录 | 与收藏预开 flag 一并清除 |
|
||||
| 实现形态 | 方案 A:sessionStorage,不新建 Pinia store |
|
||||
| 后端 | 无 |
|
||||
|
||||
## SHALL
|
||||
|
||||
1. 用户点击侧栏(收藏 / 待办列表 / 一级模块)时写入 `sessionStorage`。
|
||||
2. 首页初始化时读回;若 key 缺失或对应模块已不存在,回退「收藏」。
|
||||
3. `logOut` 与「不同用户登录」清理路径须 `removeItem`。
|
||||
4. 不改变侧栏顺序、卡片交互与角标逻辑。
|
||||
|
||||
## 非目标
|
||||
|
||||
- 不跨浏览器会话长期记住(不用 localStorage)。
|
||||
- 不把选中项同步到服务端。
|
||||
Reference in new issue
Block a user