Files
bj_power/bj_power_mes/ent/processstep.go
T
SunYF f930a1325f feat(mes/wms): 接驳台编码统一为GW点位码 + 签字模型改报检呼叫 + 台账续流修复 + 末级库位强校验(2026-12-01 终版整改)
【全系统 · 接驳台编码终版统一(12-01 用户拍板)】
- 新增 dockcode 包作为唯一真源:工位接驳台 = GW{工位号}{Z|Y}(Z=左/Y=右,工位1~10同一规则,废除左右互换),库房 = JBT21 不变
- 编码即海康 RCS 地图点位码:落库/界面/下发 RCS/读 PLC 传感器全用同一套;旧 DOCK01~20 全量废弃,系统内无第二套编号、无换算层
- dock 表去 side 字段;agv_task.target_dock、line_point、看板点位态与中文名、dockLabel 工具全部改 GW 规则
- 产线布局说明.md 同步终版(图纸名 GxZ/GxY 与 AGV 码 GWxZ/GWxY 一一对应;注明 RCS 图与主线流向图相差 180°,读图一律以 GW 码为准)

【MES · 签字模型二次重构(11-30 实测后定稿)】
- _OPERATOR 签字整体废除:工艺步骤删 needOperatorSign / needAudit / auditRole 字段,签字角色改 CALL(工人报检呼叫)+ INSPECTOR(检验员审核签)
- 呼叫时落步骤录入快照(stepValue/stepText/stepChecked/processId),供检验员查看与指纹比对;「待签任务」只认检验员签名步骤
- 「签字复核」(AuditPending 页面 + produce.audit 菜单 + 路由)整套删除

【MES · 台账续流根因修复(11-30 对账发现)】
- 流转目标「G6」与 line_point.point_no「6」对不上导致到位落账查不到、却先释放源位→工件从调度消失;新增 ledgerPointByTarget 归一
- settleDirect/settleInTransit 改为先占目标位、成功才释放源位;目标被占原样保留,工件进缓存位排队(实测 C2 排队不再丢件)

【WMS · 末级库位强校验与上架移库】
- 新增 LocationCascade 四级联动选择器(区/架/层/号,只从启用 level=4 节点派生);手工入库、半成品/成品入库、隔离库位一律四级必填且命中启用节点
- 新增上架/移库 relocate:只改四级库位与 updated_at,不动质量状态/数量/锁定量;不合格与锁定行同样允许移库;支持 ids 逐行指定或 scope 按物料+原库位整组搬
- MES 新增 WMS 自动回流库位配置(半成品/成品各一组末级库位,默认值 1区/1架/1层/1号,存 sys_config 可改)

【MES · 统一口径与工程整改】
- 新增 workpiece_location:工单详情工件列表/WIP/追溯三处共用位置判定(SCRAPPED→DONE→SEMI_STORED→在 StationNo→在途→待流转)
- 新增 workorder_close_warn:工单完工/取消时汇总各工位实物余料出一条预警,不阻断关单
- 分页下沉:新增 pagination 工具,同步失败台账(两端)改 Count+LIMIT/OFFSET 真分页,列表不再全量切片
- 全网对账/孤儿扫描(问题临时.md 第25/26节):10 类关系边断言实测,给出 8 条可重复巡检项

【文档】
- 产线布局说明.md 按 GW 编码终版重写;问题临时.md 新增 24.7 闭环实测、25 全网对账、26 补料→配送→报工人库闭环
2026-12-01 22:15:28 +08:00

202 lines
6.9 KiB
Go

