Commit 16301962 by xiaoqing.gu

同上

parent 77bdee3b
......@@ -1228,15 +1228,15 @@ bool NewPrintLib::DoLabelModelPrint(const QString &config, const QString &contex
// prdObj.insert("prt_property", property_tags);
// prdObj.insert("prt_sendtimes", sendtimes);
// prdObj.insert("prt_store", order->store_name);
prdObj.insert("code", order->code);
prdObj.insert("order_index", QString::number(order->order_index));
prdObj.insert("code", QString("\xE3\x80\x90") + order->code + QString("\xE3\x80\x91"));
prdObj.insert("order_index", QString::fromLocal8Bit("#") + QString::number(order->order_index));
prdObj.insert("order_type_desc", order->order_type_desc);
prdObj.insert("source_order_desc", source_order_desc);
prdObj.insert("datetime", datetime);
prdObj.insert("current_index", index);
prdObj.insert("allprod_num", allprod);
prdObj.insert("prod_name", prodname);
prdObj.insert("prod_price", QString::number(dish->price/100.0, 'f', 2));
prdObj.insert("prod_price", QString("\xEF\xBF\xA5") + QString::number(dish->price/100.0, 'f', 2));
prdObj.insert("property_tags", property_tags);
prdObj.insert("sendtimes", inviteTime);
prdObj.insert("store_name", order->store_name);
......
#include "drivercancelordergetwork.h"
DriverCancelOrderGetWork::DriverCancelOrderGetWork()
#include "event/fmapplication.h"
#include "event/posevent.h"
#include "QsLog.h"
#include <QJsonArray>
#include "model/posorderpool.h"
DriverCancelOrderGetWork::DriverCancelOrderGetWork(WorkObject *parent) : WorkObject(parent)
{
FMApplication::subscibeEvent(this, PosEvent::s_token_change);
FMApplication::subscibeEvent(this, PosEvent::s_login_storeinfo);
FMApplication::subscibeEvent(this, PosEvent::s_driver_cancel_order);
}
DriverCancelOrderGetWork::~DriverCancelOrderGetWork()
{
qDebug() << "";
while(!_stoped)
{
_stopflag = true;
emit quit();
EVENTWAIT(10);
}
}
bool DriverCancelOrderGetWork::event(QEvent *e)
{
if(e->type() == PosEvent::s_token_change)
{
QString token;
GETEVENTINFO(token, e, QString);
QLOG_DEBUG() << "DriverCancelOrderGetWork::event::PosEvent::s_token_chang:" << token;
_token = token;
emit quit();
return true;
}
if(e->type() == PosEvent::s_login_storeinfo)
{
QVariantMap storeinfo;
GETEVENTINFO(storeinfo,e,QVariantMap);
QLOG_DEBUG() << "DriverCancelOrderGetWork::event::PosEvent::s_login_storeinfo:" << storeinfo;
_storeinfo = storeinfo;
return true;
}
if(e->type() == PosEvent::s_driver_cancel_order)
{
QLOG_INFO() << QThread::currentThreadId() << "DriverCancelOrderGetWork PosEvent::s_need_get_order";
QVariantMap map;
GETEVENTINFO(map,e,QVariantMap);
_orderid = map["order_id"].toString();
emit quitwork();
return true;
}
return WorkObject::event(e);
}
void DriverCancelOrderGetWork::setUrl(const QString &url)
{
_url = url;
}
void DriverCancelOrderGetWork::workstart()
{
if(_token.isEmpty())
{
QEventLoop loop;
connect(this, &DriverCancelOrderGetWork::quit, &loop, &QEventLoop::quit);
loop.exec();
}
QEventLoop loop;
connect(this, &DriverCancelOrderGetWork::quitwork, &loop, &QEventLoop::quit);
connect(this, &DriverCancelOrderGetWork::quit, &loop, &QEventLoop::quit);
loop.exec();
while(!_stopflag)
{
if(!getDriverCancelOrder())
{
QLOG_WARN() << "DriverCancelOrderGetWork::getDriverCancelOrder failed wait " << DEFAULT_STALLS_TIMEOUT;
QTimer timer;
QEventLoop loop;
connect(this, &DriverCancelOrderGetWork::quit, &loop, &QEventLoop::quit);
connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
timer.start(DEFAULT_STALLS_TIMEOUT);
loop.exec();
continue;
}
//获取档口信息完成后检擦是否退出表示
if(_stopflag)
break;
QEventLoop loop;
connect(this, &DriverCancelOrderGetWork::quit, &loop, &QEventLoop::quit);
connect(this, &DriverCancelOrderGetWork::quitwork, &loop, &QEventLoop::quit);
loop.exec();
}
_stoped = true;
}
bool DriverCancelOrderGetWork::getDriverCancelOrder()
{
QJsonObject json, recvjson;
QString realurl;
QString error;
if(!GetDriverCancelOrderDataProcess::getDriverInfoRequest(json, _storeinfo, _orderid))
{
QLOG_ERROR() << "getDriverInfoRequest failed";
return false;
}
QLOG_INFO() << "getDriverInfoRequest request json : " << json;
if(!GetDriverCancelOrderDataProcess::getRealUrl(ADVANCEORDER, json, _url, realurl))
{
QLOG_ERROR() << "GetDriverInfoDataProcess getRealUrl failed";
return false;
}
QLOG_INFO() << "GetDriverInfoDataProcess request url :" << realurl;
if(!this->S_Request(json, recvjson, realurl, error))
{
QLOG_ERROR() << "getDriverInfo failed : " << error;
return false;
}
QLOG_INFO() << "getDriverInfo return json : " << recvjson;
return praseRecvJson(recvjson);
}
bool DriverCancelOrderGetWork::praseRecvJson(QJsonObject &json)
{
if(!json.contains(JSON_KEY_CODE) || QString("ok").compare(json[JSON_KEY_CODE].toString(), Qt::CaseInsensitive) != 0)
{
QLOG_ERROR() << "DriverCancelOrderGetWork::praseRecvJson failed";
return false;
}
if(!json.contains(JSON_KEY_RESULT))
{
QLOG_ERROR() << "DriverCancelOrderGetWork::praseRecvJson failed";
return false;
}
QJsonObject result = json[JSON_KEY_RESULT].toObject();
if(result.contains("delivery_status") && result["delivery_status"].toInt() == 7 && result.contains("delivery_desc"))
{
QVariantMap map;
map.insert("order_id", result["order_id"].toString());
map.insert("delivery_desc", result["delivery_desc"].toString());
map.insert("rider_name", result["courier_name"].toString());
map.insert("rider_phone", result["courier_phone"].toString());
POSTEVENTTYPE(PosEvent::s_driver_cancel_reason, map, QVariantMap);
}else {
return false;
}
return true;
}
#ifndef DRIVERCANCELORDERGETWORK_H
#define DRIVERCANCELORDERGETWORK_H
#include <QEvent>
#include <QString>
#include <QJsonObject>
#include <QTimer>
#include <QEventLoop>
#include "workobject.h"
#include "preDefine.h"
#include "base/Arithmetic/cretopt.h"
class DriverCancelOrderGetWork
#define ADVANCEORDER 0
class DriverCancelOrderGetWork : public WorkObject
{
Q_OBJECT
public:
DriverCancelOrderGetWork();
explicit DriverCancelOrderGetWork(WorkObject *parent = 0);
~DriverCancelOrderGetWork();
bool event(QEvent *e);
void setUrl(const QString &url);
signals:
void quitwork();
public slots:
void workstart();
private:
bool getDriverCancelOrder();
bool praseRecvJson(QJsonObject &json);
private:
QVariantMap _storeinfo;
QString _orderid;
QString _token;
QString _url;
};
class GetDriverCancelOrderDataProcess
{
public:
friend class DriverCancelOrderGetWork;
private:
static bool getAction(int REQ, QString &action)
{
#ifndef USE_QAACTION
switch (REQ)
{
case ADVANCEORDER:
action = QString("saas.order.getDetail");
return true;
default:
return false;
}
#else
switch (REQ)
{
case ADVANCEORDER:
action = QString("qasaas.order.getDetail");
return true;
default:
return false;
}
#endif
}
static bool getAccess_Token(QString &access_toekn)
{
access_toekn = DEFAULT_ACCESS_TOKEN;
return true;
}
static bool getVer(QString &ver)
{
ver = "1";
return true;
}
static bool getRealUrl(int reqtype, const QJsonObject &json, const QString &url, QString &realurl)
{
QString action, access_token, ver, sign;
if(!GetDriverCancelOrderDataProcess::requestGetRSASign(reqtype, json, sign, action, access_token, ver))
return false;
QString tmpurl = url;
realurl = tmpurl.arg(action, access_token, ver, sign);
return true;
}
static bool requestGetRSASign(int reqtype, const QJsonObject &json, QString &sign, QString &action, QString &access_token, QString &ver)
{
QJsonObject tmpjson;
if(!GetDriverCancelOrderDataProcess::getAction(reqtype, action) ||
!GetDriverCancelOrderDataProcess::getAccess_Token(access_token) ||
!GetDriverCancelOrderDataProcess::getVer(ver))
return false;
GetDriverCancelOrderDataProcess::getComplateJson(action, access_token, ver, json, tmpjson);
return CretOperate::GetSign(tmpjson, sign);
}
static void getComplateJson(QString action, QString access_token, QString ver, const QJsonObject &json, QJsonObject &complatejson)
{
complatejson = json;
complatejson.insert(JSON_KEY_ACTION, action);
complatejson.insert(JSON_KEY_ACCESS_TOKEN, access_token);
complatejson.insert(JSON_KEY_VER, ver);
}
static bool getDriverInfoRequest(QJsonObject &data, QVariantMap &map, QString &orderid)
{
if(!map.contains(JSON_STOREID)) {
return false;
}
data.insert(JSON_KEY_PARTNERID, map[JSON_KEY_PARTNERID].toString());
data.insert(JSON_STOREID, map[JSON_STOREID].toString());
data.insert(JSON_ORDERID, orderid);
data.insert(JSON_KEY_SOURCE, "");
return true;
}
};
#endif // DRIVERCANCELORDERGETWORK_H
\ No newline at end of file
#endif // DRIVERCANCELORDERGETWORK_H
......@@ -8,6 +8,7 @@
#include <QEventLoop>
#include "workobject.h"
#include "preDefine.h"
#include "model/posorderpool.h"
#include "base/Arithmetic/cretopt.h"
#define ADVANCEORDER 0
......
......@@ -428,9 +428,9 @@ bool OrderEntryWork::insertXSMXXXtable(OrderObject order,QString &error)
QString XH = order.order_id + QString("_") + QString::number(m_index);
QString XSDH = order.order_id;
QString XMBH = product->stock_barcode;
QString XMBH = product->product_code;
QString XMMC = product->name;
QString TM = product->stock_barcode;
QString TM = product->product_code;
QString DW = getDW(XMBH);
double YSJG = product->price/100.00;
double XSJG = product->price/100.00;
......@@ -456,6 +456,7 @@ bool OrderEntryWork::insertXSMXXXtable(OrderObject order,QString &error)
QLOG_DEBUG() << "INSERT XSMXXX TABLE" << SSLBBM;
QString SFXS = "1";
QSqlQuery query;
QString str = QString("INSERT INTO XSMXXX (XH,XSDH,XMBH,XMMC,TM,DW"
",YSJG,XSJG,SL,XSJEXJ,FTJE,SYYXM,SSLBBM,SFXS) VALUES ("
......
......@@ -422,17 +422,21 @@ void OrderGetWork::optOrderWithType(const QVariantMap &map)
OrderObject localorder;
int order_type = -1;
int delivery_status;
if(PosOrderPool::GetOrderObject(orderid, localorder))
{
order_type = localorder.order_type;
delivery_status = localorder.delivery_status;
}
//2019/5/6新增需求:接单、退单、同意退款、拒绝退款等操作的请求中加入source字段,source是拉单的channel字段
json.insert(JSON_KEY_SOURCE, localorder.channel);
QLOG_INFO() << "optOrderWithType request : " << json;
QLOG_DEBUG() << "order type : " << order_type << "opt type : " << type;
QLOG_DEBUG() << "order type : " << order_type << "opt type : " << type << "delivery_status" << delivery_status;
OrderGetDataProcess::getRequestType(status, type, order_type);
OrderGetDataProcess::getRequestType(status, type, delivery_status, order_type);
QLOG_INFO() << "optOrderWithType status and reqtype : " << status << type;
......@@ -601,10 +605,20 @@ void OrderGetWork::optOrder(const QJsonArray &orders)
orderObject.setStore_phone(_storeinfo[LOGIN_STORE_PHONE].toString());
}
QLOG_DEBUG() << "----------------------------:" << orderObject.delivery_time;
QLOG_DEBUG() << "----------------------------:" << orderObject.delivery_time << orderObject.delivery_status;
//PosOrderPool::TryInsertOrder(orderObject);
POSTEVENTTYPE(PosEvent::s_inset_orderpool,orderObject,OrderObject);
if(orderObject.delivery_status == 7)
{
QVariantMap map;
map.insert("order_id", orderObject.order_id);
map.insert("delivery_desc", orderObject.delivery_desc);
map.insert("rider_name", orderObject.courier_name);
map.insert("rider_phone", orderObject.courier_phone);
POSTEVENTTYPE(PosEvent::s_driver_cancel_reason, map, QVariantMap);
}
}
}
......
......@@ -37,6 +37,7 @@
#define FMH_GETRORDER 32
//
#define FMH_MAKEOVER 10
#define FMH_ABNORMAL_SENDOUT 11
//...
......@@ -268,7 +269,7 @@ private:
complatejson.insert(JSON_KEY_VER, ver);
}
static void getRequestType(QString status, int &reqtype, int order_type = -1)
static void getRequestType(QString status, int &reqtype,int delivery_status, int order_type = -1)
{
reqtype = -1;
......@@ -277,7 +278,15 @@ private:
if(status.compare(OPERATION_REFUSE, Qt::CaseInsensitive) == 0)
reqtype = FMH_REFUSE;
if(status.compare(OPERATION_SENDOUT, Qt::CaseInsensitive) == 0)
{
// if(delivery_status == 7)
// {
// reqtype = FMH_ABNORMAL_SENDOUT;
// }else{
// reqtype = FMH_SENDOUT;
// }
reqtype = FMH_SENDOUT;
}
if(status.compare(OPERATION_COMPLETE, Qt::CaseInsensitive) == 0)
reqtype = FMH_COMPLETE;
if(status.compare(OPERATION_REFUSEREFUND, Qt::CaseInsensitive) == 0)
......@@ -325,6 +334,9 @@ private:
case FMH_REFUNDORDER:
action = QString("saas.refund.agree");
return true;
// case FMH_ABNORMAL_SENDOUT:
// action = QString("saas.dispatch.finish");
// return true;
case FMH_GETRORDER:
action = QString("saas.order.get");
return true;
......@@ -364,6 +376,9 @@ private:
case FMH_REFUNDORDER:
action = QString("qasaas.refund.agree");
return true;
// case FMH_ABNORMAL_SENDOUT:
// action = QString("qasaas.dispatch.finish");
// return true;
case FMH_GETRORDER:
action = QString("qasaas.order.get");
return true;
......
......@@ -11,6 +11,7 @@
#include "event/fmapplication.h"
#include "base/Network/billSocket.h"
#include "model/posorderpool.h"
#include "QsLog.h"
......@@ -469,11 +470,25 @@ bool OrderPushWork::checkMsgData(const QByteArray &msgdata)
QJsonDocument document = QJsonDocument::fromJson(msgdata);
QJsonObject object = document.object();
QJsonObject content = object["content"].toObject();
QLOG_DEBUG() << "deliveryStatus" << content["deliveryStatus"].toInt();
if(content.contains("deliveryStatus") && content["deliveryStatus"].toInt() == 2)
{
//推送拉取骑手信息事件
DEFAULTPOSTEVENT(PosEvent::s_need_get_driver_info, QString::fromUtf8(msgdata));
}
else if(content.contains("deliveryStatus") && content["deliveryStatus"].toInt() == 7)
{
int status;
PosOrderPool::GetDriverStatus(content["oid"].toString(),status);
if(status != 7)
{
//推送骑手取消订单事件
QVariantMap map;
map.insert("order_id", content["oid"].toString());
POSTEVENTTYPE(PosEvent::s_driver_cancel_order,map,QVariantMap);
}
}
else
{
//推送新订单事件
......
......@@ -33,6 +33,9 @@ QEvent::Type PosEvent::s_get_prtmodel = static_cast<QEvent::Type>(QEvent::regist
QEvent::Type PosEvent::s_driver_order_status = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_need_get_driver_info = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_driver_cancel_order = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_driver_cancel_reason = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_show_driver_cancel = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_show_pickup = static_cast<QEvent::Type>(QEvent::registerEventType());
QEvent::Type PosEvent::s_hide_loading = static_cast<QEvent::Type>(QEvent::registerEventType());
......
......@@ -120,7 +120,11 @@ public:
//---------------------第三方配送---------------------
static Type s_driver_order_status; //拉取到骑手信息并缓存后,推送事件,展示界面响应事件,展示图标
static Type s_get_driver_info; //登陆拉取骑手信息后,推送事件,posorderpool响应事件,将骑手信息缓存
static Type s_need_get_driver_info; //收到消息中心推送的cmd=5的消息的时候,推送的事件
static Type s_need_get_driver_info; //收到消息中心推送的cmd=6的消息的时候,推送的事件
static Type s_driver_cancel_order; //骑手取消订单的消息
static Type s_driver_cancel_reason; //骑手取消原因存储
static Type s_show_driver_cancel;
//---------------------长按悬浮框显示扫码点餐界面--------
static Type s_show_pickup;
......
......@@ -19,6 +19,7 @@
#include "control/networkcheckwork.h"
#include "control/driverinfogetwork.h"
#include "control/orderentrywork.h"
#include "control/drivercancelordergetwork.h"
#include "base/Dump/dump.h"
#include "base/DB/fm_database.h"
//#include "view/loginform.h"
......@@ -166,6 +167,8 @@ int main(int argc, char *argv[])
QThread prtModelThread;
//获取骑手信息线程
QThread driverInfoThread;
//获取骑手拒单信息线程
QThread driverCancelThread;
QLOG_INFO() << "Thread List :" << &thread << &threadt << QThread::currentThread();
//初始化打印文件
InitPtr();
......@@ -200,10 +203,13 @@ int main(int argc, char *argv[])
//拉取骑手信息
DriverInfoGetWork driverinfogetwork;
DriverCancelOrderGetWork drivercancelordergetwork;
//网络超时工作
NetworkCheckWork networkcheckwork;
driverinfogetwork.setUrl(geturl);
drivercancelordergetwork.setUrl(geturl);
prtmodelgetwork.setUrl(geturl);
stallsgetwork.setUrl(geturl);
pickuporderwork.setUrl(geturl);
......@@ -226,6 +232,7 @@ int main(int argc, char *argv[])
prtmodelgetwork.moveToThread(&prtModelThread, true);
// entrywork.moveToThread(&prtModelThread, false);
driverinfogetwork.moveToThread(&driverInfoThread, true);
drivercancelordergetwork.moveToThread(&driverCancelThread, true);
//启动tcp长链接和拉单工作流
thread.start();
threadt.start();
......@@ -236,6 +243,7 @@ int main(int argc, char *argv[])
stallsThread.start();
prtModelThread.start();
driverInfoThread.start();
driverCancelThread.start();
//界面类定义及初始化
#ifndef FM_NEW_UI
MainForm mainform;
......
......@@ -608,3 +608,13 @@ void OrderObject::setOrdertypedesc(const QString &v)
{
order_type_desc = v;
}
QString OrderObject::getDeliverydesc() const
{
return delivery_desc;
}
void OrderObject::setDeliverydesc(const QString &v)
{
delivery_desc = v;
}
......@@ -76,6 +76,7 @@ public:
Q_PROPERTY (QString code READ getCode WRITE setCode)
Q_PROPERTY (QString order_type_desc READ getOrdertypedesc WRITE setOrdertypedesc)
Q_PROPERTY (QString delivery_desc READ getDeliverydesc WRITE setDeliverydesc)
Q_PROPERTY (QJsonObject _orderObject READ getOrderObject WRITE setOrderObject)
......@@ -135,6 +136,7 @@ public:
QString store_phone; //门店点哈
QString order_type_desc;
QString delivery_desc;
QString getStore_phone() const;
void setStore_phone(const QString &value);
......@@ -257,6 +259,8 @@ protected:
void setrecords(const QStringList& v);
QString getOrdertypedesc() const;
void setOrdertypedesc(const QString& v);
QString getDeliverydesc() const;
void setDeliverydesc(const QString& v);
};
#endif // ORDEROBJECT_H
......@@ -48,6 +48,8 @@ PosOrderPool::PosOrderPool(QObject *parent) : QObject(parent)
FMApplication::subscibeEvent(this, PosEvent::s_location_orderpool);
FMApplication::subscibeEvent(this, PosEvent::s_pickuporder_remind);
FMApplication::subscibeEvent(this, PosEvent::s_get_driver_info);
FMApplication::subscibeEvent(this, PosEvent::s_driver_cancel_order);
FMApplication::subscibeEvent(this, PosEvent::s_driver_cancel_reason);
loadOrders();
......@@ -300,6 +302,7 @@ bool PosOrderPool::TryChangeOrderStatus(QString key, int order_status, int refun
info.rider_name = tmpinfo.rider_name;
info.rider_phone = tmpinfo.rider_phone;
info.order_change_time = QDateTime::currentDateTime().toTime_t();
s_order_pool.insert(key, info);
......@@ -381,6 +384,8 @@ bool PosOrderPool::GetOrderObject(QString key, OrderObject &order)
order = info.order_data;
QLOG_DEBUG() << "GetOrderObject:" << order.delivery_status;
return true;
}
......@@ -429,7 +434,7 @@ bool PosOrderPool::GetOrderStatusAndOrderType(QString key, int &status, int &ref
return true;
}
bool PosOrderPool::GetDriverInfo(QString key, QString &rider_name, QString &rider_phone)
bool PosOrderPool::GetDriverInfo(QString key, QString &rider_name, QString &rider_phone, QString &rider_reason)
{
QMutexLocker loker(&s_mutex);
......@@ -442,7 +447,9 @@ bool PosOrderPool::GetDriverInfo(QString key, QString &rider_name, QString &ride
rider_phone = info.rider_phone;
QLOG_DEBUG() << "GetDriverInfo" << key << rider_name << rider_phone;
rider_reason = info.driver_cancel_reason;
QLOG_DEBUG() << "GetDriverInfo" << key << rider_name << rider_phone << rider_reason;
return true;
}
......@@ -517,7 +524,7 @@ bool PosOrderPool::TryChangeDriverInfo(QString &key, QVariantMap &map)
QLOG_DEBUG() << "TryChangeDriverInfo:" << info.driver_order_status;
if(info.driver_order_status != 1)
if(info.driver_order_status != 1 && info.driver_order_status != 7)
{
info.driver_order_status = 1;
info.rider_name = map["rider_name"].toString();
......@@ -538,6 +545,53 @@ bool PosOrderPool::TryChangeDriverInfo(QString &key, QVariantMap &map)
return true;
}
bool PosOrderPool::TryChangeDriverCancelInfo(QString &key, QVariantMap &map)
{
QMutexLocker loker(&s_mutex);
QLOG_DEBUG() << "s_order_pool:" << key << s_order_pool.keys();
if(!s_order_pool.contains(key))
{
QLOG_DEBUG() << "TryChangeDriverCancelInfo failed!";
return false;
}
Order_Info info = s_order_pool[key];
QLOG_DEBUG() << "TryChangeDriverCancelInfo:" << info.driver_order_status;
// if(info.driver_order_status != 1)
// {
// info.driver_order_status = 1;
// info.rider_name = map["rider_name"].toString();
// info.rider_phone = map["rider_phone"].toString();
// s_order_pool.insert(key, info);
// QLOG_DEBUG() << "s_order_pool::KEY" << s_order_pool[key].driver_order_status;
// DEFAULTPOSTEVENT(PosEvent::s_driver_order_status, key);
// QVariantMap map;
// map.insert(EVENT_KEY_ORDERID, info.order_id);
// map.insert(EVENT_KEY_DRIVER_STATUS, 1);
// POSTEVENTTYPE(PosEvent::s_driver_order_status, map, QVariantMap);
// }
// if(info.driver_order_status == 7)
// {
// return true;
// }
info.driver_order_status = 7;
info.rider_name = map["rider_name"].toString();
info.rider_phone = map["rider_phone"].toString();
info.driver_cancel_reason = map["delivery_desc"].toString();
s_order_pool.insert(key, info);
DEFAULTPOSTEVENT(PosEvent::s_show_driver_cancel, key);
return true;
}
bool PosOrderPool::GetOrderBaseInfo(QString key, QVariantHash &hash)
{
......@@ -800,6 +854,27 @@ bool PosOrderPool::event(QEvent *e)
return true;
}
// if(e->type() == PosEvent::s_driver_cancel_order)
// {
// QLOG_INFO() << "PosEvent::s_driver_cancel_order : " << QThread::currentThreadId();
// QVariantMap map;
// GETEVENTINFO(map,e,QVariantMap);
// TryChangeDriverCancelInfo(map["order_id"].toString(), map);
// }
if(e->type() == PosEvent::s_driver_cancel_reason)
{
QLOG_INFO() << "PosEvent::s_driver_cancel_reason : " << QThread::currentThreadId();
QVariantMap map;
GETEVENTINFO(map,e,QVariantMap);
TryChangeDriverCancelInfo(map["order_id"].toString(), map);
}
return QObject::event(e);
}
......
......@@ -192,6 +192,8 @@ typedef struct
QString rider_name;
//骑手电话
QString rider_phone;
//骑手拒单原因
QString driver_cancel_reason;
} Order_Info;
......@@ -222,7 +224,7 @@ public:
static bool GetOrderStatusAndOrderType(QString key, int &status, int &refund_status, int &order_type, bool &oldorder);
static bool GetDriverInfo(QString key, QString &rider_name, QString &rider_phone);
static bool GetDriverInfo(QString key, QString &rider_name, QString &rider_phone, QString &rider_reason);
static bool GetDriverStatus(QString key, int &status);
......@@ -261,6 +263,9 @@ private:
//修改骑手接单状态
static bool TryChangeDriverInfo(QString &key, QVariantMap &map);
//修改骑手拒单原因
static bool TryChangeDriverCancelInfo(QString &key, QVariantMap &map);
static void removeOrderInfo(QString key);
static void GetOrderStatus(const OrderObject *order, int &status);
......
......@@ -118,3 +118,13 @@ void ProductObject::setstock_barcode(const QString &v)
{
stock_barcode = v;
}
QString ProductObject::getproduct_code() const
{
return product_code;
}
void ProductObject::setproduct_code(const QString &v)
{
product_code = v;
}
......@@ -21,6 +21,7 @@ public:
Q_PROPERTY (int product_amount READ getProductAmount WRITE setProductAmount)
Q_PROPERTY (int cost READ getcost WRITE setcost)
Q_PROPERTY (QString stock_barcode READ getstock_barcode WRITE setstock_barcode)
Q_PROPERTY (QString product_code READ getproduct_code WRITE setproduct_code)
QString property_tags;
QString pid;
......@@ -29,6 +30,7 @@ public:
int price;
int product_amount;
QString stock_barcode;
QString product_code;
QList<ProductObject*> sub_products;//子商品
int cost; //是否是优惠卷
......@@ -60,6 +62,9 @@ protected:
QString getstock_barcode() const;
void setstock_barcode(const QString &v);
QString getproduct_code() const;
void setproduct_code(const QString &v);
};
#endif // PRODUCTOBJECT_H
......@@ -89,7 +89,8 @@ SOURCES += \
$$PWD/control/driverinfogetwork.cpp \
$$PWD/view/newfloatform.cpp \
view/frminput.cpp \
control/orderentrywork.cpp
control/orderentrywork.cpp \
control/drivercancelordergetwork.cpp
HEADERS += \
$$PWD/event/fmapplication.h \
......@@ -151,7 +152,8 @@ HEADERS += \
$$PWD/control/driverinfogetwork.h \
$$PWD/view/newfloatform.h \
view/frminput.h \
control/orderentrywork.h
control/orderentrywork.h \
control/drivercancelordergetwork.h
DISTFILES += $$PWD/takeout.rc
......
......@@ -28,21 +28,33 @@ void AlertForm::SetContent(AlertForm::Type type, const QString &msg)
ui->alertLabOk->show();
ui->alertLabIng->hide();
ui->alertLabError->hide();
ui->alertLabWarn->hide();
break;
case ERROR:
ui->alertBtnOk->show();
ui->alertLabOk->hide();
ui->alertLabIng->hide();
ui->alertLabError->show();
ui->alertLabWarn->hide();
break;
case LOADING:
ui->alertBtnOk->hide();
ui->alertLabOk->hide();
ui->alertLabIng->show();
ui->alertLabError->hide();
ui->alertLabWarn->hide();
break;
case WARNING:
ui->alertBtnOk->show();
ui->alertLabOk->hide();
ui->alertLabIng->hide();
ui->alertLabError->hide();
ui->alertLabWarn->show();
}
ui->alertLabMsg->setText(msg);
ui->alertLabMsg->setWordWrap(true);
return;
}
......
......@@ -21,7 +21,8 @@ public:
{
SUCCESS=0,
ERROR,
LOADING
LOADING,
WARNING
}Type;
......
......@@ -6,13 +6,19 @@
<rect>
<x>0</x>
<y>0</y>
<width>295</width>
<width>310</width>
<height>273</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true">#alertLabWarn
{
border-image: url(:pickupwar.png);
}</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
......@@ -31,16 +37,7 @@
</property>
<item row="0" column="0">
<widget class="QWidget" name="alertWdg" native="true">
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,0">
<property name="spacing">
<number>5</number>
</property>
<property name="topMargin">
<number>25</number>
</property>
<property name="bottomMargin">
<number>25</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
......@@ -63,6 +60,25 @@
</widget>
</item>
<item>
<widget class="QLabel" name="alertLabWarn">
<property name="minimumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>68</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="alertLabOk">
<property name="minimumSize">
<size>
......
......@@ -39,8 +39,9 @@ void NewDetailForm::InitData(OrderObject *orderObject, bool flag)
QString rider_name = "";
QString rider_phone = "";
PosOrderPool::GetDriverInfo(_orderid, rider_name, rider_phone);
QLOG_DEBUG() << "driverinfo" << rider_name << rider_phone;
QString rider_reason = "";
PosOrderPool::GetDriverInfo(_orderid, rider_name, rider_phone, rider_reason);
QLOG_DEBUG() << "driverinfo" << rider_name << rider_phone << rider_reason;
//ui->detailBtn1->hide();
......@@ -120,9 +121,9 @@ void NewDetailForm::InitData(OrderObject *orderObject, bool flag)
}
//ui->deliveryInfoLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】").arg(orderObject->delivery_party,timeStr));
if(!rider_name.isEmpty() || !rider_phone.isEmpty())
if(!rider_name.isEmpty() || !rider_phone.isEmpty() || !rider_reason.isEmpty())
{
ui->deliverydriverLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】").arg(rider_name, rider_phone));
ui->deliverydriverLb_dec->setText(QString::fromLocal8Bit("【%1】【%2】【%3】").arg(rider_name, rider_phone, rider_reason));
ui->deliverydriverLb_dec->setWordWrap(true);
}
else
......
......@@ -35,6 +35,7 @@ NewFloatForm::NewFloatForm(QWidget *parent) :
FMApplication::subscibeEvent(this, PosEvent::s_login_status);
FMApplication::subscibeEvent(this, PosEvent::s_network_outtime);
FMApplication::subscibeEvent(this, PosEvent::s_pickuporder_remind);
FMApplication::subscibeEvent(this, PosEvent::s_driver_cancel_order);
m_bReminding = false;
......@@ -260,6 +261,12 @@ bool NewFloatForm::event(QEvent *e)
return true;
}
if(e->type() == PosEvent::s_driver_cancel_order)
{
onStartRemind(3);
return true;
}
return QWidget::event(e);
}
......@@ -641,6 +648,36 @@ void NewFloatForm::onStartRemind(int type)
ui->widget_base_frame->show();
}
// ui->label_back_newmsg->setText(QString::fromLocal8Bit("网络异常"));
case 3:
if(ui->widget_back_synshow->isHidden() && m_is_login && ui->widget_front_synshow->isHidden())
{
if(pos().x() > tmpdesktopSize.width() - 2*(ui->widget_base->width()))
{
ui->widget_front_synshow->show();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("骑手取消订单"));
ui->label_front_newmsg->setWordWrap(true);
} else {
ui->widget_back_synshow->show();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("骑手取消订单"));
ui->label_back_newmsg->setWordWrap(true);
}
if(!ui->widget_base_frame->isHidden())
ui->widget_base_frame->hide();
}
else if(!ui->widget_back_synshow->isHidden() && m_is_login)
{
// ui->widget_back_synshow->hide();
ui->label_back_newmsg->setText(QString::fromLocal8Bit("骑手取消订单"));
ui->label_back_newmsg->setWordWrap(true);
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
} else if(!ui->widget_front_synshow->isHidden() && m_is_login) {
// ui->widget_front_synshow->hide();
ui->label_front_newmsg->setText(QString::fromLocal8Bit("骑手取消订单"));
ui->label_front_newmsg->setWordWrap(true);
if(ui->widget_base_frame->isHidden())
ui->widget_base_frame->show();
}
}
if(m_bReminding)
......
......@@ -51,6 +51,9 @@ NewMainForm::NewMainForm(QWidget *parent) :
FMApplication::subscibeEvent(this, PosEvent::s_show_stalls);
FMApplication::subscibeEvent(this,PosEvent::s_driver_order_status);
FMApplication::subscibeEvent(this,PosEvent::s_show_pickup);
FMApplication::subscibeEvent(this, PosEvent::s_driver_cancel_order);
FMApplication::subscibeEvent(this, PosEvent::s_driver_cancel_reason);
FMApplication::subscibeEvent(this, PosEvent::s_show_driver_cancel);
//this->show();
......@@ -764,7 +767,7 @@ bool NewMainForm::event(QEvent *e)
else if(value.contains(EVENT_KEY_STATUS) && value[EVENT_KEY_STATUS].toBool() == true)
{
onSetStoreInfo(_storeinfo[JSON_STOREID].toString());
onSetCashierInfo(_storeinfo[JSON_STATIONID].toString());
onSetCashierInfo(_storeinfo[JSON_STOREID].toString());
onSetNetStatus(QString::fromUtf8("\xE7\xBD\x91\xE7\xBB\x9C\xE6\xAD\xA3\xE5\xB8\xB8"));
}
return true;
......@@ -803,6 +806,84 @@ bool NewMainForm::event(QEvent *e)
return true;
}
if(e->type() == PosEvent::s_driver_cancel_order)
{
QVariantMap map;
GETEVENTINFO(map, e, QVariantMap);
QString msg = QString::fromLocal8Bit("您的订单:%1,被骑手取消,请及时处理!").arg(map["order_id"].toString());
QLOG_DEBUG() << "msg---------" << msg;
onShowAlert((AlertForm::Type)3, msg);
QString orderid = map[JSON_ORDERID].toString();
OrderObject order;
if(!PosOrderPool::GetOrderObject(orderid, order))
return true;
Order_Index tmp = {order.status, order.refund_status};
if(_order_indexs.contains(order.order_id))
{
// _order_indexs.insert(order.order_id, tmp);
UpdateTableWidget(order);
}
else
{
_order_indexs.insert(order.order_id, tmp);
InsertTableWidget(order);
}
return true;
}
if(e->type() == PosEvent::s_driver_cancel_reason)
{
QLOG_INFO() << "PosEvent::s_driver_cancel_reason : " << QThread::currentThreadId();
QVariantMap map;
GETEVENTINFO(map, e, QVariantMap);
QString orderid = map[JSON_ORDERID].toString();
OrderObject order;
if(!PosOrderPool::GetOrderObject(orderid, order))
return true;
Order_Index tmp = {order.status, order.refund_status};
if(_order_indexs.contains(order.order_id))
{
// _order_indexs.insert(order.order_id, tmp);
UpdateTableWidget(order);
}
else
{
_order_indexs.insert(order.order_id, tmp);
InsertTableWidget(order);
}
}
if(e->type() == PosEvent::s_show_driver_cancel)
{
QString orderid;
GETEVENTINFO(orderid, e, QString);
OrderObject order;
if(!PosOrderPool::GetOrderObject(orderid, order))
return true;
Order_Index tmp = {order.status, order.refund_status};
if(_order_indexs.contains(order.order_id))
{
_order_indexs.insert(order.order_id, tmp);
UpdateTableWidget(order);
}
else
{
_order_indexs.insert(order.order_id, tmp);
InsertTableWidget(order);
}
}
return QWidget::event(e);
}
......
......@@ -414,7 +414,7 @@ QTabWidget#newmaintbwgt QTabBar::tab
<item>
<widget class="QLabel" name="newmainlabel_title">
<property name="text">
<string>非码i点餐</string>
<string>开个店</string>
</property>
</widget>
</item>
......
......@@ -81,6 +81,11 @@ void OrderTypeForm::InitChannelShow(QString order_id, int order_status, int refu
{
ui->ordertypelabel_type->setStyleSheet("#ordertypelabel_type{ border-image: url(:driver.png)}");
}
else if(_drive_status == 7 &&
!(ordertype == CancelOrder || ordertype == ServiceOrder || ordertype == RefusedOrder || ordertype == CompleteRefundOrder || ordertype == CompleteOrder))
{
ui->ordertypelabel_type->setStyleSheet("#ordertypelabel_type{ border-image: url(:error.png)}");
}
else
{
ui->ordertypelabel_type->setStyleSheet("#ordertypelabel_type{ border-image: url(:tabBtn_normal.png)}");
......
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