Files
SupplierSystem/ARCHITECTURE.md
T
Ubuntu deb3e72750
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
chore: 以 AI 生鲜配送系统 当前版本作为 SupplierSystem 起点
来源仓库:jxc/ai-fresh-delivery
来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d
快照树:  09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件)

按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据
(生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、
deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值),
整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。
供应商系统后续开发自本提交开始。
2026-10-08 17:35:43 +08:00

1179 lines
94 KiB
Markdown

# 食堂配送系统 — 整体拓扑图
```
┌─────────────────────────────────────────────────────────────────────────────────────────────┐
│ 🖥️ 前端层 │
│ │
│ ┌──────────────────┐ ┌──────────────────────┐ ┌──────────────────┐ │
│ │ 微信小程序 (MP) │ │ Web 管理端 (Admin) │ │ 供应商 H5/API │ │
│ │ │ │ │ │ │ │
│ │ • 客户下单 │ │ • 订单管理/推进 │ │ • 备货接单 │ │
│ │ • 采购员加单/自采 │ │ • 分配/履约/财务 │ │ • 价格修改 │ │
│ │ • 配送员装车/签收 │ │ • 供应商/客户管理 │ │ • 质检报告上传 │ │
│ │ • 仓管验收/分拣 │ │ • 商品/分类/角色 │ │ • 竞价报价 │ │
│ │ • 加工任务 │ │ • 仪表板/审计 │ │ • OAuth 集成 │ │
│ └────────┬─────────┘ └──────────┬───────────┘ └────────┬─────────┘ │
│ │ │ │ │
│ │ /api/mobile/* │ /api/* /api/workflow/* │ /api/supplier/* │
│ ▼ ▼ ▼ │
├─────────────────────────────────────────────────────────────────────────────────────────────┤
│ 🌐 API 网关层 │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ Nginx / 直连 (路由分发) │ │
│ │ │ │
│ │ /api/mobile/* ──────────▶ Go :3002 (主力) │ │
│ │ /api/workflow/* ──────────▶ Go :3002 (主力) │ │
│ │ /api/supplier/* ──────────▶ Go :3002 (主力) │ │
│ │ /api/* ──────────▶ Go :3002 (主力) + Node :3001 (AI 兜底) │ │
│ │ /api/storage/* ──────────▶ Go :3002 (文件上传/签名读取) │ │
│ └─────────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────────┘
│
┌───────────────────────────────┴───────────────────────────────┐
▼ ▼
┌─────────────────────────────────────┐ ┌─────────────────────────────────────┐
│ 🟢 Go 后端 :3002 │ │ 🔵 Node.js 后端 :3001 │
│ Gin + pgx + ~242 端点 │ │ Express + pg + ~200 端点 │
│ │ │ │
│ ┌───────────────────────────────┐ │ │ 负责: │
│ │ httpapi (路由层) │ │ │ • AI 订单解析 (LLM) │
│ │ router.go (159 路由) │ │ │ • 语音转写 │
│ │ workflow_*.go (58 路由) │ │ │ • 深度成本分析 (26 端点) │
│ │ mobile_*.go (移动端处理) │ │ │ • 微信订阅通知 │
│ │ admin_*.go (管理端处理) │ │ │ • 腾讯地图路线规划 │
│ │ supplier_api*.go (供应商API) │ │ │ │
│ └───────────────┬───────────────┘ │ └──────────────────┬──────────────────┘
│ │ │ │
│ ┌───────────────┼────────────────────────────────────────┼──────────────────┐ │
│ │ ▼ 🏗️ 业务层 ▼ │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │
│ │ │orderentry│ │orderadmin│ │ delivery │ │ purchase │ │ supplierbiz │ │ │
│ │ │ 订单录入 │ │ 订单管理 │ │ 配送管理 │ │ 采购管理 │ │ 供应商业务 │ │ │
│ │ │ submit │ │ manage │ │ tasks │ │ assign │ │ preps/quality│ │ │
│ │ │ sync │ │ trace │ │ advance │ │ operation│ │ prepamend │ │ │
│ │ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────┬───────┘ │ │
│ │ │ │ │ │ │ │ │
│ │ ┌────┴────┐ ┌─────┴─────┐ ┌───┴────┐ ┌─────┴─────┐ │ │
│ │ │allocation│ │orderfulfill│ │picking │ │inspection │ ┌──────────────┐ │ │
│ │ │ 分配引擎 │ │ 履约管理 │ │ 分拣称重│ │ 质检验收 │ │ processing │ │ │
│ │ │ engine │ │fulfillment│ │outbound│ │ advance │ │ ⚡ 独立模块 │ │ │
│ │ │ rules │ │ │ │ weigh │ │compliance │ │ 加工/损耗 │ │ │
│ │ └─────────┘ └───────────┘ └────────┘ └───────────┘ └──────────────┘ │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────────────────────┐ │ │
│ │ │ 💰 财务层 │ │ │
│ │ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │ │
│ │ │ │ finance │ │ invcost │ │ pricing │ │ workflow │ │ │ │
│ │ │ │ 对账结算 │ │ 库存成本 │ │ 报价定价 │ │ 工作流引擎 │ │ │ │
│ │ │ │statement │ │ bid/cost │ │ │ │ customer │ │ │ │
│ │ │ │ aging │ │ │ │ │ │ supplier │ │ │ │
│ │ │ └──────────┘ └──────────┘ └──────────┘ │ delivery │ │ │ │
│ │ │ │ finance │ │ │ │
│ │ │ │ bid │ │ │ │
│ │ │ │ import │ │ │ │
│ │ │ │ units │ │ │ │
│ │ │ └──────────────┘ │ │ │
│ │ └──────────────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────────────────────────┐ │ │
│ │ │ 🔧 横向支撑层 │ │ │
│ │ │ │ │ │
│ │ │ ┌──────┐ ┌──────┐ ┌───────┐ ┌───────┐ ┌──────┐ ┌────────┐ │ │ │
│ │ │ │ auth │ │tenant│ │storage│ │notify │ │ db │ │config │ │ │ │
│ │ │ │ JWT │ │ 多租户│ │OSS/S3 │ │ 通知 │ │连接池│ │ 配置 │ │ │ │
│ │ │ └──────┘ └──────┘ └───────┘ └───────┘ └──────┘ └────────┘ │ │ │
│ │ │ │ │ │
│ │ │ ┌────────┐ ┌──────────┐ ┌─────────┐ ┌────────┐ ┌──────────┐ │ │ │
│ │ │ │bizerr │ │featurecfg│ │tenantscope│ │picking│ │queryexec │ │ │ │
│ │ │ │ 业务错误 │ │ 功能开关 │ │ 租户上下文 │ │ 查询接口│ │ 查询执行 │ │ │ │
│ │ │ └────────┘ └──────────┘ └─────────┘ └────────┘ └──────────┘ │ │ │
│ │ └──────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ 🗄️ 数据层 │
│ │
│ ┌───────────────────────────────────────┐ ┌──────────────────────────────────┐ │
│ │ PostgreSQL (主库) │ │ OSS/S3 (文件存储) │ │
│ │ │ │ │ │
│ │ ┌─────────────────────────────────┐ │ │ /inspection-photos/ (质检照片) │ │
│ │ │ 订单域 │ │ │ /delivery-photos/ (签收照片) │ │
│ │ │ orders, order_items │ │ │ /invoices/ (凭证照片) │ │
│ │ │ order_item_fulfillments │ │ │ /sku-images/ (商品图片) │ │
│ │ └─────────────────────────────────┘ │ │ /quality-reports/ (质检报告) │ │
│ │ ┌─────────────────────────────────┐ │ │ /processing-inspection-photos/ │ │
│ │ │ 履约域 │ │ └──────────────────────────────────┘ │
│ │ │ supplier_preparations (备货) │ │ │
│ │ │ purchase_orders (自采单) │ │ │
│ │ └─────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────┐ │ │
│ │ │ 仓储域 │ │ │
│ │ │ inspections (验收) │ │ │
│ │ │ processing_tasks (加工) ⚡独立 │ │ │
│ │ │ picking_tasks (分拣) │ │ │
│ │ │ inventory (库存) │ │ │
│ │ └─────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────┐ │ │
│ │ │ 配送域 │ │ │
│ │ │ delivery_tasks (配送任务) │ │ │
│ │ │ delivery_signatures (签收) │ │ │
│ │ │ delivery_loading_items (装车) │ │ │
│ │ └─────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────┐ │ │
│ │ │ 财务域 │ │ │
│ │ │ customer_statements (客户对账) │ │ │
│ │ │ supplier_statements (供应商对账) │ │ │
│ │ │ cost_details (成本明细) │ │ │
│ │ │ operation_logs (审计日志) │ │ │
│ │ └─────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────┐ │ │
│ │ │ 基础域 │ │ │
│ │ │ users, roles, suppliers │ │ │
│ │ │ customers, purchasers, branches │ │ │
│ │ │ skus, categories, system_configs │ │ │
│ │ └─────────────────────────────────┘ │ │
│ └───────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────────────┐
│ 🌍 外部集成层 │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ 微信小程序 │ │ 腾讯地图 │ │ AI/LLM │ │ OSS/S3 │ │
│ │ 登录/支付 │ │ 路线规划 │ │ 订单解析 │ │ 文件存储 │ │
│ │ 订阅消息 │ │ (Node) │ │ 智能分类 │ │ │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────────────────┘
```
---
## 订单主流程(核心数据流)
```
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ 01 下单 │ ──▶ │ 02 分配 │ ──▶ │ 03 验收 │ ──▶ │ 04 分拣 │ ──▶ │ 05 配送 │ ──▶ │ 06 结算 │
│ │ │ │ │ │ │ │ │ │ │ │
│ status 20│ │status 20→│ │status 30→│ │status 40→│ │status 50→│ │status 90 │
│ 待分配 │ │ 30 │ │ 40 │ │ 50 │ │ 90 │ │ 完成 │
└────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
orderentry allocation inspection picking delivery
submit.go engine.go advance.go outbound.go advance.go
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
INSERT INSERT INSERT INSERT INSERT
orders supplier_ inspections picking_ delivery_
order_items preparations (验收记录) tasks tasks
purchase_ (分拣任务) (配送任务)
orders
(自采单)
┌──────────────────────────────────────────────────────────────────────────────────┐
│ ⚡ 独立模块(并行,不阻塞) │
│ │
│ 验收(40) ─────────────────────────▶ 分拣(45) ─────────▶ 配送(50) ← 主流程 │
│ │ │ │
│ └────────────┬───────────────────────┘ │
│ │ 并行触发(不阻塞订单状态) │
│ ▼ │
│ ┌─────────────────────────────┐ │
│ │ 加工模块 (processing) │ ← 独立路由 /api/mobile/processing/* │
│ │ • 从验收单自动生成加工任务 │ │
│ │ • 可手动创建独立加工单 │ ← /processing/standalone/create │
│ │ • 完工记录损耗 + 人工成本 │ │
│ │ • 加工验收拍照 │ │
│ └─────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────────────┘
```
---
## 模块间调用关系
```
httpapi (路由入口)
│
├──▶ orderentry ──▶ allocation ──▶ orderfulfill
│ │ │
│ ▼ ▼
│ pricing purchase
│ invcost supplierbiz
│
├──▶ orderadmin ──▶ orderfulfill ──▶ picking
│ │ │
│ ▼ ▼
│ producttrace delivery
│ inspection
│
├──▶ delivery ──▶ delivery/advance ──▶ finance
│
├──▶ inspection ──▶ invcost
│ │
│ ▼
│ processing (独立)
│
├──▶ supplierbiz ──▶ finance
│
└──▶ workflow/finance ──▶ finance
│
▼
workflow/customer
workflow/supplier
workflow/delivery
workflow/bid
```
---
## 状态机
```
┌─────────────────────────────────┐
│ 订单状态流转 (主流程) │
└─────────────────────────────────┘
┌──────┐ 分配引擎 ┌──────┐ 验收 ┌──────┐ 分拣 ┌──────┐ 发车 ┌──────┐ 签收 ┌──────┐
│ 20 │ ────────▶ │ 30 │ ───────▶ │ 40 │ ──────▶ │ 50 │ ──────▶ │ 60 │ ──────▶ │ 90 │
│待分配 │ │已分配 │ │待验收 │ │待配送 │ │配送中 │ │ 完成 │
└──────┘ └──────┘ └──────┘ └──────┘ └──────┘ └──────┘
│ │ │
│ │ 验收不通过 │ 配送异常
▼ ▼ ▼
┌──────┐ ┌──────┐ ┌──────────┐
│ 自采 │ │ 41 │ │ 异常工单 │
│ 转供应商│ │ 退回 │ │ exception │
└──────┘ └──────┘ └──────────┘
═══════════════════════════════════════════════════════════════════════════════════════════
⚡ 加工模块独立状态机(不阻塞订单)
═══════════════════════════════════════════════════════════════════════════════════════════
┌──────┐ 开始 ┌──────┐ 完工 ┌──────┐ 验收 ┌──────┐
│ 10 │ ───────▶ │ 20 │ ───────▶ │ 30 │ ───────▶ │ 40 │
│ 待加工 │ │ 加工中 │ │ 待验收 │ │ 已完成 │
└──────┘ └──────┘ └──────┘ └──────┘
```
---
## Go 包依赖层次
```
Layer 4 httpapi ───────────────────────────────────── (路由 + 处理器)
│
Layer 3 orderentry orderadmin delivery supplierbiz purchase inspection
picking processing(⚡) allocation finance invcost workflow
│
Layer 2 orderfulfill prepamend pricing producttrace stockin catalog
weighstation skuimage menugroupicon uipref userbinding
│
Layer 1 auth tenant db storage notify config llm prompts
wechat bizerr featurecfg tenantscope queryexec chinadate
branchtax mobile purchaseradmin supplieradmin accountlogin
jwtutil password purchaserorder
```
---
## 数据表关系 (核心)
```
┌─────────────────────────────────────┐
│ orders (订单) │
│ order_code PK │ customer_code │
│ order_status │ total_amount │
│ branch_code │ delivery_date │
└───────────────┬─────────────────────┘
┌──────────────────────┼──────────────────────┐
│ 1:N │ 1:N │ 1:N
▼ ▼ ▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ order_items │ │ inspections │ │ delivery_tasks │
│ (订单明细) │ │ (验收记录) │ │ (配送任务) │
│ id PK │ │ id PK │ │ task_code PK │
│ sku_code │ │ inspection_ │ │ task_status │
│ supplier_code │ │ status │ │ driver_id │
│ quantity │ │ processing_ │ └────────┬────────┘
│ price │ │ details │ │
└────────┬─────────┘ └────────┬──────────┘ │
│ │ │
┌───────────┼──────────┐ │ ┌────────┴────────┐
▼ ▼ ▼ ▼ ▼ ▼
┌──────────┐ ┌────────┐ ┌────────┐ ┌──────────┐ ┌────────────┐ ┌────────────────┐
│ order_ │ │supplier│ │purchase│ │processing│ │ picking │ │ delivery_ │
│ item_ │ │_prepa- │ │_orders │ │_tasks │ │ _tasks │ │ signatures │
│ fulfill- │ │rations │ │(自采单) │ │(加工⚡) │ │ (分拣) │ │ (签收) │
│ ments │ │(备货) │ │ │ │ │ │ │ │ │
└──────────┘ └────────┘ └────────┘ └──────────┘ └────────────┘ └────────────────┘
```
---
## Go ↔ Node.js 分工
| 模块 | Go :3002 | Node :3001 | 说明 |
|------|:--------:|:----------:|------|
| 订单提交/改单 | ✅ | ✅ | Go 已完全替代 |
| 分配引擎 | ✅ | ✅ | Go Pipeline 实现 |
| 备货/自采 | ✅ | ✅ | Go 已完全替代 |
| 验收/分拣 | ✅ | ✅ | Go 已完全替代 |
| 配送管理 | ✅ | ✅ | Go 已完全替代 |
| 加工模块 | ✅ (独立) | ✅ | Go 独立实现 |
| 财务结算 | ✅ | ✅ | Go 已完全替代 |
| 供应商管理 | ✅ | ✅ | Go 已完全替代 |
| 深度成本分析 | 🟡 空返回 | ✅ | 26 端点 AI 依赖 |
| 微信订阅通知 | ❌ | ✅ | 需模板 ID 配置 |
| AI 订单解析 | ❌ | ✅ | LLM 依赖 |
| 语音转写 | ❌ | ✅ | LLM 依赖 |
| 腾讯地图路线 | ❌ | ✅ | 外部 API 依赖 |
---
# 全部系统数据流
## 1. 订单录入流 (Order Entry)
```
客户小程序 Go 后端 DB
───────── ──────── ──
│ 选品下单 │
└────┬────┘
│ POST /api/mobile/customer-order/orders
▼
┌─────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_order │ ──▶ │ orderentry/ │ ──▶ │ 1. 商品智能分类 │
│ .go │ │ submit.go │ │ 2. 报价定价 (pricing)│
│ │ │ SubmitMobile │ │ 3. 预算校验 │
│ │ │ CustomerOrder() │ │ 4. 零价拦截 │
└─────────────┘ └────────┬─────────┘ └──────────┬──────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ 5. 生成订单号 │ │ 6. 商品建档 │
│ allocateOrder │ │ upsert skus │
│ Code() │ │ product_catalog│
└──────┬───────┘ └──────────────┘
│
▼
┌──────────────┐
│ 7. INSERT │
│ orders + │
│ order_items │
│ (status=20) │
└──────┬───────┘
│
▼
┌──────────────┐ ┌──────────────┐
│ 8. 分配引擎 │ ──▶ │ allocation/ │
│ ReprocessOrder│ │ engine.go │
│ Allocation() │ │ 规则引擎分配 │
└──────┬───────┘ └──────┬───────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ 9. 库存成本 │ │ 10. INSERT │
│ invcost 写回 │ │ supplier_ │
│ │ │ preparations │
└──────────────┘ │ purchase_ │
│ orders │
└──────────────┘
```
## 2. 采购员加单/改单流 (Purchaser Order Management)
```
采购员小程序 Go 后端 DB
─────────── ──────── ──
│ 加单/改单 │
└────┬─────┘
│ POST /api/mobile/purchaser/order-items/orders/:code/items
│ PATCH /api/mobile/purchaser/order-items/orders/:code
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_purchaser │ ──▶ │ orderentry/ │ ──▶ │ 1. 行锁订单 orders │
│ _order.go │ │ sync_main.go │ │ FOR UPDATE │
│ │ │ SyncOrderManage │ │ 2. 状态校验 │
│ │ │ Items() │ │ 3. 零价加菜拦截 │
└─────────────────┘ └────────┬──────────┘ └──────────┬──────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ 4. 删行+upsert│ │ 5. 重算金额/ │
│ order_items │ │ 重量 │
└──────┬───────┘ └──────────────┘
│
┌────────────┴────────────┐
▼ ▼
┌────────────┐ ┌──────────────┐
│ 订单未完成 │ │ 订单已完成 │
│ status<90 │ │ status≥90 │
└──────┬─────┘ └──────┬───────┘
│ │
▼ ▼
┌────────────┐ ┌──────────────┐
│ 分配引擎 │ │ 库存覆盖 │
│ allocation │ │ + 财务结算 │
│ engine.go │ │ + 成本回写 │
└────────────┘ └──────────────┘
```
## 3. 分配引擎流 (Allocation Engine)
```
触发: 订单提交 / 改单 / Web端手动分配
─────────────────────────────────────────────────
┌─────────────────────────────────────────────────────────────────────┐
│ allocation/engine.go │
│ │
│ Phase 1: Validate & Lock │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ SELECT ... FROM orders WHERE order_code = $1 FOR UPDATE │ │
│ │ 校验: 订单存在 + 状态<90 │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Phase 2: Load Context (4 goroutines 并行) │
│ ┌──────────┐ ┌──────────┐ ┌─────────────┐ ┌──────────────┐ │
│ │ 加载规则 │ │ 加载供应商│ │ 加载分类绑定 │ │ 加载SKU供货 │ │
│ │ system_ │ │ suppliers│ │ supplier_ │ │ sku_supplier_ │ │
│ │ configs │ │ │ │ categories │ │ prices │ │
│ └──────────┘ └──────────┘ └─────────────┘ └──────────────┘ │
│ │ │
│ ▼ │
│ Phase 3: Load & Enrich Items │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ SELECT ... FROM order_items WHERE order_code = $1 FOR UPDATE │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Phase 4: Allocate (规则引擎) │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 对每个未履约商品: │ │
│ │ SKU供货目录匹配 → 供应商备货 │ │
│ │ 分类绑定供应商 → 供应商备货 (优先 primary) │ │
│ │ 无匹配 → 自采单 (purchase_orders) │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Phase 5: Finalize │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 覆盖未履约商品 → 强制自采兜底 │ │
│ │ INSERT supplier_preparations + purchase_orders │ │
│ │ INSERT order_item_fulfillments (履约关联) │ │
│ │ UPDATE orders SET order_status = 30 │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ Phase 6: PostProcess (异步 goroutine) │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ ensureInspections (确保验收记录) │ │
│ │ reconcileArtifacts (清理孤儿备货) │ │
│ └──────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
```
## 4. 供应商备货流 (Supplier Preparation)
```
供应商 H5/小程序 Go 后端 DB
───────────── ──────── ──
│ 查看备货单 │
└────┬──────┘
│ GET /api/supplier/preparations
▼
┌─────────────────┐ ┌──────────────────┐
│ supplier_api.go │ ──▶ │ supplierbiz/ │
│ handleSupplier │ │ preps.go │
│ ApiPreparations │ │ ListSupplier │
│ │ │ Preparations() │
└─────────────────┘ └────────┬─────────┘
│ SELECT supplier_preparations
│ JOIN order_items, orders
│ WHERE supplier_code = ?
▼
┌──────────────┐
│ 返回备货列表 │
│ + 订单信息 │
│ + 商品信息 │
└──────┬───────┘
│
┌───────────────────────────┘
│ 确认备货
│ POST /api/mobile/supplier/preparations/status
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_supplier │ ──▶ │ supplierbiz/ │ ──▶ │ UPDATE │
│ .go │ │ prepstatus.go │ │ supplier_preparations│
│ │ │ UpdatePreparation │ │ prepare_status │
│ │ │ Status() │ │ 10→20(确认)→30(完成) │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
```
## 5. 采购/自采流 (Purchase Order)
```
采购员小程序 Go 后端 DB
─────────── ──────── ──
│ 查看自采单 │
└────┬─────┘
│ GET /api/mobile/purchase/orders
▼
┌─────────────────┐ ┌──────────────────┐
│ mobile_purchase │ ──▶ │ purchase/ │
│ .go │ │ operation.go │
│ │ │ ListPurchase │
│ │ │ Orders() │
└─────────────────┘ └────────┬─────────┘
│ SELECT purchase_orders
│ WHERE purchaser_code = ?
▼
┌──────────────┐
│ 返回自采列表 │
└──────┬───────┘
│
┌───────────────────────────┘
│ 转供应商 / 改状态
│ POST /api/mobile/purchase/orders/assign-supplier
│ POST /api/mobile/purchase/orders/status
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_purchase │ ──▶ │ purchase/ │ ──▶ │ UPDATE purchase_ │
│ .go │ │ assign.go │ │ orders │
│ │ │ AssignPurchase │ │ supplier_code │
│ │ │ OrderToSupplier() │ │ purchase_status │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
```
## 6. 验收流 (Inspection)
```
仓管小程序 Go 后端 DB
───────── ──────── ──
│ 验收任务列表 │
└────┬───────┘
│ GET /api/mobile/inspection/tasks
▼
┌─────────────────┐ ┌──────────────────┐
│ mobile_inspection│ ──▶ │ inspection/ │
│ .go │ │ compliance.go │
│ │ │ ListInspection │
│ │ │ Tasks() │
└─────────────────┘ └────────┬─────────┘
│ SELECT inspections
│ JOIN order_items, orders
▼
┌──────────────┐
│ 返回验收列表 │
└──────┬───────┘
│
┌───────────────────────────┘
│ 提交验收 (拍照+称重)
│ POST /api/mobile/inspection/complete
│ POST /api/mobile/inspection/photo
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_inspection│ ──▶ │ inspection/ │ ──▶ │ UPDATE inspections │
│ .go │ │ advance.go │ │ inspection_status │
│ │ │ CompleteInspection│ │ inspection_photos │
│ │ │ () │ │ processing_details │
└─────────────────┘ └────────┬─────────┘ └──────────┬──────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ 创建分拣任务 │ │ 创建加工任务 │
│ picking_tasks │ │ processing_ │
│ │ │ tasks (如需要) │
└──────────────┘ └──────────────┘
```
## 7. 加工流 (Processing) ⚡ 独立模块
```
仓管 Web/小程序 Go 后端 DB
───────────── ──────── ──
│ 加工任务列表 │
└────┬───────┘
│ GET /api/mobile/processing/tasks
▼
┌─────────────────┐ ┌──────────────────┐
│ mobile_processing│ ──▶ │ processing/ │
│ .go │ │ tasks.go │
│ │ │ ListTasks() │
└─────────────────┘ └────────┬─────────┘
│ SELECT processing_tasks
│ JOIN order_items, orders
▼
┌──────────────┐
│ 返回加工列表 │
└──────┬───────┘
│
┌───────────────────────────┼───────────────────────────┐
│ 开始加工 │ 完工登记 │ 加工验收
│ POST /processing/start │ POST /processing/complete │ POST /processing
▼ ▼ │ /inspect/complete
┌──────────┐ ┌──────────────┐ ▼
│ UPDATE │ │ UPDATE │ ┌──────────────┐
│ status │ │ status │ │ 拍照上传 │
│ 10→20 │ │ 20→30 │ │ 记录损耗 │
│ (加工中) │ │ (待验收) │ │ 人工成本入账 │
└──────────┘ └──────┬───────┘ │ processing_logs│
│ └──────────────┘
▼
┌──────────────┐
│ 记录损耗 │
│ loss_qty │
│ 出成率 │
│ 人工成本入账 │
│ cost_details │
└──────────────┘
★ 独立加工单 (不关联订单):
POST /api/mobile/processing/standalone/create
──▶ processing/standalone ──▶ INSERT processing_tasks (order_code=NULL)
```
## 8. 分拣流 (Picking)
```
仓管小程序 Go 后端 DB
───────── ──────── ──
│ 分拣任务列表 │
└────┬───────┘
│ GET /api/mobile/picking/tasks
▼
┌─────────────────┐ ┌──────────────────┐
│ mobile_picking │ ──▶ │ picking/ │
│ .go │ │ outbound.go │
│ │ │ ListPickingTasks() │
└─────────────────┘ └────────┬─────────┘
│ SELECT picking_tasks
▼
┌──────────────┐
│ 返回分拣列表 │
└──────┬───────┘
│
┌───────────────────────────┼───────────────────────────┐
│ 称重站 │ 分拣确认 │ 出库
│ POST /picking/weigh- │ POST /picking/confirm │ POST /picking
│ station/commit │ │ /outbound
▼ ▼ ▼
┌──────────┐ ┌──────────────┐ ┌──────────────┐
│ 称重记录 │ │ 确认分拣 │ │ 出库扫描 │
│ 毛重/净重 │ │ 更新状态 │ │ 生成配送任务 │
│ 拍照 │ │ │ │ delivery_ │
└──────────┘ └──────────────┘ │ tasks │
└──────────────┘
```
## 9. 配送流 (Delivery)
```
配送员小程序 Go 后端 DB
─────────── ──────── ──
│ 配送任务列表 │
└────┬───────┘
│ GET /api/mobile/delivery/tasks
▼
┌─────────────────┐ ┌──────────────────┐
│ mobile_delivery │ ──▶ │ delivery/ │
│ .go │ │ tasks.go │
│ │ │ ListDriverTasks() │
└─────────────────┘ └────────┬─────────┘
│ SELECT delivery_tasks
│ WHERE driver_id = ?
▼
┌──────────────┐
│ 返回配送列表 │
└──────┬───────┘
│
┌───────────────────────────┼───────────────────────────┐
│ 装车 │ 发车 │ 送达签收
│ POST /delivery/loading │ POST /delivery/start │ POST /delivery
│ /confirm-item │ /start-batch │ /sign-photo
▼ ▼ ▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 扫码装车 │ │ 发车出发 │ │ 拍照签收 │
│ delivery_ │ │ 开始计费 │ │ 上传签名 │
│ loading_items│ │ status 10→60 │ │ status 60→80 │
│ │ │ orders 50→60 │ │ orders 60→90 │
└──────────────┘ └──────────────┘ └──────┬───────┘
│
▼
┌──────────────┐
│ 触发财务结算 │
│ customer_ │
│ statements │
│ supplier_ │
│ statements │
└──────────────┘
```
## 10. 财务结算流 (Finance)
```
订单完成(status=90) / 手动触发
─────────────────────────────────
┌─────────────────────────────────────────────────────────────────────┐
│ finance/statement.go │
│ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 1. 供应商对账单 │ │
│ │ POST /api/workflow/finance/supplier-statements/generate │ │
│ │ ──▶ 按供应商汇总 supplier_preparations │ │
│ │ ──▶ INSERT supplier_statements │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 2. 客户对账单 │ │
│ │ POST /api/workflow/finance/customer-statements/generate │ │
│ │ ──▶ 按客户汇总 orders + order_items │ │
│ │ ──▶ INSERT customer_statements │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 3. 对账确认/争议 │ │
│ │ POST /api/workflow/finance/statement/confirm │ │
│ │ POST /api/workflow/finance/statement/dispute │ │
│ │ ──▶ 更新对账单状态 │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 4. 成本入账 │ │
│ │ POST /api/workflow/finance/cost/post-orders │ │
│ │ ──▶ 订单成本汇总 → cost_details │ │
│ │ ──▶ 采购成本 → invcost/ReconcileOrderPurchase │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 5. 其他成本 (杂费) │ │
│ │ POST /api/workflow/cost/free-cost │ │
│ │ ──▶ 配送员/采购员录入其他费用 │ │
│ │ ──▶ INSERT cost_details (cost_type='free_cost') │ │
│ │ ──▶ 凭证照片上传 + HMAC 签名 │ │
│ └──────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────────────────────────────────┐ │
│ │ 6. 账款催收 │ │
│ │ POST /api/workflow/finance/aging/scan │ │
│ │ GET /api/workflow/finance/collection-strategies │ │
│ │ ──▶ 逾期账款分析 → 催收策略 │ │
│ └──────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
```
## 11. 售后/退货流 (After-Sale)
```
客户小程序 Go 后端 DB
───────── ──────── ──
│ 申请售后 │
└────┬────┘
│ POST /api/mobile/customer-order/after-sales
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_order.go │ ──▶ │ orderentry/ │ ──▶ │ INSERT │
│ │ │ aftersale.go │ │ after_sale_orders │
│ │ │ CreateAfterSale() │ │ 退货/换货/退款 │
└─────────────────┘ └────────┬─────────┘ └──────────┬──────────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ 库存退回 │ │ 退款处理 │
│ inventory + │ │ finance │
│ 重新入库 │ │ 退款单 │
└──────────────┘ └──────────────┘
```
## 12. 质检报告流 (Quality Report)
```
供应商 H5 Go 后端 DB
───────── ──────── ──
│ 上传质检报告 │
└────┬──────┘
│ POST /api/supplier/quality-reports/library
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ supplier_api_ │ ──▶ │ supplierbiz/ │ ──▶ │ INSERT │
│ quality.go │ │ quality.go │ │ quality_reports │
│ │ │ UploadLibrary │ │ (报告类型+文件URL) │
│ │ │ QualityReport() │ │ validity_status │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│ 查看质检报告
│ GET /api/supplier/quality-reports
▼
┌─────────────────┐ ┌──────────────────┐
│ supplier_api_ │ ──▶ │ supplierbiz/ │
│ quality.go │ │ quality.go │
│ │ │ ListQuality │
│ │ │ Reports() │
└─────────────────┘ └──────────────────┘
```
## 13. 竞价流 (Bid)
```
供应商 H5 Go 后端 DB
───────── ──────── ──
│ 查看竞价邀约 │
└────┬──────┘
│ GET /api/supplier/bids
▼
┌─────────────────┐ ┌──────────────────┐
│ supplier_api_ │ ──▶ │ workflow/ │
│ bids.go │ │ bid.go │
│ │ │ ListSupplierBid │
│ │ │ Invitations() │
└─────────────────┘ └────────┬─────────┘
│ SELECT bid_rounds
│ JOIN bid_invitations
│ WHERE supplier_code = ?
▼
┌──────────────┐
│ 返回竞价列表 │
└──────┬───────┘
│
│ 查看竞价详情
│ GET /api/supplier/bids/:id
▼
┌─────────────────┐ ┌──────────────────┐
│ supplier_api_ │ ──▶ │ 查询 bid_rounds │
│ bids.go │ │ + bid_items │
│ │ │ + bid_quotes │
└─────────────────┘ └──────────────────┘
│ 提交报价
│ POST /api/supplier/bids/:id/quotes
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ supplier_api_ │ ──▶ │ workflow/ │ ──▶ │ INSERT/UPDATE │
│ bids.go │ │ bid.go │ │ bid_quotes │
│ │ │ SubmitBidQuotes() │ │ (报价价格+备注) │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
```
## 14. 库存管理流 (Inventory)
```
仓管/采购员 Go 后端 DB
───────── ──────── ──
│ 入库登记 │
└────┬────┘
│ POST /api/mobile/inventory/stock-in
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_inventory │ ──▶ │ stockin/ │ ──▶ │ INSERT inventory │
│ .go │ │ inbound.go │ │ (批次号+数量+成本) │
│ │ │ StockIn() │ │ 更新库存可用量 │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│ 库存覆盖 (分配时)
│ 自动触发
▼
┌─────────────────┐ ┌──────────────────┐
│ allocation/ │ ──▶ │ 查询 inventory │
│ engine.go │ │ 可用库存覆盖 │
│ │ │ 减少自采需求 │
└─────────────────┘ └──────────────────┘
```
## 15. 商品目录流 (Catalog)
```
Web 管理端 Go 后端 DB
───────── ──────── ──
│ 商品建档 │
└────┬────┘
│ POST /api/mobile/catalog/products
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ mobile_inventory │ ──▶ │ catalog/ │ ──▶ │ UPSERT skus │
│ .go │ │ product.go │ │ UPSERT product_ │
│ │ │ CreateProduct() │ │ catalog │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│ 税务编码查询
│ GET /api/tax-code/search
│ GET /api/tax-code/suggest
▼
┌─────────────────┐ ┌──────────────────┐
│ catalog.go │ ──▶ │ 本地税收分类编码库 │
│ │ │ 搜索/匹配 │
└─────────────────┘ └──────────────────┘
```
## 16. 用户认证流 (Auth)
```
所有客户端 Go 后端 DB
───────── ──────── ──
│ 登录 │
│ POST /api/mobile/login │ POST /api/auth/token
│ POST /api/supplier/login │ POST /api/auth/unified-login
└────┬───┘
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ auth/ │ ──▶ │ auth/ │ ──▶ │ SELECT users │
│ jwt.go │ │ login.go │ │ 验证密码/手机号 │
│ Parse() │ │ 生成 JWT token │ │ 返回用户信息 │
└─────────────────┘ └────────┬─────────┘ └─────────────────────┘
│
▼
┌──────────────┐
│ JWT 中间件 │
│ authMiddleware│
│ 解析 Bearer │
│ 注入 Claims │
└──────┬───────┘
│
▼
┌──────────────┐
│ 租户上下文 │
│ tenant/ │
│ 多租户隔离 │
│ 分公司权限 │
└──────────────┘
```
## 17. 通知流 (Notification)
```
系统事件触发 Go 后端 外部
───────── ──────── ──
│ 订单状态变更 │
│ 备货通知 │
│ 配送提醒 │
└────┬───────┘
▼
┌─────────────────┐ ┌──────────────────┐
│ 各业务模块 │ ──▶ │ notify/ │
│ delivery/ │ │ notify.go │
│ advance.go │ │ 站内通知 │
│ inspection/ │ │ 写入 notifications│
│ advance.go │ │ 表 │
└─────────────────┘ └────────┬─────────┘
│
▼
┌──────────────┐ ┌──────────────┐
│ 站内通知 │ │ 微信订阅通知 │
│ GET /mobile/ │ │ (Node.js) │
│ notifications │ │ 模板消息推送 │
└──────────────┘ └──────────────┘
```
## 18. 审计日志流 (Audit)
```
关键操作触发 Go 后端 DB
───────── ──────── ──
│ 订单编辑 │
│ 分配完成 │
│ 状态推进 │
│ 财务操作 │
└────┬───┘
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ 各业务模块 │ ──▶ │ httpapi/ │ ──▶ │ INSERT │
│ (调用 AuditLog │ │ audit.go │ │ operation_logs │
│ Quick) │ │ WriteAuditLog() │ │ operator_id │
│ │ │ │ │ operation_type │
│ │ │ │ │ old_value/new_value │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
```
## 19. 文件存储流 (Storage)
```
所有客户端 Go 后端 OSS/S3
───────── ──────── ──────
│ 上传图片 │
└────┬────┘
│ POST /api/storage/:bucket/upload
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ storage_api.go │ ──▶ │ storage/ │ ──▶ │ 上传到 OSS/S3 │
│ │ │ oss.go │ │ delivery-photos/ │
│ │ │ SaveBase64Upload()│ │ inspection-photos/ │
│ │ │ │ │ invoices/ │
│ │ │ │ │ sku-images/ │
│ │ │ │ │ quality-reports/ │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│ 读取图片
│ GET /api/storage/:bucket/public/:folder/:filename?exp=&sig=
▼
┌─────────────────┐ ┌──────────────────┐
│ storage_api.go │ ──▶ │ HMAC 签名校验 │
│ │ │ verifyStorage │
│ │ │ Signature() │
│ │ │ 从 OSS 读取 │
└─────────────────┘ └──────────────────┘
```
## 20. 仪表板/统计流 (Dashboard)
```
Web 管理端 Go 后端 DB
───────── ──────── ──
│ 仪表板概览 │
└────┬──────┘
│ GET /api/dashboard
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ admin_business │ ──▶ │ 聚合查询: │ │ COUNT orders │
│ .go │ │ 待处理订单数 │ │ COUNT preparations │
│ handleDashboard │ │ 待配送任务数 │ │ COUNT inspections │
│ │ │ 待验收数 │ │ COUNT delivery_ │
│ │ │ │ │ tasks │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│ 操作队列
│ GET /api/dashboard/action-queue
▼
┌─────────────────┐ ┌──────────────────┐
│ admin_business │ ──▶ │ 待分配订单 │
│ .go │ │ 待配送任务 │
│ │ │ 待验收记录 │
└─────────────────┘ └──────────────────┘
```
## 21. 客户管理流 (Customer)
```
Web 管理端 Go 后端 DB
───────── ──────── ──
│ 客户列表 │
└────┬────┘
│ GET /api/accounts (含客户)
▼
┌─────────────────┐ ┌──────────────────┐
│ admin_business │ ──▶ │ SELECT customers │
│ .go │ │ 预算/授信/状态 │
└─────────────────┘ └──────────────────┘
│ 客户登录账号
│ POST /api/accounts/customers/:code/login-account
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ accounts.go │ ──▶ │ ensureAccount() │ ──▶ │ INSERT users │
│ │ │ 查找或创建用户 │ │ role_type='customer'│
└─────────────────┘ └──────────────────┘ └─────────────────────┘
```
## 22. 供应商管理流 (Supplier)
```
Web 管理端 Go 后端 DB
───────── ──────── ──
│ 供应商列表 │
└────┬────┘
│ GET /api/suppliers
▼
┌─────────────────┐ ┌──────────────────┐
│ admin_business │ ──▶ │ SELECT suppliers │
│ .go │ │ 评分/状态/联系人 │
└─────────────────┘ └──────────────────┘
│ 供应商集成客户端
│ POST /api/suppliers/integration-clients
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ admin_suppliers │ ──▶ │ INSERT supplier_ │
│ .go │ │ integration_ │
│ │ │ clients │
│ │ │ (client_id+secret)│
└─────────────────┘ └──────────────────┘
│ 供应商 OAuth
│ POST /api/supplier/oauth/token
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ supplier_api.go │ ──▶ │ 验证 client_id │ ──▶ │ 返回 JWT token │
│ │ │ + client_secret │ │ scope=supplier_ │
│ │ │ │ │ integration │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
```
## 23. 数据查询/导出流 (Data API)
```
Web 管理端 Go 后端 DB
───────── ──────── ──
│ 数据查询 │
└────┬────┘
│ POST /api/data/query
▼
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────────┐
│ data_access.go │ ──▶ │ queryexec/ │ ──▶ │ 动态 SQL 查询 │
│ │ │ 权限校验 │ │ 表级别权限控制 │
│ │ │ 表白名单 │ │ 只读操作 │
└─────────────────┘ └──────────────────┘ └─────────────────────┘
│ 批量操作
│ POST /api/data/batch
▼
┌─────────────────┐ ┌──────────────────┐
│ data_access.go │ ──▶ │ 批量 INSERT/ │
│ │ │ UPDATE/DELETE │
│ │ │ 事务内执行 │
└─────────────────┘ └──────────────────┘
```
## 24. 完整数据流总览
```
┌─────────────────────────────────────────────────────────────┐
│ 请求入口 (httpapi) │
│ │
│ /mobile/* /workflow/* /api/* /supplier/* │
└──────────────────────────┬──────────────────────────────────┘
│
┌────────────┬────────────┬──────────┬───────┼───────┬──────────┬────────────┬──┐
▼ ▼ ▼ ▼ │ ▼ ▼ ▼ │
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ ┌─────────┐ ┌─────────┐ ┌────────┐
│ 订单录入 │ │ 订单管理 │ │ 配送管理 │ │ 采购管理 │ │ │ 验收管理 │ │ 分拣管理 │ │ 加工管理│
│orderentry│ │orderadmin│ │ delivery │ │ purchase │ │ │inspection│ │ picking │ │processing│
└────┬─────┘ └────┬─────┘ └────┬─────┘ └────┬─────┘ │ └────┬─────┘ └────┬─────┘ └────┬────┘
│ │ │ │ │ │ │ │
▼ ▼ ▼ ▼ │ ▼ ▼ ▼
┌────────────────────────────────────────────────────┼────────────────────────────────────┐
│ 共享数据层 │ │
│ │ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ ┌──────────┐ ┌──────────┐ │
│ │ 订单域 │ │ 履约域 │ │ 仓储域 │ │ │ 配送域 │ │ 财务域 │ │
│ │ orders │ │ supplier │ │inspection│ │ │ delivery │ │ statements│ │
│ │ order_ │ │ _prepa- │ │ picking │ │ │ _tasks │ │ cost_ │ │
│ │ items │ │ rations │ │ _tasks │ │ │ loading │ │ details │ │
│ │ fulfill │ │ purchase │ │ process │ │ │ sign │ │ operation │ │
│ │ ments │ │ _orders │ │ _tasks │ │ │ │ │ _logs │ │
│ └──────────┘ └──────────┘ └──────────┘ │ └──────────┘ └──────────┘ │
│ │ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ ┌──────────┐ ┌──────────┐ │
│ │ 供应商域 │ │ 客户域 │ │ 商品域 │ │ │ 用户域 │ │ 配置域 │ │
│ │suppliers │ │customers │ │ skus │ │ │ users │ │ system_ │ │
│ │ quality │ │ accounts │ │ catalog │ │ │ roles │ │ configs │ │
│ │ bids │ │ │ │ tax │ │ │ profiles │ │ branches │ │
│ └──────────┘ └──────────┘ └──────────┘ │ └──────────┘ └──────────┘ │
└────────────────────────────────────────────────────┴────────────────────────────────────┘
│
▼
┌──────────────────┐
│ OSS/S3 文件存储 │
│ 5 个桶 │
└──────────────────┘
```