feat(production): 修改订单流程卡死流程问题

This commit is contained in:
lidg
2026-11-06 15:49:33 +08:00
parent 753f9c3ed2
commit 81313e61b0
24 changed files with 949 additions and 261 deletions
+21
View File
@@ -34,6 +34,7 @@ public:
BackLoading,
BackChecking,
BackUnloading,
ReverseFlipping,
RackPlacing,
Judging,
Unloading,
@@ -49,6 +50,18 @@ public:
};
Q_ENUM(State)
struct Snapshot {
bool initialized = false;
int runId = 0;
int orderId = 0;
State state = Idle;
QString stateName;
bool terminationRequired = false;
bool visionRecoveryRequired = false;
QString error;
};
Snapshot snapshot() const;
static ProductionService &instance();
State state() const;
@@ -64,6 +77,7 @@ public:
bool resume(QString *error = nullptr);
bool stop(QString *error = nullptr, bool finishOrder = false);
bool stopOrder(int orderId, QString *error = nullptr);
bool stopConfirmedOrder(int runId, int orderId, QString *error = nullptr);
bool clearAlarm(QString *error = nullptr);
bool recover(QString *error = nullptr);
bool submitRecoveryDecision(const QJsonObject &decision, QString *error = nullptr);
@@ -79,6 +93,7 @@ public slots:
void publishVisionSnapshot();
signals:
void snapshotChanged(const ProductionService::Snapshot &snapshot);
void stateChanged(ProductionService::State state, const QString &name);
void deviceStatusChanged(const DeviceStatus &status);
void deviceCommunicationError(const QString &error);
@@ -130,6 +145,8 @@ private:
ProductionService &operator=(const ProductionService &) = delete;
bool setState(State state);
void publishState();
bool restoreRun(QString *error);
QString actionTypeForState(State state) const;
QString nextStepForState(State state) const;
bool ensureActionCheckpoint(State state, QString *error);
@@ -152,6 +169,7 @@ private:
bool finishCurrentWorkpiece(const QString &state, const QString &processStep,
QString *error);
bool finishOrder(QString *error);
bool finalizeRun(bool completed, bool finishOrder, QString *error);
void tickSimulation();
void tickProduction();
bool processProductionStep(State state, QString *error);
@@ -203,6 +221,8 @@ private:
QElapsedTimer m_processTimer;
QElapsedTimer m_heartbeatTimer;
State m_state;
bool m_initialized = false;
bool m_terminationRequired = false;
State m_timeoutState;
int m_runId;
int m_orderId;
@@ -271,6 +291,7 @@ private:
};
Q_DECLARE_METATYPE(ProductionService::State)
Q_DECLARE_METATYPE(ProductionService::Snapshot)
Q_DECLARE_METATYPE(Workpiece)
#endif // PRODUCTIONSERVICE_H