Files
bj_power/bj_power_wms/ent/migrate/schema.go
T
SunYF 62e45b7379 feat: 完成附件存储重构与磁盘监控功能,同步物料档案与入库单规则更新
1.  新增跨平台磁盘空间监控能力,每日7点自动检测附件目录剩余空间,触发阈值告警
2.  重构附件存储方案为年/月/日/文件类型分层结构,统一MES与WMS的附件管理逻辑
3.  对齐物料档案与入库单的质量状态校验规则,仅合格品计入库存与出库
4.  实现入库单作废功能与区域库位的多级父子结构管理
5.  删除物料简称字段,补充规格型号与单位必填项,统一系统数据口径
6.  新增附件中心与磁盘状态查询接口,完善权限控制与操作日志
2026-09-19 10:54:15 +08:00

888 lines
34 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 (
// AgvTasksColumns holds the columns for the "agv_tasks" table.
AgvTasksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "task_no", Type: field.TypeString, Unique: true, Size: 64},
{Name: "hik_task_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "source_dock", Type: field.TypeString, Size: 20, Default: ""},
{Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""},
{Name: "materials_json", Type: field.TypeString, Size: 4000, Default: ""},
{Name: "related_outbound_no", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "dispatched_at", Type: field.TypeInt64, Default: 0},
{Name: "arrived_at", Type: field.TypeInt64, Default: 0},
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 500, Default: ""},
{Name: "created_at", Type: field.TypeInt64},
}
// AgvTasksTable holds the schema information for the "agv_tasks" table.
AgvTasksTable = &schema.Table{
Name: "agv_tasks",
Columns: AgvTasksColumns,
PrimaryKey: []*schema.Column{AgvTasksColumns[0]},
Indexes: []*schema.Index{
{
Name: "agvtask_task_no",
Unique: true,
Columns: []*schema.Column{AgvTasksColumns[1]},
},
{
Name: "agvtask_target_dock",
Unique: false,
Columns: []*schema.Column{AgvTasksColumns[4]},
},
{
Name: "agvtask_status",
Unique: false,
Columns: []*schema.Column{AgvTasksColumns[7]},
},
{
Name: "agvtask_hik_task_code",
Unique: false,
Columns: []*schema.Column{AgvTasksColumns[2]},
},
},
}
// AttachmentsColumns holds the columns for the "attachments" table.
AttachmentsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "biz_type", Type: field.TypeString},
{Name: "biz_id", Type: field.TypeString},
{Name: "file_name", Type: field.TypeString},
{Name: "file_path", Type: field.TypeString},
{Name: "file_type", Type: field.TypeString, Nullable: true},
{Name: "file_ext", Type: field.TypeString, Nullable: true},
{Name: "file_md5", Type: field.TypeString, Nullable: true},
{Name: "file_size", Type: field.TypeInt64, Default: 0},
{Name: "mime_type", Type: field.TypeString, Nullable: true},
{Name: "uploaded_by", Type: field.TypeString, Nullable: true},
{Name: "archived", Type: field.TypeBool, Default: false},
{Name: "archived_at", Type: field.TypeInt64, Nullable: true},
{Name: "deleted", Type: field.TypeBool, Default: false},
{Name: "deleted_at", Type: field.TypeInt64, Nullable: true},
{Name: "deleted_by", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeInt64},
}
// AttachmentsTable holds the schema information for the "attachments" table.
AttachmentsTable = &schema.Table{
Name: "attachments",
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[16]},
},
},
}
// DocksColumns holds the columns for the "docks" table.
DocksColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "dock_code", Type: field.TypeString, Unique: true, Size: 20},
{Name: "name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "dock_type", Type: field.TypeString, Size: 16, Default: "line"},
{Name: "station_no", Type: field.TypeInt, Default: 0},
{Name: "has_pallet", Type: field.TypeBool, Default: false},
{Name: "pallet_ref", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"},
{Name: "created_at", Type: field.TypeInt64},
}
// DocksTable holds the schema information for the "docks" table.
DocksTable = &schema.Table{
Name: "docks",
Columns: DocksColumns,
PrimaryKey: []*schema.Column{DocksColumns[0]},
Indexes: []*schema.Index{
{
Name: "dock_dock_code",
Unique: true,
Columns: []*schema.Column{DocksColumns[1]},
},
{
Name: "dock_dock_type",
Unique: false,
Columns: []*schema.Column{DocksColumns[3]},
},
},
}
// 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},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "entity_type", Type: field.TypeString, Size: 32, Default: ""},
{Name: "entity_id", Type: field.TypeString, Size: 64, Default: ""},
{Name: "description", Type: field.TypeString, Size: 2147483647, Default: ""},
{Name: "payload", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeInt64},
}
// EventLogTable holds the schema information for the "event_log" table.
EventLogTable = &schema.Table{
Name: "event_log",
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},
{Name: "sn_code", Type: field.TypeString, Nullable: true},
{Name: "batch_no", Type: field.TypeString, Nullable: true},
{Name: "material_code", Type: field.TypeString},
{Name: "quantity", Type: field.TypeInt, Default: 1},
{Name: "created_at", Type: field.TypeInt64},
}
// InboundDetailsTable holds the schema information for the "inbound_details" table.
InboundDetailsTable = &schema.Table{
Name: "inbound_details",
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},
{Name: "inbound_type", Type: field.TypeString, Default: "purchase"},
{Name: "material_code", Type: field.TypeString},
{Name: "material_name", Type: field.TypeString, Nullable: true},
{Name: "manage_mode", Type: field.TypeInt, Default: 1},
{Name: "batch_no", Type: field.TypeString, Nullable: true},
{Name: "zone_code", Type: field.TypeString, Nullable: true},
{Name: "shelf_no", Type: field.TypeString, Nullable: true},
{Name: "layer_no", Type: field.TypeString, Nullable: true},
{Name: "position_no", Type: field.TypeString, Nullable: true},
{Name: "quantity", Type: field.TypeInt, Default: 0},
{Name: "operator", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{Name: "inspection_no", Type: field.TypeString},
{Name: "ownership_type", Type: field.TypeString, Default: "none"},
{Name: "ownership_no", Type: field.TypeString, Nullable: true},
{Name: "quality_status", Type: field.TypeString, Nullable: true},
{Name: "voided", Type: field.TypeBool, Default: false},
{Name: "void_reason", Type: field.TypeString, Nullable: true},
{Name: "voided_by", Type: field.TypeString, Nullable: true},
{Name: "voided_at", Type: field.TypeInt64, Nullable: true},
{Name: "created_at", Type: field.TypeInt64},
}
// InboundOrdersTable holds the schema information for the "inbound_orders" table.
InboundOrdersTable = &schema.Table{
Name: "inbound_orders",
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[12]},
},
},
}
// 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},
{Name: "target_id", Type: field.TypeString},
{Name: "material_code", Type: field.TypeString},
{Name: "material_name", Type: field.TypeString, Nullable: true},
{Name: "ownership_type", Type: field.TypeString, Nullable: true},
{Name: "ownership_no", Type: field.TypeString, Nullable: true},
{Name: "related_standard", Type: field.TypeString, Nullable: true},
{Name: "manufacturer", Type: field.TypeString, Nullable: true},
{Name: "inspection_type", Type: field.TypeString, Default: "incoming"},
{Name: "status", Type: field.TypeString, Default: "未检"},
{Name: "result_value", Type: field.TypeString, Nullable: true},
{Name: "inspect_qty", Type: field.TypeInt, Default: 0},
{Name: "pass_qty", Type: field.TypeInt, Default: 0},
{Name: "check_desc", Type: field.TypeString, Nullable: true},
{Name: "inspector", Type: field.TypeString, Nullable: true},
{Name: "inspection_no", Type: field.TypeString, Nullable: true},
{Name: "report_no", Type: field.TypeString, Nullable: true},
{Name: "disposal_type", Type: field.TypeString, Default: "NONE"},
{Name: "disposal_remark", Type: field.TypeString, Nullable: true},
{Name: "return_tracking_no", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{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",
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[9]},
},
{
Name: "inspectionrecord_status",
Unique: false,
Columns: []*schema.Column{InspectionRecordsColumns[10]},
},
},
}
// InventoriesColumns holds the columns for the "inventories" table.
InventoriesColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "manage_mode", Type: field.TypeInt},
{Name: "category", Type: field.TypeInt, Default: 1},
{Name: "material_code", Type: field.TypeString},
{Name: "material_name", Type: field.TypeString, Nullable: true},
{Name: "batch_no", Type: field.TypeString, Nullable: true},
{Name: "sn_code", Type: field.TypeString, Nullable: true},
{Name: "quantity", Type: field.TypeInt, Default: 0},
{Name: "locked_qty", Type: field.TypeInt, Default: 0},
{Name: "quality_status", Type: field.TypeString, Default: "未检"},
{Name: "zone_code", Type: field.TypeString, Nullable: true},
{Name: "shelf_no", Type: field.TypeString, Nullable: true},
{Name: "layer_no", Type: field.TypeString, Nullable: true},
{Name: "position_no", Type: field.TypeString, Nullable: true},
{Name: "status", Type: field.TypeString, Default: "在库"},
{Name: "production_date", Type: field.TypeString, Nullable: true},
{Name: "supplier", Type: field.TypeString, Nullable: true},
{Name: "inbound_no", Type: field.TypeString, Nullable: true},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "completed_process", Type: field.TypeString, Size: 64, Default: ""},
{Name: "ownership_type", Type: field.TypeString, Nullable: true},
{Name: "ownership_no", Type: field.TypeString, Nullable: true},
{Name: "product_status", Type: field.TypeString, Nullable: true},
{Name: "related_standard", Type: field.TypeString, Nullable: true},
{Name: "test_record_no", Type: field.TypeString, Nullable: true},
{Name: "recorded_by", Type: field.TypeString, Nullable: true},
{Name: "recorded_at", Type: field.TypeInt64, Nullable: true},
{Name: "outbound_reason", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{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",
Columns: InventoriesColumns,
PrimaryKey: []*schema.Column{InventoriesColumns[0]},
Indexes: []*schema.Index{
{
Name: "inventory_manage_mode",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[1]},
},
{
Name: "inventory_category",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[2]},
},
{
Name: "inventory_material_code",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[3]},
},
{
Name: "inventory_quality_status",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[9]},
},
{
Name: "inventory_zone_code",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[10]},
},
{
Name: "inventory_batch_no",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[5]},
},
{
Name: "inventory_sn_code",
Unique: false,
Columns: []*schema.Column{InventoriesColumns[6]},
},
},
}
// 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},
{Name: "target_id", Type: field.TypeString},
{Name: "material_code", Type: field.TypeString},
{Name: "locked_qty", Type: field.TypeInt, Default: 1},
{Name: "order_no", Type: field.TypeString},
{Name: "status", Type: field.TypeString, Default: "ACTIVE"},
{Name: "expired_at", Type: field.TypeInt64, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{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",
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},
{Name: "name", Type: field.TypeString},
{Name: "spec", Type: field.TypeString, Nullable: true},
{Name: "unit", Type: field.TypeString, Nullable: true},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "item_type", Type: field.TypeInt, Default: 1},
{Name: "manage_mode", Type: field.TypeInt, Default: 1},
{Name: "is_batch_managed", Type: field.TypeBool, Default: false},
{Name: "is_serial_managed", Type: field.TypeBool, Default: false},
{Name: "template_code", Type: field.TypeString, Nullable: true},
{Name: "safety_stock", Type: field.TypeInt, Default: 0},
{Name: "is_active", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeInt64},
{Name: "updated_at", Type: field.TypeInt64},
}
// MaterialsTable holds the schema information for the "materials" table.
MaterialsTable = &schema.Table{
Name: "materials",
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[10]},
},
{
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},
{Name: "future5_qty", Type: field.TypeInt, Default: 0},
{Name: "updated_at", Type: field.TypeInt64},
}
// MaterialDemandsTable holds the schema information for the "material_demands" table.
MaterialDemandsTable = &schema.Table{
Name: "material_demands",
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},
{Name: "material_code", Type: field.TypeString},
{Name: "material_name", Type: field.TypeString, Nullable: true},
{Name: "total_qty", Type: field.TypeInt, Default: 0},
{Name: "out_qty", Type: field.TypeInt, Default: 0},
{Name: "status", Type: field.TypeString, Default: "进行中"},
{Name: "target_station", Type: field.TypeString, Nullable: true},
{Name: "completed_at", Type: field.TypeInt64, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{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",
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},
{Name: "sn_code", Type: field.TypeString, Nullable: true},
{Name: "batch_no", Type: field.TypeString, Nullable: true},
{Name: "material_code", Type: field.TypeString},
{Name: "quantity", Type: field.TypeInt, Default: 1},
{Name: "order_no", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeInt64},
}
// OutboundDetailsTable holds the schema information for the "outbound_details" table.
OutboundDetailsTable = &schema.Table{
Name: "outbound_details",
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},
{Name: "outbound_type", Type: field.TypeString, Default: "workorder"},
{Name: "outbound_category", Type: field.TypeString, Nullable: true},
{Name: "ownership_type", Type: field.TypeString, Nullable: true},
{Name: "ownership_no", Type: field.TypeString, Nullable: true},
{Name: "target_station", Type: field.TypeString, Nullable: true},
{Name: "order_no", Type: field.TypeString, Nullable: true},
{Name: "material_code", Type: field.TypeString},
{Name: "material_name", Type: field.TypeString, Nullable: true},
{Name: "manage_mode", Type: field.TypeInt, Default: 1},
{Name: "batch_no", Type: field.TypeString, Nullable: true},
{Name: "zone_code", Type: field.TypeString, Nullable: true},
{Name: "quantity", Type: field.TypeInt, Default: 0},
{Name: "operator", Type: field.TypeString, Nullable: true},
{Name: "reviewer", Type: field.TypeString, Nullable: true},
{Name: "target_dock", Type: field.TypeString, Nullable: true},
{Name: "remark", Type: field.TypeString, Nullable: true},
{Name: "box_no", Type: field.TypeString, Nullable: true},
{Name: "box_sn_list", Type: field.TypeString, Nullable: true},
{Name: "contract_no", Type: field.TypeString, Nullable: true},
{Name: "created_at", Type: field.TypeInt64},
}
// OutboundOrdersTable holds the schema information for the "outbound_orders" table.
OutboundOrdersTable = &schema.Table{
Name: "outbound_orders",
Columns: OutboundOrdersColumns,
PrimaryKey: []*schema.Column{OutboundOrdersColumns[0]},
Indexes: []*schema.Index{
{
Name: "outboundorder_order_no",
Unique: false,
Columns: []*schema.Column{OutboundOrdersColumns[7]},
},
{
Name: "outboundorder_material_code",
Unique: false,
Columns: []*schema.Column{OutboundOrdersColumns[8]},
},
{
Name: "outboundorder_outbound_type",
Unique: false,
Columns: []*schema.Column{OutboundOrdersColumns[2]},
},
{
Name: "outboundorder_box_no",
Unique: false,
Columns: []*schema.Column{OutboundOrdersColumns[18]},
},
},
}
// 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},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "type", Type: field.TypeString, Size: 20, Default: "MENU"},
{Name: "parent_code", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "path", Type: field.TypeString, Nullable: true, Size: 128, Default: ""},
{Name: "icon", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
{Name: "sort", Type: field.TypeInt, Nullable: true, Default: 0},
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeInt64},
{Name: "updated_at", Type: field.TypeInt64},
}
// PermissionsTable holds the schema information for the "permissions" table.
PermissionsTable = &schema.Table{
Name: "permissions",
Columns: PermissionsColumns,
PrimaryKey: []*schema.Column{PermissionsColumns[0]},
Indexes: []*schema.Index{
{
Name: "permission_code",
Unique: true,
Columns: []*schema.Column{PermissionsColumns[1]},
},
},
}
// ProducibleSnapshotsColumns holds the columns for the "producible_snapshots" table.
ProducibleSnapshotsColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "product_code", Type: field.TypeString},
{Name: "product_name", Type: field.TypeString, Nullable: true},
{Name: "producible_qty", Type: field.TypeInt, Default: 0},
{Name: "short_text", Type: field.TypeString, Nullable: true},
{Name: "computed_at", Type: field.TypeInt64, Default: 0},
{Name: "synced_at", Type: field.TypeInt64},
}
// ProducibleSnapshotsTable holds the schema information for the "producible_snapshots" table.
ProducibleSnapshotsTable = &schema.Table{
Name: "producible_snapshots",
Columns: ProducibleSnapshotsColumns,
PrimaryKey: []*schema.Column{ProducibleSnapshotsColumns[0]},
Indexes: []*schema.Index{
{
Name: "produciblesnapshot_product_code",
Unique: false,
Columns: []*schema.Column{ProducibleSnapshotsColumns[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},
{Name: "source_type", Type: field.TypeString, Default: "station"},
{Name: "order_no", Type: field.TypeString, Default: ""},
{Name: "station_no", Type: field.TypeInt, Default: 0},
{Name: "sn", Type: field.TypeString, Default: ""},
{Name: "material_code", Type: field.TypeString},
{Name: "material_name", Type: field.TypeString, Nullable: true},
{Name: "spec", Type: field.TypeString, Nullable: true},
{Name: "qty", Type: field.TypeInt, Default: 0},
{Name: "unit", Type: field.TypeString, Default: ""},
{Name: "reason", Type: field.TypeString, Default: ""},
{Name: "status", Type: field.TypeString, Default: "PENDING"},
{Name: "operator", Type: field.TypeString, Default: ""},
{Name: "receive_by", Type: field.TypeString, Default: ""},
{Name: "created_at", Type: field.TypeInt64},
{Name: "receive_at", Type: field.TypeInt64, Default: 0},
}
// ReturnOrdersTable holds the schema information for the "return_orders" table.
ReturnOrdersTable = &schema.Table{
Name: "return_orders",
Columns: ReturnOrdersColumns,
PrimaryKey: []*schema.Column{ReturnOrdersColumns[0]},
Indexes: []*schema.Index{
{
Name: "returnorder_status",
Unique: false,
Columns: []*schema.Column{ReturnOrdersColumns[12]},
},
{
Name: "returnorder_order_no",
Unique: false,
Columns: []*schema.Column{ReturnOrdersColumns[3]},
},
{
Name: "returnorder_station_no",
Unique: false,
Columns: []*schema.Column{ReturnOrdersColumns[4]},
},
{
Name: "returnorder_material_code",
Unique: false,
Columns: []*schema.Column{ReturnOrdersColumns[6]},
},
},
}
// 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},
{Name: "code", Type: field.TypeString, Unique: true, Size: 64},
{Name: "remark", Type: field.TypeString, Nullable: true, Size: 255, Default: ""},
{Name: "permission_codes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeInt64},
{Name: "updated_at", Type: field.TypeInt64},
}
// RolesTable holds the schema information for the "roles" table.
RolesTable = &schema.Table{
Name: "roles",
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},
{Name: "material_code", Type: field.TypeString, Nullable: true},
{Name: "completed_process", Type: field.TypeString, Nullable: true},
{Name: "quantity", Type: field.TypeInt, Default: 1},
{Name: "zone_code", Type: field.TypeString, Nullable: true},
{Name: "status", Type: field.TypeString, Default: "在库"},
{Name: "order_no", Type: field.TypeString, Nullable: true},
{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",
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},
{Name: "target_type", Type: field.TypeString},
{Name: "target_id", Type: field.TypeString},
{Name: "material_code", Type: field.TypeString, Nullable: true},
{Name: "zone_code", Type: field.TypeString, Nullable: true},
{Name: "shelf_no", Type: field.TypeString, Nullable: true},
{Name: "layer_no", Type: field.TypeString, Nullable: true},
{Name: "position_no", Type: field.TypeString, Nullable: true},
{Name: "book_qty", Type: field.TypeInt, Default: 0},
{Name: "scanned_qty", Type: field.TypeInt, Default: -1},
{Name: "diff_qty", Type: field.TypeInt, Default: 0},
{Name: "counted", Type: field.TypeBool, Default: false},
{Name: "updated_at", Type: field.TypeInt64},
}
// StocktakeItemsTable holds the schema information for the "stocktake_items" table.
StocktakeItemsTable = &schema.Table{
Name: "stocktake_items",
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},
{Name: "status", Type: field.TypeString, Default: "进行中"},
{Name: "operator", Type: field.TypeString, Nullable: true},
{Name: "total_targets", Type: field.TypeInt, Default: 0},
{Name: "created_at", Type: field.TypeInt64},
{Name: "finished_at", Type: field.TypeInt64, Nullable: true},
}
// StocktakeOrdersTable holds the schema information for the "stocktake_orders" table.
StocktakeOrdersTable = &schema.Table{
Name: "stocktake_orders",
Columns: StocktakeOrdersColumns,
PrimaryKey: []*schema.Column{StocktakeOrdersColumns[0]},
Indexes: []*schema.Index{
{
Name: "stocktakeorder_status",
Unique: false,
Columns: []*schema.Column{StocktakeOrdersColumns[2]},
},
},
}
// 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},
{Name: "password", Type: field.TypeString},
{Name: "real_name", Type: field.TypeString, Nullable: true},
{Name: "role", Type: field.TypeString, Default: "operator"},
{Name: "role_id", Type: field.TypeInt, Nullable: true},
{Name: "dept", Type: field.TypeString, Nullable: true},
{Name: "phone", Type: field.TypeString, Nullable: true},
{Name: "is_active", Type: field.TypeBool, Default: true},
{Name: "last_login_at", Type: field.TypeInt64, Nullable: true},
{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",
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},
{Name: "code", Type: field.TypeString},
{Name: "name", Type: field.TypeString, Nullable: true},
{Name: "parent_code", Type: field.TypeString, Nullable: true},
{Name: "zone_code", Type: field.TypeString},
{Name: "zone_name", Type: field.TypeString, Nullable: true},
{Name: "description", Type: field.TypeString, Nullable: true},
{Name: "shelf_no", Type: field.TypeString, Nullable: true},
{Name: "layer_no", Type: field.TypeString, Nullable: true},
{Name: "position_no", Type: field.TypeString, Nullable: true},
{Name: "status", Type: field.TypeString, Default: "启用"},
{Name: "created_at", Type: field.TypeInt64},
{Name: "updated_at", Type: field.TypeInt64, Nullable: true},
}
// ZonesTable holds the schema information for the "zones" table.
ZonesTable = &schema.Table{
Name: "zones",
Columns: ZonesColumns,
PrimaryKey: []*schema.Column{ZonesColumns[0]},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
AgvTasksTable,
AttachmentsTable,
DocksTable,
EventLogTable,
InboundDetailsTable,
InboundOrdersTable,
InspectionRecordsTable,
InventoriesTable,
InventoryLocksTable,
MaterialsTable,
MaterialDemandsTable,
OrderMaterialLedgersTable,
OutboundDetailsTable,
OutboundOrdersTable,
PermissionsTable,
ProducibleSnapshotsTable,
ReturnOrdersTable,
RolesTable,
SemiFinishedsTable,
StocktakeItemsTable,
StocktakeOrdersTable,
UsersTable,
ZonesTable,
}
)
func init() {
EventLogTable.Annotation = &entsql.Annotation{
Table: "event_log",
}
PermissionsTable.Annotation = &entsql.Annotation{
Table: "permissions",
}
RolesTable.Annotation = &entsql.Annotation{
Table: "roles",
}
}