Add remind user to execute empty scan.
This commit is contained in:
@@ -376,6 +376,11 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
||||
{
|
||||
TRIGGER_EVENT(InvokeOperationEnd, nullptr, var);
|
||||
}
|
||||
|
||||
if(mIsEmptyScan)
|
||||
{
|
||||
TRIGGER_EVENT(EmptyScanFinished, nullptr, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::prepareFinishInitialize()
|
||||
|
||||
@@ -113,6 +113,7 @@ void DialogManager::requestLogin(QWidget* aParent)
|
||||
mFunctionDialog->exec();
|
||||
}
|
||||
releaseTopWidget(mFunctionDialog);
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::LoginSuccess,nullptr,nullptr);
|
||||
}
|
||||
|
||||
void DialogManager::requestScreenSaverPlay()
|
||||
|
||||
@@ -42,7 +42,7 @@ ADD_EVENT_VALUE(ErrorStateActive)\
|
||||
ADD_EVENT_VALUE(ErrorStateUnactive)\
|
||||
ADD_EVENT_VALUE(StartScanProcess)\
|
||||
ADD_EVENT_VALUE(CurrentUserNameChanged)\
|
||||
|
||||
ADD_EVENT_VALUE(EmptyScanFinished)\
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "db/SQLHelper.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "dialogs/DialogManager.h"
|
||||
#include "log/UserOperationLog.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -11,6 +12,8 @@
|
||||
|
||||
SystemCorrectionForm::SystemCorrectionForm(QWidget* aParent)
|
||||
: QWidget(aParent)
|
||||
, mCurrentEmptyScanDate(new QLabel(this))
|
||||
, mExpirationEmptyScanDate(new QLabel(this))
|
||||
{
|
||||
setObjectName("SystemCorrectionForm");
|
||||
init();
|
||||
@@ -53,18 +56,16 @@ void SystemCorrectionForm::init()
|
||||
endline->setFixedHeight(3);
|
||||
vboxLayout->addWidget(endline);
|
||||
|
||||
QLabel* currentEmptyScanDate = new QLabel(this);
|
||||
QDate lastScanDate = SQLHelper::queryValue("SELECT ScanDateTime FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toDate();
|
||||
currentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
vboxLayout->addWidget(currentEmptyScanDate);
|
||||
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
vboxLayout->addWidget(mCurrentEmptyScanDate);
|
||||
|
||||
QLabel* expirationEmptyScanDate = new QLabel(this);
|
||||
QDate expirationScanDate = lastScanDate.addMonths(1);
|
||||
QDate currentDate = QDate::currentDate();
|
||||
QString dateText = tr("%1-%2-%3").arg(expirationScanDate.year()).arg(expirationScanDate.month()).arg(expirationScanDate.day());;
|
||||
QString dateFormat = currentDate.daysTo(expirationScanDate) < 3 ? QString("<font color='red'> %1</font>").arg(dateText) : QString(" %1").arg(dateText);
|
||||
expirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
vboxLayout->addWidget(expirationEmptyScanDate);
|
||||
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
vboxLayout->addWidget(mExpirationEmptyScanDate);
|
||||
|
||||
QWidget* emptyScanButtonArea = new QWidget(this);
|
||||
QHBoxLayout* emptyScanButtonLayout = new QHBoxLayout(emptyScanButtonArea);
|
||||
@@ -87,8 +88,8 @@ void SystemCorrectionForm::init()
|
||||
title->setText(tr("Scan Preparation"));
|
||||
emptyScanTitle->setText(tr("Empty Scan"));
|
||||
emptyScanDescribe->setText(tr("Empty water scanning involves collecting ultrasound data while the tank is filled with water and free of any objects. It is essential to ensure that the tank is fully filled with water and devoid of any objects before conducting the scan. The purpose of collecting empty water data is to obtain baseline information on the time and energy variations of ultrasound propagation inside the inspection tank. This information is utilized for reconstructing reference data for transmission ultrasound imaging. Additionally, empty water data can be utilized for system status assessment and spatial calibration of the system. Therefore, empty water scanning should be performed regularly, with a frequency of once every month."));
|
||||
currentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
expirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
emptyScanButton->setText(tr("Excute empty scan"));
|
||||
});
|
||||
|
||||
@@ -101,6 +102,19 @@ void SystemCorrectionForm::init()
|
||||
}
|
||||
QString null;
|
||||
EventCenter::Default()->triggerEvent(RequestEmptyScan, nullptr, (QObject*)&null);
|
||||
LOG_USER_OPERATION("Start Empty Scan")
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::EmptyScanFinished, this, &SystemCorrectionForm::updateEmptyScanDate);
|
||||
|
||||
}
|
||||
|
||||
void SystemCorrectionForm::updateEmptyScanDate()
|
||||
{
|
||||
QDate lastScanDate = QDate::currentDate();
|
||||
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
|
||||
QDate expirationScanDate = lastScanDate.addMonths(1);
|
||||
QString dateText = tr("%1-%2-%3").arg(expirationScanDate.year()).arg(expirationScanDate.month()).arg(expirationScanDate.day());;
|
||||
QString dateFormat = QString(" %1").arg(dateText);
|
||||
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class SystemCorrectionForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -13,6 +15,13 @@ public:
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
private slots:
|
||||
void updateEmptyScanDate();
|
||||
|
||||
private:
|
||||
QLabel* mCurrentEmptyScanDate;
|
||||
QLabel* mExpirationEmptyScanDate;
|
||||
};
|
||||
|
||||
#endif // SYSTEMCORRECTIONFORM_H
|
||||
|
||||
@@ -185,7 +185,6 @@ void LoginDialog::doLogin()
|
||||
{
|
||||
resetLoginFailedCount();
|
||||
mErrorMessage->setVisible(false);
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::LoginSuccess,nullptr,nullptr);
|
||||
accept();
|
||||
LOG_USER_OPERATION("Login Sucessful");
|
||||
JsonObject::Instance()->setDefaultUser(strUserCode);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "components/UTextEdit.h"
|
||||
#include "components/WarningMessageWidget.h"
|
||||
#include "json/jsonobject.h"
|
||||
#include "db/SQLHelper.h"
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget* aParent)
|
||||
@@ -94,6 +95,9 @@ MainWindow::MainWindow(QWidget* aParent)
|
||||
QApplication::processEvents();
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::LoginSuccess, this,&MainWindow::checkEmptyScanValidity);
|
||||
connect(EventCenter::Default(), &EventCenter::EmptyScanFinished, this,&MainWindow::enableAllTabWidget);
|
||||
|
||||
connect(mTabWidget, &QTabWidget::currentChanged, this, [this](int aIndex)
|
||||
{
|
||||
if(aIndex == 1)
|
||||
@@ -147,6 +151,30 @@ void MainWindow::initializeLayout()
|
||||
mShutdownWidget->setVisible(false);
|
||||
}
|
||||
|
||||
void MainWindow::checkEmptyScanValidity()
|
||||
{
|
||||
QDate lastScanDate = SQLHelper::queryValue("SELECT ScanDateTime FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toDate();
|
||||
QDate expirationScanDate = lastScanDate.addMonths(1);
|
||||
QDate currentDate = QDate::currentDate();
|
||||
|
||||
if(currentDate.daysTo(expirationScanDate) < 0)
|
||||
{
|
||||
mTabWidget->setTabEnabled(0, false);
|
||||
mTabWidget->setTabEnabled(1, false);
|
||||
mTabWidget->setTabEnabled(2, false);
|
||||
mTabWidget->setCurrentIndex(3);
|
||||
|
||||
DialogManager::Default()->requestAlertMessage(tr("Please execute the empty scan, assist with system calibration, when empty scan is completed, the system should operate normally."), OkOnly, tr("Warning"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(currentDate.daysTo(expirationScanDate) < 3)
|
||||
{
|
||||
DialogManager::Default()->requestAlertMessage(tr("There are %1 days left until the next empty scan. Please remind users to conduct the empty scan in time.").arg(currentDate.daysTo(expirationScanDate) + 1), OkOnly, tr("Warning"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::initializeTabWidget()
|
||||
{
|
||||
mTabWidget->setTabPosition(QTabWidget::South);
|
||||
@@ -160,6 +188,8 @@ void MainWindow::initializeTabWidget()
|
||||
|
||||
mAdminTabIndex+=3;
|
||||
mTabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::reloadLanguage() {
|
||||
@@ -333,3 +363,12 @@ void MainWindow::resetRoleLayout() {
|
||||
}
|
||||
qApp->processEvents();
|
||||
}
|
||||
|
||||
void MainWindow::enableAllTabWidget()
|
||||
{
|
||||
for(int i=0; i<mTabWidget->count(); ++i)
|
||||
{
|
||||
mTabWidget->setTabEnabled(i, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ private:
|
||||
void loadStyleSheet(const QString& aSheetName);
|
||||
void showShutdownWidget();
|
||||
void processShutdownDmsFailed();
|
||||
void checkEmptyScanValidity();
|
||||
void enableAllTabWidget();
|
||||
|
||||
private:
|
||||
Ui::MainWindow* mUI;
|
||||
|
||||
Reference in New Issue
Block a user