- 新增区域状态字段与增删改查接口,支持区域启用/停用 - 重构实体字段JSON标签为camelCase格式统一接口规范 - 优化入库、盘点、装箱流程的交互与提示文案 - 新增装箱管理功能,支持合同号关联与装箱编辑 - 调整前端菜单与帮助文档适配业务场景变更
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/field"
|
|
"entgo.io/ent/schema/index"
|
|
)
|
|
|
|
// PackageBox 包装箱 ↔ SN 关联
|
|
type PackageBox struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (PackageBox) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.String("box_no").Unique().Comment("箱号"),
|
|
// 关联 SN 列表(逗号分隔)或 JSON
|
|
field.String("sn_list").Optional().Comment("箱内 SN 列表"),
|
|
field.String("material_code").Optional().Comment("物料编码"),
|
|
field.Int("quantity").Default(0).Comment("箱内数量"),
|
|
field.String("operator").Optional().Comment("包装人"),
|
|
field.String("contract_no").Optional().Comment("合同号(选填)"),
|
|
field.String("remark").Optional().Comment("备注"),
|
|
field.Int64("created_at").DefaultFunc(nowUnix),
|
|
field.Int64("updated_at").DefaultFunc(nowUnix).Optional().Comment("更新时间"),
|
|
}
|
|
}
|
|
|
|
func (PackageBox) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("material_code"),
|
|
index.Fields("contract_no"),
|
|
index.Fields("operator"),
|
|
}
|
|
}
|