refactor(mes): 移除工位接驳台绑定逻辑,改为独立dock主数据
- 移除station表的hasDock、dockCode字段及相关代码 - 新增dock表注释及关联逻辑,支持一个工位绑定多个接驳台 - 更新工位相关的seed、logic、schema及前端代码,适配新的接驳台管理方式 - 新增SQL注释固化脚本,完善MES表注释
This commit is contained in:
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -12,6 +14,9 @@ type AgvTask struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (AgvTask) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("agv_tasks"), entsql.WithComments(true), schema.Comment("AgvTask AGV 搬运任务记录:仓管下发后落库,用于状态跟踪/追溯。")}
|
||||
}
|
||||
func (AgvTask) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("task_no").Unique().MaxLen(64).Comment("我方任务号(内部)"),
|
||||
@@ -38,4 +43,4 @@ func (AgvTask) Indexes() []ent.Index {
|
||||
index.Fields("status"),
|
||||
index.Fields("hik_task_code"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -27,6 +29,9 @@ type Attachment struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Attachment) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("attachments"), entsql.WithComments(true), schema.Comment("Attachment 附件(挂载在业务单据/档案上的文件)")}
|
||||
}
|
||||
func (Attachment) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("biz_type").Comment("业务类型 inbound/material/inspection/semi/outbound"),
|
||||
|
||||
@@ -20,7 +20,7 @@ type EventLog struct {
|
||||
}
|
||||
|
||||
func (EventLog) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "event_log"}}
|
||||
return []schema.Annotation{entsql.Table("event_log"), entsql.WithComments(true), schema.Comment("EventLog 操作日志(事件审计)")}
|
||||
}
|
||||
|
||||
func (EventLog) Fields() []ent.Field {
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -13,6 +15,9 @@ type InboundDetail struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InboundDetail) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("inbound_details"), entsql.WithComments(true), schema.Comment("InboundDetail 入库明细(一张入库单可含多行)")}
|
||||
}
|
||||
func (InboundDetail) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("inbound_no").Comment("入库单号"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -11,6 +13,9 @@ type InboundOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InboundOrder) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("inbound_orders"), entsql.WithComments(true), schema.Comment("InboundOrder 入库单")}
|
||||
}
|
||||
func (InboundOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("inbound_no").Unique().Comment("入库单号"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -12,6 +14,9 @@ type InspectionRecord struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InspectionRecord) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("inspection_records"), entsql.WithComments(true), schema.Comment("InspectionRecord 检验记录")}
|
||||
}
|
||||
func (InspectionRecord) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 检验对象:BATCH/SN
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -38,6 +40,9 @@ const (
|
||||
InvCategoryFinished = 3
|
||||
)
|
||||
|
||||
func (Inventory) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("inventories"), entsql.WithComments(true), schema.Comment("Inventory 统一库存台账")}
|
||||
}
|
||||
func (Inventory) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 类型(分类语境:结构件/电气件/其他,仅用于分类统计/筛选,2026-09-30 与记账方式解耦)
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -11,6 +13,9 @@ type InventoryLock struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (InventoryLock) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("inventory_locks"), entsql.WithComments(true), schema.Comment("InventoryLock 库存锁定(工单锁库存,防超卖)")}
|
||||
}
|
||||
func (InventoryLock) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
// 锁定对象:批次或 SN
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -28,6 +30,9 @@ type Material struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Material) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("materials"), entsql.WithComments(true), schema.Comment("Material 物料档案(主数据)")}
|
||||
}
|
||||
func (Material) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("code").Unique().Comment("物料唯一编码"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
@@ -14,6 +16,9 @@ type MaterialDemand struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (MaterialDemand) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("material_demands"), entsql.WithComments(true), schema.Comment("MaterialDemand 物料未来需求(MES 按日排产推送,WMS 备料四态“预警”判定的数据源)")}
|
||||
}
|
||||
func (MaterialDemand) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("material_code").Unique().Comment("物料编码(图号)"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -20,6 +22,9 @@ type OrderMaterialLedger struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OrderMaterialLedger) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("order_material_ledgers"), entsql.WithComments(true), schema.Comment("OrderMaterialLedger 工单物料台账(WMS 侧)")}
|
||||
}
|
||||
func (OrderMaterialLedger) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("order_no").Comment("工单号"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -13,6 +15,9 @@ type OutboundDetail struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OutboundDetail) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("outbound_details"), entsql.WithComments(true), schema.Comment("OutboundDetail 出库明细(一张出库单可含多行)")}
|
||||
}
|
||||
func (OutboundDetail) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("outbound_no").Comment("出库单号"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -16,6 +18,9 @@ type OutboundOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (OutboundOrder) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("outbound_orders"), entsql.WithComments(true), schema.Comment("OutboundOrder 出库统一主表")}
|
||||
}
|
||||
func (OutboundOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("outbound_no").Unique().Comment("出库单号"),
|
||||
|
||||
@@ -18,7 +18,7 @@ type Permission struct {
|
||||
}
|
||||
|
||||
func (Permission) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "permissions"}}
|
||||
return []schema.Annotation{entsql.Table("permissions"), entsql.WithComments(true), schema.Comment("Permission 权限/菜单")}
|
||||
}
|
||||
|
||||
func (Permission) Fields() []ent.Field {
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -13,6 +15,9 @@ type ReturnOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (ReturnOrder) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("return_orders"), entsql.WithComments(true), schema.Comment("ReturnOrder 退库单(客户诉求 问题记录 L488/L491):")}
|
||||
}
|
||||
func (ReturnOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("return_no").Unique().Comment("退库单号"),
|
||||
|
||||
@@ -19,7 +19,7 @@ type Role struct {
|
||||
}
|
||||
|
||||
func (Role) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Annotation{Table: "roles"}}
|
||||
return []schema.Annotation{entsql.Table("roles"), entsql.WithComments(true), schema.Comment("Role 角色:承载菜单/按钮权限")}
|
||||
}
|
||||
|
||||
func (Role) Fields() []ent.Field {
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -14,6 +16,9 @@ type SemiFinished struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (SemiFinished) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("semi_finisheds"), entsql.WithComments(true), schema.Comment("SemiFinished 半成品库存")}
|
||||
}
|
||||
func (SemiFinished) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("sn").Unique().Comment("半成品 SN"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -11,6 +13,9 @@ type StocktakeOrder struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (StocktakeOrder) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("stocktake_orders"), entsql.WithComments(true), schema.Comment("StocktakeOrder 盘点单:发起时冻结当时库存快照(明细行)")}
|
||||
}
|
||||
func (StocktakeOrder) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("stocktake_no").Unique().Comment("盘点单号"),
|
||||
@@ -45,6 +50,9 @@ type StocktakeItem struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (StocktakeItem) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("stocktake_items"), entsql.WithComments(true), schema.Comment("StocktakeItem 盘点明细(发起时的账面快照 + 扫码实盘数)")}
|
||||
}
|
||||
func (StocktakeItem) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("stocktake_no").Comment("所属盘点单号"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
"entgo.io/ent/schema/index"
|
||||
)
|
||||
@@ -13,6 +15,9 @@ type User struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (User) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("users"), entsql.WithComments(true), schema.Comment("User 系统用户(账号与权限)")}
|
||||
}
|
||||
func (User) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.String("username").Unique().Comment("登录名"),
|
||||
|
||||
@@ -2,6 +2,8 @@ package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/dialect/entsql"
|
||||
"entgo.io/ent/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
@@ -14,6 +16,9 @@ type Zone struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
func (Zone) Annotations() []schema.Annotation {
|
||||
return []schema.Annotation{entsql.Table("zones"), entsql.WithComments(true), schema.Comment("Zone 库房库位主数据(统一主表 + 层级类型字段,符合「统一主表+类型字段,禁拆表」铁律)。")}
|
||||
}
|
||||
func (Zone) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
field.Int("level").Comment("层级 1区域/2货架/3层/4位置号"),
|
||||
|
||||
Reference in New Issue
Block a user