feat: 新增工件生命周期状态流水表及工单状态流转逻辑
新增工件生命周期状态流水表,记录所有工件状态变更动作,替代原半成品质检计数源 调整工单状态流转,将「下发工单」与「开始执行」合并为「下发并开工」,自动启用关联排产 新增工件物理位置字段,区分业务位置与实际物理工位,解决工位对账滞后问题 统一物料类别处理,避免 WMS 同步时覆盖合法值或错误设置为 0 移除已废弃的返修状态,更新相关显示与逻辑
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"bj_power_mes/ent"
|
||||
"bj_power_mes/ent/semiflow"
|
||||
"bj_power_mes/ent/workpiece"
|
||||
"bj_power_mes/ent/workpiecelifecyclelog"
|
||||
"bj_power_mes/internal/wmsclient"
|
||||
)
|
||||
|
||||
@@ -88,6 +89,18 @@ func (s *Service) ListSemiFlows(ctx context.Context, sn, orderNo string) ([]*ent
|
||||
return q.Order(ent.Desc(semiflow.FieldID)).All(ctx)
|
||||
}
|
||||
|
||||
// CountSemiIn 半成品入库次数 = workpiece_lifecycle_log.action='SEMI_IN' 记录数(三.3:替代原 CountSemiStored)。
|
||||
// 问题.md 一.5:上线次数=状态驱动、入库一次解锁一次、入库次数有记录可追溯;
|
||||
// 入库次数统一以 lifecycle 状态流水为权威源,不再依赖 semiflow 业务流水。
|
||||
func (s *Service) CountSemiIn(ctx context.Context, sn string) int {
|
||||
n, err := s.ctx.EntClient.WorkpieceLifecycleLog.Query().
|
||||
Where(workpiecelifecyclelog.Sn(sn), workpiecelifecyclelog.Action("SEMI_IN")).Count(ctx)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// ListEventLogs 操作日志查询(按工单号/操作人;operators 为候选列表,任一命中即算)
|
||||
func (s *Service) ListEventLogs(ctx context.Context, orderNo string, operators []string, eventType string, fromMs, toMs int64, page, pageSize int) ([]*ent.EventLog, int, error) {
|
||||
return s.ctx.EventLog.Query(ctx, eventType, orderNo, operators, fromMs, toMs, page, pageSize)
|
||||
|
||||
Reference in New Issue
Block a user