Files
makemd/docs/blueprints/frontend-integration/inventory-forecast-replenishment.md
Ansonai 6759d47de4 docs: 新增V30.0版本相关设计文档与指南
新增服务器启动文档、设计说明书、风险清单等核心文档
补充前端集成蓝图、多租户实施清单、上线红线检查清单
添加质量保障文档与早期业务规格书
2026-03-16 01:31:26 +08:00

49 lines
2.8 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.
# 📋 前端实现方案AGI 销量预测与智能补货 (Inventory Forecast)
## 1. UI 布局草图 (UI Layout Sketch)
```
+-------------------------------------------------------------------------+
| [Breadcrumb: Console > Inventory > Smart Replenish] |
+-------------------------------------------------------------------------+
| [Search SKU: [__________]] [Filter: Low Stock Only [x]] |
+-------------------------------------------------------------------------+
| +---------------------------------------------------------------------+ |
| | SKU: SKU-9988 (Handheld Blender) | |
| |---------------------------------------------------------------------| |
| | [当前库存: 45 PCS] [7天日均销量: 12.5 PCS] [预计可用天数: 3.6 Days] | |
| |---------------------------------------------------------------------| |
| | [销量预测 (7 Days Forecast)] | |
| | [Chart: 历史销量(蓝线) vs AI 预测销量(绿虚线)] | |
| |---------------------------------------------------------------------| |
| | [AI 补货建议 (Replenishment Advice)] | |
| | > 建议立即补货: 200 PCS | |
| | > 理由: 销售速率增长 20%,当前库存无法支撑至下次补货到货 (Lead time: 7d) | |
| | [按钮: 生成采购单 (Create PO)] [按钮: 忽略建议 (Ignore)] | |
| +---------------------------------------------------------------------+ |
+-------------------------------------------------------------------------+
```
## 2. 交互状态机 (Interaction FSM)
- **IDLE**: 展示待补货列表。
- **PREDICTING**: 点击“刷新预测”按钮,调用 `/api/trade/inventory/forecast/:skuId`
- **ADVISING**: 渲染 AI 建议与 PO 预填单。
- **EXECUTING**: 点击“生成采购单”,调用 `TradeService.createPurchaseOrder`,按钮进入 Loading。
- **COMPLETED**: 采购单生成成功,自动跳转至 PO 详情页。
## 3. 核心 API 字段映射 (API Field Mapping)
| 前端字段 (Frontend) | 后端 API 字段 (Backend) | 说明 (Description) |
| :--- | :--- | :--- |
| 7天日均销量 | `avgDailySales7d` | 最近一周的真实动销速率 |
| AI 预测总量 | `forecastNext7d` | 未来一周的预测销量 |
| 信心指数 | `confidenceScore` | AI 对预测结果的把握度 (0-1) |
| 建议补货量 | `policy.orderQuantity` | 来自 RL 算法的最优订单量 |
| 补货触发点 | `policy.reorderPoint` | 当库存低于此值时建议补货 |
## 4. ROI 可视化逻辑 (ROI Visualization)
- **缺货风险分值**: 红色 (Risk > 80) / 橙色 (Risk > 50) / 绿色 (Safe)。
- **补货 ROI 预估**: 联动 `InventoryRLService` 展示“补货后预计挽回的缺货损失” vs “仓储成本增加额”。