时钟与 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 生成代码。
252 lines
9.0 KiB
Go
252 lines
9.0 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"bj_power_mes/ent/callpool"
|
|
"fmt"
|
|
"strings"
|
|
"time"
|
|
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/dialect/sql"
|
|
)
|
|
|
|
// CallPool 叫料池:工位级物料行四数账(需求/调整/已发/占用),来源=启用状态日排产
|
|
type CallPool struct {
|
|
config `json:"-"`
|
|
// ID of the ent.
|
|
ID int `json:"id,omitempty"`
|
|
// 工位号
|
|
StationNo int `json:"stationNo,omitempty"`
|
|
// 物料编码(图号)
|
|
MaterialCode string `json:"materialCode,omitempty"`
|
|
// MaterialName holds the value of the "materialName" field.
|
|
MaterialName string `json:"materialName,omitempty"`
|
|
// Unit holds the value of the "unit" field.
|
|
Unit string `json:"unit,omitempty"`
|
|
// SnMode holds the value of the "snMode" field.
|
|
SnMode int `json:"snMode,omitempty"`
|
|
// 需求量(启用排产派生,逐行向上取整后合计)
|
|
ReqQty int `json:"reqQty,omitempty"`
|
|
// 人工调整量(可正可负;改动留痕 event_log)
|
|
AdjQty int `json:"adjQty,omitempty"`
|
|
// 已发净额(完成备料实发累加;退库收回扣减回补)
|
|
SentQty int `json:"sentQty,omitempty"`
|
|
// 占用中(待备料叫料单请求量合计)
|
|
ReservedQty int `json:"reservedQty,omitempty"`
|
|
// 已装量(装配消耗:追溯件绑定扣/撤销回补,非序列号件报工自动扣)
|
|
InstalledQty int `json:"installedQty,omitempty"`
|
|
// 是否含非今日排产(跨日叫料预警/仓库驳回异常标记)
|
|
CrossDay bool `json:"crossDay,omitempty"`
|
|
// 派生快照:贡献需求的排产日期(逗号分隔,可空)
|
|
PlanDates string `json:"planDates,omitempty"`
|
|
// CreatedAt holds the value of the "createdAt" field.
|
|
CreatedAt time.Time `json:"createdAt,omitempty"`
|
|
// UpdatedAt holds the value of the "updatedAt" field.
|
|
UpdatedAt time.Time `json:"updatedAt,omitempty"`
|
|
selectValues sql.SelectValues
|
|
}
|
|
|
|
// scanValues returns the types for scanning values from sql.Rows.
|
|
func (*CallPool) scanValues(columns []string) ([]any, error) {
|
|
values := make([]any, len(columns))
|
|
for i := range columns {
|
|
switch columns[i] {
|
|
case callpool.FieldCrossDay:
|
|
values[i] = new(sql.NullBool)
|
|
case callpool.FieldID, callpool.FieldStationNo, callpool.FieldSnMode, callpool.FieldReqQty, callpool.FieldAdjQty, callpool.FieldSentQty, callpool.FieldReservedQty, callpool.FieldInstalledQty:
|
|
values[i] = new(sql.NullInt64)
|
|
case callpool.FieldMaterialCode, callpool.FieldMaterialName, callpool.FieldUnit, callpool.FieldPlanDates:
|
|
values[i] = new(sql.NullString)
|
|
case callpool.FieldCreatedAt, callpool.FieldUpdatedAt:
|
|
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 CallPool fields.
|
|
func (_m *CallPool) 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 callpool.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 callpool.FieldStationNo:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field stationNo", values[i])
|
|
} else if value.Valid {
|
|
_m.StationNo = int(value.Int64)
|
|
}
|
|
case callpool.FieldMaterialCode:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field materialCode", values[i])
|
|
} else if value.Valid {
|
|
_m.MaterialCode = value.String
|
|
}
|
|
case callpool.FieldMaterialName:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field materialName", values[i])
|
|
} else if value.Valid {
|
|
_m.MaterialName = value.String
|
|
}
|
|
case callpool.FieldUnit:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field unit", values[i])
|
|
} else if value.Valid {
|
|
_m.Unit = value.String
|
|
}
|
|
case callpool.FieldSnMode:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field snMode", values[i])
|
|
} else if value.Valid {
|
|
_m.SnMode = int(value.Int64)
|
|
}
|
|
case callpool.FieldReqQty:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field reqQty", values[i])
|
|
} else if value.Valid {
|
|
_m.ReqQty = int(value.Int64)
|
|
}
|
|
case callpool.FieldAdjQty:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field adjQty", values[i])
|
|
} else if value.Valid {
|
|
_m.AdjQty = int(value.Int64)
|
|
}
|
|
case callpool.FieldSentQty:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field sentQty", values[i])
|
|
} else if value.Valid {
|
|
_m.SentQty = int(value.Int64)
|
|
}
|
|
case callpool.FieldReservedQty:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field reservedQty", values[i])
|
|
} else if value.Valid {
|
|
_m.ReservedQty = int(value.Int64)
|
|
}
|
|
case callpool.FieldInstalledQty:
|
|
if value, ok := values[i].(*sql.NullInt64); !ok {
|
|
return fmt.Errorf("unexpected type %T for field installedQty", values[i])
|
|
} else if value.Valid {
|
|
_m.InstalledQty = int(value.Int64)
|
|
}
|
|
case callpool.FieldCrossDay:
|
|
if value, ok := values[i].(*sql.NullBool); !ok {
|
|
return fmt.Errorf("unexpected type %T for field crossDay", values[i])
|
|
} else if value.Valid {
|
|
_m.CrossDay = value.Bool
|
|
}
|
|
case callpool.FieldPlanDates:
|
|
if value, ok := values[i].(*sql.NullString); !ok {
|
|
return fmt.Errorf("unexpected type %T for field planDates", values[i])
|
|
} else if value.Valid {
|
|
_m.PlanDates = value.String
|
|
}
|
|
case callpool.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
|
|
}
|
|
case callpool.FieldUpdatedAt:
|
|
if value, ok := values[i].(*sql.NullTime); !ok {
|
|
return fmt.Errorf("unexpected type %T for field updatedAt", values[i])
|
|
} else if value.Valid {
|
|
_m.UpdatedAt = 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 CallPool.
|
|
// This includes values selected through modifiers, order, etc.
|
|
func (_m *CallPool) Value(name string) (ent.Value, error) {
|
|
return _m.selectValues.Get(name)
|
|
}
|
|
|
|
// Update returns a builder for updating this CallPool.
|
|
// Note that you need to call CallPool.Unwrap() before calling this method if this CallPool
|
|
// was returned from a transaction, and the transaction was committed or rolled back.
|
|
func (_m *CallPool) Update() *CallPoolUpdateOne {
|
|
return NewCallPoolClient(_m.config).UpdateOne(_m)
|
|
}
|
|
|
|
// Unwrap unwraps the CallPool 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 *CallPool) Unwrap() *CallPool {
|
|
_tx, ok := _m.config.driver.(*txDriver)
|
|
if !ok {
|
|
panic("ent: CallPool is not a transactional entity")
|
|
}
|
|
_m.config.driver = _tx.drv
|
|
return _m
|
|
}
|
|
|
|
// String implements the fmt.Stringer.
|
|
func (_m *CallPool) String() string {
|
|
var builder strings.Builder
|
|
builder.WriteString("CallPool(")
|
|
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
|
|
builder.WriteString("stationNo=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.StationNo))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("materialCode=")
|
|
builder.WriteString(_m.MaterialCode)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("materialName=")
|
|
builder.WriteString(_m.MaterialName)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("unit=")
|
|
builder.WriteString(_m.Unit)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("snMode=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.SnMode))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("reqQty=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.ReqQty))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("adjQty=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.AdjQty))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("sentQty=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.SentQty))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("reservedQty=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.ReservedQty))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("installedQty=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.InstalledQty))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("crossDay=")
|
|
builder.WriteString(fmt.Sprintf("%v", _m.CrossDay))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("planDates=")
|
|
builder.WriteString(_m.PlanDates)
|
|
builder.WriteString(", ")
|
|
builder.WriteString("createdAt=")
|
|
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
|
|
builder.WriteString(", ")
|
|
builder.WriteString("updatedAt=")
|
|
builder.WriteString(_m.UpdatedAt.Format(time.ANSIC))
|
|
builder.WriteByte(')')
|
|
return builder.String()
|
|
}
|
|
|
|
// CallPools is a parsable slice of CallPool.
|
|
type CallPools []*CallPool
|