Files
bj_power/bj_power_wms/schema/serial_number.go
T

38 lines
1.2 KiB
Go
Raw Normal View History

2026-08-28 15:06:01 +08:00
package schema
import (
"entgo.io/ent"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// SerialNumber 精密件/成品 单件管理
type SerialNumber struct {
ent.Schema
}
func (SerialNumber) Fields() []ent.Field {
return []ent.Field{
field.String("sn_code").Unique().Comment("序列号"),
field.String("material_code").Comment("物料编码"),
field.String("batch_no").Optional().Comment("所属批次"),
// 状态:在库/锁定/出库/使用/报废
field.String("status").Default("在库").Comment("在库/锁定/出库/使用/报废"),
field.String("current_zone").Optional().Comment("当前区域"),
field.String("quality_status").Default("未检").Comment("检验状态 未检/合格/不合格"),
field.String("last_inbound_at").Optional().Comment("最近入库时间"),
field.String("last_outbound_at").Optional().Comment("最近出库时间"),
field.String("remark").Optional().Comment("备注"),
field.Int64("created_at").DefaultFunc(nowUnix),
field.Int64("updated_at").DefaultFunc(nowUnix),
}
}
func (SerialNumber) Indexes() []ent.Index {
return []ent.Index{
index.Fields("material_code"),
index.Fields("status"),
index.Fields("batch_no"),
}
}