2026-09-10 16:59:15 +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"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// LinePoint 产线点位台账:记录每个点位当前存放的工件(唯一事实源)。
|
2026-11-07 15:06:00 +08:00
|
|
|
|
// 产线布局(主线位置编址版,2026-11-05 权威文档):主线上下两排工位 G1~G10 + 末端下料检测位 G11/G12;
|
|
|
|
|
|
// 主线位置统一编址 C1~C15(左→右),**没有独立缓存位**——缓存是主线位置的属性:
|
|
|
|
|
|
// 正对工位的停靠位(C1/C4/C7/C10/C13/C15)不缓存(工件到达即顶升进工位),
|
|
|
|
|
|
// 其余位置(C2/C3/C5/C6/C8/C9/C11/C12/C14)可缓存,由 cacheable 字段区分。
|
|
|
|
|
|
// 上料 = 放到主线任意位置或任意工位(建档时选择当前位置);接驳台(GxL/GxR/JBT21)
|
|
|
|
|
|
// 是 AGV 点位(dock 表),不是主线位置、不进本台账。
|
2026-09-10 16:59:15 +08:00
|
|
|
|
type LinePoint struct {
|
|
|
|
|
|
ent.Schema
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (LinePoint) Annotations() []schema.Annotation {
|
2026-10-08 13:09:53 +08:00
|
|
|
|
return []schema.Annotation{entsql.Annotation{Table: "line_point"}, entsql.WithComments(true), schema.Comment("LinePoint 产线点位台账:记录每个点位当前存放的工件(唯一事实源)。")}
|
2026-09-10 16:59:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (LinePoint) Fields() []ent.Field {
|
|
|
|
|
|
return []ent.Field{
|
|
|
|
|
|
field.Int("id").Positive(),
|
2026-11-07 15:06:00 +08:00
|
|
|
|
field.String("pointType").MaxLen(20).Comment("STATION工位/STOP主线停靠位(不缓存)/CACHE主线缓存位(可缓存)/END末端;FEED上料位已废弃删除"),
|
|
|
|
|
|
field.String("pointNo").MaxLen(32).Comment("点位编号:1~10工位 / C1~C15主线位置(C1/C4/C7/C10/C13/C15=停靠位,其余=缓存位)/ END-U上排末端 / END-D下排末端"),
|
2026-09-10 16:59:15 +08:00
|
|
|
|
field.String("label").Default("").MaxLen(64).Comment("点位名称"),
|
2026-11-07 15:06:00 +08:00
|
|
|
|
field.Int("seq").Default(0).Comment("传送带顺序(上料位→主线C1~C15→末端,用于相邻缓存位判定)"),
|
|
|
|
|
|
field.Int("stationNo").Default(0).Comment("所属工位号(归属;0=无)"),
|
|
|
|
|
|
field.Bool("cacheable").Default(false).Comment("是否可缓存(主线位置属性:C2/C3/C5/C6/C8/C9/C11/C12/C14=true;停靠位/工位/末端=false)"),
|
2026-09-10 16:59:15 +08:00
|
|
|
|
field.String("currentSn").Default("").MaxLen(128).Comment("当前存放工件SN(空=空闲)"),
|
|
|
|
|
|
field.String("orderNo").Default("").MaxLen(64).Comment("当前工件所属工单号"),
|
|
|
|
|
|
field.Bool("occupied").Default(false).Comment("是否占用"),
|
|
|
|
|
|
field.Time("updatedAt").Default(time.Now).UpdateDefault(time.Now),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (LinePoint) Indexes() []ent.Index {
|
|
|
|
|
|
return []ent.Index{
|
|
|
|
|
|
index.Fields("pointType", "pointNo").Unique(),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|