Files
bj_power/bj_power_wms/README.md
T
2026-08-28 15:06:01 +08:00

73 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_batch.go # 结构件批次台账
│ ├── serial_number.go # 精密件/成品 SN
│ ├── 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 提供) |