Files
bj_power/bj_power_mes/ent/migrate/schema.go
T
SunYF ebf901ad16 chore: 完成多系统功能迭代与优化
1. 通用优化:
   - 统一系统标题为"库房客户端"/"MES产线控制",移除北自所前缀
   - 调整内置账号密码为统一123456,优化密码校验逻辑
   - 新增数据库自动创建逻辑,简化部署流程
   - 修复日志时间格式配置,优化日志输出
   - 新增纯数字密码安全提示

2. MES系统优化:
   - 新增日排产管理功能,支持增删改查与自动算料生成备料单
   - 重构BOM模块,改为按产品编码维护而非工单维度
   - 新增工艺参数模板配置与手动报工页面
   - 新增产品类型自动编码功能
   - 优化菜单结构,调整工单管理、扫码报工等页面名称与路由
   - 新增删除日排产接口与权限保护
   - 修复物料清单查询逻辑,适配新BOM结构
   - 新增refreshToken支持,优化登录会话管理

3. WMS系统优化:
   - 新增基础数据维护页面,支持区域与物料档案管理
   - 新增工单列表下拉接口,对接MES获取未完成工单优先展示
   - 优化入库管理提示文案,替换英文提示为中文
   - 修复精密件入库校验逻辑,优化错误提示
   - 优化Excel导入功能,新增备注字段支持
   - 优化登录页面与菜单文案,统一备料台账名称
   - 新增自动打开浏览器功能,优化客户端启动体验
   - 修复备料出库页面查询提示文案
   - 新增WMS与MES对接配置,完善内部API调用逻辑

4. 其他优化:
   - 删除冗余的旧版静态资源文件,更新资源引用路径
   - 新增帮助文档,完善基础数据模块说明
   - 修复多处文案不统一、英文残留问题
2026-08-29 15:30:25 +08:00

