Commit 92c81a15 by guanghui.cui

添加套餐缓存

parent 779fbe23
......@@ -4,7 +4,7 @@ maxcount=50
level=0
[Login]
password=hzl9999
password=posoperator@freemud.cn
stationId=99
operatorId=99
......@@ -46,9 +46,9 @@ fmwd="rgb(126, 224, 83)"
[StoreInfo]
businessDate=2017-07-31
matesId=CN001
partnerId=1521
partnerId=1684
posId=1001
storeId=hzl9999
storeId=pos_bft_SH002
operatorId=001
[POSServer]
......
......@@ -357,7 +357,7 @@ void MainForm::onFloatMoved(QPoint pos)
void MainForm::_InitUI()
{
this->setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint |Qt::FramelessWindowHint);
this->setWindowFlags(windowFlags()/* | Qt::WindowStaysOnTopHint |Qt::FramelessWindowHint*/);
//this->showFullScreen();
m_size = this->size();
......
......@@ -139,7 +139,7 @@ QByteArray WBillControl::GetOrderEntryData(const OrderObject *orderObject, bool
rObj.insert("fm_ver", "1.0");
cObj.insert("pay_id", "002");
cObj.insert("pay_str", QString::fromLocal8Bit("非码外卖"));
cObj.insert("pay_str", QString("非码外卖"));
cObj.insert("pay_ebcode", orderObject->channel);
cObj.insert("pay_ebcode_str", orderObject->channelName);
cObj.insert("shop_fee", orderObject->shop_fee);
......@@ -256,6 +256,7 @@ void WBillControl::GetPosMenu()
flag=false;
}
}
// QLOG_INFO() << "------------------------------menu json:"<<arr.data();
setMenu(arr);
}
}
......@@ -264,13 +265,16 @@ void WBillControl::GetPosMenu()
void WBillControl::setMenu(const QByteArray &JsonMenu)
{
//QMap<QString,QVector<SetMenuItem>> mapSetMenu;
vecMenu.clear();
mapSetMenu.clear();
QJsonObject recvJson = QJsonDocument::fromJson(JsonMenu).object();
QJsonArray orders = recvJson["MenuList"].toArray();
PrinterMenu menu;
foreach (QJsonValue order, orders) {
QJsonObject orderObj = order.toObject();
menu.strMenuId = orderObj["strMenuId"].toString();
menu.strMenuName = orderObj["strMenuName"].toString();
menu.iPrinterId = orderObj["iPrinterId"].toInt();
menu.strDevice = orderObj["strDevice"].toString();
......@@ -282,6 +286,23 @@ void WBillControl::setMenu(const QByteArray &JsonMenu)
menu.strOrderTitle = orderObj["strOrderTitle"].toString();
vecMenu.push_back(menu);
}
QJsonArray arrySetMenuList = recvJson["SetMenuMap"].toArray();
foreach (QJsonValue order, arrySetMenuList){
QJsonObject orderObj = order.toObject();
QString setMenuId = orderObj["strSetMenuId"].toString();
QVector<SetMenuItem> vecItem;
QJsonArray arrayItems = orderObj["arrayItems"].toArray();
foreach (QJsonValue orderItem, arrayItems){
SetMenuItem item;
QJsonObject objItem = orderItem.toObject();
item.strMenuId = objItem["strMenuId"].toString();
item.num = objItem["iNum"].toInt();
vecItem.push_back(item);
}
mapSetMenu.insert(setMenuId,vecItem);
}
}
void WBillControl::PrintLable(const OrderObject *obj)
......
......@@ -16,6 +16,7 @@ typedef struct {
struct PrinterMenu
{
QString strMenuId; //菜品ID
QString strMenuName; //菜品名称
int iPrinterId; //打印机ID(厨房)
QString strDevice; //打印机端口(厨房)
int iBaud; //波特率(厨房)
......@@ -26,6 +27,12 @@ struct PrinterMenu
QString strOrderTitle; //打印标题(上菜单)
};
struct SetMenuItem
{
QString strMenuId; //菜品id
int num; //数量
};
class WBillControl : public QObject
{
Q_OBJECT
......@@ -82,6 +89,7 @@ private:
public:
QVector<PrinterMenu> vecMenu;
QMap<QString,QVector<SetMenuItem>> mapSetMenu;
private:
WBillControl();
~WBillControl();
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2017-09-29T09:15:50. -->
<!-- Written by QtCreator 3.5.1, 2017-10-12T14:52:35. -->
<qtcreator>
<data>
<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