From 232deb92453db28d6fe3663a50b4309ea8fa16e4 Mon Sep 17 00:00:00 2001 From: Siegfried Siegert Date: Thu, 10 Jul 2025 13:30:19 +0200 Subject: [PATCH] Account: check account number and read again ... if wrong account is provided by DC. --- src/ATBAPP/ATBDeviceControllerPlugin.cpp | 15 ++++++++++++--- src/ATBAPP/ATBDeviceControllerPlugin.h | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.cpp b/src/ATBAPP/ATBDeviceControllerPlugin.cpp index 2f7bce7..2c07586 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.cpp +++ b/src/ATBAPP/ATBDeviceControllerPlugin.cpp @@ -27,6 +27,7 @@ ATBDeviceControllerPlugin::ATBDeviceControllerPlugin(QObject *parent) : isMaster(false) , pluginState(PLUGIN_STATE::NOT_INITIALIZED) , eventReceiver(nullptr) + , latestAccountNumber(0) { this->setParent(parent); @@ -477,13 +478,13 @@ void ATBDeviceControllerPlugin::private_startAccount() qsort( backupedAccNumbers, nrOfVals, sizeof (uint16_t), Utils::compare ); - uint16_t latestAccountNumber = backupedAccNumbers[nrOfVals-1]; + this->latestAccountNumber = backupedAccNumbers[nrOfVals-1]; // DEBUG - qCritical() << " latestAccountNumber = " << latestAccountNumber; + qCritical() << " latestAccountNumber = " << this->latestAccountNumber; - hw->log_selectVaultRecord(latestAccountNumber); + hw->log_selectVaultRecord(this->latestAccountNumber); this->accountCheckCounter = 0; QTimer::singleShot(500, this, SLOT(private_checkAccountData())); @@ -527,6 +528,14 @@ void ATBDeviceControllerPlugin::private_getAccountData() QHash accountData; + if (this->latestAccountNumber != retVR.AccountingNumber) { + // this is the wrong account! -> read again + hw->log_selectVaultRecord(this->latestAccountNumber); + + QTimer::singleShot(500, this, SLOT(private_checkAccountData())); + return; + } + accountData.insert("AccountingNumber", QString::number(retVR.AccountingNumber)); diff --git a/src/ATBAPP/ATBDeviceControllerPlugin.h b/src/ATBAPP/ATBDeviceControllerPlugin.h index 649100a..fd76fe0 100644 --- a/src/ATBAPP/ATBDeviceControllerPlugin.h +++ b/src/ATBAPP/ATBDeviceControllerPlugin.h @@ -130,6 +130,8 @@ private: // counts failed hw->log_chkIfVaultRecordAvailable() int accountCheckCounter; + uint16_t latestAccountNumber; + // counts faild hw->prn-getPrintResult() int printResultCheckCounter;