feat: Remove data transfer in gui.
This commit is contained in:
@@ -126,8 +126,6 @@ void DeviceManager::initDevice()
|
||||
mFullScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_FULLSCAN, this, "responseFullScan(const QString&)", this);
|
||||
mStopScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_STOP, this, "responseStopScan(const QString&)", this);
|
||||
mPreviewScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_PREVIEW, this, "responsePreviewScan(const QString&)", this);
|
||||
mTransferAction = new DmsSyncAction(USRV_XFR, ACT_XFR_START, this, "responseTransfer(const QString&)", this);
|
||||
mGetTransferProgressAction = new DmsSyncAction(USRV_XFR, ACT_XFR_PROGRESS_PASSIVE, this, "responseGetTransferProgress(const QString&)", this);
|
||||
mCEScanAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_CE, this, "responseCEScan(const QString&)", this);
|
||||
mGetCEStatusAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_CE_STATUS, this, "responseGetCEStatus(const QString&)", this);
|
||||
mSetSimulatorModeAction = new DmsSyncAction(USRV_SCAN, ACT_SCAN_SIMULATOR, this, "responseSetSimulatorMode(const QString&)", this);
|
||||
@@ -140,7 +138,6 @@ void DeviceManager::initDevice()
|
||||
//Async action
|
||||
mGetScanProgressAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_PROGRESS_PASSIVE, this,"responseGetScanProgress(const QString&)", this);
|
||||
mGetDeviceTemperatureAction = new DmsAsyncAction(USRV_SCAN, ACT_SCAN_TEMP, this, "responseGetDeviceTemperature(const QString&)", this);
|
||||
mStopTransferAction = new DmsAsyncAction(USRV_XFR, ACT_XFR_STOP, this, "responseStopTransfer(const QString&)", this);
|
||||
mShutDownAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_PWRDOWN, this, "responseShutDown(const QString&)", this);
|
||||
mShutDownAction->setTimeoutInterval(SHUT_DOWN_TIMEOUT);
|
||||
mPumpControlAction = new DmsAsyncAction(USRV_CONTROL, ACT_CTL_PUMP, this, "responsePumpControl(const QString&)", this);
|
||||
@@ -434,7 +431,10 @@ void DeviceManager::prepareFinishScan(bool isNormalFinish, const QString& aReaso
|
||||
insertScanRecord();
|
||||
}
|
||||
|
||||
startTransfer();
|
||||
if(ReconManager::getInstance()->isConnected())
|
||||
{
|
||||
startCreateReconRecord();
|
||||
}
|
||||
|
||||
if(isCompleteNotify)
|
||||
{
|
||||
@@ -467,11 +467,6 @@ void DeviceManager::prepareFinishInitialize()
|
||||
|
||||
void DeviceManager::stopFullScan()
|
||||
{
|
||||
// DeviceStatus inf = getDeviceStatus();
|
||||
// if (inf != DeviceStatus::Scanning)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
DmsSyncActionResult result = mStopScanAction->execute();
|
||||
if(!result.mIsSucessful)
|
||||
{
|
||||
@@ -633,8 +628,6 @@ void DeviceManager::timerEvent(QTimerEvent* event)
|
||||
getDeviceTemperature();
|
||||
return QObject::timerEvent(event);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void DeviceManager::emitErrorCallback(const QString& msg)
|
||||
@@ -702,6 +695,7 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
break;
|
||||
case ACT_SCAN_IMGQUALITI:
|
||||
emit responseCheckDataQuality(aContents);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -716,23 +710,6 @@ void DeviceManager::processReceiveDMSInfoResult(int aServerID, int aActionID, co
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_XFR :
|
||||
switch(aActionID)
|
||||
{
|
||||
case ACT_XFR_START :
|
||||
emit responseTransfer(aContents);
|
||||
break;
|
||||
case ACT_XFR_STOP :
|
||||
emit responseStopTransfer(aContents);
|
||||
break;
|
||||
case ACT_XFR_PROGRESS_PASSIVE :
|
||||
emit responseGetTransferProgress(aContents);
|
||||
break;
|
||||
case ACT_XFR_PROGRESS_ACTIVE :
|
||||
processTransferProgress(aContents);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_INFOCFG:
|
||||
switch(aActionID)
|
||||
{
|
||||
@@ -933,13 +910,6 @@ void DeviceManager::getScanProcess()
|
||||
|
||||
void DeviceManager::shutdownDms()
|
||||
{
|
||||
if(mIsTransfering)
|
||||
{
|
||||
QString msg = tr("Data is currently being transmitted, please shut down later.");
|
||||
THROW_ERROR(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!mShutDownAction->execute())
|
||||
{
|
||||
QString msg = tr("Shut down failed, please push emergency button to shutdown.");
|
||||
@@ -1015,126 +985,6 @@ void DeviceManager::insertScanRecord()
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::startTransfer()
|
||||
{
|
||||
if(mIsTransfering)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QString sql = "SELECT ScanID FROM %1 WHERE State<200 ORDER BY ScanDateTime ASC LIMIT 1";
|
||||
QString table = "EScan";
|
||||
QVariant sqlResult = SQLHelper::queryValue(sql.arg(table));
|
||||
mIsTransferEmptyScan = true;
|
||||
if(sqlResult.isNull())
|
||||
{
|
||||
mIsTransferEmptyScan = false;
|
||||
table = "Scan";
|
||||
sqlResult = SQLHelper::queryValue(sql.arg(table));
|
||||
if(sqlResult.isNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
QString scanID = sqlResult.toString();
|
||||
auto host = JsonObject::Instance()->getServer(JsonObject::RECON);
|
||||
mTransferAction->setSendData("{\"MD5\":1, \"dst\":\"" + host.ae + "@" + host.ip +":" + mReconTransferPath + "\", \"src\":\"" + scanID + "\",\"delete\":1,\"active report\":0}");
|
||||
DmsSyncActionResult result = mTransferAction->execute();
|
||||
if(!result.mIsSucessful)
|
||||
{
|
||||
QString msg = tr("Scan data transfer failed.");
|
||||
emitInfoCallback(msg, MessageLevel::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||
int code = jsonObj["code"].toInt();
|
||||
if(code != 0)
|
||||
{
|
||||
mStopTransferAction->execute();
|
||||
QString msg = tr("Scan data transfer failed.");
|
||||
emitInfoCallback(msg, MessageLevel::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
mIsTransfering = true;
|
||||
mCurrentTransferMeasurementID = scanID;
|
||||
|
||||
mCurrentTransferPatientID = mIsTransferEmptyScan ? "" : SQLHelper::queryValue(QString("SELECT PatientID FROM %1 WHERE ScanID = '%2'").arg(table).arg(scanID)).toString();
|
||||
|
||||
sql = QString("UPDATE %1 set State = 100 where ScanID = '%2'")
|
||||
.arg(mIsTransferEmptyScan ? "EScan" : "Scan")
|
||||
.arg(mCurrentTransferMeasurementID);
|
||||
if(!SQLHelper::exec(sql))
|
||||
{
|
||||
QString msg = "DB Error. Code:G501";
|
||||
emitInfoCallback(msg, MessageLevel::Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateTransferState();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::processTransferProgress(const QString& aProgress)
|
||||
{
|
||||
if(!mIsTransfering)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QJsonObject jsonObj = toJsonObject(aProgress);
|
||||
int code = jsonObj["code"].toInt();
|
||||
QString msg = jsonObj["info"].toString();
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
QString sql = QString("UPDATE %1 set State = 200 where ScanID = '%2'")
|
||||
.arg(mIsTransferEmptyScan ? "EScan" : "Scan")
|
||||
.arg(mCurrentTransferMeasurementID);
|
||||
mIsTransfering = false;
|
||||
mTransferProgress = 0;
|
||||
mCurrentTransferMeasurementID.clear();
|
||||
if(!SQLHelper::exec(sql))
|
||||
{
|
||||
QString msg = "DB Error. Code:G502";
|
||||
emitInfoCallback(msg, MessageLevel::Error);
|
||||
break;
|
||||
}
|
||||
emitInfoCallback(tr("Scan data transfer Succeeded!"), MessageLevel::Sucess);
|
||||
updateTransferState();
|
||||
if(ReconManager::getInstance()->isConnected())
|
||||
{
|
||||
startCreateReconRecord();
|
||||
}
|
||||
startTransfer();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QString sql = QString("UPDATE %1 set State = 104 where ScanID = '%2'")
|
||||
.arg(mIsTransferEmptyScan ? "EScan" : "Scan")
|
||||
.arg(mCurrentTransferMeasurementID);
|
||||
mIsTransfering = false;
|
||||
mTransferProgress = 0;
|
||||
mCurrentTransferMeasurementID.clear();
|
||||
if(!SQLHelper::exec(sql))
|
||||
{
|
||||
QString msg = "DB Error. Code:G503";
|
||||
emitInfoCallback(msg, MessageLevel::Error);
|
||||
break;
|
||||
}
|
||||
QString message = tr("Scan data transfer failed.");
|
||||
emitInfoCallback(message, MessageLevel::Error);
|
||||
updateTransferState();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceManager::processReconCreateEmptyScan(bool aResult, const QString& aScanID, const QString& aMessage, bool aIsConnectSucceed)
|
||||
{
|
||||
if(aResult)
|
||||
@@ -1205,7 +1055,7 @@ void DeviceManager::processReconQueryScanState(bool aResult, const QVariant& aSt
|
||||
|
||||
void DeviceManager::startCreateReconRecord()
|
||||
{
|
||||
QString sql = "SELECT ScanID FROM EScan WHERE State < 300 And State >= 200 ORDER BY ScanDateTime ASC";
|
||||
QString sql = "SELECT ScanID FROM EScan WHERE State < 300 ORDER BY ScanDateTime ASC";
|
||||
auto result = SQLHelper::queryValues(sql);
|
||||
for (const QVariant &variant : result)
|
||||
{
|
||||
@@ -1213,7 +1063,7 @@ void DeviceManager::startCreateReconRecord()
|
||||
emit createEmptyScanToRecon(scanid, mReconTransferPath + "/" + scanid);
|
||||
}
|
||||
|
||||
sql = "SELECT ScanID, ReferenceID, PatientID, AccessionNumber, StudyUID, MPPSUID FROM Scan WHERE State < 300 And State >= 200 ORDER BY ScanDateTime ASC";
|
||||
sql = "SELECT ScanID, ReferenceID, PatientID, AccessionNumber, StudyUID, MPPSUID FROM Scan WHERE State < 300 ORDER BY ScanDateTime ASC";
|
||||
result = SQLHelper::queryValues(sql);
|
||||
for (const QVariant &variant : result)
|
||||
{
|
||||
@@ -1227,7 +1077,6 @@ void DeviceManager::startCreateReconRecord()
|
||||
|
||||
emit createScanToRecon(scanID, mppsUID, referenceID, mReconTransferPath + "/" + scanID);
|
||||
}
|
||||
startTransfer();
|
||||
}
|
||||
|
||||
void DeviceManager::initEmptyScanMeasurementID()
|
||||
@@ -1259,41 +1108,6 @@ void DeviceManager::updateReconState()
|
||||
emit queryScanStatusToRecon(scanIDs);
|
||||
}
|
||||
|
||||
bool DeviceManager::updateTransferProgress()
|
||||
{
|
||||
if(!mIsTransfering)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
mTransferProgress = 0;
|
||||
auto result = mGetTransferProgressAction->execute();
|
||||
QJsonObject jsonObj = toJsonObject(result.mData);
|
||||
if(jsonObj["code"].toInt() == 1 )
|
||||
{
|
||||
mTransferProgress = jsonObj["info"].toString().toInt();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeviceManager::updateTransferState()
|
||||
{
|
||||
if(mIsTransferEmptyScan)
|
||||
{
|
||||
EventCenter::Default()->triggerEvent(EmptyScanDataStateUpdated, nullptr, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
emit transferStatusUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
int DeviceManager::getTransferProgress()
|
||||
{
|
||||
return mTransferProgress;
|
||||
}
|
||||
|
||||
bool DeviceManager::getCEStatus()
|
||||
{
|
||||
auto result = mGetCEStatusAction->execute();
|
||||
|
||||
@@ -67,8 +67,6 @@ public:
|
||||
void emitErrorCallback(const QString& msg);
|
||||
void emitInfoCallback(const QString& aMessage,const unsigned int aInfoType);
|
||||
bool hasValidEmptyScan();
|
||||
bool updateTransferProgress();
|
||||
int getTransferProgress();
|
||||
void prepareEmergencyReset();
|
||||
|
||||
public slots:
|
||||
@@ -105,7 +103,6 @@ private:
|
||||
void getAutoLocatePosition();
|
||||
bool getCEStatus();
|
||||
bool startCEScan();
|
||||
void startTransfer();
|
||||
void initEmptyScanMeasurementID();
|
||||
void controlDrainage(const QString& aCode);
|
||||
void checkInitStatus();
|
||||
@@ -122,7 +119,6 @@ private:
|
||||
void processAlarm(const QString& aAlarm);
|
||||
void processPreviewData(const QString& aPreviewData);
|
||||
void processDeviceTemperature(const QString& aResponseTemperature);
|
||||
void processTransferProgress(const QString& aProgress);
|
||||
void processShutDownDms(const QString& aResponse);
|
||||
void processPumpResult(const QString& aResponse);
|
||||
void processGetSoftwareVersion(const QString& aResponse);
|
||||
@@ -130,8 +126,6 @@ private:
|
||||
|
||||
void insertEmptyScanRecord();
|
||||
void insertScanRecord();
|
||||
void updateTransferState();
|
||||
|
||||
|
||||
private slots:
|
||||
//DMS
|
||||
@@ -157,13 +151,10 @@ signals:
|
||||
void responseStopScan(const QString& aResponse);
|
||||
void responsePreviewScan(const QString& aResponse);
|
||||
void responseGetSoftwareVersion(const QString& aSoftwareVersion);
|
||||
void responseTransfer(const QString& aResponse);
|
||||
void responseGetTransferProgress(const QString& aProgress);
|
||||
void responseGetCEStatus(const QString& aProgress);
|
||||
void responsePumpControl(const QString& aResponse);
|
||||
void responseSetSimulatorMode(const QString& aResponse);
|
||||
void responseSetHeartBeat(const QString& aResponese);
|
||||
void responseStopTransfer(const QString& aResponse);
|
||||
void responseShutDown(const QString& aResponse);
|
||||
void responseCheckInitStatus(const QString& aResponse);
|
||||
void responseStartAutoLocate(const QString& aResponse);
|
||||
@@ -180,7 +171,6 @@ signals:
|
||||
//GUI
|
||||
void initializeFinished();
|
||||
void initializeProgress(const QString& aProgress);
|
||||
void transferStatusUpdated();
|
||||
void startPreviewScanResult(bool aIsSucessful);
|
||||
void startPumpControlResult(bool aIsSucessful);
|
||||
void startAutoLocateResult(bool aIsSucessful);
|
||||
@@ -197,12 +187,9 @@ private:
|
||||
int mScanProgressTimer = -1;
|
||||
int mCheckInitStatusTimer = -1;
|
||||
int mGetAutoLocatePositionTimer = -1;
|
||||
int mTransferProgress = 0;
|
||||
int mEffectivePositionCount = 0;
|
||||
bool mIsEmptyScan = false;
|
||||
bool mIsTransferEmptyScan = false;
|
||||
bool mIsScanning = false;
|
||||
bool mIsTransfering = false;
|
||||
bool mIsPreviewing = false;
|
||||
bool mIsInitializing = false;
|
||||
bool mIsAutoLocating = false;
|
||||
@@ -214,8 +201,6 @@ private:
|
||||
QString mCurrentAccessionNumber = "";
|
||||
QString mCurrentLaterality = "";
|
||||
QString mCurrentOperatorName = "";
|
||||
QString mCurrentTransferMeasurementID = "";
|
||||
QString mCurrentTransferPatientID = "";
|
||||
QString mSoftwareVersion = "";
|
||||
QString mReconTransferPath = "";
|
||||
|
||||
@@ -226,8 +211,6 @@ private:
|
||||
DmsSyncAction* mPreviewScanAction = nullptr;
|
||||
DmsSyncAction* mCEScanAction = nullptr;
|
||||
DmsSyncAction* mStopScanAction = nullptr;
|
||||
DmsSyncAction* mTransferAction = nullptr;
|
||||
DmsSyncAction* mGetTransferProgressAction = nullptr;
|
||||
DmsSyncAction* mGetCEStatusAction = nullptr;
|
||||
DmsSyncAction* mSetSimulatorModeAction = nullptr;
|
||||
DmsSyncAction* mSetHeartBeatAction = nullptr;
|
||||
@@ -238,7 +221,6 @@ private:
|
||||
|
||||
DmsAsyncAction* mGetDeviceTemperatureAction = nullptr;
|
||||
DmsAsyncAction* mGetScanProgressAction = nullptr;
|
||||
DmsAsyncAction* mStopTransferAction = nullptr;
|
||||
DmsAsyncAction* mShutDownAction = nullptr;
|
||||
DmsAsyncAction* mPumpControlAction = nullptr;
|
||||
DmsAsyncAction* mGetAutoLocatePositionAction = nullptr;
|
||||
|
||||
@@ -72,24 +72,11 @@ void InfoReceiveWorker::responsed(int aServerID, int aActionID)
|
||||
break;
|
||||
case ACT_SCAN_IMGQUALITI:
|
||||
DeviceManager::Default()->mCheckDataQualityAction->responsed();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_XFR :
|
||||
switch(aActionID)
|
||||
{
|
||||
case ACT_XFR_START :
|
||||
DeviceManager::Default()->mTransferAction->responsed();
|
||||
break;
|
||||
case ACT_XFR_STOP :
|
||||
DeviceManager::Default()->mStopTransferAction->responsed();
|
||||
break;
|
||||
case ACT_XFR_PROGRESS_PASSIVE :
|
||||
DeviceManager::Default()->mGetTransferProgressAction->responsed();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case USRV_INFOCFG:
|
||||
switch(aActionID)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user