Commit 13aaf03a by wuyang.zou

New Feature: Wechat-MOD & KouBei-MOP

             Pull Order Data By Page, DetailForm Display Poskey
New Tag: 2.2020.312.1
parent e404fbdd
......@@ -922,17 +922,16 @@ bool FlowControl::_PullOrderList(const int &pageSize, const int &pageNo)
QLOG_ERROR() << QString("[<<<<---FlowControl::_PullOrderList:Pull Order List Error--->>>>][msg->%1]").arg(error);
emit showAlert(AlertForm::MSGERROR, QString::fromLocal8Bit("获取订单失败![%1]").arg(error));
result=false;
m_orderCount = 0;
} else {
//获取门店营业状态
//QString strOpeStatus=QString::fromLocal8Bit("开店");
//emit setOpeStatus(strOpeStatus);
QJsonArray orders = recvJson[JSON_DATA].toObject()[JSON_ORDERS].toArray();
foreach(QJsonValue order, orders) {
_OrderAnalysis(order.toObject());
}
ordertotalSum=recvJson[JSON_DATA].toObject()[JSON_COUNT].toInt();
m_orderCount+=1000;
if(m_orderCount<ordertotalSum) {
m_orderCount += orders.size();
if ( m_orderCount < ordertotalSum ) {
//避免出现存在多页数据,导致出现死锁: 先调用定时器的timeout 触发槽函数:_PullOrderData,
//_PullOrderData:内部会有加锁并且会调用分页获取订单函数_AddOrderPull(QString(),QString(),pageNo+1,pageSize): 内部也有加锁,所以导致死锁;
//_AddOrderPull(QString(),QString(),pageNo+1,pageSize);
......@@ -942,10 +941,15 @@ bool FlowControl::_PullOrderList(const int &pageSize, const int &pageNo)
orderPull->channel=QString();
orderPull->pageNumber=pageNo+1;
orderPull->pageSize=pageSize;
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---FlowControl::_PullOrderList: Next Page Order List :pageNo:%1--->>>>]").arg(pageNo+1);
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---FlowControl::_PullOrderList: Next Page Order List :pageNo:%1 pageSize:%2--->>>>]").arg(pageNo+1).arg(pageSize);
m_orderPullList.append(orderPull);
//避免出现存在多页数据,导致出现死锁;
} else {
//分页拉取订单列表最后一页成功后,需要重置本地拉单计数缓存, 防止影响下一次获取订单列表判断;
m_orderCount = 0;
QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---FlowControl::_PullOrderList Had Finished: The Last Request PageNo:%1--->>>>]").arg(pageNo);
}
}
}
// 如果出现拉取订单列表失败,触发下一次拉门店有效订单的时间间隔变更为20(如果一开始就获取订单列表成功:时间间隔为5s)
......@@ -2550,9 +2554,14 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
tempOrderPayType = 21;
}//MOP自测订单 在下方处理;星巴克-预约订单:在下方处理;
// OMS提供的数据://订单渠道: 星巴克-MOD,百度外卖,饿了么APP,美团外卖,星巴克-MOP;
// MOD渠道对应的业务逻辑;
// MOD渠道对应的业务逻辑 ;
else if("MOD" == orderObject->channel) {
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat;5 口碑;
if ( "4" == orderObject->platformSource ) {
tempOrderType = 27;
} else {
tempOrderType = 9;
}
tempOrderPayType = 84;
//星巴克App端支付方式: 1:支付宝; 2:微信; 3:银联; 4:SVC卡; 5/7:MOP使用券或星星抵扣 0元支付; 8:IStore订单; 9:银联支付(=3);
if(4 == orderObject->payWay){
......@@ -2579,7 +2588,12 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
}
} // MOP渠道对应的业务逻辑;
else if("MOP" == orderObject->channel){
// 区别:口碑-MOP / App-MOP;
if ( "5" == orderObject->platformSource ){
tempOrderType = 29;
} else {
tempOrderType = 18;
}
tempOrderPayType = 84;
//星巴克App端支付方式: 1:支付宝; 2:微信; 3:银联; 4:SVC卡; 5/7:MOP使用券或星星抵扣 0元支付; 8:IStore订单; 9:银联支付(=3);
if(4 == orderObject->payWay){
......@@ -2604,6 +2618,7 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
tempSbkAppPayType = -1;
tempSbkAppPayValue = "-1";
}
//MOP最后判断 是否是 MOP自测订单;
if(4== orderObject->getOrderType()) {
tempOrderType = 20;
......@@ -2704,9 +2719,20 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
emit doUnLockFloatFrom(); //无需显示mainFrom主界面;//但必须解锁之前锁定的悬浮框;
return true;
} else if("MOD" == orderObject->channel) {
// platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
if ( "4" == orderObject->platformSource ) {
tempOrderType = 28;
} else {
tempOrderType = 17;
} else if("MOP" == orderObject->channel) {
}
} else if ( "MOP" == orderObject->channel ) {
// 区分: 口碑-MOP / App-MOP;
if ( "5" == orderObject->platformSource ) {
tempOrderType = 30;
} else {
tempOrderType = 19;
}
//预约->配送费入机: 销售单订单类型:23; 退货单订单类型: 24; //预约->实物入机: 销售单订单类型:21;退货单订单类型:22;【此case不存在】
} else if("ORS" == orderObject->channel) {
tempOrderType = 24;
......@@ -2840,6 +2866,17 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
dishesObject* subDish=dish->sub_products.at(j);
//默认属性直接跳过;
if(!subDish->code.isEmpty() && !subDish->code.contains("Default",Qt::CaseInsensitive) && subDish->qty ) {
//①code中以非数字开头直接退出本次录单;
QString tempSubCodeLeftHead = subDish->code.left(1);
if ( tempSubCodeLeftHead<QString('0') || tempSubCodeLeftHead>QString('9') ) {
error = QString::fromLocal8Bit("This Order SubProduct PosKey Is String And No Contains Default");
m_OrderEntryMutex.lock();
m_simValidOrdersList.removeOne(orderObject->id);
m_OrderEntryMutex.unlock();
m_bFloatFromLockSt = false; //解锁悬浮框的锁定标志;
emit doUnLockFloatFrom(); //解锁悬浮框锁定
return true;
}
sObj.insert("consume_num", subDish->qty);
sObj.insert("pid", subDish->code);
sObj.insert("original_price", subDish->price);
......@@ -3030,7 +3067,8 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
//**********************************整合包装费-begin*****************************************//
//向商品列表尾部 添加 包装费项 + 包装费折扣项[预约实物不能录入配送费 && 预约配送费需要入机];
// 包装费 >0 且 预约实物包装费 + MOP 也不能入机;
if(orderObject->packageFee > 0 && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType ) {
if(orderObject->packageFee > 0 && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType
&& 29!=tempOrderType && 30!=tempOrderType ) {
QJsonObject tPackageFeeObj;
tPackageFeeObj.insert("consume_num", orderObject->packageFee/100);
tPackageFeeObj.insert("pid", "6000201"); //包装费SKU;
......@@ -3051,7 +3089,8 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
products.push_back(tPackDiscountObj);
}
//打包费是0元时(预约实物 + MOP 包装费不能入机):需录入打包费[非-MOP(销售退货),非-MOP测试];
} else if (0 == orderObject->packageFee && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType) {
} else if (0 == orderObject->packageFee && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType
&& 29!=tempOrderType && 30!=tempOrderType ) {
QJsonObject tPackageFeeObj;
tPackageFeeObj.insert("consume_num", 1);
tPackageFeeObj.insert("pid","6000201"); //包装费SKU;
......@@ -3062,7 +3101,8 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
//**********************************整合配送费-begin*****************************************//
//向商品列表尾部 添加 配送费项 + 配送费折扣项 [预约实物不能录入配送费 && 预约配送费需要入机];
if(orderObject->deliveryPrice > 0 && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType) {
if(orderObject->deliveryPrice > 0 && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType
&& 29!=tempOrderType && 30!=tempOrderType ) {
QJsonObject tDeliveryFeeObj;
tDeliveryFeeObj.insert("consume_num", orderObject->deliveryPrice/100);
tDeliveryFeeObj.insert("pid", "6000101"); //配送费SKU;
......@@ -3083,7 +3123,8 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
products.push_back(tDeliveryDiscountObj);
}
//配送费是0元时:需录入配送费[非-MOP(销售退货),非-MOP测试; 预约实物不能录入配送费 && 预约配送费需要入机];
} else if(0 == orderObject->deliveryPrice && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType) {
} else if(0 == orderObject->deliveryPrice && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 21!=tempOrderType && 22!=tempOrderType && 25!=tempOrderType
&& 29!=tempOrderType && 30!=tempOrderType ) {
QJsonObject tDeliveryFeeZoreObj;
tDeliveryFeeZoreObj.insert("consume_num", 9);
tDeliveryFeeZoreObj.insert("pid","6000101"); //配送费SKU;
......@@ -3289,8 +3330,7 @@ void FlowControl::onProcessReTryInputOrder(const QString &orderId)
orderPull->orderId=orderId;
orderPull->channel=TempOrderObject->channel;
orderPull->pageNumber=1;
orderPull->pageSize=1000;
m_orderCount = 0; //重置插件本地缓存数据页;
orderPull->pageSize=30;
m_orderPullList.append(orderPull);
m_PullOrderDataMutex.unlock();
}
......
......@@ -355,9 +355,9 @@ private slots:
QString _Penny2Dollar(int penny);
void _GetIpAddress();
void _AddOrderPull(const QString& orderId=0,const QString& channel=0,const int& pageNumber=1,const int& pageSize=1000);
void _AddOrderPull(const QString& orderId=0,const QString& channel=0,const int& pageNumber=1,const int& pageSize=30);
// 避免获取较多历史订单的同时,OMS又有推单过来,导致死锁;
bool _TryAddOrderPull(const QString &orderId=0, const QString &channel=0, const int &pageNumber=1, const int &pageSize=1000);
bool _TryAddOrderPull(const QString &orderId=0, const QString &channel=0, const int &pageNumber=1, const int &pageSize=30);
//点击屏幕指定区域
void _ClickOMSAssignArea();
......
......@@ -131,7 +131,11 @@ QString OrderObject::getChannelName()
{
QLOG_INFO() << QString("[<<<<---OrderObject:getChannelName [%1]--->>>>]").arg(channel);
if ("MOD" == channel && 3 != orderType){
if ( "4" == platformSource ) {
return QString::fromLocal8Bit("微信-MOD");
} else {
return QString::fromLocal8Bit("星-MOD");
}
}else if("MOD" == channel && 3 == orderType){
return QString::fromLocal8Bit("星-客诉");
}else if("ELE" == channel){
......@@ -139,7 +143,11 @@ QString OrderObject::getChannelName()
}else if("BAIDU" == channel){
return QString::fromLocal8Bit("百度外卖");
}else if("MOP" == channel && 4 != orderType){
if ( "5" == platformSource ) {
return QString::fromLocal8Bit("口碑-MOP");
} else {
return QString::fromLocal8Bit("星-MOP");
}
}else if("MOP" == channel && 4 == orderType){
return QString::fromLocal8Bit("星-自测");
}else if("ORS" == channel){
......
......@@ -77,6 +77,7 @@ class OrderObject : public QObject
Q_PROPERTY (int refundStatus READ getRefundStatus WRITE setRefundStatus)
Q_PROPERTY (int deliveryChannel READ getDeliveryChannel WRITE setDeliveryChannel)
Q_PROPERTY (QString customerSex READ getCustomerSex WRITE setCustomerSex)
Q_PROPERTY (QString platformSource READ getPlatformSource WRITE setPlatformSource)
Q_PROPERTY (int orderIndex READ getOrderIndex WRITE setOrderIndex)
public:
OrderObject(QObject *parent=0)
......@@ -149,6 +150,7 @@ public:
int orderIndex;
int updateTime;
QString customerSex; //用户性别 1-男; 2-女
QString platformSource; //订单平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
int needInvoice;
int deliveryPrice; // 配送费
int deliveryDiscount; // 配送费折扣
......@@ -380,6 +382,9 @@ public:
inline QString getCustomerSex()const{return customerSex;}
inline void setCustomerSex(const QString& v){customerSex = v;}
inline QString getPlatformSource()const{return platformSource;}
inline void setPlatformSource(const QString& v){platformSource = v;}
inline QString getPackageSku()const{return packageSku;}
inline void setPackageSku(const QString& v){packageSku = v;}
......
......@@ -114,7 +114,7 @@ void DetailForm::InitData(OrderObject *orderObject)
if(tempDishObj->promotionSku.length()){
pNum++;
ui->detailTable0->insertRow(pNum);
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString("( ") + tempDishObj->promotionName )); // 商品名
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString("( ") + tempDishObj->promotionName + QString(":") + tempDishObj->promotionSku)); // 商品名
ui->detailTable0->item(pNum, 0)->setTextAlignment(Qt::AlignRight);
ui->detailTable0->setItem(pNum, 1, new QTableWidgetItem( QString("-") + Penny2Dollar(tempDishObj->promotionPrice))); // 价格
ui->detailTable0->item(pNum, 1)->setTextAlignment(Qt::AlignCenter);
......@@ -126,7 +126,7 @@ void DetailForm::InitData(OrderObject *orderObject)
if(tempDishObj->starPromotionSku.length()){
pNum++;
ui->detailTable0->insertRow(pNum);
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString("( ") + tempDishObj->starPromotionName )); // 商品名
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString("( ") + tempDishObj->starPromotionName + QString(":") +tempDishObj->starPromotionSku )); // 商品名
ui->detailTable0->item(pNum, 0)->setTextAlignment(Qt::AlignRight);
ui->detailTable0->setItem(pNum, 1, new QTableWidgetItem( QString("-") + Penny2Dollar(tempDishObj->starPromotionPrice))); // 价格
ui->detailTable0->item(pNum, 1)->setTextAlignment(Qt::AlignCenter);
......@@ -175,7 +175,7 @@ void DetailForm::InitData(OrderObject *orderObject)
// 新增配送费 + 打包费
ui->detailTable0->insertRow(pNum);
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString::fromLocal8Bit("配送费"))); // 配送费
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString::fromLocal8Bit("配送费:") + QString("6000101") )); // 配送费
ui->detailTable0->item(pNum, 0)->setTextAlignment(Qt::AlignCenter);
ui->detailTable0->setItem(pNum, 1, new QTableWidgetItem(Penny2Dollar(orderObject->deliveryPrice))); // 价格
ui->detailTable0->item(pNum, 1)->setTextAlignment(Qt::AlignCenter);
......@@ -195,7 +195,7 @@ void DetailForm::InitData(OrderObject *orderObject)
}
ui->detailTable0->insertRow(pNum);
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString::fromLocal8Bit("包装费"))); // 包装费
ui->detailTable0->setItem(pNum, 0, new QTableWidgetItem(QString::fromLocal8Bit("包装费:") + QString("6000201") )); // 包装费
ui->detailTable0->item(pNum, 0)->setTextAlignment(Qt::AlignCenter);
ui->detailTable0->setItem(pNum, 1, new QTableWidgetItem(Penny2Dollar(orderObject->packageFee))); // 价格
ui->detailTable0->item(pNum, 1)->setTextAlignment(Qt::AlignCenter);
......@@ -294,7 +294,7 @@ QString DetailForm::GetProductName(dishesObject *dish)
QString name;
QString propertyTags;
name.append(dish->name).append("\r\n");
propertyTags=dish->specId;
propertyTags=dish->code;
if(!propertyTags.isEmpty())
{
name.append(QString("(%1)").arg(propertyTags));
......@@ -306,7 +306,11 @@ QString DetailForm::GetProductName(dishesObject *dish)
foreach(auto value,dish->sub_products)
{
name.append("| ");
name.append(value->name).append(" |").append("\r\n");
name.append(value->name);
if ( !( value->code.contains("Default",Qt::CaseInsensitive) ) ) {
name.append(':').append(value->code);
}
name.append(" |").append("\r\n");
}
}
name.remove((name.length()-1),1);
......
......@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif
VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 2,2020,26,1
PRODUCTVERSION 2,2020,26,1
FILEVERSION 2,2020,312,1
PRODUCTVERSION 2,2020,312,1
//*************************************************************************//
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
......@@ -31,8 +31,8 @@ VS_VERSION_INFO VERSIONINFO
VALUE "OriginalFilename", "fmTakeout.exe"
VALUE "ProductName", "Delivery Order Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "2.2020.26.1"
VALUE "FileVersion", "2.2020.26.1"
VALUE "ProductVersion", "2.2020.312.1"
VALUE "FileVersion", "2.2020.312.1"
//*************************************************************************//
END
END
......
......@@ -94,7 +94,7 @@ int main(int argc, char *argv[])
LoadTheme(APP_THEME);
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]");
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<<<<-- fmTakeaway Start -->>>>>>>>>>>>>>>>>>>>>>>>>>>]");
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<-- fmTakeaway Start Version:%1 -->>>>>>>>>>>>>>>>>>>>>>]").arg(APP_VERSION);
QLOG_INFO() << QString("[<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]");
// 将控制器移到工作线程
......
......@@ -384,17 +384,8 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
// 非首次收到的订单需要现在原先表中删除
if(oldStatus != -100)
{
//TODO
// if(/*2==orderObject->order_type&&*/(1==oldStatus||2==oldStatus))
// {
// table=ui->mainTableReserve;
// tabBtn = ui->mainBtnReserve;
// }
//else{
tabBtn = _GetTabBtnByOrderStatus(oldStatus);
table = findChild<QTableWidget*>(tabBtn->property("tableName").toString());
//}
for(int i=0; i<table->rowCount(); i++)
{
if(!table->item(i, 1)->text().compare(orderObject->id))
......@@ -407,16 +398,8 @@ void MainForm::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
}
}
// 将数据插入到表中
//TODO
// if(/*2==orderObject->order_type&&*/(1==orderObject->orderStatus||2==orderObject->orderStatus))
// {
// table = ui->mainTableReserve;
// tabBtn = ui->mainBtnReserve;
// }
//else{
tabBtn = _GetTabBtnByOrderStatus(orderObject->orderStatus);
table = findChild<QTableWidget*>(tabBtn->property("tableName").toString());
//}
table->insertRow(0);
QTableWidgetItem *item0 = new QTableWidgetItem(orderObject->getChannelName());
......
......@@ -24,8 +24,8 @@
//#define APP_VERSION "2.2019.729.1"
//#define APP_VERSION "2.2019.815.1"
//#define APP_VERSION "2.2019.916.2"
//#define APP_VERSION "2.2019.1224.1" //未有机会发版;
#define APP_VERSION "2.2020.26.1"
//#define APP_VERSION "2.2020.26.1"
#define APP_VERSION "2.2020.312.1"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号
......
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