- 移除station表的hasDock、dockCode字段及相关代码 - 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台 - 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式 - 新增SQL注释固化脚本,完善MES表注释
42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
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"
|
|
)
|
|
|
|
// StationState 工位运行状态(当日有效):工人自主 停止接单/恢复接单。
|
|
// 停单后上位机不再向该工位下发工件流转指令;某工艺全部工位停单=工件目的地不可达,报警。
|
|
// 跨天自动失效(只认当天记录),次日默认全部恢复接单。
|
|
type StationState struct {
|
|
ent.Schema
|
|
}
|
|
|
|
func (StationState) Annotations() []schema.Annotation {
|
|
return []schema.Annotation{entsql.Annotation{Table: "station_state"}, entsql.WithComments(true), schema.Comment("StationState 工位运行状态(当日有效):工人自主 停止接单/恢复接单。")}
|
|
}
|
|
|
|
func (StationState) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int("id").Positive(),
|
|
field.Int("stationNo").Comment("工位号"),
|
|
field.String("date").MaxLen(10).Comment("生效日期 yyyy-MM-dd(只认当天)"),
|
|
field.Bool("paused").Default(false).Comment("是否停止接单"),
|
|
field.String("reason").Default("").MaxLen(255).Comment("停单原因(缺料/故障/其他)"),
|
|
field.String("operator").Default("").MaxLen(64).Comment("操作人"),
|
|
field.Time("createdAt").Default(time.Now).Immutable(),
|
|
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
|
|
}
|
|
}
|
|
|
|
func (StationState) Indexes() []ent.Index {
|
|
return []ent.Index{
|
|
index.Fields("stationNo", "date").Unique(),
|
|
}
|
|
}
|