Files
bj_power/bj_power_mes/schema/station_shift.go
T

45 lines
1.8 KiB
Go
Raw Normal View History

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"
)
// StationShift 工位班次(2026-11-03 拍板「下班/结束作业」闭环):
// 工人登录建班;下班时工人**自己目视**左右接驳台有无剩余物料(系统不替他查)——
// 确认无 → 直接下班(CLOSED);有剩余 → 走退料流程(指定接驳台/填实际/损耗原因)后即可离场,
// 班次置 CLOSING,待库管收货+空托盘拉走后由系统事件驱动自动置 CLOSED。
// 未下班退出登录 → 终端提示安全警示(不强制拦截,留痕)。
type StationShift struct {
ent.Schema
}
func (StationShift) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "station_shifts"}, entsql.WithComments(true), schema.Comment("StationShift 工位班次:下班/结束作业闭环状态。")}
}
func (StationShift) Fields() []ent.Field {
return []ent.Field{
field.Int("stationNo").Comment("工位号"),
field.String("operator").Default("").MaxLen(64).Comment("当班工人"),
field.String("status").Default("ON_DUTY").MaxLen(20).Comment("ON_DUTY当班/CLOSING待收尾(有剩余物料退料中)/CLOSED已下班"),
field.Int64("startAt").Default(0).Comment("班次开始(登录) unix秒"),
field.Int64("endApplyAt").Default(0).Comment("申请下班时间 unix秒"),
field.Int64("closedAt").Default(0).Comment("实际下班(收尾完成) unix秒"),
field.String("remark").Default("").MaxLen(300).Optional().Comment("备注(如退料单号/退出未下班警示留痕)"),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (StationShift) Indexes() []ent.Index {
return []ent.Index{
index.Fields("stationNo"),
index.Fields("status"),
}
}