2026-08-31 08:06:55 +08:00
|
|
|
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"
|
|
|
|
|
)
|
|
|
|
|
|
2026-09-10 16:59:15 +08:00
|
|
|
// ProcessFlow 工艺流程图(菜谱):描述"这个工位怎么干",承载工艺图纸 PDF + 工序步骤模板。
|
|
|
|
|
// 一份流程可被任意工位绑定,绑定关系由 station.flow_id 维护(「关联工位」页);
|
|
|
|
|
// 执行顺序由工单的工位组合 work_order.process_seq 决定,与流程本身无关。
|
2026-08-31 08:06:55 +08:00
|
|
|
type ProcessFlow struct {
|
|
|
|
|
ent.Schema
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ProcessFlow) Annotations() []schema.Annotation {
|
|
|
|
|
return []schema.Annotation{entsql.Annotation{Table: "process_flow"}}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ProcessFlow) Fields() []ent.Field {
|
|
|
|
|
return []ent.Field{
|
|
|
|
|
field.Int("id").Positive(),
|
2026-09-10 16:59:15 +08:00
|
|
|
field.String("name").MaxLen(128).Comment("流程名称,如 3号工位装配流程"),
|
2026-08-31 08:06:55 +08:00
|
|
|
field.String("pdfFile").Default("").MaxLen(255).Comment("工艺图纸文件名"),
|
|
|
|
|
// 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(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ProcessFlow) Indexes() []ent.Index {
|
|
|
|
|
return []ent.Index{
|
|
|
|
|
index.Fields("status"),
|
|
|
|
|
}
|
|
|
|
|
}
|