43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package schema
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/dialect/entsql"
|
||
|
|
"entgo.io/ent/schema"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
"entgo.io/ent/schema/index"
|
||
|
|
)
|
||
|
|
|
||
|
|
// SemiFlow 半成品流转记录:记录已完成工序,调用 WMS /api/internal/semi/*
|
||
|
|
type SemiFlow struct {
|
||
|
|
ent.Schema
|
||
|
|
}
|
||
|
|
|
||
|
|
func (SemiFlow) Annotations() []schema.Annotation {
|
||
|
|
return []schema.Annotation{entsql.Annotation{Table: "semi_flow"}}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (SemiFlow) Fields() []ent.Field {
|
||
|
|
return []ent.Field{
|
||
|
|
field.Int("id").Positive(),
|
||
|
|
field.String("sn").MaxLen(64).Comment("工件SN"),
|
||
|
|
field.String("orderNo").Default("").MaxLen(64),
|
||
|
|
field.JSON("doneProcessCodes", []int{}).Optional().Comment("已完成工序码"),
|
||
|
|
// INBOUND / OUTBOUND
|
||
|
|
field.String("action").Default("INBOUND").MaxLen(20),
|
||
|
|
field.String("targetDock").Default("").MaxLen(20),
|
||
|
|
field.String("operator").Default("").MaxLen(64),
|
||
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (SemiFlow) Indexes() []ent.Index {
|
||
|
|
return []ent.Index{
|
||
|
|
index.Fields("sn"),
|
||
|
|
index.Fields("orderNo"),
|
||
|
|
index.Fields("action"),
|
||
|
|
}
|
||
|
|
}
|