2026-08-28 15:06:01 +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
|
|
|
// ProcessStep 工序步骤模板:一份工艺流程包含多个采集/考核步骤(按 seq 顺序执行)
|
2026-08-28 15:06:01 +08:00
|
|
|
type ProcessStep struct {
|
|
|
|
|
ent.Schema
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ProcessStep) Annotations() []schema.Annotation {
|
|
|
|
|
return []schema.Annotation{entsql.Annotation{Table: "process_step"}}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ProcessStep) Fields() []ent.Field {
|
|
|
|
|
return []ent.Field{
|
|
|
|
|
field.Int("id").Positive(),
|
2026-09-10 16:59:15 +08:00
|
|
|
field.Int("flowId").Optional().Comment("所属工艺流程图ID"),
|
2026-08-28 15:06:01 +08:00
|
|
|
field.Int("seq").Default(1).Comment("步骤序号"),
|
|
|
|
|
field.String("name").MaxLen(128).Comment("步骤名称"),
|
|
|
|
|
field.String("collectType").Default("NONE").MaxLen(20).Comment("AUTO/MANUAL/NONE"),
|
|
|
|
|
field.Bool("isTorque").Default(false).Comment("是否拧紧采集"),
|
2026-09-10 16:59:15 +08:00
|
|
|
field.Bool("needCheck").Default(false).Comment("是否需要检测确认(报工前须检验通过)"),
|
2026-08-28 15:06:01 +08:00
|
|
|
field.String("remark").Default("").MaxLen(255),
|
|
|
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (ProcessStep) Indexes() []ent.Index {
|
2026-08-31 08:06:55 +08:00
|
|
|
return []ent.Index{
|
|
|
|
|
index.Fields("flowId"),
|
|
|
|
|
}
|
2026-08-28 15:06:01 +08:00
|
|
|
}
|