776 lines
28 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 (
// AssociationTraceColumns holds the columns for the "association_trace" table.
AssociationTraceColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "finished_sn", Type: field.TypeString, Unique: true, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "process_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "batch_items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "serial_items", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// AssociationTraceTable holds the schema information for the "association_trace" table.
AssociationTraceTable = &schema.Table{
Name: "association_trace",
Columns: AssociationTraceColumns,
PrimaryKey: []*schema.Column{AssociationTraceColumns[0]},
Indexes: []*schema.Index{
{
Name: "associationtrace_finished_sn",
Unique: true,
Columns: []*schema.Column{AssociationTraceColumns[1]},
},
},
}
// WorkOrderBomColumns holds the columns for the "work_order_bom" table.
WorkOrderBomColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "product_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "material_code", Type: field.TypeString, Size: 64},
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "spec", Type: field.TypeString, Size: 128, Default: ""},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "manage_mode", Type: field.TypeString, Size: 10, Default: "2"},
{Name: "unit_qty", Type: field.TypeFloat64, Default: 0},
{Name: "loss_rate", Type: field.TypeFloat64, Default: 0},
{Name: "required_qty", Type: field.TypeFloat64, Default: 0},
{Name: "serial_sns", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// WorkOrderBomTable holds the schema information for the "work_order_bom" table.
WorkOrderBomTable = &schema.Table{
Name: "work_order_bom",
Columns: WorkOrderBomColumns,
PrimaryKey: []*schema.Column{WorkOrderBomColumns[0]},
Indexes: []*schema.Index{
{
Name: "bomitem_product_code",
Unique: false,
Columns: []*schema.Column{WorkOrderBomColumns[1]},
},
{
Name: "bomitem_product_code_material_code",
Unique: true,
Columns: []*schema.Column{WorkOrderBomColumns[1], WorkOrderBomColumns[2]},
},
},
}
// DailyPlanColumns holds the columns for the "daily_plan" table.
DailyPlanColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "order_no", Type: field.TypeString, Size: 64},
{Name: "plan_date", Type: field.TypeString, Size: 10},
{Name: "plan_qty", Type: field.TypeInt, Default: 0},
{Name: "completed_qty", Type: field.TypeInt, Default: 0},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// DailyPlanTable holds the schema information for the "daily_plan" table.
DailyPlanTable = &schema.Table{
Name: "daily_plan",
Columns: DailyPlanColumns,
PrimaryKey: []*schema.Column{DailyPlanColumns[0]},
Indexes: []*schema.Index{
{
Name: "dailyplan_order_no",
Unique: false,
Columns: []*schema.Column{DailyPlanColumns[1]},
},
{
Name: "dailyplan_plan_date",
Unique: false,
Columns: []*schema.Column{DailyPlanColumns[2]},
},
{
Name: "dailyplan_plan_date_order_no",
Unique: true,
Columns: []*schema.Column{DailyPlanColumns[2], DailyPlanColumns[1]},
},
},
}
// 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: 50},
{Name: "work_order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "entity_type", Type: field.TypeString, Size: 30, Default: ""},
{Name: "entity_id", Type: field.TypeString, Size: 50, 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.TypeTime},
}
// 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_work_order_no",
Unique: false,
Columns: []*schema.Column{EventLogColumns[2]},
},
{
Name: "eventlog_operator",
Unique: false,
Columns: []*schema.Column{EventLogColumns[3]},
},
{
Name: "eventlog_created_at",
Unique: false,
Columns: []*schema.Column{EventLogColumns[8]},
},
},
}
// MaterialRequestColumns holds the columns for the "material_request" table.
MaterialRequestColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "request_no", Type: field.TypeString, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64},
{Name: "plan_date", Type: field.TypeString, Size: 10},
{Name: "material_code", Type: field.TypeString, Size: 64},
{Name: "material_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "manage_mode", Type: field.TypeString, Size: 10, Default: "2"},
{Name: "req_qty", Type: field.TypeFloat64, Default: 0},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// MaterialRequestTable holds the schema information for the "material_request" table.
MaterialRequestTable = &schema.Table{
Name: "material_request",
Columns: MaterialRequestColumns,
PrimaryKey: []*schema.Column{MaterialRequestColumns[0]},
Indexes: []*schema.Index{
{
Name: "materialrequest_order_no",
Unique: false,
Columns: []*schema.Column{MaterialRequestColumns[2]},
},
{
Name: "materialrequest_material_code",
Unique: false,
Columns: []*schema.Column{MaterialRequestColumns[4]},
},
{
Name: "materialrequest_status",
Unique: false,
Columns: []*schema.Column{MaterialRequestColumns[9]},
},
},
}
// PermissionColumns holds the columns for the "permission" table.
PermissionColumns = []*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: "path", Type: field.TypeString, Size: 128, Default: ""},
{Name: "icon", Type: field.TypeString, Size: 64, Default: ""},
{Name: "sort", Type: field.TypeInt, Nullable: true, Default: 0},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// PermissionTable holds the schema information for the "permission" table.
PermissionTable = &schema.Table{
Name: "permission",
Columns: PermissionColumns,
PrimaryKey: []*schema.Column{PermissionColumns[0]},
Indexes: []*schema.Index{
{
Name: "permission_code",
Unique: true,
Columns: []*schema.Column{PermissionColumns[1]},
},
},
}
// PlcSendLogColumns holds the columns for the "plc_send_log" table.
PlcSendLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "sn", Type: field.TypeString, Size: 64, Default: ""},
{Name: "station_no", Type: field.TypeInt, Nullable: true},
{Name: "process_combination", Type: field.TypeString, Size: 64, Default: ""},
{Name: "process_codes", Type: field.TypeJSON, Nullable: true},
{Name: "status", Type: field.TypeString, Size: 20, Default: "PENDING"},
{Name: "send_time", Type: field.TypeTime, Nullable: true},
{Name: "done_time", Type: field.TypeTime, Nullable: true},
{Name: "ack", Type: field.TypeBool, Default: false},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// PlcSendLogTable holds the schema information for the "plc_send_log" table.
PlcSendLogTable = &schema.Table{
Name: "plc_send_log",
Columns: PlcSendLogColumns,
PrimaryKey: []*schema.Column{PlcSendLogColumns[0]},
Indexes: []*schema.Index{
{
Name: "plcsendlog_order_no",
Unique: false,
Columns: []*schema.Column{PlcSendLogColumns[1]},
},
{
Name: "plcsendlog_sn",
Unique: false,
Columns: []*schema.Column{PlcSendLogColumns[2]},
},
{
Name: "plcsendlog_status",
Unique: false,
Columns: []*schema.Column{PlcSendLogColumns[6]},
},
},
}
// ProcessStepColumns holds the columns for the "process_step" table.
ProcessStepColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "process_code", Type: field.TypeInt},
{Name: "seq", Type: field.TypeInt, Default: 1},
{Name: "name", Type: field.TypeString, Size: 128},
{Name: "collect_type", Type: field.TypeString, Size: 20, Default: "NONE"},
{Name: "is_torque", Type: field.TypeBool, Default: false},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// ProcessStepTable holds the schema information for the "process_step" table.
ProcessStepTable = &schema.Table{
Name: "process_step",
Columns: ProcessStepColumns,
PrimaryKey: []*schema.Column{ProcessStepColumns[0]},
Indexes: []*schema.Index{
{
Name: "processstep_process_code",
Unique: false,
Columns: []*schema.Column{ProcessStepColumns[1]},
},
},
}
// ProductTypeColumns holds the columns for the "product_type" table.
ProductTypeColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "name", Type: field.TypeString, Size: 50},
{Name: "code", Type: field.TypeString, Size: 20},
{Name: "category", Type: field.TypeString, Size: 30, Default: ""},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "is_active", Type: field.TypeBool, Default: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// ProductTypeTable holds the schema information for the "product_type" table.
ProductTypeTable = &schema.Table{
Name: "product_type",
Columns: ProductTypeColumns,
PrimaryKey: []*schema.Column{ProductTypeColumns[0]},
Indexes: []*schema.Index{
{
Name: "producttype_code",
Unique: false,
Columns: []*schema.Column{ProductTypeColumns[2]},
},
{
Name: "producttype_is_active",
Unique: false,
Columns: []*schema.Column{ProductTypeColumns[5]},
},
},
}
// RoleColumns holds the columns for the "role" table.
RoleColumns = []*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, Size: 255, Default: ""},
{Name: "permission_codes", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "created_at", Type: field.TypeTime},
}
// RoleTable holds the schema information for the "role" table.
RoleTable = &schema.Table{
Name: "role",
Columns: RoleColumns,
PrimaryKey: []*schema.Column{RoleColumns[0]},
Indexes: []*schema.Index{
{
Name: "role_code",
Unique: true,
Columns: []*schema.Column{RoleColumns[2]},
},
},
}
// ScanRecordColumns holds the columns for the "scan_record" table.
ScanRecordColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "station", Type: field.TypeString, Size: 32, Default: ""},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "type", Type: field.TypeString, Size: 20, Default: "PROCESS"},
{Name: "process_code", Type: field.TypeInt, Nullable: true},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "time", Type: field.TypeTime},
{Name: "created_at", Type: field.TypeTime},
}
// ScanRecordTable holds the schema information for the "scan_record" table.
ScanRecordTable = &schema.Table{
Name: "scan_record",
Columns: ScanRecordColumns,
PrimaryKey: []*schema.Column{ScanRecordColumns[0]},
Indexes: []*schema.Index{
{
Name: "scanrecord_station",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[1]},
},
{
Name: "scanrecord_sn",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[2]},
},
{
Name: "scanrecord_order_no",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[3]},
},
{
Name: "scanrecord_created_at",
Unique: false,
Columns: []*schema.Column{ScanRecordColumns[8]},
},
},
}
// SemiFlowColumns holds the columns for the "semi_flow" table.
SemiFlowColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "done_process_codes", Type: field.TypeJSON, Nullable: true},
{Name: "action", Type: field.TypeString, Size: 20, Default: "INBOUND"},
{Name: "target_dock", Type: field.TypeString, Size: 20, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// SemiFlowTable holds the schema information for the "semi_flow" table.
SemiFlowTable = &schema.Table{
Name: "semi_flow",
Columns: SemiFlowColumns,
PrimaryKey: []*schema.Column{SemiFlowColumns[0]},
Indexes: []*schema.Index{
{
Name: "semiflow_sn",
Unique: false,
Columns: []*schema.Column{SemiFlowColumns[1]},
},
{
Name: "semiflow_order_no",
Unique: false,
Columns: []*schema.Column{SemiFlowColumns[2]},
},
{
Name: "semiflow_action",
Unique: false,
Columns: []*schema.Column{SemiFlowColumns[4]},
},
},
}
// StationProcessColumns holds the columns for the "station_process" table.
StationProcessColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "station_no", Type: field.TypeInt},
{Name: "process_code", Type: field.TypeInt},
{Name: "effect_date", Type: field.TypeString, Size: 10, Default: ""},
{Name: "shift", Type: field.TypeString, Size: 20, Default: ""},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// StationProcessTable holds the schema information for the "station_process" table.
StationProcessTable = &schema.Table{
Name: "station_process",
Columns: StationProcessColumns,
PrimaryKey: []*schema.Column{StationProcessColumns[0]},
Indexes: []*schema.Index{
{
Name: "stationprocess_station_no",
Unique: false,
Columns: []*schema.Column{StationProcessColumns[1]},
},
{
Name: "stationprocess_effect_date",
Unique: false,
Columns: []*schema.Column{StationProcessColumns[3]},
},
{
Name: "stationprocess_station_no_effect_date",
Unique: false,
Columns: []*schema.Column{StationProcessColumns[1], StationProcessColumns[3]},
},
},
}
// StepCriterionColumns holds the columns for the "step_criterion" table.
StepCriterionColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "step_id", Type: field.TypeInt},
{Name: "name", Type: field.TypeString, Size: 64},
{Name: "unit", Type: field.TypeString, Size: 16, Default: ""},
{Name: "logic", Type: field.TypeString, Size: 16, Default: "NONE"},
{Name: "target", Type: field.TypeFloat64, Default: 0},
{Name: "min", Type: field.TypeFloat64, Nullable: true},
{Name: "max", Type: field.TypeFloat64, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
}
// StepCriterionTable holds the schema information for the "step_criterion" table.
StepCriterionTable = &schema.Table{
Name: "step_criterion",
Columns: StepCriterionColumns,
PrimaryKey: []*schema.Column{StepCriterionColumns[0]},
Indexes: []*schema.Index{
{
Name: "stepcriterion_step_id",
Unique: false,
Columns: []*schema.Column{StepCriterionColumns[1]},
},
},
}
// StepDataColumns holds the columns for the "step_data" table.
StepDataColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "process_id", Type: field.TypeInt, Nullable: true},
{Name: "step_id", Type: field.TypeInt},
{Name: "step_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "criterion_id", Type: field.TypeInt, Nullable: true},
{Name: "criterion_name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "criterion_logic", Type: field.TypeString, Size: 16, Default: "NONE"},
{Name: "value", Type: field.TypeFloat64, Default: 0},
{Name: "value_text", Type: field.TypeString, Size: 64, Default: ""},
{Name: "is_ok", Type: field.TypeBool, Default: true},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// StepDataTable holds the schema information for the "step_data" table.
StepDataTable = &schema.Table{
Name: "step_data",
Columns: StepDataColumns,
PrimaryKey: []*schema.Column{StepDataColumns[0]},
Indexes: []*schema.Index{
{
Name: "stepdata_sn",
Unique: false,
Columns: []*schema.Column{StepDataColumns[1]},
},
{
Name: "stepdata_process_id",
Unique: false,
Columns: []*schema.Column{StepDataColumns[2]},
},
{
Name: "stepdata_step_id",
Unique: false,
Columns: []*schema.Column{StepDataColumns[3]},
},
},
}
// TorqueRecordColumns holds the columns for the "torque_record" table.
TorqueRecordColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "work_order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "screw_no", Type: field.TypeString, Size: 32, Default: ""},
{Name: "strain", Type: field.TypeFloat64, Default: 0},
{Name: "torque", Type: field.TypeFloat64, Default: 0},
{Name: "angle", Type: field.TypeFloat64, Default: 0},
{Name: "result", Type: field.TypeString, Size: 10, Default: "OK"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
{Name: "time", Type: field.TypeTime},
{Name: "created_at", Type: field.TypeTime},
}
// TorqueRecordTable holds the schema information for the "torque_record" table.
TorqueRecordTable = &schema.Table{
Name: "torque_record",
Columns: TorqueRecordColumns,
PrimaryKey: []*schema.Column{TorqueRecordColumns[0]},
Indexes: []*schema.Index{
{
Name: "torquerecord_sn",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[2]},
},
{
Name: "torquerecord_work_order_no",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[1]},
},
{
Name: "torquerecord_created_at",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[11]},
},
{
Name: "torquerecord_time",
Unique: false,
Columns: []*schema.Column{TorqueRecordColumns[10]},
},
},
}
// UserColumns holds the columns for the "user" table.
UserColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "username", Type: field.TypeString, Unique: true, Size: 64},
{Name: "password", Type: field.TypeString, Size: 128},
{Name: "name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "role_id", Type: field.TypeInt, Nullable: true},
{Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// UserTable holds the schema information for the "user" table.
UserTable = &schema.Table{
Name: "user",
Columns: UserColumns,
PrimaryKey: []*schema.Column{UserColumns[0]},
Indexes: []*schema.Index{
{
Name: "user_username",
Unique: true,
Columns: []*schema.Column{UserColumns[1]},
},
{
Name: "user_role_id",
Unique: false,
Columns: []*schema.Column{UserColumns[4]},
},
},
}
// WorkOrderColumns holds the columns for the "work_order" table.
WorkOrderColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "work_order_no", Type: field.TypeString, Size: 64},
{Name: "product_type_id", Type: field.TypeInt},
{Name: "product_code", Type: field.TypeString, Size: 64, Default: ""},
{Name: "product_name", Type: field.TypeString, Size: 128, Default: ""},
{Name: "quantity", Type: field.TypeInt, Default: 1},
{Name: "finished_num", Type: field.TypeInt, Default: 0},
{Name: "fail_num", Type: field.TypeInt, Default: 0},
{Name: "process_seq", Type: field.TypeString, Size: 64, Default: ""},
{Name: "status", Type: field.TypeString, Size: 20, Default: "CREATED"},
{Name: "plan_start", Type: field.TypeTime, Nullable: true},
{Name: "plan_end", Type: field.TypeTime, Nullable: true},
{Name: "context", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}},
{Name: "completed_at", Type: field.TypeTime, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// WorkOrderTable holds the schema information for the "work_order" table.
WorkOrderTable = &schema.Table{
Name: "work_order",
Columns: WorkOrderColumns,
PrimaryKey: []*schema.Column{WorkOrderColumns[0]},
Indexes: []*schema.Index{
{
Name: "workorder_work_order_no",
Unique: true,
Columns: []*schema.Column{WorkOrderColumns[1]},
},
{
Name: "workorder_status",
Unique: false,
Columns: []*schema.Column{WorkOrderColumns[9]},
},
{
Name: "workorder_product_type_id",
Unique: false,
Columns: []*schema.Column{WorkOrderColumns[2]},
},
},
}
// WorkpieceColumns holds the columns for the "workpiece" table.
WorkpieceColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Unique: true, Size: 64},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "work_order_id", Type: field.TypeInt, Nullable: true},
{Name: "process_seq", Type: field.TypeString, Size: 64, Default: ""},
{Name: "current_process", Type: field.TypeInt, Nullable: true},
{Name: "status", Type: field.TypeString, Size: 20, Default: "ONLINE"},
{Name: "online_at", Type: field.TypeTime, Nullable: true},
{Name: "done_at", Type: field.TypeTime, Nullable: true},
{Name: "created_at", Type: field.TypeTime},
{Name: "updated_at", Type: field.TypeTime, Nullable: true},
}
// WorkpieceTable holds the schema information for the "workpiece" table.
WorkpieceTable = &schema.Table{
Name: "workpiece",
Columns: WorkpieceColumns,
PrimaryKey: []*schema.Column{WorkpieceColumns[0]},
Indexes: []*schema.Index{
{
Name: "workpiece_sn",
Unique: true,
Columns: []*schema.Column{WorkpieceColumns[1]},
},
{
Name: "workpiece_order_no",
Unique: false,
Columns: []*schema.Column{WorkpieceColumns[2]},
},
{
Name: "workpiece_status",
Unique: false,
Columns: []*schema.Column{WorkpieceColumns[6]},
},
},
}
// WorkpieceProcessColumns holds the columns for the "workpiece_process" table.
WorkpieceProcessColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
{Name: "sn", Type: field.TypeString, Size: 64},
{Name: "process_code", Type: field.TypeInt},
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
{Name: "order_no", Type: field.TypeString, Size: 64, Default: ""},
{Name: "process_name", Type: field.TypeString, Size: 64, Default: ""},
{Name: "status", Type: field.TypeString, Size: 20, Default: "DONE"},
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
{Name: "result", Type: field.TypeString, Size: 10, Default: "OK"},
{Name: "started_at", Type: field.TypeTime, Nullable: true},
{Name: "ended_at", Type: field.TypeTime, Nullable: true},
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
{Name: "created_at", Type: field.TypeTime},
}
// WorkpieceProcessTable holds the schema information for the "workpiece_process" table.
WorkpieceProcessTable = &schema.Table{
Name: "workpiece_process",
Columns: WorkpieceProcessColumns,
PrimaryKey: []*schema.Column{WorkpieceProcessColumns[0]},
Indexes: []*schema.Index{
{
Name: "workpieceprocess_sn",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[1]},
},
{
Name: "workpieceprocess_sn_process_code",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[1], WorkpieceProcessColumns[2]},
},
{
Name: "workpieceprocess_order_no",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[4]},
},
{
Name: "workpieceprocess_station_no",
Unique: false,
Columns: []*schema.Column{WorkpieceProcessColumns[3]},
},
},
}
// Tables holds all the tables in the schema.
Tables = []*schema.Table{
AssociationTraceTable,
WorkOrderBomTable,
DailyPlanTable,
EventLogTable,
MaterialRequestTable,
PermissionTable,
PlcSendLogTable,
ProcessStepTable,
ProductTypeTable,
RoleTable,
ScanRecordTable,
SemiFlowTable,
StationProcessTable,
StepCriterionTable,
StepDataTable,
TorqueRecordTable,
UserTable,
WorkOrderTable,
WorkpieceTable,
WorkpieceProcessTable,
}
)
func init() {
AssociationTraceTable.Annotation = &entsql.Annotation{
Table: "association_trace",
}
WorkOrderBomTable.Annotation = &entsql.Annotation{
Table: "work_order_bom",
}
DailyPlanTable.Annotation = &entsql.Annotation{
Table: "daily_plan",
}
EventLogTable.Annotation = &entsql.Annotation{
Table: "event_log",
}
MaterialRequestTable.Annotation = &entsql.Annotation{
Table: "material_request",
}
PermissionTable.Annotation = &entsql.Annotation{
Table: "permission",
}
PlcSendLogTable.Annotation = &entsql.Annotation{
Table: "plc_send_log",
}
ProcessStepTable.Annotation = &entsql.Annotation{
Table: "process_step",
}
ProductTypeTable.Annotation = &entsql.Annotation{
Table: "product_type",
}
RoleTable.Annotation = &entsql.Annotation{
Table: "role",
}
ScanRecordTable.Annotation = &entsql.Annotation{
Table: "scan_record",
}
SemiFlowTable.Annotation = &entsql.Annotation{
Table: "semi_flow",
}
StationProcessTable.Annotation = &entsql.Annotation{
Table: "station_process",
}
StepCriterionTable.Annotation = &entsql.Annotation{
Table: "step_criterion",
}
StepDataTable.Annotation = &entsql.Annotation{
Table: "step_data",
}
TorqueRecordTable.Annotation = &entsql.Annotation{
Table: "torque_record",
}
UserTable.Annotation = &entsql.Annotation{
Table: "user",
}
WorkOrderTable.Annotation = &entsql.Annotation{
Table: "work_order",
}
WorkpieceTable.Annotation = &entsql.Annotation{
Table: "workpiece",
}
WorkpieceProcessTable.Annotation = &entsql.Annotation{
Table: "workpiece_process",
}
}