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 全量更新
This commit is contained in:
@@ -31,14 +31,6 @@ const (
|
||||
FieldReturnNo = "return_no"
|
||||
// FieldWorkOrderNo holds the string denoting the workorderno field in the database.
|
||||
FieldWorkOrderNo = "work_order_no"
|
||||
// FieldStatus holds the string denoting the status field in the database.
|
||||
FieldStatus = "status"
|
||||
// FieldComment holds the string denoting the comment field in the database.
|
||||
FieldComment = "comment"
|
||||
// FieldCommenter holds the string denoting the commenter field in the database.
|
||||
FieldCommenter = "commenter"
|
||||
// FieldCommentedAt holds the string denoting the commentedat field in the database.
|
||||
FieldCommentedAt = "commented_at"
|
||||
// FieldOperator holds the string denoting the operator field in the database.
|
||||
FieldOperator = "operator"
|
||||
// FieldCreatedAt holds the string denoting the createdat field in the database.
|
||||
@@ -59,10 +51,6 @@ var Columns = []string{
|
||||
FieldReason,
|
||||
FieldReturnNo,
|
||||
FieldWorkOrderNo,
|
||||
FieldStatus,
|
||||
FieldComment,
|
||||
FieldCommenter,
|
||||
FieldCommentedAt,
|
||||
FieldOperator,
|
||||
FieldCreatedAt,
|
||||
}
|
||||
@@ -94,20 +82,6 @@ var (
|
||||
DefaultWorkOrderNo string
|
||||
// WorkOrderNoValidator is a validator for the "workOrderNo" field. It is called by the builders before save.
|
||||
WorkOrderNoValidator func(string) error
|
||||
// DefaultStatus holds the default value on creation for the "status" field.
|
||||
DefaultStatus string
|
||||
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
|
||||
StatusValidator func(string) error
|
||||
// DefaultComment holds the default value on creation for the "comment" field.
|
||||
DefaultComment string
|
||||
// CommentValidator is a validator for the "comment" field. It is called by the builders before save.
|
||||
CommentValidator func(string) error
|
||||
// DefaultCommenter holds the default value on creation for the "commenter" field.
|
||||
DefaultCommenter string
|
||||
// CommenterValidator is a validator for the "commenter" field. It is called by the builders before save.
|
||||
CommenterValidator func(string) error
|
||||
// DefaultCommentedAt holds the default value on creation for the "commentedAt" field.
|
||||
DefaultCommentedAt int64
|
||||
// DefaultOperator holds the default value on creation for the "operator" field.
|
||||
DefaultOperator string
|
||||
// OperatorValidator is a validator for the "operator" field. It is called by the builders before save.
|
||||
@@ -169,26 +143,6 @@ func ByWorkOrderNo(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldWorkOrderNo, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByStatus orders the results by the status field.
|
||||
func ByStatus(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldStatus, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByComment orders the results by the comment field.
|
||||
func ByComment(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldComment, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCommenter orders the results by the commenter field.
|
||||
func ByCommenter(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCommenter, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByCommentedAt orders the results by the commentedAt field.
|
||||
func ByCommentedAt(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldCommentedAt, opts...).ToFunc()
|
||||
}
|
||||
|
||||
// ByOperator orders the results by the operator field.
|
||||
func ByOperator(opts ...sql.OrderTermOption) OrderOption {
|
||||
return sql.OrderByField(FieldOperator, opts...).ToFunc()
|
||||
|
||||
@@ -99,26 +99,6 @@ func WorkOrderNo(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldWorkOrderNo, v))
|
||||
}
|
||||
|
||||
// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
|
||||
func Status(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// Comment applies equality check predicate on the "comment" field. It's identical to CommentEQ.
|
||||
func Comment(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldComment, v))
|
||||
}
|
||||
|
||||
// Commenter applies equality check predicate on the "commenter" field. It's identical to CommenterEQ.
|
||||
func Commenter(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommentedAt applies equality check predicate on the "commentedAt" field. It's identical to CommentedAtEQ.
|
||||
func CommentedAt(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// Operator applies equality check predicate on the "operator" field. It's identical to OperatorEQ.
|
||||
func Operator(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldOperator, v))
|
||||
@@ -614,241 +594,6 @@ func WorkOrderNoContainsFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContainsFold(FieldWorkOrderNo, v))
|
||||
}
|
||||
|
||||
// StatusEQ applies the EQ predicate on the "status" field.
|
||||
func StatusEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusNEQ applies the NEQ predicate on the "status" field.
|
||||
func StatusNEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNEQ(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusIn applies the In predicate on the "status" field.
|
||||
func StatusIn(vs ...string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusNotIn applies the NotIn predicate on the "status" field.
|
||||
func StatusNotIn(vs ...string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNotIn(FieldStatus, vs...))
|
||||
}
|
||||
|
||||
// StatusGT applies the GT predicate on the "status" field.
|
||||
func StatusGT(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGT(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusGTE applies the GTE predicate on the "status" field.
|
||||
func StatusGTE(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGTE(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusLT applies the LT predicate on the "status" field.
|
||||
func StatusLT(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLT(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusLTE applies the LTE predicate on the "status" field.
|
||||
func StatusLTE(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLTE(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusContains applies the Contains predicate on the "status" field.
|
||||
func StatusContains(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContains(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusHasPrefix applies the HasPrefix predicate on the "status" field.
|
||||
func StatusHasPrefix(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldHasPrefix(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusHasSuffix applies the HasSuffix predicate on the "status" field.
|
||||
func StatusHasSuffix(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldHasSuffix(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusEqualFold applies the EqualFold predicate on the "status" field.
|
||||
func StatusEqualFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEqualFold(FieldStatus, v))
|
||||
}
|
||||
|
||||
// StatusContainsFold applies the ContainsFold predicate on the "status" field.
|
||||
func StatusContainsFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContainsFold(FieldStatus, v))
|
||||
}
|
||||
|
||||
// CommentEQ applies the EQ predicate on the "comment" field.
|
||||
func CommentEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentNEQ applies the NEQ predicate on the "comment" field.
|
||||
func CommentNEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNEQ(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentIn applies the In predicate on the "comment" field.
|
||||
func CommentIn(vs ...string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldIn(FieldComment, vs...))
|
||||
}
|
||||
|
||||
// CommentNotIn applies the NotIn predicate on the "comment" field.
|
||||
func CommentNotIn(vs ...string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNotIn(FieldComment, vs...))
|
||||
}
|
||||
|
||||
// CommentGT applies the GT predicate on the "comment" field.
|
||||
func CommentGT(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGT(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentGTE applies the GTE predicate on the "comment" field.
|
||||
func CommentGTE(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGTE(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentLT applies the LT predicate on the "comment" field.
|
||||
func CommentLT(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLT(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentLTE applies the LTE predicate on the "comment" field.
|
||||
func CommentLTE(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLTE(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentContains applies the Contains predicate on the "comment" field.
|
||||
func CommentContains(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContains(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentHasPrefix applies the HasPrefix predicate on the "comment" field.
|
||||
func CommentHasPrefix(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldHasPrefix(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentHasSuffix applies the HasSuffix predicate on the "comment" field.
|
||||
func CommentHasSuffix(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldHasSuffix(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentEqualFold applies the EqualFold predicate on the "comment" field.
|
||||
func CommentEqualFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEqualFold(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommentContainsFold applies the ContainsFold predicate on the "comment" field.
|
||||
func CommentContainsFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContainsFold(FieldComment, v))
|
||||
}
|
||||
|
||||
// CommenterEQ applies the EQ predicate on the "commenter" field.
|
||||
func CommenterEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterNEQ applies the NEQ predicate on the "commenter" field.
|
||||
func CommenterNEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNEQ(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterIn applies the In predicate on the "commenter" field.
|
||||
func CommenterIn(vs ...string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldIn(FieldCommenter, vs...))
|
||||
}
|
||||
|
||||
// CommenterNotIn applies the NotIn predicate on the "commenter" field.
|
||||
func CommenterNotIn(vs ...string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNotIn(FieldCommenter, vs...))
|
||||
}
|
||||
|
||||
// CommenterGT applies the GT predicate on the "commenter" field.
|
||||
func CommenterGT(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGT(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterGTE applies the GTE predicate on the "commenter" field.
|
||||
func CommenterGTE(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGTE(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterLT applies the LT predicate on the "commenter" field.
|
||||
func CommenterLT(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLT(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterLTE applies the LTE predicate on the "commenter" field.
|
||||
func CommenterLTE(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLTE(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterContains applies the Contains predicate on the "commenter" field.
|
||||
func CommenterContains(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContains(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterHasPrefix applies the HasPrefix predicate on the "commenter" field.
|
||||
func CommenterHasPrefix(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldHasPrefix(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterHasSuffix applies the HasSuffix predicate on the "commenter" field.
|
||||
func CommenterHasSuffix(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldHasSuffix(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterEqualFold applies the EqualFold predicate on the "commenter" field.
|
||||
func CommenterEqualFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEqualFold(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommenterContainsFold applies the ContainsFold predicate on the "commenter" field.
|
||||
func CommenterContainsFold(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldContainsFold(FieldCommenter, v))
|
||||
}
|
||||
|
||||
// CommentedAtEQ applies the EQ predicate on the "commentedAt" field.
|
||||
func CommentedAtEQ(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// CommentedAtNEQ applies the NEQ predicate on the "commentedAt" field.
|
||||
func CommentedAtNEQ(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNEQ(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// CommentedAtIn applies the In predicate on the "commentedAt" field.
|
||||
func CommentedAtIn(vs ...int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldIn(FieldCommentedAt, vs...))
|
||||
}
|
||||
|
||||
// CommentedAtNotIn applies the NotIn predicate on the "commentedAt" field.
|
||||
func CommentedAtNotIn(vs ...int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldNotIn(FieldCommentedAt, vs...))
|
||||
}
|
||||
|
||||
// CommentedAtGT applies the GT predicate on the "commentedAt" field.
|
||||
func CommentedAtGT(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGT(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// CommentedAtGTE applies the GTE predicate on the "commentedAt" field.
|
||||
func CommentedAtGTE(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldGTE(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// CommentedAtLT applies the LT predicate on the "commentedAt" field.
|
||||
func CommentedAtLT(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLT(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// CommentedAtLTE applies the LTE predicate on the "commentedAt" field.
|
||||
func CommentedAtLTE(v int64) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldLTE(FieldCommentedAt, v))
|
||||
}
|
||||
|
||||
// OperatorEQ applies the EQ predicate on the "operator" field.
|
||||
func OperatorEQ(v string) predicate.LossLedger {
|
||||
return predicate.LossLedger(sql.FieldEQ(FieldOperator, v))
|
||||
|
||||
Reference in New Issue
Block a user