From e8f3e7aaede76e040b793ea33ee76c41318208dd Mon Sep 17 00:00:00 2001 From: sunwen Date: Mon, 23 Sep 2024 15:12:33 +0800 Subject: [PATCH] feat: Improve the prompt message for alarm dialog. --- src/device/DeviceManager.cpp | 7 +-- src/translations/en_US.ts | 15 ++++++ src/translations/zh_CN.ts | 93 +++++++++++++++++++++-------------- src/utilities/AlarmHelper.cpp | 53 ++++++++++++++++++++ src/utilities/AlarmHelper.h | 89 +++++++++++++++++++++++++++++++++ 5 files changed, 218 insertions(+), 39 deletions(-) create mode 100644 src/utilities/AlarmHelper.cpp create mode 100644 src/utilities/AlarmHelper.h diff --git a/src/device/DeviceManager.cpp b/src/device/DeviceManager.cpp index fb5c7bf..e42f66d 100644 --- a/src/device/DeviceManager.cpp +++ b/src/device/DeviceManager.cpp @@ -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 : "<= 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; diff --git a/src/translations/en_US.ts b/src/translations/en_US.ts index d21a36d..8403397 100644 --- a/src/translations/en_US.ts +++ b/src/translations/en_US.ts @@ -1406,6 +1406,21 @@ After lying down, click the confirm buttonto start scanning on the next side.Other + + +Hardware error, please contact maintenance staff. + + + + +Device busy, please try again later. + + + + +The emergency button has been pushed. Please reset it before other operations. + + ReconFormWidget diff --git a/src/translations/zh_CN.ts b/src/translations/zh_CN.ts index cc13ab3..8539c32 100644 --- a/src/translations/zh_CN.ts +++ b/src/translations/zh_CN.ts @@ -468,57 +468,57 @@ DeviceManager - - - - + + + + DMS connection error DMS失去连接 - - + + progress:%1% 进度:%1% - + Patient can leave. progress:%1% 检查对象可以起身 进度:%1% - + Data quality assessment in progress progress:99% 数据质量判断中 进度:99% - - - + + + Initialize Failed. 初始化失败 - + Fail to connect to DB!Reboot device to try! 数据库连接失败,请重启设备后再试! - + Device is not ready, start scan operation failed! 设备状态错误,无法开始检查流程 - + Device is not ready, start empty scan operation failed! 设备状态错误,无法开始空水扫查 - + Scan completed! Please prepare for the next scan. After lying down, click the confirm buttonto start scanning on the next side. 扫查结束,请准备下一侧扫查。 @@ -526,91 +526,91 @@ After lying down, click the confirm buttonto start scanning on the next side. - + Scan completed! 扫查结束 - + Error: 错误: - + Start scan failed. Reason:time out. 扫查启动失败,原因:超时 - + Start scan failed. Reason:%1 扫查启动失败,原因:%1 - + Start CE Scan Failed. CE扫查启动失败 - + Data is currently being transmitted, please shut down later. 数据传输中,请稍后再执行关机。 - + Shut down failed, please push emergency button to shutdown. 关机失败,请按紧急按钮进行关机。 - - - + + + Scan data transfer failed. 扫查数据上传失败 - + Scan data transfer Succeeded! - + Create empty scan data failed 空水数据新增失败 - + Create scan data failed 扫查数据新增失败 - + Recon disconnected. 重建服务器已断开连接 - - + + Open pump failed. 排水阀打开失败 - + Recon error, can't start scan process 重建服务器错误,无法开始检查流程 - - + + Start auto locate failed 自动化定位启动失败 - + The data quality is low, please restart the data scan. 扫查数据质量较低,请重新开始检查流程 - + Device reset failed, please contact maintenance person 设备复位失败,请联系维修人员 @@ -2164,6 +2164,27 @@ After lying down, click the confirm buttonto start scanning on the next side.Other 其他 + + + +Hardware error, please contact maintenance staff. + +设备硬件错误,请联系设备维护人员 + + + + +Device busy, please try again later. + +设备繁忙,请稍后重试 + + + + +The emergency button has been pushed. Please reset it before other operations. + +急停按钮被按下,请复位后再进行其他操作 + ReconFormWidget diff --git a/src/utilities/AlarmHelper.cpp b/src/utilities/AlarmHelper.cpp new file mode 100644 index 0000000..750f973 --- /dev/null +++ b/src/utilities/AlarmHelper.cpp @@ -0,0 +1,53 @@ +#include "AlarmHelper.h" + +#include + +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 ""; + } +} diff --git a/src/utilities/AlarmHelper.h b/src/utilities/AlarmHelper.h new file mode 100644 index 0000000..b59996a --- /dev/null +++ b/src/utilities/AlarmHelper.h @@ -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 + +class AlarmHelper +{ +public: + AlarmHelper() = delete; + + static QString getAlarmString(const QString aCode); + static QString getAlarmString(int aCode); +}; + +#endif // ALARMHELPER_H