// Code generated by ent, DO NOT EDIT.
package ent
import (
"bj_power_mes/ent/processstep"
"encoding/json"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
)
// ProcessStep 工序步骤模板:一份工艺流程包含多个采集/考核步骤(按 seq 顺序执行)
type ProcessStep struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// 所属工艺流程图ID
FlowId int `json:"flowId,omitempty"`
// 步骤序号
Seq int `json:"seq,omitempty"`
// 步骤名称
Name string `json:"name,omitempty"`
// 采集方式 AUTO(拧紧枪自动)/MANUAL(手填)/SCAN(扫码,与手填等价采一串字符串)/NONE(仅记录)
CollectType string `json:"collectType,omitempty"`
// 是否需要工人自检(报工前须勾选确认)
NeedCheck bool `json:"needCheck,omitempty"`
// 是否需要检验员签字(检验员签OK后放行)
NeedInspectorSign bool `json:"needInspectorSign,omitempty"`
// 本步骤图纸/附件列表 [{name,url}]
Attachment []map[string]string `json:"attachment,omitempty"`
// Remark holds the value of the "remark" field.
Remark string `json:"remark,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 (*ProcessStep) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case processstep.FieldAttachment:
values[i] = new([]byte)
case processstep.FieldNeedCheck, processstep.FieldNeedInspectorSign:
values[i] = new(sql.NullBool)
case processstep.FieldID, processstep.FieldFlowId, processstep.FieldSeq:
values[i] = new(sql.NullInt64)
case processstep.FieldName, processstep.FieldCollectType, processstep.FieldRemark:
values[i] = new(sql.NullString)
case processstep.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 ProcessStep fields.
func (_m *ProcessStep) 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 processstep.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 processstep.FieldFlowId:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field flowId", values[i])
} else if value.Valid {
_m.FlowId = int(value.Int64)
}
case processstep.FieldSeq:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field seq", values[i])
} else if value.Valid {
_m.Seq = int(value.Int64)
}
case processstep.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
_m.Name = value.String
}
case processstep.FieldCollectType:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field collectType", values[i])
} else if value.Valid {
_m.CollectType = value.String
}
case processstep.FieldNeedCheck:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field needCheck", values[i])
} else if value.Valid {
_m.NeedCheck = value.Bool
}
case processstep.FieldNeedInspectorSign:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field needInspectorSign", values[i])
} else if value.Valid {
_m.NeedInspectorSign = value.Bool
}
case processstep.FieldAttachment:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field attachment", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &_m.Attachment); err != nil {
return fmt.Errorf("unmarshal field attachment: %w", err)
}
}
case processstep.FieldRemark:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field remark", values[i])
} else if value.Valid {
_m.Remark = value.String
}
case processstep.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 ProcessStep.
// This includes values selected through modifiers, order, etc.
func (_m *ProcessStep) Value(name string) (ent.Value, error) {
return _m.selectValues.Get(name)
}
// Update returns a builder for updating this ProcessStep.
// Note that you need to call ProcessStep.Unwrap() before calling this method if this ProcessStep
// was returned from a transaction, and the transaction was committed or rolled back.
func (_m *ProcessStep) Update() *ProcessStepUpdateOne {
return NewProcessStepClient(_m.config).UpdateOne(_m)
}
// Unwrap unwraps the ProcessStep 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 *ProcessStep) Unwrap() *ProcessStep {
_tx, ok := _m.config.driver.(*txDriver)
if !ok {
panic("ent: ProcessStep is not a transactional entity")
}
_m.config.driver = _tx.drv
return _m
}
// String implements the fmt.Stringer.
func (_m *ProcessStep) String() string {
var builder strings.Builder
builder.WriteString("ProcessStep(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
builder.WriteString("flowId=")
builder.WriteString(fmt.Sprintf("%v", _m.FlowId))
builder.WriteString(", ")
builder.WriteString("seq=")
builder.WriteString(fmt.Sprintf("%v", _m.Seq))
builder.WriteString(", ")
builder.WriteString("name=")
builder.WriteString(_m.Name)
builder.WriteString(", ")
builder.WriteString("collectType=")
builder.WriteString(_m.CollectType)
builder.WriteString(", ")
builder.WriteString("needCheck=")
builder.WriteString(fmt.Sprintf("%v", _m.NeedCheck))
builder.WriteString(", ")
builder.WriteString("needInspectorSign=")
builder.WriteString(fmt.Sprintf("%v", _m.NeedInspectorSign))
builder.WriteString(", ")
builder.WriteString("attachment=")
builder.WriteString(fmt.Sprintf("%v", _m.Attachment))
builder.WriteString(", ")
builder.WriteString("remark=")
builder.WriteString(_m.Remark)
builder.WriteString(", ")
builder.WriteString("createdAt=")
builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
// ProcessSteps is a parsable slice of ProcessStep.
type ProcessSteps []*ProcessStep