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

47 lines
1.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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"
)
// Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ DOCK21(库房收货)。
// 接驳台真源在 MES(工位维护、AGV 通讯、排产推荐都查本表);仓库不维护接驳台。
// hasPallet 标记该接驳台当前是否有托盘:来源 PLC 托盘传感器 或 AGV 到位/卸货自动维护。
type Dock struct {
ent.Schema
}
func (Dock) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "dock"}, entsql.WithComments(true), schema.Comment("Dock 接驳台主数据:DOCK01~DOCK20(产线,DOCKn↔工位n)+ DOCK21(库房收货)。")}
}
func (Dock) Fields() []ent.Field {
return []ent.Field{
field.String("dockCode").Unique().MaxLen(20).Comment("接驳台编码 DOCK01..21"),
field.String("name").Default("").MaxLen(64).Comment("接驳台名称"),
// type: line(产线) / store(库房) / other(其他,如缓存区、线边暂存位)
field.String("dockType").Default("line").MaxLen(16).Comment("类型 line产线/store库房/other其他"),
// 关联工位(产线接驳台 DOCKn↔工位n,1:1);库房/其他接驳台不挂工位,为 0
field.Int("stationNo").Default(0).Comment("关联工位号(与工位1:1,非产线为0)"),
field.Bool("hasPallet").Default(false).Comment("当前是否有托盘"),
// 有托盘时的关联出库/任务(便于查这个托盘是哪批料、要送到哪)
field.String("palletRef").Default("").MaxLen(64).Optional().Comment("托盘关联(出库单号/备料单号)"),
// ENABLED / DISABLED
field.String("status").Default("ENABLED").MaxLen(20),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (Dock) Indexes() []ent.Index {
return []ent.Index{
index.Fields("dockCode").Unique(),
index.Fields("dockType"),
}
}