feat: 新增预警与附件模块,优化工位派工功能
1. 新增预警规则、预警消息、业务附件数据库表与CRUD逻辑 2. 为拧紧记录添加审核人、审核时间字段及审核留痕功能 3. 优化产线点位类型与编号描述,更新工位组合下发菜单名称为工艺路线派工 4. 新增上传文件获取原文件名与大小的工具方法 5. 在系统管理菜单新增预警中心与附件中心入口
This commit is contained in:
@@ -9,6 +9,71 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// AlertColumns holds the columns for the "alert" table.
|
||||
AlertColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "rule_id", Type: field.TypeInt, Default: 0},
|
||||
{Name: "type", Type: field.TypeString, Size: 40},
|
||||
{Name: "title", Type: field.TypeString, Size: 120},
|
||||
{Name: "content", Type: field.TypeString, Size: 500, Default: ""},
|
||||
{Name: "ref_type", Type: field.TypeString, Size: 40, Default: ""},
|
||||
{Name: "ref_id", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "status", Type: field.TypeString, Size: 10, Default: "UNREAD"},
|
||||
{Name: "receiver", Type: field.TypeString, Size: 255, Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// AlertTable holds the schema information for the "alert" table.
|
||||
AlertTable = &schema.Table{
|
||||
Name: "alert",
|
||||
Columns: AlertColumns,
|
||||
PrimaryKey: []*schema.Column{AlertColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "alert_status",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AlertColumns[7]},
|
||||
},
|
||||
{
|
||||
Name: "alert_type",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AlertColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "alert_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AlertColumns[9]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// AlertRuleColumns holds the columns for the "alert_rule" table.
|
||||
AlertRuleColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "name", Type: field.TypeString, Size: 80},
|
||||
{Name: "type", Type: field.TypeString, Size: 40},
|
||||
{Name: "threshold", Type: field.TypeFloat64, Default: 0},
|
||||
{Name: "receiver", Type: field.TypeString, Size: 255, Default: ""},
|
||||
{Name: "enabled", Type: field.TypeBool, Default: true},
|
||||
{Name: "created_by", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// AlertRuleTable holds the schema information for the "alert_rule" table.
|
||||
AlertRuleTable = &schema.Table{
|
||||
Name: "alert_rule",
|
||||
Columns: AlertRuleColumns,
|
||||
PrimaryKey: []*schema.Column{AlertRuleColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "alertrule_type",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AlertRuleColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "alertrule_enabled",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AlertRuleColumns[5]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// AssociationTraceColumns holds the columns for the "association_trace" table.
|
||||
AssociationTraceColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -33,6 +98,35 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// AttachmentColumns holds the columns for the "attachment" table.
|
||||
AttachmentColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "biz_type", Type: field.TypeString, Size: 40},
|
||||
{Name: "biz_id", Type: field.TypeString, Size: 64},
|
||||
{Name: "file_name", Type: field.TypeString, Size: 255},
|
||||
{Name: "file_path", Type: field.TypeString, Size: 255},
|
||||
{Name: "file_size", Type: field.TypeInt, Default: 0},
|
||||
{Name: "uploader", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// AttachmentTable holds the schema information for the "attachment" table.
|
||||
AttachmentTable = &schema.Table{
|
||||
Name: "attachment",
|
||||
Columns: AttachmentColumns,
|
||||
PrimaryKey: []*schema.Column{AttachmentColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "attachment_biz_type_biz_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AttachmentColumns[1], AttachmentColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "attachment_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{AttachmentColumns[7]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// WorkOrderBomColumns holds the columns for the "work_order_bom" table.
|
||||
WorkOrderBomColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -681,6 +775,36 @@ var (
|
||||
},
|
||||
},
|
||||
}
|
||||
// TorqueAuditLogColumns holds the columns for the "torque_audit_log" table.
|
||||
TorqueAuditLogColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
{Name: "torque_record_id", Type: field.TypeInt},
|
||||
{Name: "action", Type: field.TypeString, Size: 20},
|
||||
{Name: "field_name", Type: field.TypeString, Size: 40, Default: ""},
|
||||
{Name: "old_val", Type: field.TypeString, Size: 255, Default: ""},
|
||||
{Name: "new_val", Type: field.TypeString, Size: 255, Default: ""},
|
||||
{Name: "operator", Type: field.TypeString, Size: 64},
|
||||
{Name: "remark", Type: field.TypeString, Size: 255, Default: ""},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// TorqueAuditLogTable holds the schema information for the "torque_audit_log" table.
|
||||
TorqueAuditLogTable = &schema.Table{
|
||||
Name: "torque_audit_log",
|
||||
Columns: TorqueAuditLogColumns,
|
||||
PrimaryKey: []*schema.Column{TorqueAuditLogColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "torqueauditlog_torque_record_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{TorqueAuditLogColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "torqueauditlog_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{TorqueAuditLogColumns[8]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// TorqueRecordColumns holds the columns for the "torque_record" table.
|
||||
TorqueRecordColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt, Increment: true},
|
||||
@@ -694,6 +818,8 @@ var (
|
||||
{Name: "operator", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "station_no", Type: field.TypeString, Size: 32, Default: ""},
|
||||
{Name: "time", Type: field.TypeTime},
|
||||
{Name: "audit_by", Type: field.TypeString, Size: 64, Default: ""},
|
||||
{Name: "audit_at", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// TorqueRecordTable holds the schema information for the "torque_record" table.
|
||||
@@ -715,7 +841,7 @@ var (
|
||||
{
|
||||
Name: "torquerecord_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{TorqueRecordColumns[11]},
|
||||
Columns: []*schema.Column{TorqueRecordColumns[13]},
|
||||
},
|
||||
{
|
||||
Name: "torquerecord_time",
|
||||
@@ -963,7 +1089,10 @@ var (
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
AlertTable,
|
||||
AlertRuleTable,
|
||||
AssociationTraceTable,
|
||||
AttachmentTable,
|
||||
WorkOrderBomTable,
|
||||
DailyPlanTable,
|
||||
EventLogTable,
|
||||
@@ -985,6 +1114,7 @@ var (
|
||||
StationProcessTable,
|
||||
StepCriterionTable,
|
||||
StepDataTable,
|
||||
TorqueAuditLogTable,
|
||||
TorqueRecordTable,
|
||||
UserTable,
|
||||
UserStationTable,
|
||||
@@ -996,9 +1126,18 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
AlertTable.Annotation = &entsql.Annotation{
|
||||
Table: "alert",
|
||||
}
|
||||
AlertRuleTable.Annotation = &entsql.Annotation{
|
||||
Table: "alert_rule",
|
||||
}
|
||||
AssociationTraceTable.Annotation = &entsql.Annotation{
|
||||
Table: "association_trace",
|
||||
}
|
||||
AttachmentTable.Annotation = &entsql.Annotation{
|
||||
Table: "attachment",
|
||||
}
|
||||
WorkOrderBomTable.Annotation = &entsql.Annotation{
|
||||
Table: "work_order_bom",
|
||||
}
|
||||
@@ -1062,6 +1201,9 @@ func init() {
|
||||
StepDataTable.Annotation = &entsql.Annotation{
|
||||
Table: "step_data",
|
||||
}
|
||||
TorqueAuditLogTable.Annotation = &entsql.Annotation{
|
||||
Table: "torque_audit_log",
|
||||
}
|
||||
TorqueRecordTable.Annotation = &entsql.Annotation{
|
||||
Table: "torque_record",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user