- production_runs 新增动作阶段、尝试次数、版本及人工确认字段 - 提供兼容 PostgreSQL 9.5 的幂等升级脚本和数据库结构检查 - 工序推进、动作完成检查点和审计记录使用同一事务 - 机器人命令单次发送,完成反馈先持久化再清握手 - 已完成动作恢复仅补握手或数据库记录,避免重复执行 - 恢复/重试按钮固定显示在清除报警前,加入明确人工处理选项 - 记录人工决定、操作人及现场核对信息,拒绝过期确认 - 区分普通暂停继续、故障恢复与终止后的视觉锁解除 - 补齐视觉目标跨重启校验、异步失败及迟到回调防护 - 检测结果关联动作和尝试次数,重试清除旧结果缓存
116 lines
3.7 KiB
C++
116 lines
3.7 KiB
C++
#ifndef DASHBOARDPAGE_H
|
|
#define DASHBOARDPAGE_H
|
|
|
|
#include "../services/productionworker.h"
|
|
|
|
#include <QWidget>
|
|
#include <QVector>
|
|
#include <QPointer>
|
|
|
|
class QTableWidget;
|
|
class QGroupBox;
|
|
class QResizeEvent;
|
|
class QLabel;
|
|
class QPushButton;
|
|
class QTimer;
|
|
class QThread;
|
|
class VisionService;
|
|
class QDialog;
|
|
|
|
namespace Ui { class DashboardPage; }
|
|
|
|
class DashboardPage : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit DashboardPage(QWidget *parent = nullptr);
|
|
~DashboardPage();
|
|
void addLog(const QString &type, const QString &module, const QString &content,
|
|
const QString &status);
|
|
void attachVisionService(VisionService *service);
|
|
|
|
signals:
|
|
void systemStateChanged(const QString &state);
|
|
void currentStepChanged(const QString &step);
|
|
void currentOrderChanged(const QString &orderNo);
|
|
void currentWorkpieceChanged(const QString &workpiece);
|
|
void deviceStatusChanged(const DeviceStatus &status);
|
|
void deviceCommunicationError(const QString &error);
|
|
void visionCycleChanged(const QJsonObject &cycle);
|
|
void visionProductionActiveChanged(bool active, bool maintenanceAllowed);
|
|
void recoveryDecisionSubmitted(const QJsonObject &decision);
|
|
void logRequested(const QString &type, const QString &module, const QString &action,
|
|
const QString &content, const QString &status);
|
|
|
|
private slots:
|
|
void startProduction();
|
|
void pauseProduction();
|
|
void stopProduction();
|
|
void clearAlarm();
|
|
void onProductionStateChanged(ProductionService::State state,
|
|
const QString &name);
|
|
void onCurrentWorkpieceChanged(int workpieceId, const QString &barcode);
|
|
void onCurrentWorkpieceSnapshotChanged(const Workpiece &workpiece);
|
|
void onCurrentPositionChanged(int trayNo, int slotNo);
|
|
void onProductionError(const QString &error);
|
|
void onProductionFinished(int orderId);
|
|
void onDeviceStatusChanged(const DeviceStatus &status);
|
|
void onProcessElapsedChanged(const QString &processStep, int elapsedMs);
|
|
void onTimeoutRecoveryRequired(const QString &state, const QString &message);
|
|
void onRecoveryCompleted(const QString &mode);
|
|
void recoverProduction();
|
|
void onRecoveryDecisionRequired(const QJsonObject &context);
|
|
void onRecoveryBusyChanged(bool busy);
|
|
void markWorkpieceNg();
|
|
|
|
protected:
|
|
void resizeEvent(QResizeEvent *event) override;
|
|
|
|
private:
|
|
void loadCurrentOrder();
|
|
void updateProductionStats();
|
|
void updateRackSummary();
|
|
void updateRackSize();
|
|
void updateRecoveryButtons();
|
|
void refreshProcessRecords();
|
|
void updateCurrentProcessDuration(int elapsedMs);
|
|
static QString formatDuration(int elapsedMs);
|
|
|
|
Ui::DashboardPage *ui;
|
|
QGroupBox *rackBox;
|
|
QVector<QLabel *> rackTrayCells;
|
|
QLabel *deviceStatusLabel;
|
|
QLabel *inspectionMachineCell;
|
|
QLabel *robotCell;
|
|
QLabel *robotControlCabinetCell;
|
|
QLabel *mainControlCabinetCell;
|
|
QLabel *safetyDoor1Cell;
|
|
QLabel *safetyDoor2Cell;
|
|
QLabel *safetyDoor3Cell;
|
|
QLabel *alarmCell;
|
|
QPushButton *markNgButton;
|
|
QPushButton *stopButton;
|
|
QGroupBox *processBox;
|
|
QLabel *currentProcessLabel;
|
|
QLabel *processElapsedLabel;
|
|
QLabel *processTotalElapsedLabel;
|
|
QTableWidget *processTable;
|
|
QTimer *processRefreshTimer;
|
|
int currentProcessElapsedMs;
|
|
QThread *productionThread;
|
|
ProductionWorker *productionWorker;
|
|
ProductionService::State productionState;
|
|
int currentOrderId;
|
|
bool currentOrderStartable;
|
|
bool currentOrderResumable;
|
|
Workpiece productionWorkpiece;
|
|
int productionTrayNo;
|
|
int productionSlotNo;
|
|
bool visionRecoveryRequired = false;
|
|
bool recoveryBusy = false;
|
|
QPointer<QDialog> recoveryDialog;
|
|
};
|
|
|
|
#endif // DASHBOARDPAGE_H
|