Files
bj_power/bj_power_mes/schema/association_trace.go
T
SunYF 1f7a42fc38 refactor(mes): 移除工位接驳台绑定逻辑,改为独立dock主数据
- 移除station表的hasDock、dockCode字段及相关代码
- 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台
- 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式
- 新增SQL注释固化脚本,完善MES表注释
2026-10-08 13:09:53 +08:00

43 lines
1.4 KiB
Go

package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// AssociationTrace 成品追溯关联:成品SN ↔ 结构件批次 + 电气件SN
type AssociationTrace struct {
ent.Schema
}
func (AssociationTrace) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "association_trace"}, entsql.WithComments(true), schema.Comment("AssociationTrace 成品追溯关联:成品SN ↔ 结构件批次 + 电气件SN")}
}
func (AssociationTrace) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.String("finishedSn").Unique().MaxLen(64).Comment("成品SN(主件)"),
field.String("orderNo").Default("").MaxLen(64),
field.String("processCode").Default("").MaxLen(64).Comment("成品的工序组合"),
field.JSON("batchItems", []string{}).Optional().SchemaType(map[string]string{
dialect.Postgres: "jsonb",
}).Comment("结构件批次号列表"),
field.JSON("serialItems", []string{}).Optional().SchemaType(map[string]string{
dialect.Postgres: "jsonb",
}).Comment("电气件SN码列表"),
field.String("operator").Default("").MaxLen(64).Comment("完工关联登记人"),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (AssociationTrace) Indexes() []ent.Index {
return []ent.Index{index.Fields("finishedSn").Unique()}
}