Files
bj_power/bj_power_mes/ent/predicate/predicate.go
T
SunYF 88875c1f13 feat(mes/wms/终端): 工位终端状态感知 + 全厂统一账号 + 单号短号规则 + 退料SN逐颗核对闭环(2026-11-26~28 现场整改)
【MES · 工位终端状态感知(11-28 第十三节拍板)】
- 新增 station_terminal_state / station_terminal_event 两表:当前状态镜像 + 状态变化流水
- 在线判定走既有 SSE 长连接存活:建连/断连/30s ping 心跳,90s 无心跳判离线,零 HTTP 轮询
- 登录/退出/暂停/恢复由终端事件驱动上报;新增「终端状态」管理页(produce.terminalstate,仅超级管理员):看在线/登录/操作人/接单/下班判定/心跳,抽屉看状态流水
- 库管代退料前置条件②「工人已下班」据此判定:未登录或终端离线任一即下班

【工位终端 · 全厂统一账号(11-28 拍板)】
- 删除本地账号表与 seed,登录直连 MES 用户表;本地 SQLite 只剩操作日志+登录态,断网不能换人
- SSE 客户端携带本机固定工位号,MES 据连接存活映射该工位在线状态

【单号短号规则(11-27 拍板)】
- 叫料单 MR / 叫料包 PK / 转产退库 TR / 配送单 DL:改「前缀+YYMMDD+3位当天序号」,每天从 001 归零、超 999 进 4 位
- MR 与 TR 同列不同前缀独立计数不撞号;进程内互斥分配 + DB 唯一索引兜底;历史时间戳号一律不动

【退料闭环(11-28)】
- 退库单新增 sn_list:工位提交的待退 SN 清单落库,收货逐颗扫码核对(不按批次分组、允许跨批次混合,所属批次系统按 SN 带出,库管不必填)
- 收货改大数量必须有实物依据:SN 件以精确扫描的最终清单为准(条数相等且不重复);批次件必须落到真实启用的四级库位,禁止凭空加库存
- 余量参考值口径定稿(N4):应剩余量 = 实际备料 − 已消耗 − 已退 − 已损耗
- 损耗台账取消「后审核批注」:删 status/comment/commenter/commented_at 字段,WMS 确认收货当场落账闭环,MES 台账只读

【日排产 · 两种 PENDING 区分(11-26 口径定稿)】
- daily_plan 新增 discarded 废弃标记:停用打标、新建不打标;额度只算 CONFIRMED + 未废弃 PENDING
- 工单管「要干几台」、日排产管「按天从哪个工位领多少料」,两张账不合并不互倒推;排产合计可小于工单数(缺口靠借料/补料审批摆出,不自动兜底)

【其他】
- SN 查询大小写脱敏(11-27):存储原样不强制大小写,匹配 LOWER(sn)=LOWER(?),扫 ABC-0001 与 abc-0001 命中同一件
- 拧紧枪人工跳过链路:设备未连接时人工跳过上报,「拧紧跳过(设备未连接)」前缀单独列示,不写 torque_record 绝不冒充设备结果
- 单据流转提示规则表全量 35 条(MES 18 + WMS 17):常驻提示条、单号可复制;单号字段逐条对后端响应实测,取不到不显示复制按钮
- PLC 快照缓存/对账、产线清线、绩效与拧紧枪配置页同步修正

【文档】
- 新增《临时结束.md》2026-11-26 日排产/叫料/完工口径大讨论定稿(含状态专项结论与被推翻旧说法留档);问题临时.md 全量更新
2026-11-28 13:44:51 +08:00

152 lines
5.1 KiB
Go

