Compare commits

..

5 Commits
2.3.0 ... 2.4.0

4 changed files with 77 additions and 8 deletions

View File

@@ -726,7 +726,8 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
<< " licenseplate = " << printingData["licenseplate"] << endl << " licenseplate = " << printingData["licenseplate"] << endl
<< " amount = " << printingData["amount"] << endl << " amount = " << printingData["amount"] << endl
<< " parkingEnd = " << printingData["parkingEnd"] << endl << " parkingEnd = " << printingData["parkingEnd"] << endl
<< " currentDateTime = " << printingData["currentDateTime"] << endl; << " currentDateTime = " << printingData["currentDateTime"] << endl
<< " ticketNumber = " << printingData["ticketNumber"] << endl;
QDateTime parkingEndDateTime = QDateTime::fromString(printingData["parkingEnd"].toString(), Qt::ISODate); QDateTime parkingEndDateTime = QDateTime::fromString(printingData["parkingEnd"].toString(), Qt::ISODate);
QDateTime currentDateTime = QDateTime::fromString(printingData["currentDateTime"].toString(), Qt::ISODate); QDateTime currentDateTime = QDateTime::fromString(printingData["currentDateTime"].toString(), Qt::ISODate);
@@ -758,6 +759,10 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
QByteArray ba_currentDate = codec->fromUnicode(currentDateString); QByteArray ba_currentDate = codec->fromUnicode(currentDateString);
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8)); memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
// Ticket-Number
QByteArray ba_ticketNumber = codec->fromUnicode(printingData["ticketNumber"].toString());
memcpy((char*)dynTicketData->dynDat7, ba_ticketNumber.data(), std::min(ba_ticketNumber.size(),8));
// DEBUG // DEBUG
/* /*
@@ -791,7 +796,8 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
<< " amount = " << printingData["amount"] << endl << " amount = " << printingData["amount"] << endl
<< " parkingEnd = " << printingData["parkingEnd"] << endl << " parkingEnd = " << printingData["parkingEnd"] << endl
<< " currentTime = " << printingData["currentTime"] << endl << " currentTime = " << printingData["currentTime"] << endl
<< " currentDate = " << printingData["currentDate"] << endl; << " currentDate = " << printingData["currentDate"] << endl
<< " ticketNumber = " << printingData["ticketNumber"] << endl;
this->onPrintFinishedERR(); this->onPrintFinishedERR();
@@ -812,19 +818,39 @@ void ATBDeviceControllerPlugin::requestPrintTicket(const QHash<QString, QVariant
QString paymentType = printingData["paymentType"].toString(); // must be "CASH" | "CARD" QString paymentType = printingData["paymentType"].toString(); // must be "CASH" | "CARD"
QString productName = printingData["product"].toString(); // must be "ShortTimeParking" | "DayTicket" QString productName = printingData["product"].toString(); // must be "ShortTimeParking" | "DayTicket"
if ( (paymentType == "CASH") && (productName == "SHORT_TERM_PARKING") ) { if ( (paymentType == "CASH") && ( (productName == "SHORT_TERM_PARKING") ||
(productName == "SHORT_TERM_PARKING_CAR") ||
(productName == "SHORT_TERM_PARKING_VAN") ||
(productName == "SHORT_TERM_PARKING_CAMPER")
))
{
this->currentSelectedTicketType = 1; // "Kombiticket #1" this->currentSelectedTicketType = 1; // "Kombiticket #1"
} }
else else
if ( (paymentType == "CARD") && (productName == "SHORT_TERM_PARKING") ) { if ( (paymentType == "CARD") && ( (productName == "SHORT_TERM_PARKING") ||
(productName == "SHORT_TERM_PARKING_CAR") ||
(productName == "SHORT_TERM_PARKING_VAN") ||
(productName == "SHORT_TERM_PARKING_CAMPER")
))
{
this->currentSelectedTicketType = 2; // "Kombiticket #2" this->currentSelectedTicketType = 2; // "Kombiticket #2"
} }
else else
if ( (paymentType == "CASH") && (productName == "DAY_TICKET") ) { if ( (paymentType == "CASH") && ( (productName == "DAY_TICKET") ||
(productName == "DAY_TICKET_CAR") ||
(productName == "DAY_TICKET_VAN") ||
(productName == "DAY_TICKET_CAMPER")
))
{
this->currentSelectedTicketType = 3; // "Kombiticket #3" this->currentSelectedTicketType = 3; // "Kombiticket #3"
} }
else else
if ( (paymentType == "CARD") && (productName == "DAY_TICKET") ) { if ( (paymentType == "CARD") && ( (productName == "DAY_TICKET") ||
(productName == "DAY_TICKET_CAR") ||
(productName == "DAY_TICKET_VAN") ||
(productName == "DAY_TICKET_CAMPER")
))
{
this->currentSelectedTicketType = 4; // "Kombiticket #4" this->currentSelectedTicketType = 4; // "Kombiticket #4"
} }
else else
@@ -1003,6 +1029,9 @@ void ATBDeviceControllerPlugin::prepareDynTemplateData()
break; break;
case nsDeviceControllerInterface::TICKET_VARIANT::PARKING_TICKET: case nsDeviceControllerInterface::TICKET_VARIANT::PARKING_TICKET:
break; break;
case nsDeviceControllerInterface::TICKET_VARIANT::FREE_TICKET:
private_setupDynTemplatData_FREE_TICKET(dynTicketData, this->currentTicket);
break;
case nsDeviceControllerInterface::TICKET_VARIANT::FOOD_STAMP: case nsDeviceControllerInterface::TICKET_VARIANT::FOOD_STAMP:
private_setupDynTemplatData_FOOD_STAMP(dynTicketData, this->currentTicket); private_setupDynTemplatData_FOOD_STAMP(dynTicketData, this->currentTicket);
break; break;
@@ -1128,6 +1157,41 @@ void ATBDeviceControllerPlugin::private_setupDynTemplatData_FINE_PAYMENT(struct
} }
void ATBDeviceControllerPlugin::private_setupDynTemplatData_FREE_TICKET(struct T_dynDat *dynTicketData, Ticket *ticket)
{
QDateTime currentDateTime = QDateTime::fromString(ticket->getPrintingData()["currentDateTime"].toString(), Qt::ISODate);
QString currentDateString = this->printerLocale.toString(currentDateTime.date(), QLocale::ShortFormat);
// set dynamic printer data:
QByteArray ba_licenseplate = codec->fromUnicode(ticket->getPrintingData()["licenseplate"].toString());
memcpy((char*)dynTicketData->licensePlate, ba_licenseplate.data(), std::min(ba_licenseplate.size(),8));
QByteArray ba_amount = codec->fromUnicode(ticket->getPrintingData()["amount"].toString());
memcpy((char*)dynTicketData->vendingPrice, ba_amount.data(), std::min(ba_amount.size(),8)); // Szeged
memcpy((char*)dynTicketData->dynDat6, ba_amount.data(), std::min(ba_amount.size(),8)); // Schoenau
QByteArray ba_currentDate = codec->fromUnicode(currentDateString);
memcpy((char*)dynTicketData->currentDate, ba_currentDate.data(), std::min(ba_currentDate.size(),8));
// FREE_TICKET needs parking endtime:
QDateTime parkingEndDateTime = QDateTime::fromString(ticket->getPrintingData()["parkingEnd"].toString(), Qt::ISODate);
QByteArray ba_parkingEndTime = codec->fromUnicode(parkingEndDateTime.toString("hh:mm"));
memcpy((char*)dynTicketData->parkingEnd, ba_parkingEndTime.data(), std::min(ba_parkingEndTime.size(),8));
QString parkingEndDateString = this->printerLocale.toString(parkingEndDateTime.date(), QLocale::ShortFormat);
QByteArray ba_parkingEndDate = codec->fromUnicode(parkingEndDateString);
memcpy((char*)dynTicketData->currentTime, ba_parkingEndDate.data(), std::min(ba_parkingEndDate.size(),8));
// ! and yes... 'ParkingEndDate' is 'currentTime'
}
/************************************************************************************************ /************************************************************************************************
* cash payment * cash payment
*/ */

