Files
2026-08-28 15:06:01 +08:00

41 lines
1.0 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"
)
// StationProcess 工位↔工序 派工(当日/班次可换)
type StationProcess struct {
ent.Schema
}
func (StationProcess) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "station_process"}}
}
func (StationProcess) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("stationNo").Comment("工位号 1..12"),
field.Int("processCode").Comment("工序代码"),
field.String("effectDate").Default("").MaxLen(10).Comment("生效日期"),
field.String("shift").Default("").MaxLen(20).Comment("班次"),
field.String("operator").Default("").MaxLen(64),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (StationProcess) Indexes() []ent.Index {
return []ent.Index{
index.Fields("stationNo"),
index.Fields("effectDate"),
index.Fields("stationNo", "effectDate"),
}
}