Files
bj_power/bj_power_mes/schema/alert.go
T
SunYF 05b0b8a909 feat: 完成客户第12条需求+多系统改造
1. 新增预警表添加工单号字段,支持按工单号检索预警
2. 添加工单过滤在制品/绩效报表/预警中心查询
3. 补全WMS台账字段口径与权限配置
4. 修复备料单与数量不符处理流程
5. 新增配送进度/库位联动/自动出库功能
6. 修复AGV配送状态更新逻辑
7. 优化退料与库存管理细节
2026-09-19 17:04:58 +08:00

46 lines
1.5 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/entsql"
"entgo.io/ent/schema"
"entgo.io/ent/schema/field"
"entgo.io/ent/schema/index"
)
// Alert 预警消息:规则命中或手动触发后写入,供前端预警中心收件箱展示
type Alert struct {
ent.Schema
}
func (Alert) Annotations() []schema.Annotation {
return []schema.Annotation{entsql.Annotation{Table: "alert"}}
}
func (Alert) Fields() []ent.Field {
return []ent.Field{
field.Int("id").Positive(),
field.Int("ruleId").Default(0).Comment("关联规则ID0=手动触发"),
field.String("type").MaxLen(40).Comment("预警类型"),
field.String("title").MaxLen(120).Comment("标题"),
field.String("content").Default("").MaxLen(500).Comment("内容"),
field.String("refType").Default("").MaxLen(40).Comment("关联业务类型"),
field.String("refId").Default("").MaxLen(64).Comment("关联业务ID"),
// 关联工单号(客户第12条「记录查看加一项看工单号查询」):预警中心按工单号检索用,可空。
field.String("orderNo").Default("").MaxLen(64).Comment("关联工单号(按工单号查询用)"),
field.String("status").Default("UNREAD").MaxLen(10).Comment("UNREAD/READ"),
field.String("receiver").Default("").MaxLen(255).Comment("接收人"),
field.Time("createdAt").Default(time.Now).Immutable(),
}
}
func (Alert) Indexes() []ent.Index {
return []ent.Index{
index.Fields("status"),
index.Fields("type"),
index.Fields("createdAt"),
}
}