- 移除station表的hasDock、dockCode字段及相关代码 - 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台 - 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式 - 新增SQL注释固化脚本,完善MES表注释
45 lines
1.5 KiB
Go
45 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"
|
||
)
|
||
|
||
// SemiFlow 半成品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/*
|
||
type SemiFlow struct {
|
||
ent.Schema
|
||
}
|
||
|
||
func (SemiFlow) Annotations() []schema.Annotation {
|
||
return []schema.Annotation{entsql.Annotation{Table: "semi_flow"}, entsql.WithComments(true), schema.Comment("SemiFlow 半成品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/*")}
|
||
}
|
||
|
||
func (SemiFlow) Fields() []ent.Field {
|
||
return []ent.Field{
|
||
field.Int("id").Positive(),
|
||
field.String("sn").MaxLen(64).Comment("工件SN"),
|
||
field.String("orderNo").Default("").MaxLen(64),
|
||
// 已废除旧字段:不再写入,仅保留历史数据(进度唯一权威源=workpiece.currentStationNo)
|
||
field.JSON("doneProcessCodes", []int{}).Optional().Comment("已完成工序码(已废除,历史数据保留)"),
|
||
field.String("completedText").Default("").MaxLen(64).Comment("完成至工位快照(如:已完成至工位3;空=尚未报工)"),
|
||
// INBOUND / OUTBOUND
|
||
field.String("action").Default("INBOUND").MaxLen(20),
|
||
field.String("targetDock").Default("").MaxLen(20),
|
||
field.String("operator").Default("").MaxLen(64),
|
||
field.Time("createdAt").Default(time.Now).Immutable(),
|
||
}
|
||
}
|
||
|
||
func (SemiFlow) Indexes() []ent.Index {
|
||
return []ent.Index{
|
||
index.Fields("sn"),
|
||
index.Fields("orderNo"),
|
||
index.Fields("action"),
|
||
}
|
||
}
|