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

206 lines
6.4 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.
// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/alert"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// Alert is the model entity for the Alert schema.
type Alert struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 关联规则ID0=手动触发
RuleId int `json:"ruleId,omitempty"`
// 预警类型
Type string `json:"type,omitempty"`
// 标题
Title string `json:"title,omitempty"`
// 内容
Content string `json:"content,omitempty"`
// 关联业务类型
RefType string `json:"refType,omitempty"`
// 关联业务ID
RefId string `json:"refId,omitempty"`
// 关联工单号(按工单号查询用)
OrderNo string `json:"orderNo,omitempty"`
// UNREAD/READ
Status string `json:"status,omitempty"`
// 接收人
Receiver string `json:"receiver,omitempty"`
// CreatedAt holds the value of the "createdAt" field.
CreatedAt time.Time `json:"createdAt,omitempty"`
selectValues sql.SelectValues
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Alert) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case alert.FieldID, alert.FieldRuleId:
values[i] = new(sql.NullInt64)
case alert.FieldType, alert.FieldTitle, alert.FieldContent, alert.FieldRefType, alert.FieldRefId, alert.FieldOrderNo, alert.FieldStatus, alert.FieldReceiver:
values[i] = new(sql.NullString)
case alert.FieldCreatedAt:
values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Alert fields.
func (_m *Alert) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case alert.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
_m.ID = int(value.Int64)
case alert.FieldRuleId:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field ruleId", values[i])
} else if value.Valid {
_m.RuleId = int(value.Int64)
}
case alert.FieldType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field type", values[i])
} else if value.Valid {
_m.Type = value.String
}
case alert.FieldTitle:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field title", values[i])
} else if value.Valid {
_m.Title = value.String
}
case alert.FieldContent:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field content", values[i])
} else if value.Valid {
_m.Content = value.String
}
case alert.FieldRefType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field refType", values[i])
} else if value.Valid {
_m.RefType = value.String
}
case alert.FieldRefId:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field refId", values[i])
} else if value.Valid {
_m.RefId = value.String
}
case alert.FieldOrderNo:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field orderNo", values[i])
} else if value.Valid {
_m.OrderNo = value.String
}
case alert.FieldStatus:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field status", values[i])
} else if value.Valid {
_m.Status = value.String
}
case alert.FieldReceiver:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field receiver", values[i])
} else if value.Valid {
_m.Receiver = value.String
}
case alert.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field createdAt", values[i])
} else if value.Valid {
_m.CreatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Alert.
// This includes values selected through modifiers, order, etc.
func (_m *Alert) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this Alert.
// Note that you need to call Alert.Unwrap() before calling this method if this Alert
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *Alert) Update() *AlertUpdateOne {
return NewAlertClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the Alert entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (_m *Alert) Unwrap() *Alert {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: Alert is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *Alert) String() string {
var builder strings.Builder
builder.WriteString("Alert(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("ruleId=")
builder.WriteString(fmt.Sprintf("%v", _m.RuleId))
builder.WriteString(", ")
builder.WriteString("type=")
builder.WriteString(_m.Type)
builder.WriteString(", ")
builder.WriteString("title=")
builder.WriteString(_m.Title)
builder.WriteString(", ")
builder.WriteString("content=")
builder.WriteString(_m.Content)
builder.WriteString(", ")
builder.WriteString("refType=")
builder.WriteString(_m.RefType)
builder.WriteString(", ")
builder.WriteString("refId=")
builder.WriteString(_m.RefId)
builder.WriteString(", ")
builder.WriteString("orderNo=")
builder.WriteString(_m.OrderNo)
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
builder.WriteString("receiver=")
builder.WriteString(_m.Receiver)
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// Alerts is a parsable slice of Alert.
type Alerts []*Alert