feat: Remove check empty scan validity date.

This commit is contained in:
sunwen
2025-06-05 15:58:21 +08:00
parent 260606fdf0
commit 323cc58a5e
6 changed files with 87 additions and 130 deletions

View File

@@ -14,9 +14,9 @@
SystemCorrectionForm::SystemCorrectionForm(QWidget* aParent)
: QWidget(aParent)
, mCurrentEmptyScanDate(new QLabel(this))
, mExpirationEmptyScanDate(new QLabel(this))
, mCurrentEmptyScanState(new QLabel(this))
// , mCurrentEmptyScanDate(new QLabel(this))
// , mExpirationEmptyScanDate(new QLabel(this))
// , mCurrentEmptyScanState(new QLabel(this))
, mEmptyScanState()
{
setObjectName("SystemCorrectionForm");
@@ -60,20 +60,20 @@ void SystemCorrectionForm::init()
endline->setFixedHeight(3);
vboxLayout->addWidget(endline);
QDate lastScanDate = SQLHelper::queryValue("SELECT ScanDateTime FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toDate();
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
vboxLayout->addWidget(mCurrentEmptyScanDate);
// QDate lastScanDate = SQLHelper::queryValue("SELECT ScanDateTime FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toDate();
// mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
// vboxLayout->addWidget(mCurrentEmptyScanDate);
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'>&nbsp;&nbsp;&nbsp;%1</font>").arg(dateText) : QString(" %1").arg(dateText);
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
vboxLayout->addWidget(mExpirationEmptyScanDate);
// 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'>&nbsp;&nbsp;&nbsp;%1</font>").arg(dateText) : QString(" %1").arg(dateText);
// mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
// vboxLayout->addWidget(mExpirationEmptyScanDate);
mEmptyScanState = SQLHelper::queryValue("SELECT State FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toInt();
mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
vboxLayout->addWidget(mCurrentEmptyScanState);
// mEmptyScanState = SQLHelper::queryValue("SELECT State FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toInt();
// mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
// vboxLayout->addWidget(mCurrentEmptyScanState);
QWidget* emptyScanButtonArea = new QWidget(this);
QHBoxLayout* emptyScanButtonLayout = new QHBoxLayout(emptyScanButtonArea);
@@ -96,11 +96,11 @@ 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."));
mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
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'>&nbsp;&nbsp;&nbsp;%1</font>").arg(dateText) : QString(" %1").arg(dateText);
mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
// mCurrentEmptyScanDate->setText(tr("Current date for Empty Scanning %1-%2-%3").arg(lastScanDate.year()).arg(lastScanDate.month()).arg(lastScanDate.day()));
// 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'>&nbsp;&nbsp;&nbsp;%1</font>").arg(dateText) : QString(" %1").arg(dateText);
// mExpirationEmptyScanDate->setText(tr("Expiration date for Empty Scanning %1").arg(dateFormat));
// mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
emptyScanButton->setText(tr("Excute empty scan"));
});
@@ -116,41 +116,41 @@ void SystemCorrectionForm::init()
LOG_USER_OPERATION("Start Empty Scan")
});
connect(EventCenter::Default(), &EventCenter::EmptyScanFinished, this, &SystemCorrectionForm::updateEmptyScanDate);
connect(EventCenter::Default(), &EventCenter::EmptyScanDataStateUpdated, this, &SystemCorrectionForm::updateEmptyScanState);
connect(EventCenter::Default(), &EventCenter::EmptyScanDataExpire, this, &SystemCorrectionForm::updateEmptyScanDateExpire);
connect(EventCenter::Default(), &EventCenter::EmptyScanDataBroked, this, &SystemCorrectionForm::updateEmptyScanBroked);
// connect(EventCenter::Default(), &EventCenter::EmptyScanFinished, this, &SystemCorrectionForm::updateEmptyScanDate);
// connect(EventCenter::Default(), &EventCenter::EmptyScanDataStateUpdated, this, &SystemCorrectionForm::updateEmptyScanState);
// connect(EventCenter::Default(), &EventCenter::EmptyScanDataExpire, this, &SystemCorrectionForm::updateEmptyScanDateExpire);
// connect(EventCenter::Default(), &EventCenter::EmptyScanDataBroked, this, &SystemCorrectionForm::updateEmptyScanBroked);
}
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));
mEmptyScanState = 0;
mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
}
//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));
// mEmptyScanState = 0;
// mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
//}
void SystemCorrectionForm::updateEmptyScanState()
{
mEmptyScanState = SQLHelper::queryValue("SELECT State FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toInt();
mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
}
//void SystemCorrectionForm::updateEmptyScanState()
//{
// mEmptyScanState = SQLHelper::queryValue("SELECT State FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toInt();
// mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
//}
void SystemCorrectionForm::updateEmptyScanBroked()
{
mEmptyScanState = -1;
mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
}
//void SystemCorrectionForm::updateEmptyScanBroked()
//{
// mEmptyScanState = -1;
// mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
//}
void SystemCorrectionForm::updateEmptyScanDateExpire()
{
mEmptyScanState = -2;
mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
}
//void SystemCorrectionForm::updateEmptyScanDateExpire()
//{
// mEmptyScanState = -2;
// mCurrentEmptyScanState->setText(tr("Current state for Empty Scanning %1").arg(getStateString(mEmptyScanState)));
//}
QString SystemCorrectionForm::getStateString(int aState)
{

View File

@@ -19,15 +19,15 @@ private:
QString getStateString(int aState);
private slots:
void updateEmptyScanDate();
void updateEmptyScanState();
void updateEmptyScanDateExpire();
void updateEmptyScanBroked();
// void updateEmptyScanDate();
// void updateEmptyScanState();
// void updateEmptyScanDateExpire();
// void updateEmptyScanBroked();
private:
QLabel* mCurrentEmptyScanDate;
QLabel* mExpirationEmptyScanDate;
QLabel* mCurrentEmptyScanState;
// QLabel* mCurrentEmptyScanDate;
// QLabel* mExpirationEmptyScanDate;
// QLabel* mCurrentEmptyScanState;
int mEmptyScanState;
};

View File

@@ -1080,18 +1080,10 @@ After lying down, click the confirm buttonto start scanning on the next side.</s
<source>Shut down failed, please push emergency button to shutdown.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please execute the empty scan, assist with system calibration, when empty scan is completed, the system should operate normally.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>There are %1 days left until the next empty scan. Please remind users to conduct the empty scan in time.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Due to empty scan data corruption on the server, needs to be execute the empty scan. No other operations can be conducted until the scan is complete.</source>
<translation type="unfinished"></translation>
@@ -1980,18 +1972,6 @@ The emergency button has been pushed. Please reset it before other operations.</
<source>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.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Current date for Empty Scanning %1-%2-%3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1-%2-%3</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Expiration date for Empty Scanning %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Excute empty scan</source>
<translation type="unfinished"></translation>
@@ -2024,10 +2004,6 @@ The emergency button has been pushed. Please reset it before other operations.</
<source>Expired</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Current state for Empty Scanning %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Scan completed</source>
<translation type="unfinished"></translation>

View File

@@ -498,7 +498,7 @@
<location filename="../device/DeviceManager.cpp" line="412"/>
<source>Patient can leave.
progress:%1%</source>
<translation type="unfinished">
<translation type="unfinished">
:%1%</translation>
</message>
<message>
@@ -1618,21 +1618,17 @@ After lying down, click the confirm buttonto start scanning on the next side.</s
<translation></translation>
</message>
<message>
<location filename="../windows/MainWindow.cpp" line="174"/>
<source>Please execute the empty scan, assist with system calibration, when empty scan is completed, the system should operate normally.</source>
<translation type="unfinished"></translation>
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../windows/MainWindow.cpp" line="174"/>
<location filename="../windows/MainWindow.cpp" line="183"/>
<location filename="../windows/MainWindow.cpp" line="390"/>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../windows/MainWindow.cpp" line="183"/>
<source>There are %1 days left until the next empty scan. Please remind users to conduct the empty scan in time.</source>
<translation type="unfinished">%1</translation>
<translation type="obsolete">%1</translation>
</message>
<message>
<location filename="../windows/MainWindow.cpp" line="221"/>
@@ -3045,25 +3041,16 @@ parameters
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="64"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="99"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="128"/>
<source>Current date for Empty Scanning %1-%2-%3</source>
<translation type="unfinished"> %1%2%3</translation>
<translation type="obsolete"> %1%2%3</translation>
</message>
<message>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="69"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="100"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="130"/>
<source>%1-%2-%3</source>
<translation type="unfinished">%1%2%3</translation>
<translation type="obsolete">%1%2%3</translation>
</message>
<message>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="71"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="102"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="132"/>
<source>Expiration date for Empty Scanning %1</source>
<translation type="unfinished">%1</translation>
<translation type="obsolete">%1</translation>
</message>
<message>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="81"/>
@@ -3087,14 +3074,8 @@ parameters
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="75"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="103"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="134"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="140"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="146"/>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="152"/>
<source>Current state for Empty Scanning %1</source>
<translation type="unfinished"> %1</translation>
<translation type="obsolete"> %1</translation>
</message>
<message>
<location filename="../forms/settings/SystemCorrectionForm.cpp" line="159"/>

View File

@@ -75,7 +75,7 @@ MainWindow::MainWindow(QWidget* aParent)
QApplication::processEvents();
});
connect(EventCenter::Default(), &EventCenter::LoginSuccess, this,&MainWindow::checkEmptyScanValidity);
//connect(EventCenter::Default(), &EventCenter::LoginSuccess, this,&MainWindow::checkEmptyScanValidity);
connect(EventCenter::Default(), &EventCenter::EmptyScanFinished, this,&MainWindow::enableAllTabWidget);
connect(EventCenter::Default(), &EventCenter::EmptyScanDataCorrupted, this, &MainWindow::handleEmptyScanDataCorrupted);
@@ -162,28 +162,28 @@ 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(lastScanDate.isNull() || currentDate.daysTo(expirationScanDate) < 0)
{
mTabWidget->setCurrentIndex(3);
EventCenter::Default()->triggerEvent(EmptyScanDataExpire, nullptr, nullptr);
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"));
mTabWidget->setTabEnabled(2, false);
mTabWidget->setTabEnabled(1, false);
mTabWidget->setTabEnabled(0, false);
return;
}
//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(lastScanDate.isNull() || currentDate.daysTo(expirationScanDate) < 0)
// {
// mTabWidget->setCurrentIndex(3);
// EventCenter::Default()->triggerEvent(EmptyScanDataExpire, nullptr, nullptr);
// 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"));
// mTabWidget->setTabEnabled(2, false);
// mTabWidget->setTabEnabled(1, false);
// mTabWidget->setTabEnabled(0, false);
// 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;
}
}
// 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()
{

View File

@@ -53,7 +53,7 @@ private:
void loadStyleSheet(const QString& aSheetName);
void showShutdownWidget();
void processShutdownDmsFailed();
void checkEmptyScanValidity();
// void checkEmptyScanValidity();
void enableAllTabWidget();
void handleEmptyScanDataCorrupted();