时钟与 JWT:验签按「谁签发谁的时间为准」,向签发方取 /api/server-time, 对端地址由既有 BaseURL 自动推导;不再要求现场人工 w32tm 对时。 排产 C 方案:工单状态不再回写排产,排产只表示启用开关;启用排产是唯一 开工开关,未启用不允许建档上件;完工/取消后工单进度从工单派生、叫料池 按工单状态重算;逐日手改后合计为准;日期筛选默认空=全部日期。 叫料配送 B 方案:新增 DELIVERED 待签收态,货真到工位才从 PREPARED 转 DELIVERED、工人签收再转 DONE;PREPARED 在途不可签收/退库;叫料队列一屏 显示 PENDING+PREPARED、支持批量完成备料;配送链改按工位凑车,一张配送单 =一个托盘=一个工位,只在配送单页新建,未派车可删可改;新建弹窗直列有货 工位;派车硬门禁要求接驳台传感器检测到托盘;删除改为事务内复核状态、 带 PENDING 条件删单头,防止并发派车时误删。 装配记账:新增已装量 installedQty 与追溯绑定 traceBind,落实「总账=分账 之和」;追溯件绑定/撤销回补、非序列号件报工按单台用量自动扣已装;报工前 按工位×物料核对累计已签收 ≥ 已消耗,不够拦下。 工件与工位终端:建档/重上线增加上料位可达性校验与 PLC 送件、半截补齐防 重复扣库;终端去轮询改事件驱动(报警/工件到位/点位/停单即时推送),铃铛 只挂消息类预警、与待办角标分家;刷新保留拧紧录入;跨服务连线失败不再 误报成数据库故障;新增 BJ_POWER_DEV=1 单进程调试模式(不起守护/托盘)。 告警:新增处置字段 resolved_at/resolved_by,红点=待处置数,确认关闭才消。 清理:删除 migrate 中 SHIPPED→DELIVERED 兼容补丁;场景1测试断言改为 现行 PREPARED / DELIVERED;同步更新案例.md、现场对时操作卡.md 与 ent 生成代码。
203 lines
6.5 KiB
Go
203 lines
6.5 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_wms/ent/alert"
|
|
"fmt"
|
|
"strings"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
// Alert 预警实例:扫描器按规则产生,用户标记已读闭环
|
|
type Alert struct {
|
|
config `json:"-"`
|
|
// ID of the ent.
|
|
ID int `json:"id,omitempty"`
|
|
// 关联规则编码(固定五类)
|
|
RuleCode string `json:"ruleCode,omitempty"`
|
|
// 级别 info/warning/error
|
|
Level string `json:"level,omitempty"`
|
|
// 预警标题
|
|
Title string `json:"title,omitempty"`
|
|
// 预警内容
|
|
Content string `json:"content,omitempty"`
|
|
// 关联对象(物料编码/批次/SN/库存行ID等)
|
|
Target string `json:"target,omitempty"`
|
|
// 状态 unread/read
|
|
Status string `json:"status,omitempty"`
|
|
// 处置(确认关闭)时间 unix 秒,未处置为 0
|
|
ResolvedAt int64 `json:"resolvedAt,omitempty"`
|
|
// 处置人(确认关闭时写入)
|
|
ResolvedBy string `json:"resolvedBy,omitempty"`
|
|
// 创建时间
|
|
CreatedAt int64 `json:"createdAt,omitempty"`
|
|
// 更新时间
|
|
UpdatedAt int64 `json:"updatedAt,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.FieldResolvedAt, alert.FieldCreatedAt, alert.FieldUpdatedAt:
|
|
values[i] = new(sql.NullInt64)
|
|
case alert.FieldRuleCode, alert.FieldLevel, alert.FieldTitle, alert.FieldContent, alert.FieldTarget, alert.FieldStatus, alert.FieldResolvedBy:
|
|
values[i] = new(sql.NullString)
|
|
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.FieldRuleCode:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field rule_code", values[i])
|
|
} else if value.Valid {
|
|
_m.RuleCode = value.String
|
|
}
|
|
case alert.FieldLevel:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field level", values[i])
|
|
} else if value.Valid {
|
|
_m.Level = 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.FieldTarget:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field target", values[i])
|
|
} else if value.Valid {
|
|
_m.Target = 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.FieldResolvedAt:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field resolved_at", values[i])
|
|
} else if value.Valid {
|
|
_m.ResolvedAt = value.Int64
|
|
}
|
|
case alert.FieldResolvedBy:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field resolved_by", values[i])
|
|
} else if value.Valid {
|
|
_m.ResolvedBy = value.String
|
|
}
|
|
case alert.FieldCreatedAt:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field created_at", values[i])
|
|
} else if value.Valid {
|
|
_m.CreatedAt = value.Int64
|
|
}
|
|
case alert.FieldUpdatedAt:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
|
|
} else if value.Valid {
|
|
_m.UpdatedAt = value.Int64
|
|
}
|
|
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("rule_code=")
|
|
builder.WriteString(_m.RuleCode)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("level=")
|
|
builder.WriteString(_m.Level)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("title=")
|
|
builder.WriteString(_m.Title)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("content=")
|
|
builder.WriteString(_m.Content)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("target=")
|
|
builder.WriteString(_m.Target)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("status=")
|
|
builder.WriteString(_m.Status)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("resolved_at=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.ResolvedAt))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("resolved_by=")
|
|
builder.WriteString(_m.ResolvedBy)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("created_at=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("updated_at=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.UpdatedAt))
|
|
builder.WriteByte(')')
|
|
return builder.String()
|
|
}
|
|
|
|
// Alerts is a parsable slice of Alert.
|
|
type Alerts []*Alert
|