Commit 31c70139 by 李定达

1.添加打印和日结弹窗提示

parent fe5a9e58
...@@ -46,6 +46,7 @@ Control::Control(QObject *parent) : QObject(parent), _widget(NULL) ...@@ -46,6 +46,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:" << indata; QLOG_INFO() << "get data from pos:" << indata;
QString appPath; QString appPath;
...@@ -64,9 +65,10 @@ void Control::Start(const char *indata, char *outdata) ...@@ -64,9 +65,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)
...@@ -76,9 +78,23 @@ void Control::Start(const char *indata, char *outdata) ...@@ -76,9 +78,23 @@ 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); _widget->ShowWithRequest(_request);
loop.exec();
if(reqtype.compare("40") != 0)
{
loop.exec();
}else
{
if(reqtype.compare("40") == 0 && refundflag == false)
loop.exec();
}
_lock.lock(); _lock.lock();
delete _widget; delete _widget;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#define JSON_KEY_STATUSCODE "statusCode" #define JSON_KEY_STATUSCODE "statusCode"
#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"
......
...@@ -46,7 +46,7 @@ HostWidget::HostWidget(QWidget *parent) : ...@@ -46,7 +46,7 @@ HostWidget::HostWidget(QWidget *parent) :
ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); //ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
ui->tableWidget->verticalHeader()->setDefaultSectionSize(45); ui->tableWidget->verticalHeader()->setDefaultSectionSize(45);
} }
...@@ -265,6 +265,7 @@ void HostWidget::ShowWiteJson(bool flag, QJsonObject object, QString error) ...@@ -265,6 +265,7 @@ void HostWidget::ShowWiteJson(bool flag, QJsonObject object, QString error)
pBtn->setFixedSize(70, 30); pBtn->setFixedSize(70, 30);
pBtn->setFocusPolicy(Qt::NoFocus); pBtn->setFocusPolicy(Qt::NoFocus);
pBtn->setProperty("orderId", tmp[JSON_KEY_FMID].toString()); pBtn->setProperty("orderId", tmp[JSON_KEY_FMID].toString());
pBtn->setText(QString::fromLocal8Bit("打印")); pBtn->setText(QString::fromLocal8Bit("打印"));
hLayout->addWidget(pBtn); hLayout->addWidget(pBtn);
hLayout->setMargin(0); hLayout->setMargin(0);
...@@ -272,11 +273,19 @@ void HostWidget::ShowWiteJson(bool flag, QJsonObject object, QString error) ...@@ -272,11 +273,19 @@ void HostWidget::ShowWiteJson(bool flag, QJsonObject object, QString error)
ui->tableWidget->setCellWidget(0, 4, pWdg); // 操作按钮 ui->tableWidget->setCellWidget(0, 4, pWdg); // 操作按钮
pBtn->setStyleSheet("border:0px;border-radius:2px;background-color: rgb(0, 179, 238);font: 75 20px \"Microsoft YaHei UI Light\";"); pBtn->setStyleSheet("border:0px;border-radius:2px;background-color: rgb(0, 179, 238);font: 75 20px \"Microsoft YaHei UI Light\";");
qDebug() << "********************-----------*******************" << tmp;
if(tmp[JSON_KEYT_STATE].toString().toInt() != 1)
{
pBtn->setEnabled(false);
pBtn->setStyleSheet("border:0px;border-radius:2px;background-color: rgb(208, 208, 208);font: 75 20px \"Microsoft YaHei UI Light\";");
}
connect(pBtn, &QPushButton::clicked, this, [this, pBtn]() connect(pBtn, &QPushButton::clicked, this, [this, pBtn]()
{ {
QStringList list; QStringList list;
list.append(pBtn->property("orderId").toString()); list.append(pBtn->property("orderId").toString());
this->hide(); on_btn_printagain_clicked();
emit RequestWithType(againprint, list); emit RequestWithType(againprint, list);
}); });
...@@ -320,8 +329,9 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message) ...@@ -320,8 +329,9 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
ui->label_pay_title->setText(QString::fromLocal8Bit("支付成功")); ui->label_pay_title->setText(QString::fromLocal8Bit("支付成功"));
ui->label_pay_time->setPixmap(QPixmap(":res/success.png")); ui->label_pay_time->setPixmap(QPixmap(":res/success.png"));
} else { } else {
ui->label_pay_title->setText(QString::fromLocal8Bit("支付失败")); // ui->label_pay_title->setText(QString::fromLocal8Bit("支付失败"));
ui->label_pay_time->setPixmap(QPixmap(":res/warning.png")); // ui->label_pay_time->setPixmap(QPixmap(":res/warning.png"));
emit Exits();
} }
return ; return ;
} }
...@@ -336,6 +346,8 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message) ...@@ -336,6 +346,8 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
ui->btn_pay_exit->setVisible(true); ui->btn_pay_exit->setVisible(true);
ui->btn_pay_exit->setText(QString::fromLocal8Bit("确认")); ui->btn_pay_exit->setText(QString::fromLocal8Bit("确认"));
qDebug() << "-----" << flag;
if(flag) { if(flag) {
ui->label_pay_msg_time->setVisible(true); ui->label_pay_msg_time->setVisible(true);
_label_pay_timer->setLabel(ui->label_pay_msg_time); _label_pay_timer->setLabel(ui->label_pay_msg_time);
...@@ -343,25 +355,78 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message) ...@@ -343,25 +355,78 @@ void HostWidget::ShowWiteMGS(ReqType type, bool flag, QString message)
ui->label_pay_title->setText(QString::fromLocal8Bit("退款成功")); ui->label_pay_title->setText(QString::fromLocal8Bit("退款成功"));
ui->label_pay_time->setPixmap(QPixmap(":res/success.png")); ui->label_pay_time->setPixmap(QPixmap(":res/success.png"));
} else { } else {
ui->label_pay_title->setText(QString::fromLocal8Bit("退款失败")); // ui->label_pay_title->setText(QString::fromLocal8Bit("退款失败"));
ui->label_pay_time->setPixmap(QPixmap(":res/warning.png")); // ui->label_pay_time->setPixmap(QPixmap(":res/warning.png"));
emit Exits();
} }
return ; return ;
} }
if(type == endday) if(type == endday)
{ {
emit Exits(); _need_exit = true;
return; _label_pay_timer->stop();
ui->label_pay_time_load->setVisible(false);
ui->label_pay_money->setVisible(true);
ui->label_pay_money->setText(message);
ui->label_pay_title->show();
ui->label_pay_msg_time->show();
ui->btn_pay_exit->setVisible(true);
ui->btn_pay_exit->setText(QString::fromLocal8Bit("确认"));
if(flag) {
ui->label_pay_msg_time->setVisible(true);
_label_pay_timer->setLabel(ui->label_pay_msg_time);
_label_pay_timer->start(3);
ui->label_pay_title->setText(QString::fromLocal8Bit("打印日结单成功"));
ui->label_pay_time->setPixmap(QPixmap(":res/success.png"));
} else {
ui->label_pay_msg_time->hide();
ui->label_pay_title->setText(QString::fromLocal8Bit("打印日结单失败"));
ui->label_pay_time->setPixmap(QPixmap(":res/warning.png"));
}
return ;
} }
if(type == againprint) if(type == againprint)
{ {
emit Exits(); _need_exit = true;
return; _label_pay_timer->stop();
ui->label_pay_time_load->setVisible(false);
ui->label_pay_money->setVisible(true);
ui->label_pay_money->setText(message);
ui->label_pay_title->show();
ui->label_pay_msg_time->show();
ui->btn_pay_exit->setVisible(true);
ui->btn_pay_exit->setText(QString::fromLocal8Bit("确认"));
if(flag) {
ui->label_pay_msg_time->setVisible(true);
_label_pay_timer->setLabel(ui->label_pay_msg_time);
_label_pay_timer->start(3);
ui->label_pay_title->setText(QString::fromLocal8Bit("重印小票成功"));
ui->label_pay_time->setPixmap(QPixmap(":res/success.png"));
} else {
ui->label_pay_msg_time->hide();
ui->label_pay_title->setText(QString::fromLocal8Bit("重印小票失败"));
ui->label_pay_time->setPixmap(QPixmap(":res/warning.png"));
}
return ;
} }
} }
void HostWidget::on_btn_printagain_clicked()
{
_type = againprint;
ui->label_pay_title->hide();
ui->label_pay_money->hide();
//ui->label_pay_msg_time->hide();
ui->btn_pay_exit->hide();
ShowWidget(ui->pay);
_curr_show_widget = ui->pay;
}
void HostWidget::on_btn_mananger_register_clicked() void HostWidget::on_btn_mananger_register_clicked()
{ {
QStringList list; QStringList list;
...@@ -395,7 +460,15 @@ void HostWidget::on_btn_mananger_print_clicked() ...@@ -395,7 +460,15 @@ void HostWidget::on_btn_mananger_print_clicked()
{ {
QStringList list; QStringList list;
this->hide(); _type = endday;
ui->label_pay_title->hide();
ui->label_pay_money->hide();
//ui->label_pay_msg_time->hide();
ui->btn_pay_exit->hide();
ShowWidget(ui->pay);
_curr_show_widget = ui->pay;
emit RequestWithType(endday, list); emit RequestWithType(endday, list);
} }
...@@ -455,10 +528,21 @@ void HostWidget::on_btn_find_check_clicked() ...@@ -455,10 +528,21 @@ void HostWidget::on_btn_find_check_clicked()
QStringList headerString; QStringList headerString;
headerString<<QString::fromLocal8Bit("订单编号")<<QString::fromLocal8Bit("订单金额")<<QString::fromLocal8Bit("订单时间")<<QString::fromLocal8Bit("支付状态")<<QString::fromLocal8Bit("操作"); headerString<<QString::fromLocal8Bit("订单编号")<<QString::fromLocal8Bit("订单金额")<<QString::fromLocal8Bit("订单时间")<<QString::fromLocal8Bit("支付状态")<<QString::fromLocal8Bit("操作");
int width = ui->widget_find_main->width() - 4;
qDebug() << "===========" << width;
//ui->tableWidget->setColumnWidth(0,1/10.0*width);
ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{border: 0px;font: 75 18px \"Microsoft YaHei UI Light\";}"); ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{border: 0px;font: 75 18px \"Microsoft YaHei UI Light\";}");
ui->tableWidget->horizontalHeader()->setFixedHeight(25); //设置表头的高度 ui->tableWidget->horizontalHeader()->setFixedHeight(25); //设置表头的高度
ui->tableWidget->setHorizontalHeaderLabels(headerString); ui->tableWidget->setHorizontalHeaderLabels(headerString);
ui->tableWidget->setColumnWidth(0,5/14.0*width);
ui->tableWidget->setColumnWidth(1,2/14.0*width);
ui->tableWidget->setColumnWidth(2,3/14.0*width);
ui->tableWidget->setColumnWidth(3,2/14.0*width);
ui->frame->hide(); ui->frame->hide();
ui->widget_check_load->show(); ui->widget_check_load->show();
ui->btn_find_check->hide(); ui->btn_find_check->hide();
......
...@@ -30,8 +30,7 @@ public: ...@@ -30,8 +30,7 @@ public:
void ShowWiteJson(bool flag, QJsonObject object, QString error); void ShowWiteJson(bool flag, QJsonObject object, QString error);
void setRuning(bool runing); void setRuning(bool runing);
signals: signals:
void RequestWithType(ReqType type, QStringList list); void RequestWithType(ReqType type, QStringList list);
...@@ -44,6 +43,8 @@ protected: ...@@ -44,6 +43,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();
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1933</width> <width>2023</width>
<height>839</height> <height>839</height>
</rect> </rect>
</property> </property>
...@@ -833,7 +833,7 @@ QHeaderView::section{ ...@@ -833,7 +833,7 @@ QHeaderView::section{
<bool>true</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="horizontalHeaderStretchLastSection"> <attribute name="horizontalHeaderStretchLastSection">
<bool>false</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="verticalHeaderVisible"> <attribute name="verticalHeaderVisible">
<bool>false</bool> <bool>false</bool>
...@@ -1169,7 +1169,7 @@ QHeaderView::section{ ...@@ -1169,7 +1169,7 @@ QHeaderView::section{
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Maximum</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
...@@ -1201,14 +1201,14 @@ QHeaderView::section{ ...@@ -1201,14 +1201,14 @@ QHeaderView::section{
<widget class="QWidget" name="widget_pay_main" native="true"> <widget class="QWidget" name="widget_pay_main" native="true">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>310</width> <width>400</width>
<height>310</height> <height>400</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>310</width> <width>400</width>
<height>310</height> <height>400</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
...@@ -1480,8 +1480,8 @@ QHeaderView::section{ ...@@ -1480,8 +1480,8 @@ QHeaderView::section{
<widget class="QPushButton" name="btn_pay_exit"> <widget class="QPushButton" name="btn_pay_exit">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>280</width> <width>340</width>
<height>33</height> <height>40</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
......
...@@ -136,6 +136,7 @@ private: ...@@ -136,6 +136,7 @@ private:
json.insert(JSON_KEY_STATIONID, FMTool::GetString((const void *)&(request.DeviceNo), 6)); json.insert(JSON_KEY_STATIONID, FMTool::GetString((const void *)&(request.DeviceNo), 6));
json.insert(JSON_KEY_ENDTIME, FMTool::GetString((const void *)&(request.BusinessDay), 8).append( FMTool::GetString((const void *)&(request.TransTime), 6))); json.insert(JSON_KEY_ENDTIME, FMTool::GetString((const void *)&(request.BusinessDay), 8).append( FMTool::GetString((const void *)&(request.TransTime), 6)));
json.insert(JSON_KEY_PARTORDERID, FMTool::GetString((const void *)&(request.Reserved1), 64)); json.insert(JSON_KEY_PARTORDERID, FMTool::GetString((const void *)&(request.Reserved1), 64));
json.insert(JSON_KEY_PRINTACTION, QString("103"));
return true; return true;
} }
...@@ -151,7 +152,7 @@ private: ...@@ -151,7 +152,7 @@ private:
json.insert(JSON_KEY_STATIONID, FMTool::GetString((const void *)&(request.DeviceNo), 6)); json.insert(JSON_KEY_STATIONID, FMTool::GetString((const void *)&(request.DeviceNo), 6));
json.insert(JSON_KEY_OPERATORID, FMTool::GetString((const void *)&(request.CashierNo), 6)); json.insert(JSON_KEY_OPERATORID, FMTool::GetString((const void *)&(request.CashierNo), 6));
json.insert(JSON_KEY_FMID, list[0]); json.insert(JSON_KEY_FMID, list[0]);
json.insert(JSON_KEY_PRINTACTION, QString("103")); json.insert(JSON_KEY_PRINTACTION, QString("104"));
return true; return true;
} }
......
...@@ -244,9 +244,9 @@ int main(int argc, char *argv[]) ...@@ -244,9 +244,9 @@ int main(int argc, char *argv[])
FMTool::SetString(req.DeviceNo, 6 , QString("1")); FMTool::SetString(req.DeviceNo, 6 , QString("1"));
FMTool::SetString(req.CashierNo, 6 , QString("0123")); FMTool::SetString(req.CashierNo, 6 , QString("0123"));
FMTool::SetString(req.CashTraceNo, 6 , QString("16723")); FMTool::SetString(req.CashTraceNo, 6 , QString("16723"));
FMTool::SetString(req.OriginTrace, 64 , QString("7871170818A00002005")); FMTool::SetString(req.OriginTrace, 64 , QString(""));
FMTool::SetString(req.Amount, 12, QString("1")); FMTool::SetString(req.Amount, 12, QString("1"));
FMTool::SetString(req.Reserved1, 48 , QString("12411235821335894422")); FMTool::SetString(req.Reserved1, 48 , QString("1365670843098735894422"));
req.item_line_qty[0] = '2'; req.item_line_qty[0] = '2';
req.item_line_qty[1] = ' '; req.item_line_qty[1] = ' ';
......
...@@ -13,7 +13,7 @@ TARGET = sbkpay ...@@ -13,7 +13,7 @@ TARGET = sbkpay
include("./QsLog/QsLog.pri") include("./QsLog/QsLog.pri")
CONFIG += C++11 SBKDLL CONFIG += C++11
include($$PWD/qtwinmigrate/src/qtwinmigrate.pri) include($$PWD/qtwinmigrate/src/qtwinmigrate.pri)
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-08-19T19:19:22. --> <!-- Written by QtCreator 3.5.1, 2017-08-24T16:03:42. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
......
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