feat: 新增收集式校验错误弹窗及工位报警语音播报
新增 ErrorListDialog 组件用于统一展示结构化校验错误信息,实现报错一次收全;新增工位报警语音播报功能,通过浏览器 SpeechSynthesis 播放本工位相关报警;调整物料类别及序列号字段文案,移除「其他」类别;新增工单实际开始字段及采集方式配置;优化 AGV 及 PlcSend 页签刷新逻辑;新增看板物料追溯及工位报警接口;删除 PLC 强制写 M 位及相关测试代码;同步数据库字段注释及补丁。
This commit is contained in:
@@ -826,7 +826,7 @@ func (s *Service) DoneWorkpiece(ctx context.Context, req DoneReq, operator strin
|
||||
}
|
||||
|
||||
// Trace 追溯查询(SN 维度):工序时间线/操作人/步骤数据/物料批次SN/拧紧数据
|
||||
func (s *Service) Trace(ctx context.Context, sn string) (map[string]any, error) {
|
||||
func (s *Service) Trace(ctx context.Context, sn, operator string) (map[string]any, error) {
|
||||
wp, err := s.ctx.EntClient.Workpiece.Query().Where(workpiece.Sn(sn)).First(ctx)
|
||||
if err != nil {
|
||||
return nil, errors.New("该SN无追溯数据")
|
||||
@@ -837,8 +837,12 @@ func (s *Service) Trace(ctx context.Context, sn string) (map[string]any, error)
|
||||
Where(stepdata.Sn(sn)).Order(ent.Desc(stepdata.FieldID)).All(ctx)
|
||||
assoc, _ := s.ctx.EntClient.AssociationTrace.Query().
|
||||
Where(associationtrace.FinishedSn(sn)).First(ctx)
|
||||
torque, _ := s.ctx.EntClient.TorqueRecord.Query().
|
||||
Where(torquerecord.Sn(sn)).Order(ent.Desc(torquerecord.FieldTime)).Limit(200).All(ctx)
|
||||
tq := s.ctx.EntClient.TorqueRecord.Query().
|
||||
Where(torquerecord.Sn(sn))
|
||||
if operator != "" {
|
||||
tq = tq.Where(torquerecord.OperatorEqualFold(operator))
|
||||
}
|
||||
torque, _ := tq.Order(ent.Desc(torquerecord.FieldTime)).Limit(200).All(ctx)
|
||||
bindVO, _ := s.BuildBindTrace(ctx, sn)
|
||||
// 半成品流转记录(IN=暂存退库 / OUT=重上线),追溯页展示完成至工位快照
|
||||
semiFlows, _ := s.ctx.EntClient.SemiFlow.Query().
|
||||
@@ -964,8 +968,10 @@ func (s *Service) inspectionRecordAttachments(ctx context.Context, rec *ent.Insp
|
||||
return out
|
||||
}
|
||||
|
||||
// ListWorkpieces 查询工件(sn 模糊包含、orderNo 精确;limit>0 时截断封顶 200,默认 500)
|
||||
func (s *Service) ListWorkpieces(ctx context.Context, sn, orderNo string, limit int) ([]*ent.Workpiece, error) {
|
||||
// ListWorkpieces 查询工件(sn 模糊包含、orderNo 精确、status 精确)。
|
||||
// page>0 走后端 SQL 分页:按 SN 升序(预生成 SN={工单号}-{3位序号},SN 升序=产品序号小号在前),
|
||||
// 返回 rows+total;page=0 保持旧行为(limit 封顶 200、默认 500,按 ID 降序),兼容既有下拉/追溯调用方。
|
||||
func (s *Service) ListWorkpieces(ctx context.Context, sn, orderNo, status string, limit, page, pageSize int) ([]*ent.Workpiece, int, error) {
|
||||
q := s.ctx.EntClient.Workpiece.Query()
|
||||
if sn != "" {
|
||||
q = q.Where(workpiece.SnContains(sn))
|
||||
@@ -973,6 +979,21 @@ func (s *Service) ListWorkpieces(ctx context.Context, sn, orderNo string, limit
|
||||
if orderNo != "" {
|
||||
q = q.Where(workpiece.OrderNo(orderNo))
|
||||
}
|
||||
if status != "" {
|
||||
q = q.Where(workpiece.StatusEQ(status))
|
||||
}
|
||||
if page > 0 {
|
||||
if pageSize <= 0 {
|
||||
pageSize = 100
|
||||
}
|
||||
total, err := q.Count(ctx)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
rows, err := q.Order(ent.Asc(workpiece.FieldSn)).
|
||||
Offset((page - 1) * pageSize).Limit(pageSize).All(ctx)
|
||||
return rows, total, err
|
||||
}
|
||||
if limit > 0 {
|
||||
if limit > 200 {
|
||||
limit = 200
|
||||
@@ -981,7 +1002,12 @@ func (s *Service) ListWorkpieces(ctx context.Context, sn, orderNo string, limit
|
||||
} else {
|
||||
q = q.Limit(500)
|
||||
}
|
||||
return q.Order(ent.Desc(workpiece.FieldID)).All(ctx)
|
||||
total, terr := q.Count(ctx)
|
||||
if terr != nil {
|
||||
return nil, 0, terr
|
||||
}
|
||||
rows, err := q.Order(ent.Desc(workpiece.FieldID)).All(ctx)
|
||||
return rows, total, err
|
||||
}
|
||||
|
||||
// InProcessItem 在制品(已进线未完工)视图项。跨天工件继续停留,日排产不重复排。
|
||||
|
||||
Reference in New Issue
Block a user