本提交完成了WMS系统的多维度优化升级: 1. 新增RBAC权限系统,支持角色/菜单/按钮三级权限管控 2. 重构库存盘点、物料管理、区域维护等模块的查询筛选与展示逻辑 3. 优化入库/出库/质检等业务流程,完善数据冗余与业务闭环 4. 移除旧装箱表,将装箱逻辑合并到出库主表 5. 新增前端权限判断工具、导出工具与端到端测试用例 6. 补充完善各类注释与数据库字段说明
49 lines
2.2 KiB
Go
49 lines
2.2 KiB
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
"entgo.io/ent/schema/index"
|
|
)
|
|
|
|
// OutboundOrder 出库统一主表
|
|
// 所有出库(备料出库 workorder / 通用出库 general / 装箱)都落在这一张表,
|
|
// 用 outbound_type 区分;装箱属性(箱号/SN清单/合同号)直接存本表,不再单独建装箱表。
|
|
// 备料出库强约束:累计出库 ≤ 工单 BOM 需求量(由 MES 校验),WMS 侧校验 order_no 对应台账。
|
|
type OutboundOrder struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (OutboundOrder) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("outbound_no").Unique().Comment("出库单号"),
|
|
// 类型:workorder(工单领料/MES) general(通用出库,不依赖工单)
|
|
field.String("outbound_type").Default("workorder").Comment("出库类型"),
|
|
field.String("order_no").Optional().Comment("关联工单号(工单为唯一挂靠载体)"),
|
|
field.String("material_code").Comment("物料编码"),
|
|
field.String("material_name").Optional().Comment("物料名称(冗余)"),
|
|
field.Int("manage_mode").Default(1).Comment("管理粒度 1批次/2序列号"),
|
|
field.String("batch_no").Optional().Comment("批次号(结构件)"),
|
|
field.String("zone_code").Optional().Comment("出库区域"),
|
|
field.Int("quantity").Default(0).Comment("本次出库总数量"),
|
|
field.String("operator").Optional().Comment("操作人"),
|
|
field.String("reviewer").Optional().Comment("复核人"),
|
|
field.String("target_dock").Optional().Comment("目标接驳台(AGV配送)"),
|
|
field.String("remark").Optional().Comment("备注"),
|
|
// 装箱属性:出库时一并记录箱号/SN清单/合同号,统一落在出库主表,不再单独建装箱表
|
|
field.String("box_no").Optional().Comment("箱号(装箱出库时填写,用于整箱发货追溯)"),
|
|
field.String("box_sn_list").Optional().Comment("装箱 SN 清单(JSON 数组字符串)"),
|
|
field.String("contract_no").Optional().Comment("合同号(装箱选填)"),
|
|
field.Int64("created_at").DefaultFunc(nowUnix).Comment("创建时间"),
|
|
}
|
|
}
|
|
|
|
func (OutboundOrder) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("order_no"),
|
|
index.Fields("material_code"),
|
|
index.Fields("outbound_type"),
|
|
index.Fields("box_no"),
|
|
}
|
|
}
|