chore: init bj_power monorepo (dashboard/mes/wms/wms_client/workstation), clear subproject git metadata and align naming to folder names

This commit is contained in:
SunYF
2026-08-27 10:09:54 +08:00
commit 1f0ee844a4
408 changed files with 102201 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
package schema
import (
"bj_power_mes/constants"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// RecipeStep 工�定义,工艺路线中的�个加工步骤�
//
// 设计原则:步骤的走��Scheduler 层实时决策,�通过 JSON 字段�置分支逻辑�
// nextStepDefault �供默认下一跳,Scheduler �Generator/Filter �在�行时根�系统状�覆盖�
type RecipeStep struct {
ent.Schema
}
func (RecipeStep) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{
Table: "recipe_step",
Options: "COMMENT='工�定义表,工艺路线中的�个加工步骤'",
},
entsql.WithComments(true),
}
}
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.String("stepName").MaxLen(50).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("工��述"),
}
}
func (RecipeStep) Edges() []ent.Edge {
return []ent.Edge{
edge.From("recipe", Recipe.Type).Ref("steps").Field("recipeId").Unique().Required().Comment("所属工艺路�),
}
}
func (RecipeStep) Indexes() []ent.Index {
return []ent.Index{
index.Fields("recipeId", "stepIndex").Unique(),
index.Fields("recipeId", "stepId").Unique(),
}
}