// Code generated by ent, DO NOT EDIT.
package predicate
import (
"entgo.io/ent/dialect/sql"
)
// AgvPoint is the predicate function for agvpoint builders.
type AgvPoint func(*sql.Selector)
// AgvTask is the predicate function for agvtask builders.
type AgvTask func(*sql.Selector)
// AgvVehicleState is the predicate function for agvvehiclestate builders.
type AgvVehicleState func(*sql.Selector)
// Alert is the predicate function for alert builders.
type Alert func(*sql.Selector)
// AlertRule is the predicate function for alertrule builders.
type AlertRule func(*sql.Selector)
// AssociationTrace is the predicate function for associationtrace builders.
type AssociationTrace func(*sql.Selector)
// Attachment is the predicate function for attachment builders.
type Attachment func(*sql.Selector)
// BackupRecord is the predicate function for backuprecord builders.
type BackupRecord func(*sql.Selector)
// CallPool is the predicate function for callpool builders.
type CallPool func(*sql.Selector)
// DailyPlan is the predicate function for dailyplan builders.
type DailyPlan func(*sql.Selector)
// Dock is the predicate function for dock builders.
type Dock func(*sql.Selector)
// EventLog is the predicate function for eventlog builders.
type EventLog func(*sql.Selector)
// InspectionRecord is the predicate function for inspectionrecord builders.
type InspectionRecord func(*sql.Selector)
// LinePoint is the predicate function for linepoint builders.
type LinePoint func(*sql.Selector)
// LossLedger is the predicate function for lossledger builders.
type LossLedger func(*sql.Selector)
// Material is the predicate function for material builders.
type Material func(*sql.Selector)
// MaterialQtyReport is the predicate function for materialqtyreport builders.
type MaterialQtyReport func(*sql.Selector)
// MaterialRequest is the predicate function for materialrequest builders.
type MaterialRequest func(*sql.Selector)
// Permission is the predicate function for permission builders.
type Permission func(*sql.Selector)
// PlcSendLog is the predicate function for plcsendlog builders.
type PlcSendLog func(*sql.Selector)
// ProcessFlow is the predicate function for processflow builders.
type ProcessFlow func(*sql.Selector)
// ProcessStep is the predicate function for processstep builders.
type ProcessStep func(*sql.Selector)
// ProductBOM is the predicate function for productbom builders.
type ProductBOM func(*sql.Selector)
// ProductProcess is the predicate function for productprocess builders.
type ProductProcess func(*sql.Selector)
// ProductProcessItem is the predicate function for productprocessitem builders.
type ProductProcessItem func(*sql.Selector)
// ProductProcessMaterial is the predicate function for productprocessmaterial builders.
type ProductProcessMaterial func(*sql.Selector)
// Role is the predicate function for role builders.
type Role func(*sql.Selector)
// SemiFlow is the predicate function for semiflow builders.
type SemiFlow func(*sql.Selector)
// ShortageRequest is the predicate function for shortagerequest builders.
type ShortageRequest func(*sql.Selector)
// Station is the predicate function for station builders.
type Station func(*sql.Selector)
// StationShift is the predicate function for stationshift builders.
type StationShift func(*sql.Selector)
// StationState is the predicate function for stationstate builders.
type StationState func(*sql.Selector)
// StationTerminalEvent is the predicate function for stationterminalevent builders.
type StationTerminalEvent func(*sql.Selector)
// StationTerminalState is the predicate function for stationterminalstate builders.
type StationTerminalState func(*sql.Selector)
// StepCriterion is the predicate function for stepcriterion builders.
type StepCriterion func(*sql.Selector)
// StepData is the predicate function for stepdata builders.
type StepData func(*sql.Selector)
// StepSignRecord is the predicate function for stepsignrecord builders.
type StepSignRecord func(*sql.Selector)
// SyncFailure is the predicate function for syncfailure builders.
type SyncFailure func(*sql.Selector)
// SysConfig is the predicate function for sysconfig builders.
type SysConfig func(*sql.Selector)
// TorqueRecord is the predicate function for torquerecord builders.
type TorqueRecord func(*sql.Selector)
// TrialRecord is the predicate function for trialrecord builders.
type TrialRecord func(*sql.Selector)
// User is the predicate function for user builders.
type User func(*sql.Selector)
// UserStation is the predicate function for userstation builders.
type UserStation func(*sql.Selector)
// WorkOrder is the predicate function for workorder builders.
type WorkOrder func(*sql.Selector)
// Workpiece is the predicate function for workpiece builders.
type Workpiece func(*sql.Selector)
// WorkpieceBind is the predicate function for workpiecebind builders.
type WorkpieceBind func(*sql.Selector)
// WorkpieceLifecycleLog is the predicate function for workpiecelifecyclelog builders.
type WorkpieceLifecycleLog func(*sql.Selector)
// WorkpieceProcess is the predicate function for workpieceprocess builders.
type WorkpieceProcess func(*sql.Selector)