Files
bj_power/bj_power_wms/README.md
T
SunYF 68f50ee46e refactor(wms): 合并库存表为统一inventory,重构业务逻辑
1. 合并inventory_batch与serial_number为统一inventory表,用manage_mode区分结构件批次/精密件SN
2. 移除冗余的material_type字段与相关逻辑
3. 重构库存查询、检验、入库出库等业务逻辑适配新表结构
4. 调整前端路由与菜单,拆分基础数据为区域维护和物料档案
5. 优化入库校验逻辑,避免空单问题
6. 调整Vite构建配置,关闭自动清空输出目录
7. 为各模块添加详细中文注释,统一业务术语
8. 生成并更新Ent自动代码文件
2026-09-02 08:21:11 +08:00

72 lines
2.7 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.
# bj_power_wms(项目 C)— WMS 仓库系统
> 纯 Go 后端 API 服务,不包含前端。前端由项目 Ebj_power_wms_client)提供。
## 技术栈
- Go 1.25 + go-zero 1.8.3REST 框架)
- Ent ORM v0.14.5(自动建表/迁移)
- PostgreSQL(独立库 `bj_power_wms`
## 目录结构
```
bj_power_wms/
├── bj_power_wms.go # 主入口
├── etc/bj_power_wms-api.yaml # 配置文件
├── schema/ # Ent schema(业务表定义)
│ ├── material.go # 物料档案(精密件 SN / 结构件批次)
│ ├── zone.go # 库房区域
│ ├── inventory.go # 统一库存表(结构件批次 + 精密件 SN,manage_mode 区分)
│ ├── inventory_lock.go # 库存锁定(工单锁库存)
│ ├── inbound_order.go # 入库单 + inbound_detail 明细
│ ├── outbound_order.go # 出库单 + outbound_detail 明细
│ ├── inspection_record.go # 检验记录
│ ├── semi_finished.go # 半成品库存
│ ├── package_box.go # 包装箱 ↔ SN
│ ├── order_material_ledger.go # 工单物料台账(出库强约束)
│ └── user.go # 用户
├── ent/ # Ent 生成代码(勿手改)
├── internal/
│ ├── config/ # 配置结构
│ ├── db/ # 数据库连接 + 自动迁移
│ ├── svc/ # ServiceContext
│ └── handler/ # HTTP handlerAPI 层)
└── tools/ # ent 代码生成工具
```
## 常用命令
```bash
# 生成 ent 代码(修改 schema 后执行)
go run tools/generate.go
# 启动服务
go run bj_power_wms.go -f etc/bj_power_wms-api.yaml
```
## 当前状态
- [x] 工程骨架(go-zero + Ent + PostgreSQL
- [x] 15 张核心表 schema + 自动迁移
- [x] 物料 CRUD / 区域
- [x] 入库(结构件批次 + 精密件 SN)
- [x] 出库扣减(含工单物料台账强约束:累计出库 ≤ BOM 需求)
- [x] 库存查询 / 锁定 / 解锁 / 校验
- [x] 检验(单条 + 批量翻转)
- [x] 半成品出入库 / 包装绑定
- [ ] 登录鉴权(JWT
- [ ] Excel 批量导入
- [ ] 盘点
- [ ] 追溯查询
## 对外 APIB ↔ C 联动)
| 接口 | 说明 |
| --- | --- |
| `POST /api/stock/lock` | 工单锁定库存(批次/SN),带 order_no |
| `POST /api/stock/deduct` | 出库扣减,WMS 校验累计 ≤ BOM |
| `GET /api/stock/query` | 库存查询(MES 查料) |
| `POST /api/semi/inbound` / `outbound` | 半成品入库/出库 |
| `GET /api/order/query` | 工单查询(待 MES 提供) |