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
+66
View File
@@ -0,0 +1,66 @@
package schema
import (
"time"
"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"
)
// WorkOrder 工�,一次生产任务的下达指令
type WorkOrder struct {
ent.Schema
}
func (WorkOrder) Annotations() []schema.Annotation {
return []schema.Annotation{
entsql.Annotation{
Table: "work_order",
Options: "COMMENT='工�表,记录�次生产任务的下达指令:产��数��状�����完工统计'",
},
entsql.WithComments(true),
}
}
func (WorkOrder) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive().Comment("主键ID"),
field.Int("productTypeId").Comment("产�类型ID,决定生产的工件�类"),
field.Int("quantity").Default(1).Comment("工件计划数�,该工�需�生产的总件�),
field.Int("finishedNum").Default(0).Comment("已完�良�数�),
field.Int("failNum").Default(0).Comment("检测NG数�,加工或检测��格的件�),
field.Enum("status").
GoType(constants.WorkOrderStatus("")).
Default(string(constants.WorkOrderStatus_Created)).
Comment("å·¥å�•çŠæ€�:Created/InProgress/Paused/Completed/Cancelled/Error/Reported"),
field.Time("createdAt").Default(time.Now).Immutable().Comment("创建æ—é—´"),
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable().Comment("æ›´æ–°æ—é—´"),
field.Time("completedAt").Optional().Nillable().Comment("完工æ—间,所有工ä»åŠ å·¥å®Œæ¯•çš„æ—刻"),
field.Enum("source").
GoType(constants.WorkOrderSource("")).
Default(string(constants.WorkOrderSource_Manual)).
Comment("工���:Manual/MOM,标识工�的创建渠�"),
field.String("workOrderNo").Default("").Comment("工��,外部系统(MOM/ERP)传入的业务编�"),
field.Bool("isDel").Default(false).Comment("软删除标记:TRUE=已删除(删除工å�•æ—软删,ä¿�留审计数æ�®ï¼‰ï¼›æŸ¥è¯¢éœ€è¿‡æ»¤ is_del = FALSE"),
}
}
func (WorkOrder) Edges() []ent.Edge {
return []ent.Edge{
edge.From("productType", ProductType.Type).Ref("workOrders").Field("productTypeId").Unique().Required().Comment("产�类型"),
edge.To("jobs", Job.Type).Comment("å·¥å�•下的工ä»åˆ—表"),
}
}
func (WorkOrder) Indexes() []ent.Index {
return []ent.Index{
index.Fields("status"),
index.Fields("productTypeId"),
}
}