初始化
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
|
||||
// BomItem 产品 BOM 明细
|
||||
// unitQty = 单台产品对该物料的需求量;isSuite=true 表示该项是套件(组合件),
|
||||
// 其子物料行通过 suite_of 指向套件的物料编码。
|
||||
type BomItem struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (BomItem) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("product_code").Comment("产品型号编码"),
|
||||
field.String("material_code").Comment("物料编码"),
|
||||
field.String("material_name").Optional(),
|
||||
field.Int("unit_qty").Default(1).Comment("单台需求量"),
|
||||
field.Bool("is_suite").Default(false).Comment("是否套件本身"),
|
||||
field.String("suite_of").Optional().Comment("属于哪个套件(空=直属产品)"),
|
||||
field.Time("created_at").Default(time.Now).Immutable(),
|
||||
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
|
||||
}
|
||||
}
|
||||
|
||||
func (BomItem) Indexes() []ent.Index {
|
||||
return []ent.Index{
|
||||
index.Fields("product_code"),
|
||||
index.Fields("material_code"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user