Commit d2c36461 by yunpeng.song

暂时屏蔽一些订单操作按钮,新订单时点击屏幕指定区域

parent c63739b6
#include "flowControl.h" #include "windows.h"
#include "flowControl.h"
#include "QsLog.h" #include "QsLog.h"
#include "DTools/dataManger.h" #include "DTools/dataManger.h"
#include "preDefine.h" #include "preDefine.h"
...@@ -18,8 +19,10 @@ ...@@ -18,8 +19,10 @@
#include <QMap> #include <QMap>
#include <QFile> #include <QFile>
#include <DTools/orderstatus.h> #include <DTools/orderstatus.h>
//#include "windows.h"
#include <QHostInfo> #include <QHostInfo>
FlowControl &FlowControl::GetInstance() FlowControl &FlowControl::GetInstance()
{ {
static FlowControl fc; static FlowControl fc;
...@@ -94,12 +97,11 @@ FlowControl::FlowControl() ...@@ -94,12 +97,11 @@ FlowControl::FlowControl()
msg= error; msg= error;
if(!m_ordersMapXbk.isEmpty()) if(!m_ordersMapXbk.isEmpty())
iscontinue=1; iscontinue=1;
} }
if(actionId==0) if(actionId==0)
{ {
data.insert("msg",msg); // data.insert("msg",msg);
data.insert("statusCode",-1); // data.insert("statusCode",-1);
replyObject=data; replyObject=data;
} }
else{ else{
...@@ -130,22 +132,19 @@ FlowControl::FlowControl() ...@@ -130,22 +132,19 @@ FlowControl::FlowControl()
QString FlowControl::_GetIpAddress() QString FlowControl::_GetIpAddress()
{ {
QString ipAddress; QString ipAddress;
#ifdef TEST
ipAddress=ConfigManger::GetInstance().GetIpAddress(); ipAddress=ConfigManger::GetInstance().GetIpAddress();
#else
QHostInfo info = QHostInfo::fromName(QHostInfo::localHostName()); QHostInfo info = QHostInfo::fromName(QHostInfo::localHostName());
foreach(QHostAddress address,info.addresses()) foreach(QHostAddress address,info.addresses())
{ {
if(address.protocol() == QAbstractSocket::IPv4Protocol) if(address.protocol() == QAbstractSocket::IPv4Protocol)
{ {
if(address.toString().endsWith("")) if(address.toString().contains(ipAddress))
{ {
ipAddress=address.toString(); ipAddress=address.toString();
} }
} }
} }
#endif
qDebug() <<"IPV4 Address: "<< ipAddress;
return ipAddress+QString(":")+QString::number(ConfigManger::GetInstance().GetHttpServerPort()); return ipAddress+QString(":")+QString::number(ConfigManger::GetInstance().GetHttpServerPort());
} }
...@@ -167,6 +166,14 @@ void FlowControl::_GetOrder(const QString &orderId, const QString &channel) ...@@ -167,6 +166,14 @@ void FlowControl::_GetOrder(const QString &orderId, const QString &channel)
_PullOrder(); _PullOrder();
} }
void FlowControl::_ClickOMSAssignArea()
{
QPoint point=ConfigManger::GetOMSBtnPostion();
SetCursorPos(point.x(),point.y());
mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
}
void FlowControl::onGetNewStoreInfo() void FlowControl::onGetNewStoreInfo()
{ {
m_timestamp = "0"; m_timestamp = "0";
...@@ -211,13 +218,13 @@ bool FlowControl::_Login() ...@@ -211,13 +218,13 @@ bool FlowControl::_Login()
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "登录失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "登录失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("登录失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("登录失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
m_storeName = recvJson[JSON_STORENAME].toString(); m_storeName = recvJson[JSON_STORENAME].toString();
...@@ -248,7 +255,6 @@ bool FlowControl::_Login() ...@@ -248,7 +255,6 @@ bool FlowControl::_Login()
bool FlowControl::_PullOrder() bool FlowControl::_PullOrder()
{ {
qDebug()<<"----------";
if(m_orderPullList.isEmpty()) if(m_orderPullList.isEmpty())
return true; return true;
emit hideAlert(); emit hideAlert();
...@@ -281,7 +287,7 @@ bool FlowControl::_PullOrder() ...@@ -281,7 +287,7 @@ bool FlowControl::_PullOrder()
{ {
QString error = recvJson[JSON_ERRMSG].toString(); QString error = recvJson[JSON_ERRMSG].toString();
QLOG_ERROR() << QString("pull orders error.[msg->%1]").arg(error); QLOG_ERROR() << QString("pull orders error.[msg->%1]").arg(error);
emit showAlert(AlertForm::ERROR, QString("获取订单失败![%1]").arg(error)); emit showAlert(AlertForm::MSGERROR, QString("获取订单失败![%1]").arg(error));
result=false; result=false;
}else }else
{ {
...@@ -308,8 +314,13 @@ bool FlowControl::_PullOrder() ...@@ -308,8 +314,13 @@ bool FlowControl::_PullOrder()
if(!Orderstatus::getInstance().isorderexit(orderObject->order_id)) if(!Orderstatus::getInstance().isorderexit(orderObject->order_id))
{ {
Orderstatus::getInstance().statusinsert(orderObject->order_id,0,0,0,0,QDate::currentDate().toString("yyyy-MM-dd")); Orderstatus::getInstance().statusinsert(orderObject->order_id,0,0,0,0,QDate::currentDate().toString("yyyy-MM-dd"));
if(orderObject->status==OrderObject::NewOrder)
{
_ClickOMSAssignArea();
}
} }
emit changeOrderStatus(orderObject); emit changeOrderStatus(orderObject);
}else }else
{ {
//旧数据有更新 //旧数据有更新
...@@ -405,13 +416,13 @@ bool FlowControl::_SendHeart() ...@@ -405,13 +416,13 @@ bool FlowControl::_SendHeart()
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "发送心跳失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "发送心跳失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("发送心跳失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("发送心跳失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
//TODO //TODO
...@@ -438,13 +449,13 @@ bool FlowControl::_GetDelivers(const QString &orderId) ...@@ -438,13 +449,13 @@ bool FlowControl::_GetDelivers(const QString &orderId)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "获取配送员失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "获取配送员失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("获取配送员失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("获取配送员失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
QList<DeliverObject> deliverList; QList<DeliverObject> deliverList;
...@@ -486,13 +497,13 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del ...@@ -486,13 +497,13 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "接单失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "接单失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_ERRCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_ERRCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("接单失败![%1]").arg(recvJson[JSON_ERRMSG].toString())); emit showAlert(AlertForm::MSGERROR, QString("接单失败![%1]").arg(recvJson[JSON_ERRMSG].toString()));
}else }else
{ {
m_orderPair.first=orderId; m_orderPair.first=orderId;
...@@ -531,13 +542,13 @@ bool FlowControl::_RefuseOrder(const QString &orderId, int refuseCode) ...@@ -531,13 +542,13 @@ bool FlowControl::_RefuseOrder(const QString &orderId, int refuseCode)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "拒单失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "拒单失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("拒单失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("拒单失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
emit showAlert(AlertForm::SUCCESS, "拒单成功!"); emit showAlert(AlertForm::SUCCESS, "拒单成功!");
...@@ -559,7 +570,7 @@ bool FlowControl::_SendOrder(const QString& orderId) ...@@ -559,7 +570,7 @@ bool FlowControl::_SendOrder(const QString& orderId)
{ {
if(m_ordersMap.value(orderId)->courier_name.isEmpty()&&m_ordersMap.value(orderId)->delivery_type==1) if(m_ordersMap.value(orderId)->courier_name.isEmpty()&&m_ordersMap.value(orderId)->delivery_type==1)
{ {
emit showAlert(AlertForm::ERROR,QString("配送员暂未接单,请等待")); emit showAlert(AlertForm::MSGERROR,QString("配送员暂未接单,请等待"));
return true; return true;
} }
QString error; QString error;
...@@ -576,13 +587,13 @@ bool FlowControl::_SendOrder(const QString& orderId) ...@@ -576,13 +587,13 @@ bool FlowControl::_SendOrder(const QString& orderId)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "送出失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "送出失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("送出失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("送出失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
emit showAlert(AlertForm::SUCCESS, "送出成功!"); emit showAlert(AlertForm::SUCCESS, "送出成功!");
...@@ -616,13 +627,13 @@ bool FlowControl::_CompleteOrder(const QString& orderId) ...@@ -616,13 +627,13 @@ bool FlowControl::_CompleteOrder(const QString& orderId)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "完成失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "完成失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("完成失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("完成失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
emit showAlert(AlertForm::SUCCESS, "完成成功!"); emit showAlert(AlertForm::SUCCESS, "完成成功!");
...@@ -657,13 +668,13 @@ bool FlowControl::_RefuseRefund(const QString& orderId) ...@@ -657,13 +668,13 @@ bool FlowControl::_RefuseRefund(const QString& orderId)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "拒绝退单失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "拒绝退单失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("拒绝退单失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("拒绝退单失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
emit showAlert(AlertForm::SUCCESS, "拒绝退单成功!"); emit showAlert(AlertForm::SUCCESS, "拒绝退单成功!");
...@@ -704,13 +715,13 @@ bool FlowControl::_RefundOrder(const QString &orderId,QString reason) ...@@ -704,13 +715,13 @@ bool FlowControl::_RefundOrder(const QString &orderId,QString reason)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "退单失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "退单失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_ERRCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_ERRCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("退单失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("退单失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}/*else }/*else
{ {
// 通知主界面移动订单 // 通知主界面移动订单
...@@ -747,7 +758,7 @@ void FlowControl::onPullDishes() ...@@ -747,7 +758,7 @@ void FlowControl::onPullDishes()
{ {
if(!m_bLoginResult) if(!m_bLoginResult)
{ {
emit showAlert(AlertForm::ERROR, QString("门店还未登录")); emit showAlert(AlertForm::MSGERROR, QString("门店还未登录"));
return ; return ;
} }
QString error; QString error;
...@@ -765,7 +776,7 @@ void FlowControl::onPullDishes() ...@@ -765,7 +776,7 @@ void FlowControl::onPullDishes()
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "获取平台列表失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "获取平台列表失败![网络错误]");
}else }else
{ {
//recvJson = QJsonDocument::fromJson("{\"statusCode\":100,\"msg\":\"s\",\"channels\":[ {\"code\":\"bdwm\",\"name\":\"百度外卖\",\"status\":1},{\"code\":\"mtwm\",\"name\":\"美团外卖\",\"status\":0},{\"code\":\"eleme2\",\"name\":\"饿了么\",\"status\":1}]}").object(); //recvJson = QJsonDocument::fromJson("{\"statusCode\":100,\"msg\":\"s\",\"channels\":[ {\"code\":\"bdwm\",\"name\":\"百度外卖\",\"status\":1},{\"code\":\"mtwm\",\"name\":\"美团外卖\",\"status\":0},{\"code\":\"eleme2\",\"name\":\"饿了么\",\"status\":1}]}").object();
...@@ -773,7 +784,7 @@ void FlowControl::onPullDishes() ...@@ -773,7 +784,7 @@ void FlowControl::onPullDishes()
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
emit showAlert(AlertForm::ERROR, QString("获取平台列表失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("获取平台列表失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
// 分别获取每个平台的菜品信息 // 分别获取每个平台的菜品信息
...@@ -792,7 +803,7 @@ void FlowControl::onPullDishes() ...@@ -792,7 +803,7 @@ void FlowControl::onPullDishes()
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, QString("获取[%1]菜品信息失败![网络超时]").arg(channelName)); emit showAlert(AlertForm::MSGERROR, QString("获取[%1]菜品信息失败![网络超时]").arg(channelName));
break; break;
}else }else
{ {
...@@ -832,7 +843,7 @@ void FlowControl::onPullDishes() ...@@ -832,7 +843,7 @@ void FlowControl::onPullDishes()
emit iniDishesData(m_dishesMap); emit iniDishesData(m_dishesMap);
}else }else
{ {
emit showAlert(AlertForm::ERROR, QString("未获取到菜品信息!")); emit showAlert(AlertForm::MSGERROR, QString("未获取到菜品信息!"));
} }
} }
} }
...@@ -855,13 +866,13 @@ void FlowControl::onUpdDishes(QString channelCode, QMap<QString, int> dishes) ...@@ -855,13 +866,13 @@ void FlowControl::onUpdDishes(QString channelCode, QMap<QString, int> dishes)
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "同步菜品销售状态失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "同步菜品销售状态失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("同步菜品销售状态失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("同步菜品销售状态失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
emit hideAlert(); emit hideAlert();
...@@ -900,12 +911,12 @@ void FlowControl::onSetStoreOperatingStatus(QString channel, int business_status ...@@ -900,12 +911,12 @@ void FlowControl::onSetStoreOperatingStatus(QString channel, int business_status
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "设置门店营业状态失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "设置门店营业状态失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
emit showAlert(AlertForm::ERROR, QString("设置门店营业状态失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("设置门店营业状态失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
emit hideAlert(); emit hideAlert();
...@@ -918,7 +929,7 @@ void FlowControl::onDailyReport() ...@@ -918,7 +929,7 @@ void FlowControl::onDailyReport()
{ {
if(!m_bLoginResult) if(!m_bLoginResult)
{ {
emit showAlert(AlertForm::ERROR, QString("门店未登录")); emit showAlert(AlertForm::MSGERROR, QString("门店未登录"));
return; return;
} }
QString error; QString error;
...@@ -937,13 +948,13 @@ void FlowControl::onDailyReport() ...@@ -937,13 +948,13 @@ void FlowControl::onDailyReport()
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "获取入账日结失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "获取入账日结失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
result = false; result = false;
emit showAlert(AlertForm::ERROR, QString("获取入账日结失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("获取入账日结失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
recvJson.insert(JSON_STORENAME,m_storeName); recvJson.insert(JSON_STORENAME,m_storeName);
...@@ -1141,7 +1152,7 @@ void FlowControl::onGetBusinessStatus() ...@@ -1141,7 +1152,7 @@ void FlowControl::onGetBusinessStatus()
{ {
if(!m_bLoginResult) if(!m_bLoginResult)
{ {
emit showAlert(AlertForm::ERROR, QString("门店还未登录")); emit showAlert(AlertForm::MSGERROR, QString("门店还未登录"));
return ; return ;
} }
QString error; QString error;
...@@ -1158,12 +1169,12 @@ void FlowControl::onGetBusinessStatus() ...@@ -1158,12 +1169,12 @@ void FlowControl::onGetBusinessStatus()
.arg(result).arg(error, _GetJsonStr(recvJson)); .arg(result).arg(error, _GetJsonStr(recvJson));
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "获取平台营业状态失败![网络错误]"); emit showAlert(AlertForm::MSGERROR, "获取平台营业状态失败![网络错误]");
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
emit showAlert(AlertForm::ERROR, QString("获取平台营业状态失败![%1]").arg(recvJson[JSON_MESSAGE].toString())); emit showAlert(AlertForm::MSGERROR, QString("获取平台营业状态失败![%1]").arg(recvJson[JSON_MESSAGE].toString()));
}else }else
{ {
// 分别获取每个平台的菜品信息 // 分别获取每个平台的菜品信息
...@@ -1185,7 +1196,7 @@ void FlowControl::onGetBusinessStatus() ...@@ -1185,7 +1196,7 @@ void FlowControl::onGetBusinessStatus()
emit initChannelsData(strListChannels); emit initChannelsData(strListChannels);
}else }else
{ {
emit showAlert(AlertForm::ERROR, QString("未获取到平台信息!")); emit showAlert(AlertForm::MSGERROR, QString("未获取到平台信息!"));
} }
} }
} }
......
...@@ -248,6 +248,8 @@ private slots: ...@@ -248,6 +248,8 @@ private slots:
QString _GetIpAddress(); QString _GetIpAddress();
void _AddOrder(const QString& orderId,const QString& channel,const int& pageNumber=1,const int& pageSize=100); void _AddOrder(const QString& orderId,const QString& channel,const int& pageNumber=1,const int& pageSize=100);
void _GetOrder(const QString& orderId,const QString& channel); void _GetOrder(const QString& orderId,const QString& channel);
//点击屏幕指定区域
void _ClickOMSAssignArea();
......
...@@ -140,5 +140,10 @@ QString ConfigManger::GetIpAddress() ...@@ -140,5 +140,10 @@ QString ConfigManger::GetIpAddress()
return m_config->value("IpAddress/ip").toString(); return m_config->value("IpAddress/ip").toString();
} }
QPoint ConfigManger::GetOMSBtnPostion()
{
return m_userConfig->value(INI_OMSBTNPOSTION).toPoint();
}
...@@ -121,6 +121,8 @@ public: ...@@ -121,6 +121,8 @@ public:
QString GetIpAddress(); QString GetIpAddress();
QPoint GetOMSBtnPostion();
private: private:
ConfigManger(); ConfigManger();
ConfigManger(ConfigManger const&); ConfigManger(ConfigManger const&);
......
...@@ -35,22 +35,13 @@ QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &st ...@@ -35,22 +35,13 @@ QJsonObject DataManger::GetLoginData(const QString &partnerId, const QString &st
const QString &stationId, const QString &cashierId, const QString &ipAddress) const QString &stationId, const QString &cashierId, const QString &ipAddress)
{ {
QJsonObject rObj; QJsonObject rObj;
#ifdef TEST
rObj.insert(JSON_IPADDRESS, ipAddress);
rObj.insert(JSON_PARTNERID,"7ba9ce8d-4ffd-4acf-96e6-42a117ad6fe6");
rObj.insert(JSON_ORGCODE, storeId);
rObj.insert(JSON_PASSWORD, password);
rObj.insert(JSON_MACHINECODE, stationId);
//rObj.insert(JSON_USERID, cashierId);
#else
QJsonObject rObj;
rObj.insert(JSON_IPADDRESS, ipAddress); rObj.insert(JSON_IPADDRESS, ipAddress);
rObj.insert(JSON_PARTNERID,partnerId); rObj.insert(JSON_PARTNERID,partnerId);
rObj.insert(JSON_ORGCODE, storeId); rObj.insert(JSON_ORGCODE, storeId);
rObj.insert(JSON_PASSWORD, password); rObj.insert(JSON_PASSWORD, password);
rObj.insert(JSON_MACHINECODE, stationId); rObj.insert(JSON_MACHINECODE, stationId);
//rObj.insert(JSON_USERID, cashierId); //rObj.insert(JSON_USERID, cashierId);
#endif
return rObj; return rObj;
} }
...@@ -58,22 +49,12 @@ QJsonObject DataManger::GetHeartData(const QString &partnerId, const QString &st ...@@ -58,22 +49,12 @@ QJsonObject DataManger::GetHeartData(const QString &partnerId, const QString &st
const QString &stationId, const QString &cashierId, const QString &ipAddress) const QString &stationId, const QString &cashierId, const QString &ipAddress)
{ {
QJsonObject rObj; QJsonObject rObj;
#ifdef TEST
rObj.insert(JSON_IPADDRESS, ipAddress); rObj.insert(JSON_IPADDRESS, ipAddress);
rObj.insert(JSON_PARTNERID,"7ba9ce8d-4ffd-4acf-96e6-42a117ad6fe6"); rObj.insert(JSON_PARTNERID,partnerId);
rObj.insert(JSON_ORGCODE, storeId); rObj.insert(JSON_ORGCODE, storeId);
rObj.insert(JSON_PASSWORD, password); rObj.insert(JSON_PASSWORD, password);
rObj.insert(JSON_MACHINECODE, stationId); rObj.insert(JSON_MACHINECODE, stationId);
//rObj.insert(JSON_USERID, cashierId); //rObj.insert(JSON_USERID, cashierId);
#else
QJsonObject rObj;
rObj.insert(JSON_IPADDRESS, ipAddress);
rObj.insert(JSON_PARTNERID,partnerId);
rObj.insert(JSON_STOREID, storeId);
rObj.insert(JSON_PASSWORD, password);
rObj.insert(JSON_POSNO, stationId);
//rObj.insert(JSON_USERID, cashierId);
#endif
return rObj; return rObj;
} }
...@@ -87,18 +68,10 @@ QJsonObject DataManger::GetPullOrderData(const QString &orderId, const QString & ...@@ -87,18 +68,10 @@ QJsonObject DataManger::GetPullOrderData(const QString &orderId, const QString &
rObj.insert(JSON_PAGENUMBER,pageNumber); rObj.insert(JSON_PAGENUMBER,pageNumber);
rObj.insert(JSON_PAGESIZE,pageSize); rObj.insert(JSON_PAGESIZE,pageSize);
} }
#ifdef TEST
rObj.insert(JSON_BUSINESSID,orderId);
rObj.insert(JSON_CHANNEL, channel);
rObj.insert(JSON_SHOPCODE,storeId);
#else
rObj.insert(JSON_BUSINESSID,orderId); rObj.insert(JSON_BUSINESSID,orderId);
rObj.insert(JSON_CHANNEL, channel); rObj.insert(JSON_CHANNEL, channel);
rObj.insert(JSON_SHOPCODE,storeId); rObj.insert(JSON_SHOPCODE,storeId);
//rObj.insert(JSON_AUTOCONFIRM, autoconfirm); //rObj.insert(JSON_AUTOCONFIRM, autoconfirm);
#endif
return rObj; return rObj;
} }
...@@ -160,19 +133,11 @@ QJsonObject DataManger::GetCompleteOrderData(const QString &orderId) ...@@ -160,19 +133,11 @@ QJsonObject DataManger::GetCompleteOrderData(const QString &orderId)
QJsonObject DataManger::GetRefundOrderData(const QString &reason, const QString &orderId,const QString& channel) QJsonObject DataManger::GetRefundOrderData(const QString &reason, const QString &orderId,const QString& channel)
{ {
QJsonObject rObj; QJsonObject rObj;
#ifdef TEST
rObj.insert(JSON_BUSINESSID, orderId);
rObj.insert(JSON_REASON, reason);
rObj.insert(JSON_CODE, -1);
rObj.insert(JSON_CHANNEL,channel);
rObj.insert(JSON_SHOPCODE, m_storeId);
#else
rObj.insert(JSON_BUSINESSID, orderId); rObj.insert(JSON_BUSINESSID, orderId);
rObj.insert(JSON_REASON, reason); rObj.insert(JSON_REASON, reason);
rObj.insert(JSON_CODE, -1); rObj.insert(JSON_CODE, -1);
rObj.insert(JSON_CHANNEL,channel); rObj.insert(JSON_CHANNEL,channel);
rObj.insert(JSON_SHOPCODE, m_storeId); rObj.insert(JSON_SHOPCODE, m_storeId);
#endif
return rObj; return rObj;
} }
......
...@@ -27,7 +27,7 @@ void AlertForm::SetContent(AlertForm::Type type, const QString &msg) ...@@ -27,7 +27,7 @@ void AlertForm::SetContent(AlertForm::Type type, const QString &msg)
ui->alertLabIng->hide(); ui->alertLabIng->hide();
ui->alertLabError->hide(); ui->alertLabError->hide();
break; break;
case ERROR: case MSGERROR:
ui->alertBtnOk->show(); ui->alertBtnOk->show();
ui->alertLabOk->hide(); ui->alertLabOk->hide();
ui->alertLabIng->hide(); ui->alertLabIng->hide();
......
...@@ -21,7 +21,7 @@ public: ...@@ -21,7 +21,7 @@ public:
typedef enum typedef enum
{ {
SUCCESS=0, SUCCESS=0,
ERROR, MSGERROR,
LOADING LOADING
}Type; }Type;
......
...@@ -385,27 +385,25 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus) ...@@ -385,27 +385,25 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
table->setItem(0, 5, item5); // 下单时间 table->setItem(0, 5, item5); // 下单时间
if(table != ui->mainTableFinsh && table != ui->mainTableOther) if(table != ui->mainTableFinsh && table != ui->mainTableOther)
{ {
QWidget *pWdg = new QWidget(table);
QHBoxLayout *hLayout = new QHBoxLayout(pWdg);
QPushButton * pBtn = new QPushButton(pWdg);
pBtn->setFixedSize(70, 30);
pBtn->setFocusPolicy(Qt::NoFocus);
pBtn->setObjectName("mainProcBtn");
pBtn->setProperty("orderId", orderObject->order_id);
pBtn->setProperty("operation", table->property("operation").toString());
pBtn->setText(table->property("operationName").toString());
hLayout->addWidget(pBtn);
hLayout->setMargin(0);
pWdg->setLayout(hLayout);
#ifdef TODO
if(!table->property("operationName").toString().compare("接单")) if(!table->property("operationName").toString().compare("接单"))
{ {
QWidget *pWdg = new QWidget(table);
QHBoxLayout *hLayout = new QHBoxLayout(pWdg);
QPushButton * pBtn = new QPushButton(pWdg);
pBtn->setFixedSize(70, 30);
pBtn->setFocusPolicy(Qt::NoFocus);
pBtn->setObjectName("mainProcBtn");
pBtn->setProperty("orderId", orderObject->order_id);
pBtn->setProperty("operation", table->property("operation").toString());
pBtn->setText(table->property("operationName").toString());
hLayout->addWidget(pBtn);
hLayout->setMargin(0);
pWdg->setLayout(hLayout);
table->setCellWidget(0, 6, pWdg); // 操作按钮 table->setCellWidget(0, 6, pWdg); // 操作按钮
connect(pBtn, &QPushButton::clicked, this, &MainForm::onMainProcBtnClicked);
} }
#else
table->setCellWidget(0, 6, pWdg);
#endif
connect(pBtn, &QPushButton::clicked, this, &MainForm::onMainProcBtnClicked);
} }
QString btnText = QString("%1\n%2").arg(table->rowCount()).arg(tabBtn->property("name").toString()); QString btnText = QString("%1\n%2").arg(table->rowCount()).arg(tabBtn->property("name").toString());
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define INI_LOGINSERVER "FmServer/loginUrl" #define INI_LOGINSERVER "FmServer/loginUrl"
#define INI_ORDERSERVER "FmServer/orderUrl" #define INI_ORDERSERVER "FmServer/orderUrl"
#define INI_PRINTERNAME "Printer/name" #define INI_PRINTERNAME "Printer/name"
#define INI_OMSBTNPOSTION "OmsBtn/postion"
#define INI_FLOATPOSTION "Float/postion" #define INI_FLOATPOSTION "Float/postion"
#define INI_FLOATOPACITY "Float/opacity" #define INI_FLOATOPACITY "Float/opacity"
#define INI_BLINKINTERVAL "Float/blinkInterval" #define INI_BLINKINTERVAL "Float/blinkInterval"
......
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