订单流程修改--QThread事件循环导致的逻辑修改
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <QElapsedTimer>
|
||||
#include <QObject>
|
||||
#include <atomic>
|
||||
|
||||
class QTimer;
|
||||
|
||||
@@ -39,7 +40,8 @@ public:
|
||||
TimeoutPaused,
|
||||
RecoveryChecking,
|
||||
ManualConfirm,
|
||||
Retrying
|
||||
Retrying,
|
||||
Terminating
|
||||
};
|
||||
Q_ENUM(State)
|
||||
|
||||
@@ -58,13 +60,19 @@ public:
|
||||
bool resume(QString *error = nullptr);
|
||||
bool stop(QString *error = nullptr);
|
||||
bool reset(QString *error = nullptr);
|
||||
bool clearAlarm(QString *error = nullptr);
|
||||
bool recover(QString *error = nullptr);
|
||||
bool retry(QString *error = nullptr);
|
||||
bool markCurrentWorkpieceNg(QString *error = nullptr);
|
||||
bool restoreActiveRun(QString *error = nullptr);
|
||||
void shutdown(const DeviceService::OperationCallback &callback);
|
||||
void setExternalStopFlag(std::atomic_bool *flag);
|
||||
void requestStopImmediate();
|
||||
|
||||
signals:
|
||||
void stateChanged(ProductionService::State state, const QString &name);
|
||||
void deviceStatusChanged(const DeviceStatus &status);
|
||||
void deviceCommunicationError(const QString &error);
|
||||
void currentWorkpieceChanged(int workpieceId, const QString &barcode);
|
||||
void currentWorkpieceSnapshotChanged(const Workpiece &workpiece);
|
||||
void currentPositionChanged(int trayNo, int slotNo);
|
||||
@@ -99,6 +107,11 @@ private:
|
||||
void tickProduction();
|
||||
bool processProductionStep(State state, QString *error);
|
||||
bool recoverFromPlcStep(QString *error);
|
||||
bool processProductionAction(DeviceService::ProductionAction action,
|
||||
bool *completed, QString *error);
|
||||
void cancelPendingProductionAction(
|
||||
const DeviceService::OperationCallback &callback);
|
||||
void tryDeferredActionCancel();
|
||||
bool executeCurrentAction(DeviceService::ProductionAction action,
|
||||
const QString &nextProcessStep,
|
||||
State nextState, QString *error);
|
||||
@@ -118,14 +131,18 @@ private:
|
||||
bool isTimedState(State state) const;
|
||||
QString stateNameForState(State state) const;
|
||||
QString processStepForState(State state) const;
|
||||
State stateForProcessStep(const QString &processStep) const;
|
||||
QString runStateForState(State state) const;
|
||||
State stateFromName(const QString &name) const;
|
||||
void persistAlarm(const QString &code, const QString &message);
|
||||
void persistDeviceStatus(const DeviceStatus &status);
|
||||
void fail(const QString &error);
|
||||
void finishShutdown(bool success, const QString &error);
|
||||
bool isActive() const;
|
||||
bool stopRequested() const;
|
||||
|
||||
QTimer *m_timer;
|
||||
DeviceService *m_deviceService;
|
||||
QElapsedTimer m_stateTimer;
|
||||
QElapsedTimer m_processTimer;
|
||||
QElapsedTimer m_heartbeatTimer;
|
||||
@@ -141,10 +158,28 @@ private:
|
||||
int m_currentTrayNo;
|
||||
int m_currentSlotNo;
|
||||
int m_frontRawResult;
|
||||
bool m_actionPending;
|
||||
bool m_actionStarting;
|
||||
bool m_actionPollPending;
|
||||
bool m_actionCompleted;
|
||||
QString m_actionError;
|
||||
bool m_actionCancelRequested;
|
||||
DeviceService::OperationCallback m_deferredCancelCallback;
|
||||
bool m_inspectionStatusPending;
|
||||
bool m_inspectionStatusReady;
|
||||
QString m_inspectionStatusError;
|
||||
bool m_starting;
|
||||
bool m_plcStarted;
|
||||
bool m_tickRunning;
|
||||
DeviceService::ProductionAction m_pendingAction;
|
||||
QString m_inspectionMode;
|
||||
QString m_frontResultState;
|
||||
QString m_currentProcessStep;
|
||||
QString m_lastError;
|
||||
std::atomic_bool m_stopRequested;
|
||||
std::atomic_bool *m_externalStopRequested;
|
||||
bool m_shutdownRequested;
|
||||
DeviceService::OperationCallback m_shutdownCallback;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ProductionService::State)
|
||||
|
||||
Reference in New Issue
Block a user