初始化
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// InventoryBatch 结构件批次台账
|
||||
type InventoryBatch struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InventoryBatch) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("batch_no").Unique().Comment("批次号(系统自动生成:日期+自增)"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.String("material_name").Optional().Comment("物料名称(冗余)"),
|
||||
field.Int("quantity").Default(0).Comment("当前可用数量"),
|
||||
field.Int("locked_qty").Default(0).Comment("已锁定数量"),
|
||||
field.String("production_date").Optional().Comment("生产日期"),
|
||||
field.String("supplier").Optional().Comment("供应商"),
|
||||
field.String("quality_status").Default("未检").Comment("检验状态 未检/合格/不合格"),
|
||||
field.String("zone_code").Optional().Comment("所在区域"),
|
||||
field.String("remark").Optional().Comment("备注"),
|
||||
field.Int64("created_at").DefaultFunc(nowUnix),
|
||||
field.Int64("updated_at").DefaultFunc(nowUnix),
|
||||
}
|
||||
}
|
||||
|
||||
func (InventoryBatch) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("material_code"),
|
||||
index.Fields("quality_status"),
|
||||
index.Fields("zone_code"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user