38 lines
995 B
Go
38 lines
995 B
Go
package schema
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
"entgo.io/ent/schema/index"
|
||
|
|
)
|
||
|
|
|
||
|
|
// SemiFlow 半成品流转记录(同步 WMS 半成品出入库)
|
||
|
|
type SemiFlow struct {
|
||
|
|
ent.Schema
|
||
|
|
}
|
||
|
|
|
||
|
|
func (SemiFlow) Fields() []ent.Field {
|
||
|
|
return []ent.Field{
|
||
|
|
field.String("order_no").Optional(),
|
||
|
|
field.String("sn").Comment("半成品SN"),
|
||
|
|
field.String("material_code").Optional(),
|
||
|
|
field.String("completed_process").Optional().Comment("已完成工序,如 1-2-5"),
|
||
|
|
field.String("zone_code").Optional().Comment("目标库区 Z02 等"),
|
||
|
|
field.Enum("action").
|
||
|
|
Values("inbound", "outbound").
|
||
|
|
Default("inbound").Comment("入库暂存/出库重上线"),
|
||
|
|
field.Bool("wms_ok").Default(false).Comment("WMS 同步是否成功"),
|
||
|
|
field.String("resp_text").Optional().Comment("WMS 响应摘要"),
|
||
|
|
field.Time("created_at").Default(time.Now),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (SemiFlow) Indexes() []ent.Index {
|
||
|
|
return []ent.Index{
|
||
|
|
index.Fields("order_no"),
|
||
|
|
index.Fields("sn"),
|
||
|
|
}
|
||
|
|
}
|