Files
bj_power/bj_power_mes/ent/callpool.go
T
SunYF f9eaebad28 feat(mes/wms/终端): 签字循环业务重构 + 叫料池实物账两列 + 工位流水按包真分页 + 下线单据提示条(2026-11-30 现场整改)
【MES · 签字循环重构(业务重构,非修 bug)】
- 旧模型作废(签字随报工落库、检验员分支永不生效的死代码);新口径:
  工人干完点「呼叫签字」→ 检验员巡检端签 OK/NG → OK 后工人再点一次「报工」;NG 整改后重新呼叫(新一轮)
- 内容指纹(SHA256):呼叫时算一次落库,报工时重算比对,变了即「签字后改数据作废本轮」要求重呼;
  只覆盖步骤录入(值/文本/勾选/拧紧结果),装机绑定不进指纹(独立台账)、改备注不触发
- 轮次统一:一次呼叫=一轮,操作工/检验员共用 round;NG/撤回/重呼=新一轮,旧轮作废历史保留
- 三档状态(作业中/签字中/待整改/可报工)从签字记录推导,不建表不存终端
- 报工闸门:本轮需签步骤齐全(操作工+检验员OK)+ 指纹未变才放行
- 撤回呼叫整轮作废;超时巡检每分钟扫描(阈值 30 分钟可在基础设置调),超时落预警中心+异常角标不进铃铛,60 分钟窗口去重
- 工位终端新增签字交互接口与呼叫/撤回/状态查询;巡检端保留 NG 回看

【MES · 叫料池实物账(十五节 Q1/Q16 + 17.6 裁决)】
- call_pool 新增 receivedQty(已收累计,拒收按退库单冲减)/ returnedQty(已退累计,按退库单号防重)两列实物账,与 sentQty 额度账并存
- 台面在手(可用)= 已收 − 已装 − 已退;在途 = 已发 − 已收

【工位终端 · 物料/叫料页重构(十五节 Q1~Q17 拍板落地)】
- 「本工位物料明细」改名「物料明细」,四数列改为:可用/需求/已发/已收/已装,量为 0 也显示不分左右托盘
- 去除「刷新池子」「刷新」按钮(有长连接);「我的叫料单」扩为类银行流水(叫料/退料/等等)
- 叫料/退料数量列直排,提交时弹窗确认数量并选接驳台;管理端叫料与退料 AGV 派车流程统一收归库管
- 工位流水按包真分页(2026-11-29 拍板):后端按包号分组 Count+Limit/Offset,每页 20 包,前端不再内存聚合

【下线 · 单据流转提示条】
- MES/WMS 前端整体删除 NextStepBar / nextStep / nextStepRules(35 条规则表整套下线),页面不再出现常驻「下一步」提示条

【文档】
- 问题临时.md 新增十四节(主控独立审计:终端账号删除/心跳/闸门函数 8 处对码全过)+ 十五节(工位物料叫料 8 条原话逐字留档与 Q1~Q17 拍板底稿)
- 新增《工位终端页面.md》;案例.md 同步更新验收口径
2026-11-30 15:25:29 +08:00

274 lines
10 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"`
// 已收累计(送达并接收,实物账;拒收冲减)
ReceivedQty int `json:"receivedQty,omitempty"`
// 已退累计(工位主动退回,实物账;按退库单号防重)
ReturnedQty int `json:"returnedQty,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, callpool.FieldReceivedQty, callpool.FieldReturnedQty:
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.FieldReceivedQty:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field receivedQty", values[i])
} else if value.Valid {
_m.ReceivedQty = int(value.Int64)
}
case callpool.FieldReturnedQty:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field returnedQty", values[i])
} else if value.Valid {
_m.ReturnedQty = 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("receivedQty=")
builder.WriteString(fmt.Sprintf("%v", _m.ReceivedQty))
builder.WriteString(", ")
builder.WriteString("returnedQty=")
builder.WriteString(fmt.Sprintf("%v", _m.ReturnedQty))
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