feat: Improve the prompt message for alarm dialog.

This commit is contained in:
sunwen
2024-09-23 15:12:33 +08:00
parent 3e5415e3d6
commit e8f3e7aaed
5 changed files with 218 additions and 39 deletions

View File

@@ -24,6 +24,7 @@
#include "dialogs/MultyMessageDialog.h"
#include "UsctStateManager.h"
#include "utilities/ScanProcessSequence.h"
#include "utilities/AlarmHelper.h"
#include "log/LogManager.h"
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
@@ -784,7 +785,7 @@ void DeviceManager::processAlarm(const QString& aAlarm)
{
QJsonObject jsonObj = toJsonObject(aAlarm);
int alarmCode = jsonObj["code"].toInt();
QString alarm = tr("Error: ") + QString::number(alarmCode);
QString alarm = tr("Error: ") + QString::number(alarmCode) + AlarmHelper::getAlarmString(alarmCode);
qDebug()<<"processAlarm : "<<alarmCode;
if(alarmCode >= 400 && alarmCode < 500)
{
@@ -879,7 +880,7 @@ bool DeviceManager::startFullScan(const QString& aPatientInfo)
int code = jsonObj["code"].toInt();
if(code != 0)
{
QString msg = tr("Start scan failed. Reason:%1").arg(jsonObj["info"].toString());
QString msg = tr("Start scan failed. Reason:%1").arg(jsonObj["info"].toString()) + AlarmHelper::getAlarmString(code);
LOG_SYS_OPERATION("Start full scan failed. " + msg);
THROW_ERROR(msg);
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
@@ -1382,7 +1383,7 @@ bool DeviceManager::startAutoLocate()
}
emit startAutoLocateResult(false);
TRIGGER_EVENT(StopScanProcess, nullptr, nullptr);
QString errorMessage = tr("Start auto locate failed");
QString errorMessage = tr("Start auto locate failed") + AlarmHelper::getAlarmString(toJsonObject(result.mData)["info"].toInt());
THROW_ERROR(errorMessage)
LOG_SYS_OPERATION("Start auto locate failed.")
return false;

View File

@@ -1406,6 +1406,21 @@ After lying down, click the confirm buttonto start scanning on the next side.</s
<source>Other</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>
Hardware error, please contact maintenance staff.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>
Device busy, please try again later.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>
The emergency button has been pushed. Please reset it before other operations.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ReconFormWidget</name>

View File

@@ -468,57 +468,57 @@
<context>
<name>DeviceManager</name>
<message>
<location filename="../device/DeviceManager.cpp" line="168"/>
<location filename="../device/DeviceManager.cpp" line="836"/>
<location filename="../device/DeviceManager.cpp" line="844"/>
<location filename="../device/DeviceManager.cpp" line="1463"/>
<location filename="../device/DeviceManager.cpp" line="169"/>
<location filename="../device/DeviceManager.cpp" line="837"/>
<location filename="../device/DeviceManager.cpp" line="845"/>
<location filename="../device/DeviceManager.cpp" line="1464"/>
<source>DMS connection error</source>
<translation type="unfinished">DMS失去连接</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="367"/>
<location filename="../device/DeviceManager.cpp" line="376"/>
<location filename="../device/DeviceManager.cpp" line="368"/>
<location filename="../device/DeviceManager.cpp" line="377"/>
<source>progress:%1%</source>
<translation type="unfinished">:%1%</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="381"/>
<location filename="../device/DeviceManager.cpp" line="382"/>
<source>Patient can leave.
progress:%1%</source>
<translation type="unfinished">
:%1%</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="388"/>
<location filename="../device/DeviceManager.cpp" line="389"/>
<source>Data quality assessment in progress
progress:99%</source>
<translation type="unfinished">
进度:99%</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="257"/>
<location filename="../device/DeviceManager.cpp" line="897"/>
<location filename="../device/DeviceManager.cpp" line="905"/>
<location filename="../device/DeviceManager.cpp" line="258"/>
<location filename="../device/DeviceManager.cpp" line="898"/>
<location filename="../device/DeviceManager.cpp" line="906"/>
<source>Initialize Failed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="228"/>
<location filename="../device/DeviceManager.cpp" line="229"/>
<source>Fail to connect to DB!Reboot device to try!</source>
<translation type="unfinished">!</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="323"/>
<location filename="../device/DeviceManager.cpp" line="324"/>
<source>Device is not ready, start scan operation failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="323"/>
<location filename="../device/DeviceManager.cpp" line="324"/>
<source>Device is not ready, start empty scan operation failed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="442"/>
<location filename="../device/DeviceManager.cpp" line="443"/>
<source>Scan completed! Please prepare for the next scan.
After lying down, click the confirm buttonto start scanning on the next side.</source>
<translation type="unfinished">
@@ -526,91 +526,91 @@ After lying down, click the confirm buttonto start scanning on the next side.</s
!</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="443"/>
<location filename="../device/DeviceManager.cpp" line="444"/>
<source>Scan completed!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="787"/>
<location filename="../device/DeviceManager.cpp" line="788"/>
<source>Error: </source>
<translation type="unfinished">: </translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="871"/>
<location filename="../device/DeviceManager.cpp" line="872"/>
<source>Start scan failed. Reason:time out.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="882"/>
<location filename="../device/DeviceManager.cpp" line="883"/>
<source>Start scan failed. Reason:%1</source>
<translation type="unfinished">%1</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="907"/>
<location filename="../device/DeviceManager.cpp" line="908"/>
<source>Start CE Scan Failed.</source>
<translation type="unfinished">CE扫查启动失败</translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="939"/>
<location filename="../device/DeviceManager.cpp" line="940"/>
<source>Data is currently being transmitted, please shut down later.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="946"/>
<location filename="../device/DeviceManager.cpp" line="947"/>
<source>Shut down failed, please push emergency button to shutdown.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1037"/>
<location filename="../device/DeviceManager.cpp" line="1047"/>
<location filename="../device/DeviceManager.cpp" line="1123"/>
<location filename="../device/DeviceManager.cpp" line="1038"/>
<location filename="../device/DeviceManager.cpp" line="1048"/>
<location filename="../device/DeviceManager.cpp" line="1124"/>
<source>Scan data transfer failed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1101"/>
<location filename="../device/DeviceManager.cpp" line="1102"/>
<source>Scan data transfer Succeeded!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1145"/>
<location filename="../device/DeviceManager.cpp" line="1146"/>
<source>Create empty scan data failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1168"/>
<location filename="../device/DeviceManager.cpp" line="1169"/>
<source>Create scan data failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1235"/>
<location filename="../device/DeviceManager.cpp" line="1236"/>
<source>Recon disconnected.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1312"/>
<location filename="../device/DeviceManager.cpp" line="1327"/>
<location filename="../device/DeviceManager.cpp" line="1313"/>
<location filename="../device/DeviceManager.cpp" line="1328"/>
<source>Open pump failed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1344"/>
<location filename="../device/DeviceManager.cpp" line="1345"/>
<source>Recon error, can&apos;t start scan process</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1385"/>
<location filename="../device/DeviceManager.cpp" line="1437"/>
<location filename="../device/DeviceManager.cpp" line="1386"/>
<location filename="../device/DeviceManager.cpp" line="1438"/>
<source>Start auto locate failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1457"/>
<location filename="../device/DeviceManager.cpp" line="1458"/>
<source>The data quality is low, please restart the data scan.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../device/DeviceManager.cpp" line="1485"/>
<location filename="../device/DeviceManager.cpp" line="1486"/>
<source>Device reset failed, please contact maintenance person</source>
<translation type="unfinished"></translation>
</message>
@@ -2164,6 +2164,27 @@ After lying down, click the confirm buttonto start scanning on the next side.</s
<source>Other</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../utilities/AlarmHelper.cpp" line="44"/>
<source>
Hardware error, please contact maintenance staff.</source>
<translation type="unfinished">
</translation>
</message>
<message>
<location filename="../utilities/AlarmHelper.cpp" line="46"/>
<source>
Device busy, please try again later.</source>
<translation type="unfinished">
</translation>
</message>
<message>
<location filename="../utilities/AlarmHelper.cpp" line="49"/>
<source>
The emergency button has been pushed. Please reset it before other operations.</source>
<translation type="unfinished">
</translation>
</message>
</context>
<context>
<name>ReconFormWidget</name>

View File

@@ -0,0 +1,53 @@
#include "AlarmHelper.h"
#include <QObject>
QString AlarmHelper::getAlarmString(const QString aCode)
{
int code = aCode.toInt();
return getAlarmString(code);
}
QString AlarmHelper::getAlarmString(int aCode)
{
switch (aCode)
{
case DMSL_F401:
case DMSL_F402:
case DMSL_F403:
case DMSL_F404:
case DMSL_F405:
case DMSL_F406:
case DMSL_F407:
case DMSL_F408:
case DMSL_F409:
case DMSL_F410:
case DMSL_F411:
case DMSL_F412:
case DMSL_F413:
case DMSL_F414:
case DMSL_F415:
case DMSL_F416:
case DMSL_F417:
case DMSL_F418:
case DMSL_F419:
case DMSL_F420:
case DMSL_F421:
case DMSL_F422:
case DMSL_F423:
case DMSL_F491:
case DMSL_F493:
case DMSL_F496:
case DMSL_F497:
case DMSL_F498:
case DMSL_F499:
return QObject::tr("\nHardware error, please contact maintenance staff.");
case DMSL_F495:
return QObject::tr("\nDevice busy, please try again later.");
case DMSL_F492:
case DMSL_F494:
return QObject::tr("\nThe emergency button has been pushed. Please reset it before other operations.");
default:
return "";
}
}

View File

@@ -0,0 +1,89 @@
#ifndef ALARMHELPER_H
#define ALARMHELPER_H
enum AlarmCode
{
DMSL_F401 = 401, //AMC板卡缺失
DMSL_F402, //DB/FEB串口打开失败
DMSL_F403, //电机串口打开失败
DMSL_F404, //操作AMC板卡失败
DMSL_F405, //创建Ascan文件夹失败
DMSL_F406, //读取配置文件失败
DMSL_F407, //Ascan超时
DMSL_F408, //CE超时
DMSL_F409, //Ascan数据导出错误
DMSL_F410, //CE数据导出错误
DMSL_F411, //Dicom传输失败
DMSL_F412, //电机控制失败
DMSL_F413, //必须的指令不存在
DMSL_F414, //MAC地址不存在
DMSL_F415, //串口配置失败
DMSL_F416, //网络错误
DMSL_F417, //检查配置文件夹失败
DMSL_F418, //硬盘空间不足
DMSL_F419, //传输启动失败
DMSL_F420, //参数解析错误
DMSL_F421, //文件传输失败
DMSL_F422, //参数设置错误
DMSL_F423, //扫查状态还没有准备好
DMSL_F491 = 491, //电控板异常
DMSL_F492 = 492, //左侧急停按下
DMSL_F493 = 493, //数据导出异常
DMSL_F494 = 494, //右侧急停按下
DMSL_F495 = 495, //启动失败,需要停止后重新启动
DMSL_F496 = 496, //导出错误
DMSL_F497, //扫查过程中出现问题
DMSL_F498, //硬盘满了
DMSL_F499, //初始化(自检)失败,扫查不可进行。
DMSL_W501 = 501, //TAS缺失(少于10%
DMSL_W502, //创建日志文件失败
DMSL_W503, //JSON解析错误
DMSL_W504, //线程尚未结束
DMSL_W505, //异常服务ID
DMSL_W506, //数据解析异常
DMSL_W507, //DB/FEB操作失败
DMSL_W508, //串口操作失败
DMSL_W509, //文件(夹)读取失败
DMSL_W510, //Vbus错误
DMSL_W511, //CE 文件缺失
DMSL_W590 = 590, //配置出错
DMSL_W591, //上传数据出错
DMSL_I601 = 601, //启动Ascan
DMSL_I602, //启动CE
DMSL_I603, //启动PreView
DMSL_I604, //停止(执行完成停止)
DMSL_I605, //停止被GUI强制停止
DMSL_I606, //启动Dicom数据传输
DMSL_I607, //停止Dicom数据传输执行完成停止
DMSL_I608, //停止Dicom数据传输被GUI强制停止
DMSL_I609, //DB FEB操作信息
DMSL_D700 = 700, //启动时候的Debug信息
DMSL_D701, //常规的扫查debug信息
DMSL_D702, //常规的传输debug信息
DMSL_D703, //常规的信息debug信息
DMSL_D704, //常规设备操作debug信息
DMSL_D705, //常规的固件升级debug信息
DMSL_D706, //常规的协议操作debug信息
DMSL_D707, //常规网络debug信息
DMSL_D708, //常规vbus debug信息
};
#include <QString>
class AlarmHelper
{
public:
AlarmHelper() = delete;
static QString getAlarmString(const QString aCode);
static QString getAlarmString(int aCode);
};
#endif // ALARMHELPER_H