feat: 多系统新增扫码中间件与 AGV 对接,优化拧紧与退库流程

新增扫码中间件支持网络型扫码枪键盘注入,AGV 对接从 WMS 迁至 MES 统一管理;新增拧紧不合格人工处置与 PLC 对账机制,优化退库单关联与工位终端功能,同时清理旧 AGV 任务表,完善数据库与配置项。
This commit is contained in:
SunYF
2026-10-14 17:24:59 +08:00
parent 8e6048c64b
commit f65a52d9e1
170 changed files with 15415 additions and 10572 deletions
+16 -1
View File
@@ -121,6 +121,8 @@ func (s *Service) SaveDailyPlan(ctx context.Context, req DailyPlanReq, operator
}
}
s.ctx.EventLog.Write(ctx, "daily.plan.save", req.OrderNo, operator, "daily_plan", req.OrderNo, "保存日排产", map[string]any{"planDate": req.PlanDate, "planQty": req.PlanQty})
// 叫料池重算(B5:排产是池子唯一来源,任何变更立即对齐)
_, _ = s.RecomputePoolAll(ctx)
s.notifyDashboard()
return nil
}
@@ -202,6 +204,8 @@ func (s *Service) saveDailyPlanBatch(ctx context.Context, req DailyPlanReq, oper
}
s.ctx.EventLog.Write(ctx, "daily.plan.batch", req.OrderNo, operator, "daily_plan", req.OrderNo,
"日排产批量生成", map[string]any{"days": days, "total": sum, "mode": req.Mode, "quota": quota})
// 叫料池重算(B5)
_, _ = s.RecomputePoolAll(ctx)
s.notifyDashboard()
return nil
}
@@ -276,6 +280,8 @@ func (s *Service) syncPlansByOrderStatus(ctx context.Context, orderNo, woStatus,
if changed > 0 {
s.ctx.EventLog.Write(ctx, "daily.plan.status_sync", orderNo, operator, "daily_plan", orderNo,
"工单状态联动排产", map[string]any{"woStatus": woStatus, "changed": changed})
// 叫料池重算(B5:排产状态被联动改掉,池子跟随对齐)
_, _ = s.RecomputePoolAll(ctx)
}
}
@@ -404,7 +410,12 @@ func (s *Service) ListUnplannedWorkOrders(ctx context.Context) ([]*UnplannedWork
// DeleteDailyPlan 删除一条日排产记录
func (s *Service) DeleteDailyPlan(ctx context.Context, id int) error {
return s.ctx.EntClient.DailyPlan.DeleteOneID(id).Exec(ctx)
if err := s.ctx.EntClient.DailyPlan.DeleteOneID(id).Exec(ctx); err != nil {
return err
}
// 叫料池重算(B5)
_, _ = s.RecomputePoolAll(ctx)
return nil
}
// SetDailyPlanStatus 日排产启用/停用(人工专用入口,POST /daily-plans/:id/status):
@@ -442,6 +453,8 @@ func (s *Service) SetDailyPlanStatus(ctx context.Context, id int, target, operat
}
s.ctx.EventLog.Write(ctx, "daily.plan.status", p.OrderNo, operator, "daily_plan", p.OrderNo,
"排产启用/停用", map[string]any{"id": id, "from": p.Status, "to": target})
// 叫料池重算(B5:启用=池子开关,领导置非启用即不可叫)
_, _ = s.RecomputePoolAll(ctx)
s.notifyDashboard()
return nil
}
@@ -715,6 +728,8 @@ func (s *Service) AutoScheduleApply(ctx context.Context, req AutoScheduleApplyRe
}
s.ctx.EventLog.Write(ctx, "daily.plan.apply", req.OrderNo, operator, "daily_plan", req.OrderNo,
"确认排产(预览逐日调节)", map[string]any{"days": len(req.Items), "total": sum, "quota": quota})
// 叫料池重算(B5)
_, _ = s.RecomputePoolAll(ctx)
s.notifyDashboard()
return nil
}