WMS_MAIN/docs/order-cancel-db-checklist.md
liufumingren 460ce119c5 ok
2026-04-11 17:08:55 +08:00

54 lines
1.6 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.

# 订单取消 / 状态机 — 库表核对清单(§0.7 执行用)
> 用途:实施 `order_todo.md` **§2.3a(取消进 M4)** 前,对 **`wms_order_delivery` 及分表** 做只读核对。
> 不改变数据库;核对结果记录在工单或 `order_todo.md` 修订记录。
## 1. 列出本库所有发货单相关表
```sql
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = DATABASE()
AND (
TABLE_NAME = 'wms_order_delivery'
OR TABLE_NAME REGEXP '^wms_order_delivery_[0-9]+(_history)?$'
)
ORDER BY TABLE_NAME;
```
## 2. 对每张表核对关键列是否存在
将 `YOUR_TABLE` 替换为上一步的表名(含模板表 `wms_order_delivery` 与各仓 `wms_order_delivery_{wh}` / `_history`)。
```sql
SELECT COLUMN_NAME, DATA_TYPE, COLUMN_TYPE, IS_NULLABLE, COLUMN_COMMENT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'YOUR_TABLE'
AND COLUMN_NAME IN (
'status',
'intercept_status',
'step',
'outbound_status',
'inspection_status',
'delivery_time',
'updated_at',
'create_at'
)
ORDER BY COLUMN_NAME;
```
## 3. 结论填写(人工)
| 检查项 | 是否满足「取消进 M4」筛选与展示 |
|--------|----------------------------------|
| `status` 含 `cancel` 枚举(与 ORM 一致) | |
| `intercept_status` 含 `cancelled` 等 | |
| `step` 存在且含「9=已关闭」语义 | |
| 若产品要求 **独立「取消进 M4」列** | 缺则走 migration + 模型 + 工厂 DDL |
## 4. 参考
- 模型枚举源:`app/model/order_delivery.js`(`StatusEnum`、`step` 注释)
- 规划说明:仓库根目录 `order_todo.md` §0.7、§2.3a