View File

@@ -145,6 +145,7 @@ private:
void private_setupDynTemplatData_STOP_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket); void private_setupDynTemplatData_STOP_RECEIPT(struct T_dynDat *dynTicketData, Ticket *ticket);
void private_setupDynTemplatData_FOOD_STAMP(struct T_dynDat *dynTicketData, Ticket *ticket); void private_setupDynTemplatData_FOOD_STAMP(struct T_dynDat *dynTicketData, Ticket *ticket);
void private_setupDynTemplatData_FINE_PAYMENT(struct T_dynDat *dynTicketData, Ticket *ticket); void private_setupDynTemplatData_FINE_PAYMENT(struct T_dynDat *dynTicketData, Ticket *ticket);
void private_setupDynTemplatData_FREE_TICKET(struct T_dynDat *dynTicketData, Ticket *ticket);
// --------------------------------------------------------------------------------------------- // ---------------------------------------------------------------------------------------------
private slots: private slots:

View File

@@ -203,7 +203,7 @@ signals:
Q_DECLARE_INTERFACE(DeviceControllerInterface, Q_DECLARE_INTERFACE(DeviceControllerInterface,
"eu.atb.ptu.plugin.DeviceControllerInterface/1.1.5") "eu.atb.ptu.plugin.DeviceControllerInterface/1.1.6")
namespace nsDeviceControllerInterface { namespace nsDeviceControllerInterface {
@@ -237,7 +237,8 @@ namespace nsDeviceControllerInterface {
START_RECEIPT, // e.g. Szeged Start START_RECEIPT, // e.g. Szeged Start
STOP_RECEIPT, // e.g. Szeged Stop STOP_RECEIPT, // e.g. Szeged Stop
FINE_PAYMENT, // e.g. Klaipeda FINE_PAYMENT, // e.g. Klaipeda
FOOD_STAMP FOOD_STAMP,
FREE_TICKET
}; };
enum class COIN_PROCESSOR : quint8 { enum class COIN_PROCESSOR : quint8 {

View File

@@ -67,6 +67,9 @@ bool Ticket::initNew(TICKET_VARIANT ticketVariant, const QList<quint8> & templat
case TICKET_VARIANT::FINE_PAYMENT: case TICKET_VARIANT::FINE_PAYMENT:
this->_templateList << 24 << 25 << 26; this->_templateList << 24 << 25 << 26;
break; break;
case TICKET_VARIANT::FREE_TICKET:
this->_templateList << 24 << 25 << 26;
break;
case TICKET_VARIANT::FOOD_STAMP: case TICKET_VARIANT::FOOD_STAMP:
if (printingData.contains("dyn1_list")) { if (printingData.contains("dyn1_list")) {
this->_hasTemplateDynData = true; this->_hasTemplateDynData = true;