添加状态点位表
This commit is contained in:
+33
-7
@@ -28,6 +28,9 @@ Widget::Widget(QWidget *parent)
|
||||
, currentOrderLabel(nullptr)
|
||||
, currentWorkpieceLabel(nullptr)
|
||||
, currentStepLabel(nullptr)
|
||||
, plcStatusLabel(nullptr)
|
||||
, robotStatusLabel(nullptr)
|
||||
, safetyStatusLabel(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle("小轴多参数上下料单元管控系统");
|
||||
@@ -41,7 +44,7 @@ Widget::Widget(QWidget *parent)
|
||||
setupTopBar(rootLayout);
|
||||
setupMainArea(rootLayout);
|
||||
|
||||
appendLog("生产日志", "系统", "启动", "页面原型已启动,当前为模拟模式", "成功");
|
||||
appendLog("生产日志", "系统", "启动", "生产控制系统已启动", "成功");
|
||||
}
|
||||
|
||||
Widget::~Widget()
|
||||
@@ -80,18 +83,21 @@ void Widget::setupTopBar(QVBoxLayout *rootLayout)
|
||||
topLayout->addWidget(new QLabel("小轴单元"));
|
||||
|
||||
systemStateLabel = UiHelpers::makeBadge("系统:待机", "#607d8b");
|
||||
currentOrderLabel = UiHelpers::makeBadge("订单:ORD-20260808-001", "#455a64");
|
||||
currentWorkpieceLabel = UiHelpers::makeBadge("工件:WP-0001", "#455a64");
|
||||
currentStepLabel = UiHelpers::makeBadge("工序:待取料", "#00897b");
|
||||
currentOrderLabel = UiHelpers::makeBadge("订单:-", "#455a64");
|
||||
currentWorkpieceLabel = UiHelpers::makeBadge("工件:-", "#455a64");
|
||||
currentStepLabel = UiHelpers::makeBadge("工序:未采集", "#607d8b");
|
||||
|
||||
topLayout->addWidget(systemStateLabel);
|
||||
topLayout->addWidget(currentOrderLabel);
|
||||
topLayout->addWidget(currentWorkpieceLabel);
|
||||
topLayout->addWidget(currentStepLabel);
|
||||
topLayout->addStretch();
|
||||
topLayout->addWidget(UiHelpers::makeBadge("PLC:模拟", "#795548"));
|
||||
topLayout->addWidget(UiHelpers::makeBadge("机器人:模拟", "#795548"));
|
||||
topLayout->addWidget(UiHelpers::makeBadge("安全门:关闭", "#2e7d32"));
|
||||
plcStatusLabel = UiHelpers::makeBadge("PLC:未采集", "#607d8b");
|
||||
robotStatusLabel = UiHelpers::makeBadge("机器人:未采集", "#607d8b");
|
||||
safetyStatusLabel = UiHelpers::makeBadge("安全回路:未采集", "#607d8b");
|
||||
topLayout->addWidget(plcStatusLabel);
|
||||
topLayout->addWidget(robotStatusLabel);
|
||||
topLayout->addWidget(safetyStatusLabel);
|
||||
|
||||
rootLayout->addWidget(topBar);
|
||||
}
|
||||
@@ -131,8 +137,28 @@ void Widget::setupMainArea(QVBoxLayout *rootLayout)
|
||||
connect(dashboardPage, &DashboardPage::currentStepChanged, this, [this](const QString &step) {
|
||||
currentStepLabel->setText("工序:" + step);
|
||||
});
|
||||
connect(dashboardPage, &DashboardPage::currentOrderChanged,
|
||||
this, [this](const QString &orderNo) {
|
||||
currentOrderLabel->setText("订单:" + orderNo);
|
||||
});
|
||||
connect(dashboardPage, &DashboardPage::currentWorkpieceChanged,
|
||||
this, [this](const QString &workpiece) {
|
||||
currentWorkpieceLabel->setText("工件:" + workpiece);
|
||||
});
|
||||
connect(dashboardPage, &DashboardPage::deviceStatusChanged,
|
||||
devicePage, &DevicePage::updateStatus);
|
||||
connect(dashboardPage, &DashboardPage::deviceStatusChanged,
|
||||
this, [this](const DeviceStatus &status) {
|
||||
const QString plc = !status.statusValid ? "未采集"
|
||||
: status.plcConnected ? "在线" : "离线";
|
||||
const QString robot = !status.statusValid ? "未采集"
|
||||
: status.robotReady ? "就绪" : "未就绪";
|
||||
const QString safety = !status.statusValid ? "未采集"
|
||||
: status.safetyDoorClosed && !status.emergencyStop ? "正常" : "异常";
|
||||
plcStatusLabel->setText("PLC:" + plc);
|
||||
robotStatusLabel->setText("机器人:" + robot);
|
||||
safetyStatusLabel->setText("安全回路:" + safety);
|
||||
});
|
||||
connect(dashboardPage, &DashboardPage::deviceCommunicationError,
|
||||
devicePage, &DevicePage::handleCommunicationError);
|
||||
connect(dashboardPage, &DashboardPage::logRequested, this, &Widget::appendLog);
|
||||
|
||||
Reference in New Issue
Block a user