feat: 新增预警与附件模块,优化工位派工功能

1. 新增预警规则、预警消息、业务附件数据库表与CRUD逻辑
2. 为拧紧记录添加审核人、审核时间字段及审核留痕功能
3. 优化产线点位类型与编号描述,更新工位组合下发菜单名称为工艺路线派工
4. 新增上传文件获取原文件名与大小的工具方法
5. 在系统管理菜单新增预警中心与附件中心入口
This commit is contained in:
SunYF
2026-09-14 16:31:08 +08:00
parent 0ab21b1234
commit 5c3b747a20
399 changed files with 147674 additions and 2213 deletions
+179 -1
View File
@@ -3,7 +3,10 @@
package ent
import (
"bj_power_mes/ent/alert"
"bj_power_mes/ent/alertrule"
"bj_power_mes/ent/associationtrace"
"bj_power_mes/ent/attachment"
"bj_power_mes/ent/bomitem"
"bj_power_mes/ent/dailyplan"
"bj_power_mes/ent/eventlog"
@@ -25,6 +28,7 @@ import (
"bj_power_mes/ent/stationprocess"
"bj_power_mes/ent/stepcriterion"
"bj_power_mes/ent/stepdata"
"bj_power_mes/ent/torqueauditlog"
"bj_power_mes/ent/torquerecord"
"bj_power_mes/ent/user"
"bj_power_mes/ent/userstation"
@@ -40,6 +44,96 @@ import (
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
alertFields := schema.Alert{}.Fields()
_ = alertFields
// alertDescRuleId is the schema descriptor for ruleId field.
alertDescRuleId := alertFields[1].Descriptor()
// alert.DefaultRuleId holds the default value on creation for the ruleId field.
alert.DefaultRuleId = alertDescRuleId.Default.(int)
// alertDescType is the schema descriptor for type field.
alertDescType := alertFields[2].Descriptor()
// alert.TypeValidator is a validator for the "type" field. It is called by the builders before save.
alert.TypeValidator = alertDescType.Validators[0].(func(string) error)
// alertDescTitle is the schema descriptor for title field.
alertDescTitle := alertFields[3].Descriptor()
// alert.TitleValidator is a validator for the "title" field. It is called by the builders before save.
alert.TitleValidator = alertDescTitle.Validators[0].(func(string) error)
// alertDescContent is the schema descriptor for content field.
alertDescContent := alertFields[4].Descriptor()
// alert.DefaultContent holds the default value on creation for the content field.
alert.DefaultContent = alertDescContent.Default.(string)
// alert.ContentValidator is a validator for the "content" field. It is called by the builders before save.
alert.ContentValidator = alertDescContent.Validators[0].(func(string) error)
// alertDescRefType is the schema descriptor for refType field.
alertDescRefType := alertFields[5].Descriptor()
// alert.DefaultRefType holds the default value on creation for the refType field.
alert.DefaultRefType = alertDescRefType.Default.(string)
// alert.RefTypeValidator is a validator for the "refType" field. It is called by the builders before save.
alert.RefTypeValidator = alertDescRefType.Validators[0].(func(string) error)
// alertDescRefId is the schema descriptor for refId field.
alertDescRefId := alertFields[6].Descriptor()
// alert.DefaultRefId holds the default value on creation for the refId field.
alert.DefaultRefId = alertDescRefId.Default.(string)
// alert.RefIdValidator is a validator for the "refId" field. It is called by the builders before save.
alert.RefIdValidator = alertDescRefId.Validators[0].(func(string) error)
// alertDescStatus is the schema descriptor for status field.
alertDescStatus := alertFields[7].Descriptor()
// alert.DefaultStatus holds the default value on creation for the status field.
alert.DefaultStatus = alertDescStatus.Default.(string)
// alert.StatusValidator is a validator for the "status" field. It is called by the builders before save.
alert.StatusValidator = alertDescStatus.Validators[0].(func(string) error)
// alertDescReceiver is the schema descriptor for receiver field.
alertDescReceiver := alertFields[8].Descriptor()
// alert.DefaultReceiver holds the default value on creation for the receiver field.
alert.DefaultReceiver = alertDescReceiver.Default.(string)
// alert.ReceiverValidator is a validator for the "receiver" field. It is called by the builders before save.
alert.ReceiverValidator = alertDescReceiver.Validators[0].(func(string) error)
// alertDescCreatedAt is the schema descriptor for createdAt field.
alertDescCreatedAt := alertFields[9].Descriptor()
// alert.DefaultCreatedAt holds the default value on creation for the createdAt field.
alert.DefaultCreatedAt = alertDescCreatedAt.Default.(func() time.Time)
// alertDescID is the schema descriptor for id field.
alertDescID := alertFields[0].Descriptor()
// alert.IDValidator is a validator for the "id" field. It is called by the builders before save.
alert.IDValidator = alertDescID.Validators[0].(func(int) error)
alertruleFields := schema.AlertRule{}.Fields()
_ = alertruleFields
// alertruleDescName is the schema descriptor for name field.
alertruleDescName := alertruleFields[1].Descriptor()
// alertrule.NameValidator is a validator for the "name" field. It is called by the builders before save.
alertrule.NameValidator = alertruleDescName.Validators[0].(func(string) error)
// alertruleDescType is the schema descriptor for type field.
alertruleDescType := alertruleFields[2].Descriptor()
// alertrule.TypeValidator is a validator for the "type" field. It is called by the builders before save.
alertrule.TypeValidator = alertruleDescType.Validators[0].(func(string) error)
// alertruleDescThreshold is the schema descriptor for threshold field.
alertruleDescThreshold := alertruleFields[3].Descriptor()
// alertrule.DefaultThreshold holds the default value on creation for the threshold field.
alertrule.DefaultThreshold = alertruleDescThreshold.Default.(float64)
// alertruleDescReceiver is the schema descriptor for receiver field.
alertruleDescReceiver := alertruleFields[4].Descriptor()
// alertrule.DefaultReceiver holds the default value on creation for the receiver field.
alertrule.DefaultReceiver = alertruleDescReceiver.Default.(string)
// alertrule.ReceiverValidator is a validator for the "receiver" field. It is called by the builders before save.
alertrule.ReceiverValidator = alertruleDescReceiver.Validators[0].(func(string) error)
// alertruleDescEnabled is the schema descriptor for enabled field.
alertruleDescEnabled := alertruleFields[5].Descriptor()
// alertrule.DefaultEnabled holds the default value on creation for the enabled field.
alertrule.DefaultEnabled = alertruleDescEnabled.Default.(bool)
// alertruleDescCreatedBy is the schema descriptor for createdBy field.
alertruleDescCreatedBy := alertruleFields[6].Descriptor()
// alertrule.DefaultCreatedBy holds the default value on creation for the createdBy field.
alertrule.DefaultCreatedBy = alertruleDescCreatedBy.Default.(string)
// alertrule.CreatedByValidator is a validator for the "createdBy" field. It is called by the builders before save.
alertrule.CreatedByValidator = alertruleDescCreatedBy.Validators[0].(func(string) error)
// alertruleDescCreatedAt is the schema descriptor for createdAt field.
alertruleDescCreatedAt := alertruleFields[7].Descriptor()
// alertrule.DefaultCreatedAt holds the default value on creation for the createdAt field.
alertrule.DefaultCreatedAt = alertruleDescCreatedAt.Default.(func() time.Time)
// alertruleDescID is the schema descriptor for id field.
alertruleDescID := alertruleFields[0].Descriptor()
// alertrule.IDValidator is a validator for the "id" field. It is called by the builders before save.
alertrule.IDValidator = alertruleDescID.Validators[0].(func(int) error)
associationtraceFields := schema.AssociationTrace{}.Fields()
_ = associationtraceFields
// associationtraceDescFinishedSn is the schema descriptor for finishedSn field.
@@ -72,6 +166,42 @@ func init() {
associationtraceDescID := associationtraceFields[0].Descriptor()
// associationtrace.IDValidator is a validator for the "id" field. It is called by the builders before save.
associationtrace.IDValidator = associationtraceDescID.Validators[0].(func(int) error)
attachmentFields := schema.Attachment{}.Fields()
_ = attachmentFields
// attachmentDescBizType is the schema descriptor for bizType field.
attachmentDescBizType := attachmentFields[1].Descriptor()
// attachment.BizTypeValidator is a validator for the "bizType" field. It is called by the builders before save.
attachment.BizTypeValidator = attachmentDescBizType.Validators[0].(func(string) error)
// attachmentDescBizId is the schema descriptor for bizId field.
attachmentDescBizId := attachmentFields[2].Descriptor()
// attachment.BizIdValidator is a validator for the "bizId" field. It is called by the builders before save.
attachment.BizIdValidator = attachmentDescBizId.Validators[0].(func(string) error)
// attachmentDescFileName is the schema descriptor for fileName field.
attachmentDescFileName := attachmentFields[3].Descriptor()
// attachment.FileNameValidator is a validator for the "fileName" field. It is called by the builders before save.
attachment.FileNameValidator = attachmentDescFileName.Validators[0].(func(string) error)
// attachmentDescFilePath is the schema descriptor for filePath field.
attachmentDescFilePath := attachmentFields[4].Descriptor()
// attachment.FilePathValidator is a validator for the "filePath" field. It is called by the builders before save.
attachment.FilePathValidator = attachmentDescFilePath.Validators[0].(func(string) error)
// attachmentDescFileSize is the schema descriptor for fileSize field.
attachmentDescFileSize := attachmentFields[5].Descriptor()
// attachment.DefaultFileSize holds the default value on creation for the fileSize field.
attachment.DefaultFileSize = attachmentDescFileSize.Default.(int)
// attachmentDescUploader is the schema descriptor for uploader field.
attachmentDescUploader := attachmentFields[6].Descriptor()
// attachment.DefaultUploader holds the default value on creation for the uploader field.
attachment.DefaultUploader = attachmentDescUploader.Default.(string)
// attachment.UploaderValidator is a validator for the "uploader" field. It is called by the builders before save.
attachment.UploaderValidator = attachmentDescUploader.Validators[0].(func(string) error)
// attachmentDescCreatedAt is the schema descriptor for createdAt field.
attachmentDescCreatedAt := attachmentFields[7].Descriptor()
// attachment.DefaultCreatedAt holds the default value on creation for the createdAt field.
attachment.DefaultCreatedAt = attachmentDescCreatedAt.Default.(func() time.Time)
// attachmentDescID is the schema descriptor for id field.
attachmentDescID := attachmentFields[0].Descriptor()
// attachment.IDValidator is a validator for the "id" field. It is called by the builders before save.
attachment.IDValidator = attachmentDescID.Validators[0].(func(int) error)
bomitemFields := schema.BomItem{}.Fields()
_ = bomitemFields
// bomitemDescProductCode is the schema descriptor for productCode field.
@@ -982,6 +1112,48 @@ func init() {
stepdataDescID := stepdataFields[0].Descriptor()
// stepdata.IDValidator is a validator for the "id" field. It is called by the builders before save.
stepdata.IDValidator = stepdataDescID.Validators[0].(func(int) error)
torqueauditlogFields := schema.TorqueAuditLog{}.Fields()
_ = torqueauditlogFields
// torqueauditlogDescAction is the schema descriptor for action field.
torqueauditlogDescAction := torqueauditlogFields[2].Descriptor()
// torqueauditlog.ActionValidator is a validator for the "action" field. It is called by the builders before save.
torqueauditlog.ActionValidator = torqueauditlogDescAction.Validators[0].(func(string) error)
// torqueauditlogDescFieldName is the schema descriptor for fieldName field.
torqueauditlogDescFieldName := torqueauditlogFields[3].Descriptor()
// torqueauditlog.DefaultFieldName holds the default value on creation for the fieldName field.
torqueauditlog.DefaultFieldName = torqueauditlogDescFieldName.Default.(string)
// torqueauditlog.FieldNameValidator is a validator for the "fieldName" field. It is called by the builders before save.
torqueauditlog.FieldNameValidator = torqueauditlogDescFieldName.Validators[0].(func(string) error)
// torqueauditlogDescOldVal is the schema descriptor for oldVal field.
torqueauditlogDescOldVal := torqueauditlogFields[4].Descriptor()
// torqueauditlog.DefaultOldVal holds the default value on creation for the oldVal field.
torqueauditlog.DefaultOldVal = torqueauditlogDescOldVal.Default.(string)
// torqueauditlog.OldValValidator is a validator for the "oldVal" field. It is called by the builders before save.
torqueauditlog.OldValValidator = torqueauditlogDescOldVal.Validators[0].(func(string) error)
// torqueauditlogDescNewVal is the schema descriptor for newVal field.
torqueauditlogDescNewVal := torqueauditlogFields[5].Descriptor()
// torqueauditlog.DefaultNewVal holds the default value on creation for the newVal field.
torqueauditlog.DefaultNewVal = torqueauditlogDescNewVal.Default.(string)
// torqueauditlog.NewValValidator is a validator for the "newVal" field. It is called by the builders before save.
torqueauditlog.NewValValidator = torqueauditlogDescNewVal.Validators[0].(func(string) error)
// torqueauditlogDescOperator is the schema descriptor for operator field.
torqueauditlogDescOperator := torqueauditlogFields[6].Descriptor()
// torqueauditlog.OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
torqueauditlog.OperatorValidator = torqueauditlogDescOperator.Validators[0].(func(string) error)
// torqueauditlogDescRemark is the schema descriptor for remark field.
torqueauditlogDescRemark := torqueauditlogFields[7].Descriptor()
// torqueauditlog.DefaultRemark holds the default value on creation for the remark field.
torqueauditlog.DefaultRemark = torqueauditlogDescRemark.Default.(string)
// torqueauditlog.RemarkValidator is a validator for the "remark" field. It is called by the builders before save.
torqueauditlog.RemarkValidator = torqueauditlogDescRemark.Validators[0].(func(string) error)
// torqueauditlogDescCreatedAt is the schema descriptor for createdAt field.
torqueauditlogDescCreatedAt := torqueauditlogFields[8].Descriptor()
// torqueauditlog.DefaultCreatedAt holds the default value on creation for the createdAt field.
torqueauditlog.DefaultCreatedAt = torqueauditlogDescCreatedAt.Default.(func() time.Time)
// torqueauditlogDescID is the schema descriptor for id field.
torqueauditlogDescID := torqueauditlogFields[0].Descriptor()
// torqueauditlog.IDValidator is a validator for the "id" field. It is called by the builders before save.
torqueauditlog.IDValidator = torqueauditlogDescID.Validators[0].(func(int) error)
torquerecordFields := schema.TorqueRecord{}.Fields()
_ = torquerecordFields
// torquerecordDescWorkOrderNo is the schema descriptor for workOrderNo field.
@@ -1034,8 +1206,14 @@ func init() {
torquerecordDescTime := torquerecordFields[10].Descriptor()
// torquerecord.DefaultTime holds the default value on creation for the time field.
torquerecord.DefaultTime = torquerecordDescTime.Default.(func() time.Time)
// torquerecordDescAuditBy is the schema descriptor for auditBy field.
torquerecordDescAuditBy := torquerecordFields[11].Descriptor()
// torquerecord.DefaultAuditBy holds the default value on creation for the auditBy field.
torquerecord.DefaultAuditBy = torquerecordDescAuditBy.Default.(string)
// torquerecord.AuditByValidator is a validator for the "auditBy" field. It is called by the builders before save.
torquerecord.AuditByValidator = torquerecordDescAuditBy.Validators[0].(func(string) error)
// torquerecordDescCreatedAt is the schema descriptor for createdAt field.
torquerecordDescCreatedAt := torquerecordFields[11].Descriptor()
torquerecordDescCreatedAt := torquerecordFields[13].Descriptor()
// torquerecord.DefaultCreatedAt holds the default value on creation for the createdAt field.
torquerecord.DefaultCreatedAt = torquerecordDescCreatedAt.Default.(func() time.Time)
// torquerecordDescID is the schema descriptor for id field.