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

45 lines
1.5 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"
)
// 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"),
}
}