2026-08-28 15:06:01 +08:00
|
|
|
|
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"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
2026-09-22 14:42:52 +08:00
|
|
|
|
// SemiFlow 半成品流转记录:进度快照(完成至工位N),调用 WMS /api/internal/semi/*
|
2026-08-28 15:06:01 +08:00
|
|
|
|
type SemiFlow struct {
|
|
|
|
|
|
ent.Schema
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (SemiFlow) Annotations() []schema.Annotation {
|
|
|
|
|
|
return []schema.Annotation{entsql.Annotation{Table: "semi_flow"}}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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),
|
2026-09-22 14:42:52 +08:00
|
|
|
|
// 已废除旧字段:不再写入,仅保留历史数据(进度唯一权威源=workpiece.currentStationNo)
|
|
|
|
|
|
field.JSON("doneProcessCodes", []int{}).Optional().Comment("已完成工序码(已废除,历史数据保留)"),
|
|
|
|
|
|
field.String("completedText").Default("").MaxLen(64).Comment("完成至工位快照(如:已完成至工位3;空=尚未报工)"),
|
2026-08-28 15:06:01 +08:00
|
|
|
|
// 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"),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|