- WMS 新增「检验处置项」实体(schema + ent 生成码),配套检验记录实体调整与复检接口,完善来料检/不良退货/入库检验前端 - MES 日排产:新增达成率统计与计划对比逻辑,调整日排产前端与流程卡/工序流 - 日志与传输:MES 新增 PLC 日志与 WMS 客户端传输日志,WMS 新增 MES 客户端传输日志 - MES 其他:扫码、工单/工件、AGV 客户端与告警、产品导入等逻辑完善及前端调整 - 工位终端:上线面板/作业面板、工件 handler 与 MES 客户端调整 - 配置与文档:更新 mes-api.yaml、三端构建产物与问题记录文档
1185 lines
62 KiB
Go
1185 lines
62 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
||
|
||
package migrate
|
||
|
||
import (
|
||
"entgo.io/ent/dialect/entsql"
|
||
"entgo.io/ent/dialect/sql/schema"
|
||
"entgo.io/ent/schema/field"
|
||
)
|
||
|
||
var (
|
||
// AlertsColumns holds the columns for the "alerts" table.
|
||
AlertsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "rule_code", Type: field.TypeString, Comment: "关联规则编码(固定五类)"},
|
||
{Name: "level", Type: field.TypeString, Size: 16, Comment: "级别 info/warning/error", Default: "warning"},
|
||
{Name: "title", Type: field.TypeString, Comment: "预警标题"},
|
||
{Name: "content", Type: field.TypeString, Comment: "预警内容"},
|
||
{Name: "target", Type: field.TypeString, Nullable: true, Comment: "关联对象(物料编码/批次/SN/库存行ID等)"},
|
||
{Name: "status", Type: field.TypeString, Size: 16, Comment: "状态 unread/read", Default: "unread"},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
{Name: "updated_at", Type: field.TypeInt64, Comment: "更新时间"},
|
||
}
|
||
// AlertsTable holds the schema information for the "alerts" table.
|
||
AlertsTable = &schema.Table{
|
||
Name: "alerts",
|
||
Comment: "Alert 预警实例:扫描器按规则产生,用户标记已读闭环",
|
||
Columns: AlertsColumns,
|
||
PrimaryKey: []*schema.Column{AlertsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "alert_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{AlertsColumns[6]},
|
||
},
|
||
{
|
||
Name: "alert_rule_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{AlertsColumns[1]},
|
||
},
|
||
},
|
||
}
|
||
// AlertRulesColumns holds the columns for the "alert_rules" table.
|
||
AlertRulesColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "code", Type: field.TypeString, Unique: true, Comment: "规则编码(唯一,固定五类)"},
|
||
{Name: "name", Type: field.TypeString, Comment: "规则名称"},
|
||
{Name: "enabled", Type: field.TypeBool, Comment: "是否启用", Default: true},
|
||
{Name: "threshold", Type: field.TypeInt, Comment: "阈值(含义随规则:超期小时/库龄天;0=按默认)", Default: 0},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
{Name: "updated_at", Type: field.TypeInt64, Comment: "更新时间"},
|
||
}
|
||
// AlertRulesTable holds the schema information for the "alert_rules" table.
|
||
AlertRulesTable = &schema.Table{
|
||
Name: "alert_rules",
|
||
Comment: "AlertRule 预警规则:控制各类预警是否启用与阈值",
|
||
Columns: AlertRulesColumns,
|
||
PrimaryKey: []*schema.Column{AlertRulesColumns[0]},
|
||
}
|
||
// AttachmentsColumns holds the columns for the "attachments" table.
|
||
AttachmentsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "biz_type", Type: field.TypeString, Comment: "业务类型 inbound/material/inspection/semi/outbound"},
|
||
{Name: "biz_id", Type: field.TypeString, Comment: "业务对象标识(单号/编码/ID)"},
|
||
{Name: "file_name", Type: field.TypeString, Comment: "原始文件名(含扩展名)"},
|
||
{Name: "file_path", Type: field.TypeString, Comment: "磁盘相对路径(年/月/日/文件类型/uuid.ext)"},
|
||
{Name: "file_type", Type: field.TypeString, Nullable: true, Comment: "文件类型大写枚举 PROCESS_PDF/INSPECTION_PHOTO/..."},
|
||
{Name: "file_ext", Type: field.TypeString, Nullable: true, Comment: "扩展名(小写,不含点)"},
|
||
{Name: "file_md5", Type: field.TypeString, Nullable: true, Comment: "文件MD5(秒传/去重)"},
|
||
{Name: "file_size", Type: field.TypeInt64, Comment: "文件大小(字节)", Default: 0},
|
||
{Name: "mime_type", Type: field.TypeString, Nullable: true, Comment: "MIME 类型"},
|
||
{Name: "uploaded_by", Type: field.TypeString, Nullable: true, Comment: "上传人"},
|
||
{Name: "deleted", Type: field.TypeBool, Comment: "逻辑删除标记", Default: false},
|
||
{Name: "deleted_at", Type: field.TypeInt64, Nullable: true, Comment: "删除时间(unix秒)"},
|
||
{Name: "deleted_by", Type: field.TypeString, Nullable: true, Comment: "删除人"},
|
||
{Name: "deleted_reason", Type: field.TypeString, Nullable: true, Comment: "删除说明(删除弹窗填写,警示留痕)"},
|
||
{Name: "purged_at", Type: field.TypeInt64, Nullable: true, Comment: "彻底清除时间(unix秒,仅删文件留索引)"},
|
||
{Name: "purged_by", Type: field.TypeString, Nullable: true, Comment: "彻底清除操作人"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
}
|
||
// AttachmentsTable holds the schema information for the "attachments" table.
|
||
AttachmentsTable = &schema.Table{
|
||
Name: "attachments",
|
||
Comment: "Attachment 附件(挂载在业务单据/档案上的文件)",
|
||
Columns: AttachmentsColumns,
|
||
PrimaryKey: []*schema.Column{AttachmentsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "attachment_biz_type_biz_id",
|
||
Unique: false,
|
||
Columns: []*schema.Column{AttachmentsColumns[1], AttachmentsColumns[2]},
|
||
},
|
||
{
|
||
Name: "attachment_file_type",
|
||
Unique: false,
|
||
Columns: []*schema.Column{AttachmentsColumns[5]},
|
||
},
|
||
{
|
||
Name: "attachment_file_md5",
|
||
Unique: false,
|
||
Columns: []*schema.Column{AttachmentsColumns[7]},
|
||
},
|
||
{
|
||
Name: "attachment_created_at",
|
||
Unique: false,
|
||
Columns: []*schema.Column{AttachmentsColumns[17]},
|
||
},
|
||
},
|
||
}
|
||
// BackupRecordColumns holds the columns for the "backup_record" table.
|
||
BackupRecordColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "executed_at", Type: field.TypeInt64, Comment: "备份执行时刻(unix秒)"},
|
||
{Name: "range_start", Type: field.TypeInt64, Comment: "备份范围开始(unix秒,含)"},
|
||
{Name: "range_end", Type: field.TypeInt64, Comment: "备份范围结束(unix秒,含)"},
|
||
{Name: "backup_path", Type: field.TypeString, Comment: "备份包(zip)在目标盘的完整路径"},
|
||
{Name: "total_size", Type: field.TypeInt64, Comment: "备份包总字节数", Default: 0},
|
||
{Name: "items_json", Type: field.TypeString, Comment: "各数据项及大小(JSON数组:[{name,rows,bytes}])"},
|
||
{Name: "status", Type: field.TypeString, Size: 16, Comment: "success/failed/partial/cleanup/cleanup_forced", Default: "success"},
|
||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""},
|
||
{Name: "checksum", Type: field.TypeString, Size: 64, Comment: "备份包校验和(sha256,基于 manifest)", Default: ""},
|
||
{Name: "scope", Type: field.TypeString, Size: 8, Comment: "写入方 mes/wms", Default: "wms"},
|
||
{Name: "ack_name", Type: field.TypeString, Size: 64, Comment: "强制清理时填写姓名(警示留痕,非强制清理为空)", Default: ""},
|
||
{Name: "ack_phone", Type: field.TypeString, Size: 32, Comment: "强制清理时填写手机号(警示留痕,非强制清理为空)", Default: ""},
|
||
}
|
||
// BackupRecordTable holds the schema information for the "backup_record" table.
|
||
BackupRecordTable = &schema.Table{
|
||
Name: "backup_record",
|
||
Comment: "BackupRecord 备份记录:备份到外部存储写一条,清理前校验时间窗覆盖",
|
||
Columns: BackupRecordColumns,
|
||
PrimaryKey: []*schema.Column{BackupRecordColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "backuprecord_range_start",
|
||
Unique: false,
|
||
Columns: []*schema.Column{BackupRecordColumns[2]},
|
||
},
|
||
{
|
||
Name: "backuprecord_range_end",
|
||
Unique: false,
|
||
Columns: []*schema.Column{BackupRecordColumns[3]},
|
||
},
|
||
{
|
||
Name: "backuprecord_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{BackupRecordColumns[7]},
|
||
},
|
||
},
|
||
}
|
||
// DeliveryOrderColumns holds the columns for the "delivery_order" table.
|
||
DeliveryOrderColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "delivery_no", Type: field.TypeString, Size: 64, Comment: "配送单号"},
|
||
{Name: "package_no", Type: field.TypeString, Size: 64, Comment: "关联叫料包号(material_request.packageNo)", Default: ""},
|
||
{Name: "station_no", Type: field.TypeInt, Comment: "目标工位号", Default: 0},
|
||
{Name: "target_dock", Type: field.TypeString, Size: 20, Comment: "配送接驳台(左右手必选,仅可选空台:传感器+在途任务)", Default: ""},
|
||
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
|
||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "创建人(库管)", Default: ""},
|
||
{Name: "remark", Type: field.TypeString, Size: 255, Comment: "备注", Default: ""},
|
||
{Name: "agv_task_no", Type: field.TypeString, Size: 64, Comment: "AGV 任务号(派车成功后回写)", Default: ""},
|
||
{Name: "created_at", Type: field.TypeTime},
|
||
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
|
||
}
|
||
// DeliveryOrderTable holds the schema information for the "delivery_order" table.
|
||
DeliveryOrderTable = &schema.Table{
|
||
Name: "delivery_order",
|
||
Comment: "DeliveryOrder 配送单:WMS 按叫料包创建,一包可拆多张;一单=一次托盘配送",
|
||
Columns: DeliveryOrderColumns,
|
||
PrimaryKey: []*schema.Column{DeliveryOrderColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "deliveryorder_package_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{DeliveryOrderColumns[2]},
|
||
},
|
||
{
|
||
Name: "deliveryorder_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{DeliveryOrderColumns[5]},
|
||
},
|
||
{
|
||
Name: "deliveryorder_station_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{DeliveryOrderColumns[3]},
|
||
},
|
||
},
|
||
}
|
||
// DeliveryOrderItemColumns holds the columns for the "delivery_order_item" table.
|
||
DeliveryOrderItemColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "delivery_no", Type: field.TypeString, Size: 64, Comment: "配送单号"},
|
||
{Name: "request_no", Type: field.TypeString, Size: 64, Comment: "关联叫料单号", Default: ""},
|
||
{Name: "material_code", Type: field.TypeString, Size: 64, Comment: "物料编码"},
|
||
{Name: "material_name", Type: field.TypeString, Size: 128, Comment: "物料名称", Default: ""},
|
||
{Name: "unit", Type: field.TypeString, Size: 16, Comment: "单位", Default: ""},
|
||
{Name: "qty", Type: field.TypeFloat64, Comment: "本次配送数量", Default: 0},
|
||
{Name: "station_no", Type: field.TypeInt, Comment: "目标工位号", Default: 0},
|
||
{Name: "order_no", Type: field.TypeString, Size: 64, Comment: "工单号(物料挂工单)", Default: ""},
|
||
{Name: "flow_name", Type: field.TypeString, Size: 128, Comment: "工艺名", Default: ""},
|
||
{Name: "plan_date", Type: field.TypeString, Size: 10, Comment: "排产日 yyyy-MM-dd", Default: ""},
|
||
{Name: "sn_mode", Type: field.TypeInt, Comment: "序列号 1=是(逐件SN)/2=否", Default: 2},
|
||
}
|
||
// DeliveryOrderItemTable holds the schema information for the "delivery_order_item" table.
|
||
DeliveryOrderItemTable = &schema.Table{
|
||
Name: "delivery_order_item",
|
||
Comment: "DeliveryOrderItem 配送单明细:物料×量×工位×工单×工艺×排产日",
|
||
Columns: DeliveryOrderItemColumns,
|
||
PrimaryKey: []*schema.Column{DeliveryOrderItemColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "deliveryorderitem_delivery_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{DeliveryOrderItemColumns[1]},
|
||
},
|
||
{
|
||
Name: "deliveryorderitem_request_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{DeliveryOrderItemColumns[2]},
|
||
},
|
||
},
|
||
}
|
||
// EventLogColumns holds the columns for the "event_log" table.
|
||
EventLogColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "event_type", Type: field.TypeString, Size: 64, Comment: "事件类型,如 user.create / inbound.create / auth.login"},
|
||
{Name: "operator", Type: field.TypeString, Size: 64, Comment: "操作人", Default: ""},
|
||
{Name: "entity_type", Type: field.TypeString, Size: 32, Comment: "对象类型,如 user/role/material/inbound/outbound", Default: ""},
|
||
{Name: "entity_id", Type: field.TypeString, Size: 64, Comment: "对象标识:主键ID或业务单号", Default: ""},
|
||
{Name: "description", Type: field.TypeString, Size: 2147483647, Comment: "事件描述", Default: ""},
|
||
{Name: "payload", Type: field.TypeJSON, Nullable: true, Comment: "扩展负载", SchemaType: map[string]string{"postgres": "jsonb"}},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "发生时间"},
|
||
}
|
||
// EventLogTable holds the schema information for the "event_log" table.
|
||
EventLogTable = &schema.Table{
|
||
Name: "event_log",
|
||
Comment: "EventLog 操作日志(事件审计)",
|
||
Columns: EventLogColumns,
|
||
PrimaryKey: []*schema.Column{EventLogColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "eventlog_event_type",
|
||
Unique: false,
|
||
Columns: []*schema.Column{EventLogColumns[1]},
|
||
},
|
||
{
|
||
Name: "eventlog_operator",
|
||
Unique: false,
|
||
Columns: []*schema.Column{EventLogColumns[2]},
|
||
},
|
||
{
|
||
Name: "eventlog_created_at",
|
||
Unique: false,
|
||
Columns: []*schema.Column{EventLogColumns[7]},
|
||
},
|
||
},
|
||
}
|
||
// InboundDetailsColumns holds the columns for the "inbound_details" table.
|
||
InboundDetailsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "inbound_no", Type: field.TypeString, Comment: "入库单号"},
|
||
{Name: "sn_code", Type: field.TypeString, Nullable: true, Comment: "SN(电气件)"},
|
||
{Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号(结构件)"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "quantity", Type: field.TypeInt, Comment: "数量", Default: 1},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
}
|
||
// InboundDetailsTable holds the schema information for the "inbound_details" table.
|
||
InboundDetailsTable = &schema.Table{
|
||
Name: "inbound_details",
|
||
Comment: "InboundDetail 入库明细(一张入库单可含多行)",
|
||
Columns: InboundDetailsColumns,
|
||
PrimaryKey: []*schema.Column{InboundDetailsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "inbounddetail_inbound_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InboundDetailsColumns[1]},
|
||
},
|
||
{
|
||
Name: "inbounddetail_sn_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InboundDetailsColumns[2]},
|
||
},
|
||
},
|
||
}
|
||
// InboundOrdersColumns holds the columns for the "inbound_orders" table.
|
||
InboundOrdersColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "inbound_no", Type: field.TypeString, Unique: true, Comment: "入库单号"},
|
||
{Name: "inbound_type", Type: field.TypeString, Comment: "入库类型 purchase/semi/finished/return/other", Default: "purchase"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "material_name", Type: field.TypeString, Nullable: true, Comment: "物料名称(冗余)"},
|
||
{Name: "manage_mode", Type: field.TypeInt, Comment: "类型 1结构件/2电气件/3其他", Default: 1},
|
||
{Name: "sn_mode", Type: field.TypeInt, Comment: "序列号 1=是(逐件SN)/2=否(按批次数量)/0未选择", Default: 0},
|
||
{Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号(结构件)"},
|
||
{Name: "zone_code", Type: field.TypeString, Nullable: true, Comment: "入库区域(大区)"},
|
||
{Name: "shelf_no", Type: field.TypeString, Nullable: true, Comment: "货架号(如 A)"},
|
||
{Name: "layer_no", Type: field.TypeString, Nullable: true, Comment: "第几层(如 3)"},
|
||
{Name: "position_no", Type: field.TypeString, Nullable: true, Comment: "位置号(如 12)"},
|
||
{Name: "quantity", Type: field.TypeInt, Comment: "本次入库总数量(批次合计或SN条数)", Default: 0},
|
||
{Name: "operator", Type: field.TypeString, Nullable: true, Comment: "操作人"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "inspection_no", Type: field.TypeString, Comment: "检测单号(入库检报告单号)"},
|
||
{Name: "ownership_type", Type: field.TypeString, Comment: "归属类型 workorder/project/other", Default: "other"},
|
||
{Name: "ownership_no", Type: field.TypeString, Nullable: true, Comment: "归属编号(合同号/科技项目号)"},
|
||
{Name: "product_work_no", Type: field.TypeString, Nullable: true, Comment: "产品工号(手填)"},
|
||
{Name: "quality_status", Type: field.TypeString, Nullable: true, Comment: "质量状态 合格/不合格/部分(空=未关联检验)"},
|
||
{Name: "voided", Type: field.TypeBool, Comment: "是否已作废", Default: false},
|
||
{Name: "void_reason", Type: field.TypeString, Nullable: true, Comment: "作废原因"},
|
||
{Name: "voided_by", Type: field.TypeString, Nullable: true, Comment: "作废人"},
|
||
{Name: "voided_at", Type: field.TypeInt64, Nullable: true, Comment: "作废时间(unix秒)"},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
}
|
||
// InboundOrdersTable holds the schema information for the "inbound_orders" table.
|
||
InboundOrdersTable = &schema.Table{
|
||
Name: "inbound_orders",
|
||
Comment: "InboundOrder 入库单",
|
||
Columns: InboundOrdersColumns,
|
||
PrimaryKey: []*schema.Column{InboundOrdersColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "inboundorder_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InboundOrdersColumns[3]},
|
||
},
|
||
{
|
||
Name: "inboundorder_inbound_type",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InboundOrdersColumns[2]},
|
||
},
|
||
{
|
||
Name: "inboundorder_operator",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InboundOrdersColumns[13]},
|
||
},
|
||
},
|
||
}
|
||
// InspectionDisposalItemsColumns holds the columns for the "inspection_disposal_items" table.
|
||
InspectionDisposalItemsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "record_id", Type: field.TypeInt64, Comment: "父检验记录ID(inspection_records.id)"},
|
||
{Name: "dispose_type", Type: field.TypeString, Comment: "处置方式 RETURN/REWORK/SCRAP"},
|
||
{Name: "qty", Type: field.TypeInt, Comment: "本行处置数量(合计=记录不合格数)"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "处置备注(非必填;退货物流信息也填此处)"},
|
||
{Name: "operator", Type: field.TypeString, Comment: "操作人", Default: ""},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
}
|
||
// InspectionDisposalItemsTable holds the schema information for the "inspection_disposal_items" table.
|
||
InspectionDisposalItemsTable = &schema.Table{
|
||
Name: "inspection_disposal_items",
|
||
Comment: "InspectionDisposalItem 不合格品处置明细(按数量分退货/返修/报废)",
|
||
Columns: InspectionDisposalItemsColumns,
|
||
PrimaryKey: []*schema.Column{InspectionDisposalItemsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "inspectiondisposalitem_record_id",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InspectionDisposalItemsColumns[1]},
|
||
},
|
||
},
|
||
}
|
||
// InspectionRecordsColumns holds the columns for the "inspection_records" table.
|
||
InspectionRecordsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "target_type", Type: field.TypeString, Comment: "BATCH/SN"},
|
||
{Name: "target_id", Type: field.TypeString, Comment: "批次号或 SN"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "material_name", Type: field.TypeString, Nullable: true, Comment: "物料名称(冗余,列表直接展示/模糊查询)"},
|
||
{Name: "ownership_type", Type: field.TypeString, Nullable: true, Comment: "归属类型 workorder/project/other"},
|
||
{Name: "ownership_no", Type: field.TypeString, Nullable: true, Comment: "归属编号(工单号/科技项目号/其他)"},
|
||
{Name: "product_work_no", Type: field.TypeString, Nullable: true, Comment: "产品工号(随入库单带入,来料检验展示/筛选)"},
|
||
{Name: "related_standard", Type: field.TypeString, Nullable: true, Comment: "相关标准(检验细则号)"},
|
||
{Name: "manufacturer", Type: field.TypeString, Nullable: true, Comment: "生产厂家"},
|
||
{Name: "inspection_type", Type: field.TypeString, Comment: "来料检(过程检/完工检已移至 MES)", Default: "incoming"},
|
||
{Name: "status", Type: field.TypeString, Comment: "未检/合格/不合格", Default: "未检"},
|
||
{Name: "result_value", Type: field.TypeString, Nullable: true, Comment: "实测值(部分检验项)"},
|
||
{Name: "inspect_qty", Type: field.TypeInt, Comment: "检验数量(抽检件数)", Default: 0},
|
||
{Name: "pass_qty", Type: field.TypeInt, Comment: "合格数量(≤检验数量)", Default: 0},
|
||
{Name: "batch_seq", Type: field.TypeInt, Comment: "第几批(序列号=否来料检验必填≥1,0=未填)", Default: 0},
|
||
{Name: "batch_total", Type: field.TypeInt, Comment: "共几件(序列号=否来料检验必填≥1,0=未填)", Default: 0},
|
||
{Name: "reject_qty", Type: field.TypeInt, Comment: "不合格数量(=检验数量-合格数量)", Default: 0},
|
||
{Name: "check_desc", Type: field.TypeString, Nullable: true, Comment: "检测说明(检验项目/方法)"},
|
||
{Name: "inspector", Type: field.TypeString, Nullable: true, Comment: "检验人"},
|
||
{Name: "inspection_no", Type: field.TypeString, Nullable: true, Comment: "检测单号(检验报告单号)"},
|
||
{Name: "report_no", Type: field.TypeString, Nullable: true, Comment: "报检单号(生产报检关联)"},
|
||
{Name: "inspection_conclusion", Type: field.TypeString, Comment: "检验结论 合格/不合格/待检/挑选(与处置方式正交)", Default: ""},
|
||
{Name: "disposal_status", Type: field.TypeString, Comment: "不合格品处置状态 待处置/已处置", Default: ""},
|
||
{Name: "parent_record_id", Type: field.TypeInt64, Comment: "拆行来源检验记录ID(不合格隔离行回挂原单)", Default: 0},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// InspectionRecordsTable holds the schema information for the "inspection_records" table.
|
||
InspectionRecordsTable = &schema.Table{
|
||
Name: "inspection_records",
|
||
Comment: "InspectionRecord 检验记录",
|
||
Columns: InspectionRecordsColumns,
|
||
PrimaryKey: []*schema.Column{InspectionRecordsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "inspectionrecord_target_id",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InspectionRecordsColumns[2]},
|
||
},
|
||
{
|
||
Name: "inspectionrecord_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InspectionRecordsColumns[3]},
|
||
},
|
||
{
|
||
Name: "inspectionrecord_inspection_type",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InspectionRecordsColumns[10]},
|
||
},
|
||
{
|
||
Name: "inspectionrecord_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InspectionRecordsColumns[11]},
|
||
},
|
||
},
|
||
}
|
||
// InventoriesColumns holds the columns for the "inventories" table.
|
||
InventoriesColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "manage_mode", Type: field.TypeInt, Comment: "类型 1结构件/2电气件/3其他"},
|
||
{Name: "sn_mode", Type: field.TypeInt, Comment: "序列号 1=是(逐件SN)/2=否(按批次数量)/0未选择", Default: 0},
|
||
{Name: "category", Type: field.TypeInt, Comment: "物料类别 1=原材料 2=在制品 3=成品", Default: 1},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码(关联 materials 表)"},
|
||
{Name: "material_name", Type: field.TypeString, Nullable: true, Comment: "物料名称(冗余,便于直接展示)"},
|
||
{Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号(系统生成);序列号=是可关联所属批次"},
|
||
{Name: "sn_code", Type: field.TypeString, Nullable: true, Comment: "序列号(SN,仅序列号=是);全局唯一,空值表示非 SN 行"},
|
||
{Name: "quantity", Type: field.TypeInt, Comment: "数量:序列号=否=批次余量;序列号=是=1", Default: 0},
|
||
{Name: "locked_qty", Type: field.TypeInt, Comment: "已锁定数量(库存占用):序列号=否=件数;序列号=是=0/1", Default: 0},
|
||
{Name: "quality_status", Type: field.TypeString, Comment: "检验状态 未检/合格/不合格", Default: "未检"},
|
||
{Name: "zone_code", Type: field.TypeString, Nullable: true, Comment: "所在区域(Z01~Z04 大分区)"},
|
||
{Name: "shelf_no", Type: field.TypeString, Nullable: true, Comment: "货架号(手填,如 A)"},
|
||
{Name: "layer_no", Type: field.TypeString, Nullable: true, Comment: "第几层(手填,如 3)"},
|
||
{Name: "position_no", Type: field.TypeString, Nullable: true, Comment: "位置号(手填,如 12)"},
|
||
{Name: "status", Type: field.TypeString, Comment: "生命周期:在库/锁定/出库/使用/报废(序列号=是用;序列号=否恒在库)。使用=预留未启用:原 SN 件产线在制态,现统一走「出库」,枚举值保留不动以保持兼容", Default: "在库"},
|
||
{Name: "production_date", Type: field.TypeString, Nullable: true, Comment: "生产日期"},
|
||
{Name: "supplier", Type: field.TypeString, Nullable: true, Comment: "供应商"},
|
||
{Name: "inbound_no", Type: field.TypeString, Nullable: true, Comment: "关联入库单号"},
|
||
{Name: "order_no", Type: field.TypeString, Size: 64, Comment: "关联工单号(在制品/成品回流)", Default: ""},
|
||
{Name: "product_work_no", Type: field.TypeString, Nullable: true, Comment: "产品工号(贯穿库存,出库/检验/在制品带出展示)"},
|
||
{Name: "completed_process", Type: field.TypeString, Size: 64, Comment: "已完成工序(在制品用,如 135)", Default: ""},
|
||
{Name: "ownership_type", Type: field.TypeString, Nullable: true, Comment: "归属类型 workorder/project/other"},
|
||
{Name: "ownership_no", Type: field.TypeString, Nullable: true, Comment: "归属编号(工单号/科技项目号/其他)"},
|
||
{Name: "product_status", Type: field.TypeString, Nullable: true, Comment: "产品状态 已通过/部分通过/返修(成品用)"},
|
||
{Name: "related_standard", Type: field.TypeString, Nullable: true, Comment: "相关标准(试验方案号)"},
|
||
{Name: "test_record_no", Type: field.TypeString, Nullable: true, Comment: "试验记录单号"},
|
||
{Name: "recorded_by", Type: field.TypeString, Nullable: true, Comment: "记录员(展示名;2026-11-13 起由服务端按登录人覆写,前端不可编辑)"},
|
||
{Name: "recorded_by_id", Type: field.TypeInt64, Nullable: true, Comment: "记录员 user_id(取自 JWT X-UserID,服务端强制写入)"},
|
||
{Name: "recorded_at", Type: field.TypeInt64, Nullable: true, Comment: "记录日期(unix 秒)"},
|
||
{Name: "outbound_reason", Type: field.TypeString, Nullable: true, Comment: "出库原因(在制品/成品出库用)"},
|
||
{Name: "stocktake_no", Type: field.TypeString, Size: 64, Comment: "盘点冻结标记(进行中盘点单号;空=未冻结)", Default: ""},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// InventoriesTable holds the schema information for the "inventories" table.
|
||
InventoriesTable = &schema.Table{
|
||
Name: "inventories",
|
||
Comment: "Inventory 统一库存台账",
|
||
Columns: InventoriesColumns,
|
||
PrimaryKey: []*schema.Column{InventoriesColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "inventory_manage_mode",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[1]},
|
||
},
|
||
{
|
||
Name: "inventory_sn_mode",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[2]},
|
||
},
|
||
{
|
||
Name: "inventory_category",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[3]},
|
||
},
|
||
{
|
||
Name: "inventory_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[4]},
|
||
},
|
||
{
|
||
Name: "inventory_quality_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[10]},
|
||
},
|
||
{
|
||
Name: "inventory_zone_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[11]},
|
||
},
|
||
{
|
||
Name: "inventory_batch_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[6]},
|
||
},
|
||
{
|
||
Name: "inventory_sn_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoriesColumns[7]},
|
||
},
|
||
},
|
||
}
|
||
// InventoryLocksColumns holds the columns for the "inventory_locks" table.
|
||
InventoryLocksColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "target_type", Type: field.TypeString, Comment: "BATCH/SN"},
|
||
{Name: "target_id", Type: field.TypeString, Comment: "批次号或 SN"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "locked_qty", Type: field.TypeInt, Comment: "锁定数量", Default: 1},
|
||
{Name: "order_no", Type: field.TypeString, Comment: "关联工单号"},
|
||
{Name: "status", Type: field.TypeString, Comment: "ACTIVE/RELEASED/CONSUMED", Default: "ACTIVE"},
|
||
{Name: "expired_at", Type: field.TypeInt64, Nullable: true, Comment: "过期时间戳"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// InventoryLocksTable holds the schema information for the "inventory_locks" table.
|
||
InventoryLocksTable = &schema.Table{
|
||
Name: "inventory_locks",
|
||
Comment: "InventoryLock 库存锁定(工单锁库存,防超卖)",
|
||
Columns: InventoryLocksColumns,
|
||
PrimaryKey: []*schema.Column{InventoryLocksColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "inventorylock_order_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoryLocksColumns[5]},
|
||
},
|
||
{
|
||
Name: "inventorylock_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoryLocksColumns[6]},
|
||
},
|
||
{
|
||
Name: "inventorylock_target_id",
|
||
Unique: false,
|
||
Columns: []*schema.Column{InventoryLocksColumns[2]},
|
||
},
|
||
},
|
||
}
|
||
// MaterialsColumns holds the columns for the "materials" table.
|
||
MaterialsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "code", Type: field.TypeString, Unique: true, Comment: "物料唯一编码"},
|
||
{Name: "name", Type: field.TypeString, Comment: "物料真实名称"},
|
||
{Name: "spec", Type: field.TypeString, Nullable: true, Comment: "规格型号"},
|
||
{Name: "unit", Type: field.TypeString, Nullable: true, Comment: "单位"},
|
||
{Name: "description", Type: field.TypeString, Nullable: true, Comment: "描述"},
|
||
{Name: "item_type", Type: field.TypeInt, Comment: "物料类别 1原材料/3成品(在制品不是物料类别,由库存 category=2 承载)", Default: 1},
|
||
{Name: "manage_mode", Type: field.TypeInt, Comment: "类型 1结构件/2电气件/3其他", Default: 1},
|
||
{Name: "sn_mode", Type: field.TypeInt, Comment: "序列号 1=是(逐件录SN)/2=否(按数量)/0未选择", Default: 0},
|
||
{Name: "is_batch_managed", Type: field.TypeBool, Comment: "是否批次管理(按 sn_mode=2 派生)", Default: false},
|
||
{Name: "is_serial_managed", Type: field.TypeBool, Comment: "是否序列号管理(按 sn_mode=1 派生)", Default: false},
|
||
{Name: "template_code", Type: field.TypeString, Nullable: true, Comment: "物料模板编码(物料种类)"},
|
||
{Name: "safety_stock", Type: field.TypeInt, Comment: "安全库存(低于则缺货预警,0=不预警)", Default: 0},
|
||
{Name: "is_active", Type: field.TypeBool, Comment: "是否启用", Default: true},
|
||
{Name: "sync_pending", Type: field.TypeBool, Comment: "WMS→MES 推送失败标记(手动重推清位)", Default: false},
|
||
{Name: "material_code", Type: field.TypeString, Nullable: true, Size: 128, Comment: "物料编码(普通字段,不参与业务)"},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
{Name: "updated_at", Type: field.TypeInt64, Comment: "更新时间"},
|
||
}
|
||
// MaterialsTable holds the schema information for the "materials" table.
|
||
MaterialsTable = &schema.Table{
|
||
Name: "materials",
|
||
Comment: "Material 物料档案(主数据)",
|
||
Columns: MaterialsColumns,
|
||
PrimaryKey: []*schema.Column{MaterialsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "material_name",
|
||
Unique: false,
|
||
Columns: []*schema.Column{MaterialsColumns[2]},
|
||
},
|
||
{
|
||
Name: "material_template_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{MaterialsColumns[11]},
|
||
},
|
||
{
|
||
Name: "material_item_type",
|
||
Unique: false,
|
||
Columns: []*schema.Column{MaterialsColumns[6]},
|
||
},
|
||
},
|
||
}
|
||
// MaterialDemandsColumns holds the columns for the "material_demands" table.
|
||
MaterialDemandsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "material_code", Type: field.TypeString, Unique: true, Comment: "物料编码(图号)"},
|
||
{Name: "future5_qty", Type: field.TypeInt, Comment: "未来5天需求量(近5天日排产×单台用量)", Default: 0},
|
||
{Name: "updated_at", Type: field.TypeInt64, Comment: "更新时间(unix 秒)"},
|
||
}
|
||
// MaterialDemandsTable holds the schema information for the "material_demands" table.
|
||
MaterialDemandsTable = &schema.Table{
|
||
Name: "material_demands",
|
||
Comment: "MaterialDemand 物料未来需求(MES 按日排产推送,WMS 备料四态“预警”判定的数据源)",
|
||
Columns: MaterialDemandsColumns,
|
||
PrimaryKey: []*schema.Column{MaterialDemandsColumns[0]},
|
||
}
|
||
// OrderMaterialLedgersColumns holds the columns for the "order_material_ledgers" table.
|
||
OrderMaterialLedgersColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "order_no", Type: field.TypeString, Comment: "工单号"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "material_name", Type: field.TypeString, Nullable: true, Comment: "物料名称(冗余)"},
|
||
{Name: "total_qty", Type: field.TypeInt, Comment: "物料总需求数量", Default: 0},
|
||
{Name: "out_qty", Type: field.TypeInt, Comment: "累计已发出数量(仅出库写入)", Default: 0},
|
||
{Name: "returned_qty", Type: field.TypeInt, Comment: "累计已退回数量(仅退库收货写入)", Default: 0},
|
||
{Name: "consumed_qty", Type: field.TypeInt, Comment: "累计已消耗数量(仅报工反冲核销写入;不动库存)", Default: 0},
|
||
{Name: "status", Type: field.TypeString, Comment: "进行中/领料完结", Default: "进行中"},
|
||
{Name: "target_station", Type: field.TypeString, Nullable: true, Comment: "目标工位(装配工位号)"},
|
||
{Name: "completed_at", Type: field.TypeInt64, Nullable: true, Comment: "领料完结时间(unix 秒)"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// OrderMaterialLedgersTable holds the schema information for the "order_material_ledgers" table.
|
||
OrderMaterialLedgersTable = &schema.Table{
|
||
Name: "order_material_ledgers",
|
||
Comment: "OrderMaterialLedger 工单物料台账(WMS 侧)",
|
||
Columns: OrderMaterialLedgersColumns,
|
||
PrimaryKey: []*schema.Column{OrderMaterialLedgersColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "ordermaterialledger_order_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OrderMaterialLedgersColumns[1]},
|
||
},
|
||
{
|
||
Name: "ordermaterialledger_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OrderMaterialLedgersColumns[2]},
|
||
},
|
||
},
|
||
}
|
||
// OutboundDetailsColumns holds the columns for the "outbound_details" table.
|
||
OutboundDetailsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "outbound_no", Type: field.TypeString, Comment: "出库单号"},
|
||
{Name: "sn_code", Type: field.TypeString, Nullable: true, Comment: "SN(电气件)"},
|
||
{Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号(结构件)"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "quantity", Type: field.TypeInt, Comment: "数量", Default: 1},
|
||
{Name: "order_no", Type: field.TypeString, Nullable: true, Comment: "关联工单号"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
}
|
||
// OutboundDetailsTable holds the schema information for the "outbound_details" table.
|
||
OutboundDetailsTable = &schema.Table{
|
||
Name: "outbound_details",
|
||
Comment: "OutboundDetail 出库明细(一张出库单可含多行)",
|
||
Columns: OutboundDetailsColumns,
|
||
PrimaryKey: []*schema.Column{OutboundDetailsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "outbounddetail_outbound_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundDetailsColumns[1]},
|
||
},
|
||
{
|
||
Name: "outbounddetail_sn_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundDetailsColumns[2]},
|
||
},
|
||
{
|
||
Name: "outbounddetail_order_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundDetailsColumns[6]},
|
||
},
|
||
},
|
||
}
|
||
// OutboundOrdersColumns holds the columns for the "outbound_orders" table.
|
||
OutboundOrdersColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "outbound_no", Type: field.TypeString, Unique: true, Comment: "出库单号"},
|
||
{Name: "outbound_type", Type: field.TypeString, Comment: "出库类型", Default: "workorder"},
|
||
{Name: "status", Type: field.TypeString, Comment: "出库单状态 已出库/已送达", Default: "已出库"},
|
||
{Name: "need_agv", Type: field.TypeBool, Comment: "是否需要AGV配送到接驳台", Default: false},
|
||
{Name: "outbound_category", Type: field.TypeString, Nullable: true, Comment: "出库类别 return/sample/scrap/deliver/other"},
|
||
{Name: "ownership_type", Type: field.TypeString, Nullable: true, Comment: "归属类型 workorder/project/other"},
|
||
{Name: "ownership_no", Type: field.TypeString, Nullable: true, Comment: "归属编号(工单号/科技项目号)"},
|
||
{Name: "target_station", Type: field.TypeString, Nullable: true, Comment: "目标工位(装配工位号)"},
|
||
{Name: "order_no", Type: field.TypeString, Nullable: true, Comment: "关联工单号(工单为唯一挂靠载体)"},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "material_name", Type: field.TypeString, Nullable: true, Comment: "物料名称(冗余)"},
|
||
{Name: "manage_mode", Type: field.TypeInt, Comment: "类型 1结构件/2电气件/3其他", Default: 1},
|
||
{Name: "sn_mode", Type: field.TypeInt, Comment: "序列号 1=是(逐件SN)/2=否(按数量)/0未选择", Default: 0},
|
||
{Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号(结构件)"},
|
||
{Name: "zone_code", Type: field.TypeString, Nullable: true, Comment: "出库区域(大区)"},
|
||
{Name: "shelf_no", Type: field.TypeString, Nullable: true, Comment: "货架号(与入库同口径)"},
|
||
{Name: "layer_no", Type: field.TypeString, Nullable: true, Comment: "第几层(与入库同口径)"},
|
||
{Name: "position_no", Type: field.TypeString, Nullable: true, Comment: "位置号(与入库同口径)"},
|
||
{Name: "quantity", Type: field.TypeInt, Comment: "本次出库总数量", Default: 0},
|
||
{Name: "operator", Type: field.TypeString, Nullable: true, Comment: "操作人"},
|
||
{Name: "reviewer", Type: field.TypeString, Nullable: true, Comment: "复核人"},
|
||
{Name: "target_dock", Type: field.TypeString, Nullable: true, Comment: "目标接驳台(AGV配送)"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Comment: "备注"},
|
||
{Name: "box_no", Type: field.TypeString, Nullable: true, Comment: "箱号(装箱出库时填写,用于整箱发货追溯)"},
|
||
{Name: "box_sn_list", Type: field.TypeString, Nullable: true, Comment: "装箱 SN 清单(JSON 数组字符串)"},
|
||
{Name: "contract_no", Type: field.TypeString, Nullable: true, Comment: "合同号(装箱选填)"},
|
||
{Name: "borrow_from", Type: field.TypeJSON, Nullable: true, Comment: "跨工位借料来源 stationNo→借用量(call 备料出库专用);空=本工位自取"},
|
||
{Name: "inspection_no", Type: field.TypeString, Nullable: true, Comment: "检测单号(溯源关联检验单据)"},
|
||
{Name: "delivery_no", Type: field.TypeString, Comment: "关联配送单号(叫料配送出库回写)", Default: ""},
|
||
{Name: "product_work_no", Type: field.TypeString, Nullable: true, Comment: "产品工号(随库存带入,出库记录展示/筛选)"},
|
||
{Name: "voided", Type: field.TypeBool, Comment: "是否已作废", Default: false},
|
||
{Name: "void_reason", Type: field.TypeString, Comment: "作废原因(必填留痕)", Default: ""},
|
||
{Name: "voided_by", Type: field.TypeString, Comment: "作废操作人", Default: ""},
|
||
{Name: "voided_at", Type: field.TypeInt64, Nullable: true, Comment: "作废时间戳"},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
}
|
||
// OutboundOrdersTable holds the schema information for the "outbound_orders" table.
|
||
OutboundOrdersTable = &schema.Table{
|
||
Name: "outbound_orders",
|
||
Comment: "OutboundOrder 出库统一主表",
|
||
Columns: OutboundOrdersColumns,
|
||
PrimaryKey: []*schema.Column{OutboundOrdersColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "outboundorder_order_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundOrdersColumns[9]},
|
||
},
|
||
{
|
||
Name: "outboundorder_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundOrdersColumns[10]},
|
||
},
|
||
{
|
||
Name: "outboundorder_outbound_type",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundOrdersColumns[2]},
|
||
},
|
||
{
|
||
Name: "outboundorder_box_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundOrdersColumns[24]},
|
||
},
|
||
{
|
||
Name: "outboundorder_inspection_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{OutboundOrdersColumns[28]},
|
||
},
|
||
},
|
||
}
|
||
// PermissionsColumns holds the columns for the "permissions" table.
|
||
PermissionsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "code", Type: field.TypeString, Unique: true, Size: 64, Comment: "权限编码,如 inbound:view"},
|
||
{Name: "name", Type: field.TypeString, Size: 64, Comment: "名称"},
|
||
{Name: "type", Type: field.TypeString, Size: 20, Comment: "类型 MENU菜单/BUTTON按钮", Default: "MENU"},
|
||
{Name: "parent_code", Type: field.TypeString, Nullable: true, Size: 64, Comment: "所属菜单编码(BUTTON 填其所属 MENU 的 code;全局按钮填空)", Default: ""},
|
||
{Name: "path", Type: field.TypeString, Nullable: true, Size: 128, Comment: "前端路由(菜单类)", Default: ""},
|
||
{Name: "icon", Type: field.TypeString, Nullable: true, Size: 64, Comment: "图标(菜单类)", Default: ""},
|
||
{Name: "sort", Type: field.TypeInt, Nullable: true, Comment: "排序", Default: 0},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Comment: "备注", Default: ""},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
{Name: "updated_at", Type: field.TypeInt64, Comment: "更新时间"},
|
||
}
|
||
// PermissionsTable holds the schema information for the "permissions" table.
|
||
PermissionsTable = &schema.Table{
|
||
Name: "permissions",
|
||
Comment: "Permission 权限/菜单",
|
||
Columns: PermissionsColumns,
|
||
PrimaryKey: []*schema.Column{PermissionsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "permission_code",
|
||
Unique: true,
|
||
Columns: []*schema.Column{PermissionsColumns[1]},
|
||
},
|
||
},
|
||
}
|
||
// ReturnOrdersColumns holds the columns for the "return_orders" table.
|
||
ReturnOrdersColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "return_no", Type: field.TypeString, Unique: true, Comment: "退库单号"},
|
||
{Name: "source_type", Type: field.TypeString, Comment: "来源 station=工位退库/call=叫料单退库", Default: "station"},
|
||
{Name: "order_no", Type: field.TypeString, Comment: "关联工单号", Default: ""},
|
||
{Name: "ref_no", Type: field.TypeString, Size: 64, Comment: "关联单据号(source_type=call 时为叫料单号,仓库确认收回后回调 MES 关单)", Default: ""},
|
||
{Name: "station_no", Type: field.TypeInt, Comment: "退库工位号", Default: 0},
|
||
{Name: "return_dock", Type: field.TypeString, Size: 20, Comment: "退料接驳台(退料时指定从哪个接驳台拉走,AGV 回库依据,2026-11-03 拍板)", Default: ""},
|
||
{Name: "sn", Type: field.TypeString, Comment: "工件SN(可空)", Default: ""},
|
||
{Name: "material_code", Type: field.TypeString, Comment: "物料编码"},
|
||
{Name: "material_name", Type: field.TypeString, Nullable: true, Comment: "物料名称(冗余)"},
|
||
{Name: "spec", Type: field.TypeString, Nullable: true, Comment: "规格"},
|
||
{Name: "qty", Type: field.TypeInt, Comment: "退库数量", Default: 0},
|
||
{Name: "unit", Type: field.TypeString, Comment: "单位", Default: ""},
|
||
{Name: "reason", Type: field.TypeString, Comment: "退库原因", Default: ""},
|
||
{Name: "loss_reason", Type: field.TypeString, Size: 200, Comment: "损耗原因(退料发起方填写;巡检/代退料一律必填,转产退料实际<理论时必填)", Default: ""},
|
||
{Name: "status", Type: field.TypeString, Comment: "PENDING/RECEIVED/CANCELLED", Default: "PENDING"},
|
||
{Name: "transport_mode", Type: field.TypeString, Size: 10, Comment: "运输方式 agv=AGV自动派车/manual=人工搬运", Default: ""},
|
||
{Name: "dispatched_at", Type: field.TypeInt64, Comment: "AGV自动派车时间(0=未派车)", Default: 0},
|
||
{Name: "cancelled_by", Type: field.TypeString, Size: 64, Comment: "取消操作人", Default: ""},
|
||
{Name: "cancel_reason", Type: field.TypeString, Size: 200, Comment: "取消原因", Default: ""},
|
||
{Name: "operator", Type: field.TypeString, Comment: "退库发起人(工位终端操作人)", Default: ""},
|
||
{Name: "receive_by", Type: field.TypeString, Comment: "WMS 确认收货人", Default: ""},
|
||
{Name: "receive_qty", Type: field.TypeInt, Comment: "库管实收量(确认收货时录入;0=整单全收)", Default: 0},
|
||
{Name: "receive_diff", Type: field.TypeInt, Comment: "收货差异=应退-实收(>0 为少收,记待核,不自动进损耗台账)", Default: 0},
|
||
{Name: "receive_note", Type: field.TypeString, Comment: "收货差异备注(库管填写,说明差异原因)", Default: ""},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
{Name: "receive_at", Type: field.TypeInt64, Comment: "确认收货时间", Default: 0},
|
||
}
|
||
// ReturnOrdersTable holds the schema information for the "return_orders" table.
|
||
ReturnOrdersTable = &schema.Table{
|
||
Name: "return_orders",
|
||
Comment: "ReturnOrder 退库单(客户诉求 问题记录 L488/L491):",
|
||
Columns: ReturnOrdersColumns,
|
||
PrimaryKey: []*schema.Column{ReturnOrdersColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "returnorder_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{ReturnOrdersColumns[15]},
|
||
},
|
||
{
|
||
Name: "returnorder_order_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{ReturnOrdersColumns[3]},
|
||
},
|
||
{
|
||
Name: "returnorder_station_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{ReturnOrdersColumns[5]},
|
||
},
|
||
{
|
||
Name: "returnorder_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{ReturnOrdersColumns[8]},
|
||
},
|
||
},
|
||
}
|
||
// RolesColumns holds the columns for the "roles" table.
|
||
RolesColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "name", Type: field.TypeString, Size: 64, Comment: "角色名称"},
|
||
{Name: "code", Type: field.TypeString, Unique: true, Size: 64, Comment: "角色编码,如 admin/operator/inspector"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Comment: "备注", Default: ""},
|
||
{Name: "permission_codes", Type: field.TypeJSON, Nullable: true, Comment: "权限编码列表", SchemaType: map[string]string{"postgres": "jsonb"}},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "创建时间"},
|
||
{Name: "updated_at", Type: field.TypeInt64, Comment: "更新时间"},
|
||
}
|
||
// RolesTable holds the schema information for the "roles" table.
|
||
RolesTable = &schema.Table{
|
||
Name: "roles",
|
||
Comment: "Role 角色:承载菜单/按钮权限",
|
||
Columns: RolesColumns,
|
||
PrimaryKey: []*schema.Column{RolesColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "role_code",
|
||
Unique: true,
|
||
Columns: []*schema.Column{RolesColumns[2]},
|
||
},
|
||
},
|
||
}
|
||
// SemiFinishedsColumns holds the columns for the "semi_finisheds" table.
|
||
SemiFinishedsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "sn", Type: field.TypeString, Unique: true, Comment: "在制品 SN"},
|
||
{Name: "material_code", Type: field.TypeString, Nullable: true, Comment: "物料编码(MES 未传时按 SN 反查,可空)"},
|
||
{Name: "completed_process", Type: field.TypeString, Nullable: true, Comment: "已完成工序(如 135)"},
|
||
{Name: "quantity", Type: field.TypeInt, Comment: "数量", Default: 1},
|
||
{Name: "zone_code", Type: field.TypeString, Nullable: true, Comment: "所在区域"},
|
||
{Name: "status", Type: field.TypeString, Comment: "在库/出库/使用", Default: "在库"},
|
||
{Name: "order_no", Type: field.TypeString, Nullable: true, Comment: "关联工单"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// SemiFinishedsTable holds the schema information for the "semi_finisheds" table.
|
||
SemiFinishedsTable = &schema.Table{
|
||
Name: "semi_finisheds",
|
||
Comment: "SemiFinished 在制品库存",
|
||
Columns: SemiFinishedsColumns,
|
||
PrimaryKey: []*schema.Column{SemiFinishedsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "semifinished_material_code",
|
||
Unique: false,
|
||
Columns: []*schema.Column{SemiFinishedsColumns[2]},
|
||
},
|
||
{
|
||
Name: "semifinished_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{SemiFinishedsColumns[6]},
|
||
},
|
||
},
|
||
}
|
||
// StocktakeItemsColumns holds the columns for the "stocktake_items" table.
|
||
StocktakeItemsColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "stocktake_no", Type: field.TypeString, Comment: "所属盘点单号"},
|
||
{Name: "target_type", Type: field.TypeString, Comment: "BATCH/SN"},
|
||
{Name: "target_id", Type: field.TypeString, Comment: "批次号或SN码"},
|
||
{Name: "material_code", Type: field.TypeString, Nullable: true, Comment: "物料编码(冗余,便于盘点差异按物料归类)"},
|
||
{Name: "zone_code", Type: field.TypeString, Nullable: true, Comment: "所在区域"},
|
||
{Name: "shelf_no", Type: field.TypeString, Nullable: true, Comment: "货架号(快照)"},
|
||
{Name: "layer_no", Type: field.TypeString, Nullable: true, Comment: "第几层(快照)"},
|
||
{Name: "position_no", Type: field.TypeString, Nullable: true, Comment: "位置号(快照)"},
|
||
{Name: "book_qty", Type: field.TypeInt, Comment: "账面数量", Default: 0},
|
||
{Name: "scanned_qty", Type: field.TypeInt, Comment: "实盘数量,-1=未盘", Default: -1},
|
||
{Name: "diff_qty", Type: field.TypeInt, Comment: "差异 = 实盘 - 账面", Default: 0},
|
||
{Name: "counted", Type: field.TypeBool, Comment: "是否已扫码", Default: false},
|
||
{Name: "counted_by", Type: field.TypeString, Nullable: true, Comment: "实盘人(扫码录入者)"},
|
||
{Name: "counted_at", Type: field.TypeInt64, Nullable: true, Comment: "实盘时间(unix 秒)"},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// StocktakeItemsTable holds the schema information for the "stocktake_items" table.
|
||
StocktakeItemsTable = &schema.Table{
|
||
Name: "stocktake_items",
|
||
Comment: "StocktakeItem 盘点明细(发起时的账面快照 + 扫码实盘数)",
|
||
Columns: StocktakeItemsColumns,
|
||
PrimaryKey: []*schema.Column{StocktakeItemsColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "stocktakeitem_stocktake_no",
|
||
Unique: false,
|
||
Columns: []*schema.Column{StocktakeItemsColumns[1]},
|
||
},
|
||
{
|
||
Name: "stocktakeitem_target_id",
|
||
Unique: false,
|
||
Columns: []*schema.Column{StocktakeItemsColumns[3]},
|
||
},
|
||
},
|
||
}
|
||
// StocktakeOrdersColumns holds the columns for the "stocktake_orders" table.
|
||
StocktakeOrdersColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "stocktake_no", Type: field.TypeString, Unique: true, Comment: "盘点单号"},
|
||
{Name: "status", Type: field.TypeString, Comment: "进行中/已完成/已写回/已取消", Default: "进行中"},
|
||
{Name: "operator", Type: field.TypeString, Nullable: true, Comment: "发起人"},
|
||
{Name: "total_targets", Type: field.TypeInt, Comment: "快照目标数(本次盘点覆盖的批次/SN总数)", Default: 0},
|
||
{Name: "diff_count", Type: field.TypeInt, Comment: "差异项数(diff!=0 的明细数)", Default: 0},
|
||
{Name: "adjusted", Type: field.TypeBool, Comment: "差异是否已写回库存", Default: false},
|
||
{Name: "adjust_no", Type: field.TypeString, Nullable: true, Comment: "盘点调整单号(写回时生成)"},
|
||
{Name: "written_at", Type: field.TypeInt64, Nullable: true, Comment: "写回时间(unix 秒)"},
|
||
{Name: "written_by", Type: field.TypeString, Nullable: true, Comment: "写回操作人"},
|
||
{Name: "uncounted_mode", Type: field.TypeString, Nullable: true, Comment: "未盘项处理 keep=按账面保留/zero=盘亏为0"},
|
||
{Name: "cancel_reason", Type: field.TypeString, Nullable: true, Comment: "取消原因"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "finished_at", Type: field.TypeInt64, Nullable: true, Comment: "完成时间"},
|
||
}
|
||
// StocktakeOrdersTable holds the schema information for the "stocktake_orders" table.
|
||
StocktakeOrdersTable = &schema.Table{
|
||
Name: "stocktake_orders",
|
||
Comment: "StocktakeOrder 盘点单:发起时冻结当时库存快照(明细行)",
|
||
Columns: StocktakeOrdersColumns,
|
||
PrimaryKey: []*schema.Column{StocktakeOrdersColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "stocktakeorder_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{StocktakeOrdersColumns[2]},
|
||
},
|
||
},
|
||
}
|
||
// SyncFailureColumns holds the columns for the "sync_failure" table.
|
||
SyncFailureColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "direction", Type: field.TypeString, Size: 2147483647, Comment: "调用方向,如 mes>wms / wms>mes", Default: ""},
|
||
{Name: "biz_type", Type: field.TypeString, Size: 2147483647, Comment: "业务类型,如 material.sync", Default: ""},
|
||
{Name: "biz_key", Type: field.TypeString, Size: 2147483647, Comment: "业务主键", Default: ""},
|
||
{Name: "endpoint", Type: field.TypeString, Size: 2147483647, Comment: "重试时原样重放的对端地址", Default: ""},
|
||
{Name: "payload_json", Type: field.TypeString, Size: 2147483647, Comment: "通知载荷(JSON)", Default: "{}"},
|
||
{Name: "error_msg", Type: field.TypeString, Size: 2147483647, Comment: "失败原因", Default: ""},
|
||
{Name: "idempotency_key", Type: field.TypeString, Size: 2147483647, Comment: "幂等键 direction|biz_type|biz_key"},
|
||
{Name: "status", Type: field.TypeString, Size: 2147483647, Comment: "PENDING/SUCCESS/DEAD", Default: "PENDING"},
|
||
{Name: "retry_count", Type: field.TypeInt32, Comment: "重试次数", Default: 0},
|
||
{Name: "created_at", Type: field.TypeInt64, Comment: "首次失败时刻(unix秒)", Default: 0},
|
||
{Name: "last_error_at", Type: field.TypeInt64, Comment: "最近失败时刻(unix秒)", Default: 0},
|
||
{Name: "handled_by", Type: field.TypeString, Size: 2147483647, Comment: "人工置 DEAD 的操作人", Default: ""},
|
||
}
|
||
// SyncFailureTable holds the schema information for the "sync_failure" table.
|
||
SyncFailureTable = &schema.Table{
|
||
Name: "sync_failure",
|
||
Comment: "SyncFailure 跨系统调用失败台账:本地已提交、对端通知失败,人工确认后重试",
|
||
Columns: SyncFailureColumns,
|
||
PrimaryKey: []*schema.Column{SyncFailureColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "syncfailure_idempotency_key",
|
||
Unique: true,
|
||
Columns: []*schema.Column{SyncFailureColumns[7]},
|
||
},
|
||
{
|
||
Name: "syncfailure_status",
|
||
Unique: false,
|
||
Columns: []*schema.Column{SyncFailureColumns[8]},
|
||
},
|
||
},
|
||
}
|
||
// SysConfigColumns holds the columns for the "sys_config" table.
|
||
SysConfigColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "key", Type: field.TypeString, Unique: true, Size: 64, Comment: "配置键,如 wms.base_url"},
|
||
{Name: "value", Type: field.TypeString, Size: 512, Comment: "配置值"},
|
||
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Comment: "说明"},
|
||
}
|
||
// SysConfigTable holds the schema information for the "sys_config" table.
|
||
SysConfigTable = &schema.Table{
|
||
Name: "sys_config",
|
||
Comment: "SysConfig 系统基础设置(key/value)。",
|
||
Columns: SysConfigColumns,
|
||
PrimaryKey: []*schema.Column{SysConfigColumns[0]},
|
||
}
|
||
// UsersColumns holds the columns for the "users" table.
|
||
UsersColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "username", Type: field.TypeString, Unique: true, Comment: "登录名"},
|
||
{Name: "password", Type: field.TypeString, Comment: "密码(哈希)"},
|
||
{Name: "real_name", Type: field.TypeString, Nullable: true, Comment: "姓名"},
|
||
{Name: "role", Type: field.TypeString, Comment: "角色 admin/operator/inspector(旧字段,权限数据化后由 role_id 决定,此字段仅作兼容/展示)", Default: "operator"},
|
||
{Name: "role_id", Type: field.TypeInt, Nullable: true, Comment: "角色ID,关联 roles 表;为空时回退按 role 字符串取权限"},
|
||
{Name: "dept", Type: field.TypeString, Nullable: true, Comment: "部门"},
|
||
{Name: "phone", Type: field.TypeString, Nullable: true, Comment: "电话"},
|
||
{Name: "is_active", Type: field.TypeBool, Comment: "是否启用", Default: true},
|
||
{Name: "last_login_at", Type: field.TypeInt64, Nullable: true, Comment: "最近登录时间"},
|
||
{Name: "active_token", Type: field.TypeString, Nullable: true, Comment: "后台登录会话标识(SID),互踢用;空=无生效后台会话"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64},
|
||
}
|
||
// UsersTable holds the schema information for the "users" table.
|
||
UsersTable = &schema.Table{
|
||
Name: "users",
|
||
Comment: "User 系统用户(账号与权限)",
|
||
Columns: UsersColumns,
|
||
PrimaryKey: []*schema.Column{UsersColumns[0]},
|
||
Indexes: []*schema.Index{
|
||
{
|
||
Name: "user_role",
|
||
Unique: false,
|
||
Columns: []*schema.Column{UsersColumns[4]},
|
||
},
|
||
},
|
||
}
|
||
// ZonesColumns holds the columns for the "zones" table.
|
||
ZonesColumns = []*schema.Column{
|
||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||
{Name: "level", Type: field.TypeInt, Comment: "层级 1区域/2货架/3层/4位置号"},
|
||
{Name: "code", Type: field.TypeString, Comment: "本级编码(区域编码/货架号/层号/位置号)"},
|
||
{Name: "name", Type: field.TypeString, Nullable: true, Comment: "显示名:区域名称(level1)或位置名称(level4,现场可读如'A架3层12位');其他级可空"},
|
||
{Name: "parent_code", Type: field.TypeString, Nullable: true, Comment: "上级节点编码;根级(level1)为空"},
|
||
{Name: "zone_code", Type: field.TypeString, Comment: "区域编码(冗余:本节点所属区域;level1=自身code)"},
|
||
{Name: "zone_name", Type: field.TypeString, Nullable: true, Comment: "区域名称(仅 level1 区域行有值)"},
|
||
{Name: "description", Type: field.TypeString, Nullable: true, Comment: "说明(区域级)"},
|
||
{Name: "shelf_no", Type: field.TypeString, Nullable: true, Comment: "货架号(冗余)"},
|
||
{Name: "layer_no", Type: field.TypeString, Nullable: true, Comment: "第几层(冗余;默认位置为空)"},
|
||
{Name: "position_no", Type: field.TypeString, Nullable: true, Comment: "位置号(冗余;level4=自身code)"},
|
||
{Name: "status", Type: field.TypeString, Comment: "状态:启用/停用", Default: "启用"},
|
||
{Name: "created_at", Type: field.TypeInt64},
|
||
{Name: "updated_at", Type: field.TypeInt64, Nullable: true, Comment: "更新时间"},
|
||
}
|
||
// ZonesTable holds the schema information for the "zones" table.
|
||
ZonesTable = &schema.Table{
|
||
Name: "zones",
|
||
Comment: "Zone 库房库位主数据(统一主表 + 层级类型字段,符合「统一主表+类型字段,禁拆表」铁律)。",
|
||
Columns: ZonesColumns,
|
||
PrimaryKey: []*schema.Column{ZonesColumns[0]},
|
||
}
|
||
// Tables holds all the tables in the schema.
|
||
Tables = []*schema.Table{
|
||
AlertsTable,
|
||
AlertRulesTable,
|
||
AttachmentsTable,
|
||
BackupRecordTable,
|
||
DeliveryOrderTable,
|
||
DeliveryOrderItemTable,
|
||
EventLogTable,
|
||
InboundDetailsTable,
|
||
InboundOrdersTable,
|
||
InspectionDisposalItemsTable,
|
||
InspectionRecordsTable,
|
||
InventoriesTable,
|
||
InventoryLocksTable,
|
||
MaterialsTable,
|
||
MaterialDemandsTable,
|
||
OrderMaterialLedgersTable,
|
||
OutboundDetailsTable,
|
||
OutboundOrdersTable,
|
||
PermissionsTable,
|
||
ReturnOrdersTable,
|
||
RolesTable,
|
||
SemiFinishedsTable,
|
||
StocktakeItemsTable,
|
||
StocktakeOrdersTable,
|
||
SyncFailureTable,
|
||
SysConfigTable,
|
||
UsersTable,
|
||
ZonesTable,
|
||
}
|
||
)
|
||
|
||
func init() {
|
||
AlertsTable.Annotation = &entsql.Annotation{
|
||
Table: "alerts",
|
||
}
|
||
AlertRulesTable.Annotation = &entsql.Annotation{
|
||
Table: "alert_rules",
|
||
}
|
||
AttachmentsTable.Annotation = &entsql.Annotation{
|
||
Table: "attachments",
|
||
}
|
||
BackupRecordTable.Annotation = &entsql.Annotation{
|
||
Table: "backup_record",
|
||
}
|
||
DeliveryOrderTable.Annotation = &entsql.Annotation{
|
||
Table: "delivery_order",
|
||
}
|
||
DeliveryOrderItemTable.Annotation = &entsql.Annotation{
|
||
Table: "delivery_order_item",
|
||
}
|
||
EventLogTable.Annotation = &entsql.Annotation{
|
||
Table: "event_log",
|
||
}
|
||
InboundDetailsTable.Annotation = &entsql.Annotation{
|
||
Table: "inbound_details",
|
||
}
|
||
InboundOrdersTable.Annotation = &entsql.Annotation{
|
||
Table: "inbound_orders",
|
||
}
|
||
InspectionDisposalItemsTable.Annotation = &entsql.Annotation{
|
||
Table: "inspection_disposal_items",
|
||
}
|
||
InspectionRecordsTable.Annotation = &entsql.Annotation{
|
||
Table: "inspection_records",
|
||
}
|
||
InventoriesTable.Annotation = &entsql.Annotation{
|
||
Table: "inventories",
|
||
}
|
||
InventoryLocksTable.Annotation = &entsql.Annotation{
|
||
Table: "inventory_locks",
|
||
}
|
||
MaterialsTable.Annotation = &entsql.Annotation{
|
||
Table: "materials",
|
||
}
|
||
MaterialDemandsTable.Annotation = &entsql.Annotation{
|
||
Table: "material_demands",
|
||
}
|
||
OrderMaterialLedgersTable.Annotation = &entsql.Annotation{
|
||
Table: "order_material_ledgers",
|
||
}
|
||
OutboundDetailsTable.Annotation = &entsql.Annotation{
|
||
Table: "outbound_details",
|
||
}
|
||
OutboundOrdersTable.Annotation = &entsql.Annotation{
|
||
Table: "outbound_orders",
|
||
}
|
||
PermissionsTable.Annotation = &entsql.Annotation{
|
||
Table: "permissions",
|
||
}
|
||
ReturnOrdersTable.Annotation = &entsql.Annotation{
|
||
Table: "return_orders",
|
||
}
|
||
RolesTable.Annotation = &entsql.Annotation{
|
||
Table: "roles",
|
||
}
|
||
SemiFinishedsTable.Annotation = &entsql.Annotation{
|
||
Table: "semi_finisheds",
|
||
}
|
||
StocktakeItemsTable.Annotation = &entsql.Annotation{
|
||
Table: "stocktake_items",
|
||
}
|
||
StocktakeOrdersTable.Annotation = &entsql.Annotation{
|
||
Table: "stocktake_orders",
|
||
}
|
||
SyncFailureTable.Annotation = &entsql.Annotation{
|
||
Table: "sync_failure",
|
||
}
|
||
SysConfigTable.Annotation = &entsql.Annotation{
|
||
Table: "sys_config",
|
||
}
|
||
UsersTable.Annotation = &entsql.Annotation{
|
||
Table: "users",
|
||
}
|
||
ZonesTable.Annotation = &entsql.Annotation{
|
||
Table: "zones",
|
||
}
|
||
}
|