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
+48
View File
@@ -8,6 +8,30 @@ import (
"fmt"
)
// The AlertFunc type is an adapter to allow the use of ordinary
// function as Alert mutator.
type AlertFunc func(context.Context, *ent.AlertMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f AlertFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.AlertMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AlertMutation", m)
}
// The AlertRuleFunc type is an adapter to allow the use of ordinary
// function as AlertRule mutator.
type AlertRuleFunc func(context.Context, *ent.AlertRuleMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f AlertRuleFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.AlertRuleMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AlertRuleMutation", m)
}
// The AssociationTraceFunc type is an adapter to allow the use of ordinary
// function as AssociationTrace mutator.
type AssociationTraceFunc func(context.Context, *ent.AssociationTraceMutation) (ent.Value, error)
@@ -20,6 +44,18 @@ func (f AssociationTraceFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.V
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AssociationTraceMutation", m)
}
// The AttachmentFunc type is an adapter to allow the use of ordinary
// function as Attachment mutator.
type AttachmentFunc func(context.Context, *ent.AttachmentMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f AttachmentFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.AttachmentMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AttachmentMutation", m)
}
// The BomItemFunc type is an adapter to allow the use of ordinary
// function as BomItem mutator.
type BomItemFunc func(context.Context, *ent.BomItemMutation) (ent.Value, error)
@@ -272,6 +308,18 @@ func (f StepDataFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, er
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.StepDataMutation", m)
}
// The TorqueAuditLogFunc type is an adapter to allow the use of ordinary
// function as TorqueAuditLog mutator.
type TorqueAuditLogFunc func(context.Context, *ent.TorqueAuditLogMutation) (ent.Value, error)
// Mutate calls f(ctx, m).
func (f TorqueAuditLogFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
if mv, ok := m.(*ent.TorqueAuditLogMutation); ok {
return f(ctx, mv)
}
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.TorqueAuditLogMutation", m)
}
// The TorqueRecordFunc type is an adapter to allow the use of ordinary
// function as TorqueRecord mutator.
type TorqueRecordFunc func(context.Context, *ent.TorqueRecordMutation) (ent.Value, error)