feat(production): 持久化动作检查点并完善恢复重试流程
- production_runs 新增动作阶段、尝试次数、版本及人工确认字段 - 提供兼容 PostgreSQL 9.5 的幂等升级脚本和数据库结构检查 - 工序推进、动作完成检查点和审计记录使用同一事务 - 机器人命令单次发送,完成反馈先持久化再清握手 - 已完成动作恢复仅补握手或数据库记录,避免重复执行 - 恢复/重试按钮固定显示在清除报警前,加入明确人工处理选项 - 记录人工决定、操作人及现场核对信息,拒绝过期确认 - 区分普通暂停继续、故障恢复与终止后的视觉锁解除 - 补齐视觉目标跨重启校验、异步失败及迟到回调防护 - 检测结果关联动作和尝试次数,重试清除旧结果缓存
This commit is contained in:
@@ -4,6 +4,22 @@
|
||||
#include <QDateTime>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
struct ProductionActionCheckpoint
|
||||
{
|
||||
QString token;
|
||||
QString type;
|
||||
QString phase;
|
||||
QString nextStep;
|
||||
int attempt = 0;
|
||||
int version = 0;
|
||||
QVariant command;
|
||||
QVariant feedback;
|
||||
QString manualDecision;
|
||||
QString manualOperator;
|
||||
QDateTime manualDecidedAt;
|
||||
};
|
||||
|
||||
struct ProductionRunSnapshot
|
||||
{
|
||||
@@ -20,6 +36,7 @@ struct ProductionRunSnapshot
|
||||
QString timeoutState;
|
||||
int recoveryRetryCount = 0;
|
||||
QString lastError;
|
||||
ProductionActionCheckpoint action;
|
||||
};
|
||||
|
||||
struct WorkpieceProcessRecord
|
||||
@@ -50,12 +67,23 @@ public:
|
||||
QString *error = nullptr);
|
||||
bool heartbeatRun(int runId, QString *error = nullptr);
|
||||
bool findActiveRun(ProductionRunSnapshot *run, QString *error = nullptr);
|
||||
bool findRun(int runId, ProductionRunSnapshot *run, QString *error = nullptr);
|
||||
bool checkActionSchema(QString *error = nullptr);
|
||||
bool saveActionCheckpoint(int runId, int orderId, int workpieceId,
|
||||
ProductionActionCheckpoint *action,
|
||||
QString *error = nullptr);
|
||||
bool findInspectionResult(int workpieceId, const QString &side,
|
||||
int *rawResult, QString *resultState,
|
||||
QString *error = nullptr,
|
||||
const QString &actionToken = QString(),
|
||||
int actionAttempt = 0);
|
||||
|
||||
bool insertStateHistory(int runId, int orderId, int workpieceId,
|
||||
const QString &fromState, const QString &toState,
|
||||
const QString &processStep, const QString &source,
|
||||
const QString &reason, const QString &message,
|
||||
QString *error = nullptr);
|
||||
QString *error = nullptr,
|
||||
const QString &operatorName = QString());
|
||||
|
||||
bool startWorkpieceProcess(int orderId, int workpieceId,
|
||||
const QString &processStep,
|
||||
|
||||
Reference in New Issue
Block a user