fix(Tray): 托盘传感器显示修改

This commit is contained in:
lidg
2026-11-09 18:16:54 +08:00
parent a8b2b31ce7
commit c248954b87
14 changed files with 170 additions and 51 deletions
+15 -4
View File
@@ -1152,6 +1152,7 @@ void DashboardPage::updateCurrentProcessDuration(int elapsedMs)
void DashboardPage::onDeviceStatusChanged(const DeviceStatus &status)
{
deviceStatus = status;
emit deviceStatusChanged(status);
const bool offline = !status.statusValid || !status.plcConnected;
const QString plcText = offline ? "离线"
@@ -1254,14 +1255,24 @@ void DashboardPage::updateRackSummary()
}
const Tray &tray = trays.at(index);
const QString status = tray.present ? tray.status : "离位";
const bool sensorAvailable = deviceStatus.statusValid
&& deviceStatus.plcConnected;
const bool present = !sensorAvailable || deviceStatus.trayPresent[index];
if (!present) {
updateStatusCell(cell,
QString("托盘 %1\n不在位:0/49").arg(index + 1),
"#90a4ae",
highlightedTrayIds.contains(tray.id));
continue;
}
const QString status = tray.status;
const QString statusText = status == "OK" ? "已完成"
: status == "NG" ? "有 NG"
: status == "PROCESSING" ? "加工中"
: status == "PENDING" ? "待检测"
: tray.present ? "在位" : "离位";
const QString color = !tray.present ? "#90a4ae"
: status == "NG" ? "#d32f2f"
: "有托盘";
const QString color = status == "NG" ? "#d32f2f"
: status == "PROCESSING" ? "#1e88e5"
: status == "OK" ? "#2e7d32" : "#78909c";
updateStatusCell(cell,