Commit d8b004d6 by NitefullWind

1. 实现打印日结单、交班单时弹窗显示等待信息。

parent 2f600226
...@@ -52,6 +52,7 @@ Control::Control(QObject *parent) : QObject(parent), _widget(NULL) ...@@ -52,6 +52,7 @@ Control::Control(QObject *parent) : QObject(parent), _widget(NULL)
void Control::Start(const char *indata, char *outdata) void Control::Start(const char *indata, char *outdata)
{ {
bool refundflag = false;
QLOG_INFO() << "get data from pos:" << QString::fromLocal8Bit(indata); QLOG_INFO() << "get data from pos:" << QString::fromLocal8Bit(indata);
QString appPath; QString appPath;
...@@ -83,9 +84,10 @@ void Control::Start(const char *indata, char *outdata) ...@@ -83,9 +84,10 @@ void Control::Start(const char *indata, char *outdata)
connect(_widget, &HostWidget::RequestWithType, this, &Control::RequestWithType); connect(_widget, &HostWidget::RequestWithType, this, &Control::RequestWithType);
connect(_widget, &HostWidget::Exits, this, [&loop] () connect(_widget, &HostWidget::Exits, this, [&loop, &refundflag] ()
{ {
QLOG_INFO() << "quit with normal"; QLOG_INFO() << "quit with normal";
refundflag = true;
loop.exit(); loop.exit();
}); });
connect(_widget, &HostWidget::ExitWithMSG, this, [this, &loop] (QString code, QString message) connect(_widget, &HostWidget::ExitWithMSG, this, [this, &loop] (QString code, QString message)
...@@ -95,6 +97,22 @@ void Control::Start(const char *indata, char *outdata) ...@@ -95,6 +97,22 @@ void Control::Start(const char *indata, char *outdata)
loop.exit(); loop.exit();
}); });
// QString reqtype;
// reqtype.append(_request.TransType[0]).append(_request.TransType[1]);
// _widget->ShowWithRequest(_request);
// if(reqtype.compare("40") != 0)
// {
// loop.exec();
// }else
// {
// if(reqtype.compare("40") == 0 && refundflag == false)
// loop.exec();
// }
// _widget->ShowWithRequest(_request); // _widget->ShowWithRequest(_request);
_widget->ShowWithRequest(_posReqJsonObj); _widget->ShowWithRequest(_posReqJsonObj);
...@@ -251,19 +269,19 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata, ...@@ -251,19 +269,19 @@ bool Control::SendMessageToSBKAPI(const QJsonObject &json, QByteArray &outdata,
strcpy(in, reqXmlStr.toUtf8().data()); strcpy(in, reqXmlStr.toUtf8().data());
QLOG_INFO() << "Request StarbucksAPI XML data: " << in; QLOG_INFO() << "Request StarbucksAPI XML data: " << in;
#ifndef SBKTEST #ifdef MOCK
int result = skbSend(in, guid, out, errMsg, mode);
#else
QLOG_DEBUG() << "=========================================== Read debug data. ========================================"; QLOG_DEBUG() << "=========================================== Read debug data. ========================================";
QLOG_DEBUG() << "Test req type: " << type; QLOG_DEBUG() << "Test req type: " << type;
QFile f(qApp->applicationDirPath()+QString("/test/%1.txt").arg(type)); QFile f(qApp->applicationDirPath()+QString("/test/%1.txt").arg(type));
f.open(QIODevice::ReadOnly); f.open(QIODevice::ReadOnly);
strcpy(out, f.readAll().data()); strcpy(out, f.readAll().data());
Sleep(1000*10);
QLOG_DEBUG() << "=========================================== End read debug data. ===================================="; QLOG_DEBUG() << "=========================================== End read debug data. ====================================";
int result = 0; int result = 0;
#endif //! End def SBKTEST #else
int result = skbSend(in, guid, out, errMsg, mode);
#endif //! End def MOCK
QLOG_DEBUG() << "StarbucksAPI return to GBK: " << QString::fromLocal8Bit(out); QLOG_DEBUG() << "StarbucksAPI return to GBK: " << QString::fromLocal8Bit(out);
...@@ -545,7 +563,11 @@ void Control::Request(ReqType type, QStringList list) ...@@ -545,7 +563,11 @@ void Control::Request(ReqType type, QStringList list)
char signStr[MAX_BUF_LEN] = {0}; char signStr[MAX_BUF_LEN] = {0};
bool rlt = false; bool rlt = false;
#ifdef MOCK
#else
if((rlt = GetSPCCSign(jsonArray.data(), signStr, error))) if((rlt = GetSPCCSign(jsonArray.data(), signStr, error)))
#endif
{ {
json["sign"] = QString::fromLocal8Bit(signStr); json["sign"] = QString::fromLocal8Bit(signStr);
...@@ -556,12 +578,9 @@ void Control::Request(ReqType type, QStringList list) ...@@ -556,12 +578,9 @@ void Control::Request(ReqType type, QStringList list)
if(rlt) if(rlt)
rlt = Control::GetJson(type, rtjson, outdata, error); rlt = Control::GetJson(type, rtjson, outdata, error);
else
if(!rlt)
SetResPonseWithMessage("23", error); SetResPonseWithMessage("23", error);
_lock.lock(); _lock.lock();
if(_widget != NULL && type == finds) if(_widget != NULL && type == finds)
{ {
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#define JSON_KEY_TYPE "type" #define JSON_KEY_TYPE "type"
#define JSON_KEY_FMID "fmId" #define JSON_KEY_FMID "fmId"
#define JSON_KEY_EXT "ext" #define JSON_KEY_EXT "ext"
#define JSON_KEYT_STATE "state"
#define JSON_KEY_PRINT "print" #define JSON_KEY_PRINT "print"
#define JSON_KEY_PRINTACTION "printAction" #define JSON_KEY_PRINTACTION "printAction"
#define JSON_KEY_PRINTPATH "path" #define JSON_KEY_PRINTPATH "path"
......
...@@ -45,6 +45,8 @@ protected: ...@@ -45,6 +45,8 @@ protected:
void keyPressEvent(QKeyEvent *ke); void keyPressEvent(QKeyEvent *ke);
private slots: private slots:
void on_btn_printagain_clicked();
void on_btn_mananger_register_clicked(); void on_btn_mananger_register_clicked();
void on_btn_mananger_check_clicked(); void on_btn_mananger_check_clicked();
...@@ -71,6 +73,8 @@ private slots: ...@@ -71,6 +73,8 @@ private slots:
void on_btn_mananger_print_shift_clicked(); void on_btn_mananger_print_shift_clicked();
void on_btn_wait_quit_clicked();
private: private:
void ShowWidget(QWidget *showwidget); void ShowWidget(QWidget *showwidget);
...@@ -92,6 +96,8 @@ private: ...@@ -92,6 +96,8 @@ private:
LabelsTimer *_label_find_timer; LabelsTimer *_label_find_timer;
LabelsTimer *_label_wait_timer;
QMovie *_label_pay_movie; QMovie *_label_pay_movie;
int _line; int _line;
......
...@@ -289,7 +289,7 @@ int main(int argc, char *argv[]) ...@@ -289,7 +289,7 @@ int main(int argc, char *argv[])
// control.Start(as, b); // control.Start(as, b);
char spccIn[MAX_BUF_LEN] = "{\"fmId\":\"0123456789012345678\",\"reqType\":353,\"storeId\":\"1713\",\"stationId\":\"1\",\"partnerId\":1443,\"operatorId\":\"sssaw\",\"transId\":\"52342342323806\",\"transAmount\":8000,\"partnerOrderId\":\"909911039993720192019\",\"businessDate\":\"20170508\",\"products\":[{\"pid\":\"123\",\"name\":\"中杯拿铁\",\"price\":321,\"salesType\":\"NORMAL\"}]}"; char spccIn[MAX_BUF_LEN] = "{\"fmId\":\"0123456789012345678\",\"reqType\":351,\"storeId\":\"1713\",\"stationId\":\"1\",\"partnerId\":1443,\"operatorId\":\"sssaw\",\"transId\":\"52342342323806\",\"transAmount\":8000,\"partnerOrderId\":\"909911039993720192019\",\"businessDate\":\"20170508\",\"products\":[{\"pid\":\"123\",\"name\":\"中杯拿铁\",\"price\":321,\"salesType\":\"NORMAL\"}]}";
control.Start(spccIn, b); control.Start(spccIn, b);
return a.exec(); return a.exec();
......
...@@ -13,10 +13,9 @@ TARGET = sbkpay ...@@ -13,10 +13,9 @@ TARGET = sbkpay
include("./QsLog/QsLog.pri") include("./QsLog/QsLog.pri")
CONFIG += C++11 SBKDLL CONFIG += C++11 SBKDLL1
#DEFINES += SBKTEST DEFINES += MOCK
#DEFINES += SBKDLL
include($$PWD/qtwinmigrate/src/qtwinmigrate.pri) include($$PWD/qtwinmigrate/src/qtwinmigrate.pri)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment