fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean

This commit is contained in:
SunYF
2026-08-27 10:56:41 +08:00
parent 380715f8a9
commit 371b494c54
523 changed files with 67923 additions and 24758 deletions
+25 -22
View File
@@ -4,6 +4,7 @@ import (
"bj_power_mes/constants"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
@@ -11,47 +12,49 @@ import (
"entgo.io/ent/schema/index"
)
// RecipeStep 工�定义,工艺路线中的�个加工步骤�
//
// 设计原则:步骤的走��Scheduler 层实时决策,�通过 JSON 字段�置分支逻辑�
// nextStepDefault �供默认下一跳,Scheduler �Generator/Filter �在�行时根�系统状�覆盖�
// RecipeStep 工序定义
// 第一阶段:以 stepId 为业务步骤标识,stepIndex 仅保留为排序字段。
type RecipeStep struct {
ent.Schema
}
func (RecipeStep) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{
Table: "recipe_step",
Options: "COMMENT='工�定义表,工艺路线中的�个加工步骤'",
},
entsql.WithComments(true),
entsql.Annotation{Table: "recipe_step"},
}
}
func (RecipeStep) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive().Comment("主键ID"),
field.Int("recipeId").Comment("所属工艺路线ID"),
field.String("stepId").MaxLen(20).Default("").Comment("业务步骤ID,如 OP10/OP20"),
field.Int("id").Positive(),
field.Int("recipeId").Comment("工艺路线ID"),
field.String("stepId").MaxLen(20).Default("").Comment("业务步骤ID"),
field.String("stepName").MaxLen(50).Comment("工序名称"),
field.Int("stepIndex").Comment("工���"),
field.Int("stepIndex").Comment("工序序号(排序字段)"),
field.Enum("stepType").
GoType(constants.StepType("")).
Comment("工�类型:OPERATION/BUFFER_STAGE/AIR_BLOW/LOAD_DOCK/UNLOAD_DOCK"),
field.String("resourceType").Default("").Comment("目标设备类型编�,如 GRINDER/FULL_CHECK,手��作时�为�),
field.String("nextStepDefault").Default("").Comment("默认下一步stepId,正常æµ�转æ—的目标步éª?),
field.Int("priority").Default(2).Comment("调度优先级,数值越�越优先(磨床�料等高优先),trySchedule 按当�步骤优先级排�"),
field.Int("timeoutSeconds").Default(-1).Comment("超时秒数�1=一致监�轮询兜底(�超时),0=�超时,>0=超时秒数"),
field.Bool("holdUntilHandover").Default(false).Comment("本步骤完��是�挂起等待交接(�料场景:磨完的工件等下一件��料交接,状�进�holding,�自动推进�),
field.String("fallbackNextStep").MaxLen(20).Default("").Comment("holding 挂起æ—若无å�Žç»§å·¥ä»äº¤æŽ¥ï¼Œèµ°æ­¤æ­¥éª¤æ”尾(如最å�Žä¸€ä»è‡ªè¡Œå�–料)"),
field.String("desc").Default("").Comment("工��述"),
Comment("工序类型"),
field.String("resourceType").Default("").Comment("工站设备类型(手持操作可为空)"),
field.String("toolType").Default("").Comment("手持工具类型:SCANNER, LASER"),
field.JSON("allowedResources", []string{}).Optional().SchemaType(map[string]string{
dialect.Postgres: "jsonb",
}).Comment("允许的设备ID列表"),
field.JSON("processingParams", map[string]any{}).Optional().SchemaType(map[string]string{
dialect.Postgres: "jsonb",
}).Comment("加工参数"),
field.String("nextStepDefault").Default("").Comment("默认下一步 stepId"),
field.JSON("nextStepBranches", map[string]any{}).Optional().SchemaType(map[string]string{
dialect.Postgres: "jsonb",
}).Comment("条件分支:条件→stepId"),
field.Int("stepTimeout").Default(0).Comment("工序超时秒数"),
field.Int("restoreStep").Default(-1).Comment("恢复时回退步数(-1=不回退)"),
field.String("desc").Default("").Comment("描述"),
}
}
func (RecipeStep) Edges() []ent.Edge {
return []ent.Edge{
edge.From("recipe", Recipe.Type).Ref("steps").Field("recipeId").Unique().Required().Comment("所属工艺路�),
edge.From("recipe", Recipe.Type).Ref("steps").Field("recipeId").Unique().Required(),
}
}