fix(dashboard): 显示问题修改
-PLC-未采集、机器人-未采集、安全回路-未采集 问题修改 -生成工件,成功后添加弹出提示生成成功
This commit is contained in:
+84
-64
@@ -162,14 +162,7 @@ void DeviceService::finishStatusRequest(bool success,
|
||||
{
|
||||
DeviceStatus finalStatus = status;
|
||||
finalStatus.statusValid = success;
|
||||
// PLC communication establishes readiness; M100 is not a production interlock.
|
||||
finalStatus.plcReady = success && finalStatus.plcConnected;
|
||||
if (success) {
|
||||
finalStatus.safetyDoorClosed = finalStatus.safetyDoorClosed
|
||||
&& finalStatus.safetyDoor1Closed
|
||||
&& finalStatus.safetyDoor2Closed
|
||||
&& finalStatus.safetyDoor3Closed;
|
||||
}
|
||||
finalStatus.plcConnected = success;
|
||||
|
||||
m_statusRequestPending = false;
|
||||
const QList<StatusCallback> callbacks = m_statusCallbacks;
|
||||
@@ -189,7 +182,7 @@ void DeviceService::readStatusStep(int index, const DeviceStatus &status)
|
||||
{
|
||||
const bool useErrorCode =
|
||||
ConfigManager::instance().productionConfig().usePlcErrorCode;
|
||||
if (index >= (useErrorCode ? 15 : 14)) {
|
||||
if (index >= (useErrorCode ? 19 : 18)) {
|
||||
finishStatusRequest(true, status, QString());
|
||||
return;
|
||||
}
|
||||
@@ -211,20 +204,24 @@ void DeviceService::readStatusStep(int index, const DeviceStatus &status)
|
||||
|
||||
DeviceStatus nextStatus = status;
|
||||
switch (index) {
|
||||
case 1: nextStatus.robotReady = value != 0; break;
|
||||
case 1: nextStatus.plcRunning = value != 0; break;
|
||||
case 2: nextStatus.safetyDoorClosed = value != 0; break;
|
||||
case 3: nextStatus.emergencyStop = value != 0; break;
|
||||
case 4: nextStatus.inspectionMachineReady = value != 0; break;
|
||||
case 5: nextStatus.visionReady = value != 0; break;
|
||||
case 6: nextStatus.robotControlCabinetReady = value != 0; break;
|
||||
case 7: nextStatus.mainControlCabinetReady = value != 0; break;
|
||||
case 8: nextStatus.safetyDoor1Closed = value != 0; break;
|
||||
case 9: nextStatus.safetyDoor2Closed = value != 0; break;
|
||||
case 10: nextStatus.safetyDoor3Closed = value != 0; break;
|
||||
case 11: nextStatus.activeAlarm = value != 0; break;
|
||||
case 12: nextStatus.currentStep = value; break;
|
||||
case 13: nextStatus.checkResult = value; break;
|
||||
case 14: nextStatus.errorCode = value; break;
|
||||
case 3: nextStatus.safetyDoor1Closed = value != 0; break;
|
||||
case 4: nextStatus.safetyDoor2Closed = value != 0; break;
|
||||
case 5: nextStatus.safetyDoor3Closed = value != 0; break;
|
||||
case 6: nextStatus.emergencyStop = value != 0; break;
|
||||
case 7: nextStatus.robotIdle = value != 0; break;
|
||||
case 8: nextStatus.robotRunning = value != 0; break;
|
||||
case 9: nextStatus.robotAlarm = value != 0; break;
|
||||
case 10: nextStatus.plcReady = value != 0; break;
|
||||
case 11: nextStatus.inspectionMachineReady = value != 0; break;
|
||||
case 12: nextStatus.visionReady = value != 0; break;
|
||||
case 13: nextStatus.robotControlCabinetReady = value != 0; break;
|
||||
case 14: nextStatus.mainControlCabinetReady = value != 0; break;
|
||||
case 15: nextStatus.activeAlarm = value != 0; break;
|
||||
case 16: nextStatus.currentStep = value; break;
|
||||
case 17: nextStatus.checkResult = value; break;
|
||||
case 18: nextStatus.errorCode = value; break;
|
||||
default: break;
|
||||
}
|
||||
readStatusStep(index + 1, nextStatus);
|
||||
@@ -233,7 +230,7 @@ void DeviceService::readStatusStep(int index, const DeviceStatus &status)
|
||||
const ModbusAddressMap &addresses = m_modbus->config().addressMap;
|
||||
switch (index) {
|
||||
case 1:
|
||||
m_modbus->readCoil(addresses.robotReady,
|
||||
m_modbus->readCoil(addresses.plcRunning,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
@@ -245,71 +242,91 @@ void DeviceService::readStatusStep(int index, const DeviceStatus &status)
|
||||
});
|
||||
break;
|
||||
case 3:
|
||||
m_modbus->readCoil(addresses.emergencyStop,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 4:
|
||||
m_modbus->readCoil(addresses.inspectionMachineReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 5:
|
||||
m_modbus->readCoil(addresses.visionReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 6:
|
||||
m_modbus->readCoil(addresses.robotControlCabinetReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 7:
|
||||
m_modbus->readCoil(addresses.mainControlCabinetReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 8:
|
||||
m_modbus->readCoil(addresses.safetyDoor1Closed,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 9:
|
||||
case 4:
|
||||
m_modbus->readCoil(addresses.safetyDoor2Closed,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 10:
|
||||
case 5:
|
||||
m_modbus->readCoil(addresses.safetyDoor3Closed,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 6:
|
||||
m_modbus->readCoil(addresses.emergencyStop,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 7:
|
||||
m_modbus->readCoil(addresses.robotIdle,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 8:
|
||||
m_modbus->readCoil(addresses.robotRunning,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 9:
|
||||
m_modbus->readCoil(addresses.robotAlarm,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 10:
|
||||
m_modbus->readCoil(addresses.plcReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 11:
|
||||
m_modbus->readCoil(addresses.activeAlarm,
|
||||
m_modbus->readCoil(addresses.inspectionMachineReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 12:
|
||||
m_modbus->readHoldingRegister(addresses.currentStep, next);
|
||||
m_modbus->readCoil(addresses.visionReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 13:
|
||||
m_modbus->readHoldingRegister(addresses.checkResult, next);
|
||||
m_modbus->readCoil(addresses.robotControlCabinetReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 14:
|
||||
if (useErrorCode) {
|
||||
m_modbus->readHoldingRegister(addresses.errorCode, next);
|
||||
} else {
|
||||
finishStatusRequest(true, status, QString());
|
||||
}
|
||||
m_modbus->readCoil(addresses.mainControlCabinetReady,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 15:
|
||||
m_modbus->readCoil(addresses.activeAlarm,
|
||||
[next](bool ok, bool value, const QString &error) {
|
||||
next(ok, value ? 1 : 0, error);
|
||||
});
|
||||
break;
|
||||
case 16:
|
||||
m_modbus->readHoldingRegister(addresses.currentStep, next);
|
||||
break;
|
||||
case 17:
|
||||
m_modbus->readHoldingRegister(addresses.checkResult, next);
|
||||
break;
|
||||
case 18:
|
||||
m_modbus->readHoldingRegister(addresses.errorCode, next);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -334,7 +351,10 @@ DeviceStatus DeviceService::simulatedStatus() const
|
||||
status.statusValid = true;
|
||||
status.plcConnected = true;
|
||||
status.plcReady = true;
|
||||
status.robotReady = true;
|
||||
status.plcRunning = false;
|
||||
status.robotIdle = true;
|
||||
status.robotRunning = false;
|
||||
status.robotAlarm = false;
|
||||
status.safetyDoorClosed = true;
|
||||
status.emergencyStop = false;
|
||||
status.inspectionMachineReady = true;
|
||||
|
||||
Reference in New Issue
Block a user