36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package schema
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/dialect/entsql"
|
||
|
|
"entgo.io/ent/schema"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ProcessRoute 工艺路线:产品的有序「并行工位段」序列。
|
||
|
|
// 一段 = 一个工艺流程图(flowId) + 一组并行工位(stations) + 段序号(seq)。
|
||
|
|
// 0/13 段为线下位(OFFLINE),不连 PLC。路线被工单引用,工单落地时存段快照。
|
||
|
|
type ProcessRoute struct {
|
||
|
|
ent.Schema
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ProcessRoute) Annotations() []schema.Annotation {
|
||
|
|
return []schema.Annotation{entsql.Annotation{Table: "process_route"}}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ProcessRoute) Fields() []ent.Field {
|
||
|
|
return []ent.Field{
|
||
|
|
field.Int("id").Positive(),
|
||
|
|
field.String("name").MaxLen(128).Comment("路线名称,如 标准型-A路线"),
|
||
|
|
// 关联产品型号(可空:通用路线不绑定具体型号)
|
||
|
|
field.Int("productTypeId").Optional().Comment("关联产品型号ID(空=通用路线)"),
|
||
|
|
// ACTIVE / INACTIVE
|
||
|
|
field.String("status").Default("ACTIVE").MaxLen(20),
|
||
|
|
field.String("remark").Default("").MaxLen(255),
|
||
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
||
|
|
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
|
||
|
|
}
|
||
|
|
}
|