Print: count undefined print result values and retry
This commit is contained in:
parent
b946dc5a92
commit
560b6d3221
@ -654,6 +654,7 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingStri
|
|||||||
hw->prn_switchPower(true);
|
hw->prn_switchPower(true);
|
||||||
hw->prn_setFonts(8,12,0,0);
|
hw->prn_setFonts(8,12,0,0);
|
||||||
hw->prn_sendText(&ba);
|
hw->prn_sendText(&ba);
|
||||||
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
|
||||||
|
|
||||||
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
//QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3); } );
|
||||||
@ -844,6 +845,7 @@ void ATBDeviceControllerPlugin::onPrinterDataPrepared()
|
|||||||
|
|
||||||
// note: calling prn_getPrintResult() immediately may result in wrong answer!
|
// note: calling prn_getPrintResult() immediately may result in wrong answer!
|
||||||
// We have to wait "about some seconds" until calling this function!
|
// We have to wait "about some seconds" until calling this function!
|
||||||
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
||||||
|
|
||||||
// old: use printer templates:
|
// old: use printer templates:
|
||||||
@ -867,8 +869,17 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingTicket()
|
|||||||
this->onPrintFinishedERR();
|
this->onPrintFinishedERR();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qCritical() << "DC Error: wait for printing";
|
// result value is not defined (-> workaround for DC misbehaviour)
|
||||||
this->onPrintFinishedERR();
|
if (this->printResultCheckCounter < 10) {
|
||||||
|
this->printResultCheckCounter++;
|
||||||
|
qCritical() << "DC print result undefined: " << printerResult;
|
||||||
|
QTimer::singleShot(1000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qCritical() << "DC Error: wait for printing";
|
||||||
|
this->onPrintFinishedERR();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -896,6 +907,7 @@ void ATBDeviceControllerPlugin::onPrinterPrintNextTemplate()
|
|||||||
|
|
||||||
if (this->currentTicket->templateList()->isEmpty()) {
|
if (this->currentTicket->templateList()->isEmpty()) {
|
||||||
// all templates are printed
|
// all templates are printed
|
||||||
|
this->printResultCheckCounter = 0;
|
||||||
QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingTicket()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -129,6 +129,9 @@ private:
|
|||||||
// counts failed hw->log_chkIfVaultRecordAvailable()
|
// counts failed hw->log_chkIfVaultRecordAvailable()
|
||||||
int accountCheckCounter;
|
int accountCheckCounter;
|
||||||
|
|
||||||
|
// counts faild hw->prn-getPrintResult()
|
||||||
|
int printResultCheckCounter;
|
||||||
|
|
||||||
// dbus
|
// dbus
|
||||||
int init_sc_dbus();
|
int init_sc_dbus();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user