feat: 新增收集式校验错误弹窗及工位报警语音播报

新增 ErrorListDialog 组件用于统一展示结构化校验错误信息,实现报错一次收全;新增工位报警语音播报功能,通过浏览器 SpeechSynthesis 播放本工位相关报警;调整物料类别及序列号字段文案,移除「其他」类别;新增工单实际开始字段及采集方式配置;优化 AGV 及 PlcSend 页签刷新逻辑;新增看板物料追溯及工位报警接口;删除 PLC 强制写 M 位及相关测试代码;同步数据库字段注释及补丁。
This commit is contained in:
SunYF
2026-10-20 16:36:26 +08:00
parent f743cf21fb
commit b0c048d9aa
126 changed files with 4603 additions and 1639 deletions
+16 -10
View File
@@ -65,8 +65,8 @@ func (s *Service) ReportTorque(ctx context.Context, req TorqueReq, operator stri
return nil
}
// evaluateTorqueCriterion 依据「isTorque 步骤 + RANGE 考核标准」自动判定 OK/NG 写入 step_data。
// 判定完全依据步骤 isTorque 标记与区间逻辑,不再依赖指标名(如「扭矩」),
// evaluateTorqueCriterion 依据「采集方式=拧紧枪自动(AUTO)步骤 + RANGE 考核标准」自动判定 OK/NG 写入 step_data。
// 判定完全依据步骤采集方式与区间逻辑,不再依赖指标名(如「扭矩」),
// 避免误命名(如「时间」)导致整段判定静默失效;与 dashboard.loadTorqueCriterion 共用
// torqueRangeCriteria,口径统一。仅取上报工位所绑定工艺流程内的扭矩标准,跨流程/无关步骤不会误判。
func (s *Service) evaluateTorqueCriterion(ctx context.Context, sn, stationNo string, strain, angle float64, operator string) {
@@ -119,11 +119,12 @@ func (s *Service) stationFlowId(ctx context.Context, stationNo string) int {
return st.FlowId
}
// torqueRangeCriteria 取「isTorque 步骤 + RANGE 逻辑」的考核标准(即扭矩规格)。
// torqueRangeCriteria 取「采集方式=拧紧枪自动(AUTO)步骤 + RANGE 逻辑」的考核标准(即扭矩规格)。
// flowId>0 限定某个工艺流程;flowId<=0 取全部流程(供看板全局控制图使用)。
// 判定完全依据步骤 isTorque 标记与区间逻辑,不依赖指标名,杜绝「时间」等误命名导致漏判。
// 判定完全依据步骤采集方式与区间逻辑,不依赖指标名,杜绝「时间」等误命名导致漏判。
// 2026-10-19:is_torque 字段已删(与 collectType=AUTO 完全重复),统一按采集方式过滤。
func (s *Service) torqueRangeCriteria(ctx context.Context, flowId int) ([]*ent.StepCriterion, error) {
stepQ := s.ctx.EntClient.ProcessStep.Query().Where(processstep.IsTorque(true))
stepQ := s.ctx.EntClient.ProcessStep.Query().Where(processstep.CollectType("AUTO"))
if flowId > 0 {
stepQ = stepQ.Where(processstep.FlowId(flowId))
}
@@ -143,8 +144,8 @@ func (s *Service) torqueRangeCriteria(ctx context.Context, flowId int) ([]*ent.S
All(ctx)
}
// ListTorqueRecords 查询拧紧数据(四条件复合取交集:工单号/SN/日期区间/工位)
func (s *Service) ListTorqueRecords(ctx context.Context, sn, workOrderNo, stationNo string, from, to time.Time) ([]*ent.TorqueRecord, error) {
// ListTorqueRecords 查询拧紧数据(五条件复合取交集:工单号/SN/日期区间/工位/操作人)
func (s *Service) ListTorqueRecords(ctx context.Context, sn, workOrderNo, stationNo, operator string, from, to time.Time) ([]*ent.TorqueRecord, error) {
q := s.ctx.EntClient.TorqueRecord.Query()
if sn != "" {
// 大小写不敏感(2026-09-08 全项目搜索规范)
@@ -156,6 +157,9 @@ func (s *Service) ListTorqueRecords(ctx context.Context, sn, workOrderNo, statio
if stationNo != "" {
q = q.Where(torquerecord.StationNoEqualFold(stationNo))
}
if operator != "" {
q = q.Where(torquerecord.OperatorEqualFold(operator))
}
if !from.IsZero() {
q = q.Where(torquerecord.TimeGTE(from))
}
@@ -207,8 +211,9 @@ type ProcessStepTemplate struct {
ID int `json:"id"`
Seq int `json:"seq"`
Name string `json:"name"`
CollectType string `json:"collectType"` // AUTO(拧紧枪自动)/MANUAL(手填)/NONE
IsTorque bool `json:"isTorque"`
CollectType string `json:"collectType"` // AUTO(拧紧枪自动)/MANUAL(手填)/SCAN(扫码,与手填等价)/NONE
NeedCheck bool `json:"needCheck"`
// 签字机制(需求B):操作工报工前须签字确认 / 检验员待签任务须签字确认方可流转
NeedOperatorSign bool `json:"needOperatorSign"`
@@ -254,7 +259,8 @@ type StepItemReq struct {
Seq int `json:"seq"`
Name string `json:"name"`
CollectType string `json:"collectType"`
IsTorque bool `json:"isTorque"`
NeedCheck bool `json:"needCheck"`
// 签字机制(需求B):保存工艺步骤时携带,落库到 process_step 表
NeedOperatorSign bool `json:"needOperatorSign"`