Commit 8ebb5aa7 by wuyang.zou

Version 2.2020.5.16

1、完善 WSG-MOD 用星说
2、进行 预约单准备功能
parent 53f66b32
Pipeline #21735 failed with stage
in 0 seconds
...@@ -303,7 +303,7 @@ void FlowControl::_OrderAnalysis(const QJsonObject& jsonObject) ...@@ -303,7 +303,7 @@ void FlowControl::_OrderAnalysis(const QJsonObject& jsonObject)
orderObject->forwardPosStatus =0; orderObject->forwardPosStatus =0;
orderObject->negativePosStatus =0; orderObject->negativePosStatus =0;
orderObject->businessType = "0"; orderObject->businessType = "0";
orderObject->inAdvanceTakemeal = 0;
orderObject->FromJson(jsonObject); orderObject->FromJson(jsonObject);
orderObject->pushOrderType=0; orderObject->pushOrderType=0;
...@@ -367,17 +367,30 @@ void FlowControl::_OrderAnalysis(const QJsonObject& jsonObject) ...@@ -367,17 +367,30 @@ void FlowControl::_OrderAnalysis(const QJsonObject& jsonObject)
emit startRemind(REMIND_CONFIRMED_ORDER); emit startRemind(REMIND_CONFIRMED_ORDER);
} }
} }
int syncOrderRet = PrintSumBillPosDB::getInstance().syncOrderDataToDB(orderObject);
QLOG_INFO() << QString("[<<<<---PrintSumBillPosDB.getInstance().syncOrderDataToDB orderId:%1 syncOrderRet:%2--->>>>]")
.arg(orderObject->id).arg(syncOrderRet);
QLOG_INFO() << QString("[<<<<---FmTakeout _OrderAnalysis-> changeOrderStatus--->>>>]"); QLOG_INFO() << QString("[<<<<---FmTakeout _OrderAnalysis-> changeOrderStatus--->>>>]");
emit changeOrderStatus(orderObject); emit changeOrderStatus(orderObject);
} }
/***<2>:FM插件维护的有效订单容器中存在此订单:更新订单容器中此订单的订单状态***/ /***<2>:FM插件维护的有效订单容器中存在此订单:更新订单容器中此订单的订单状态***/
else { else {
int oldStatus = orderObject->orderStatus; int oldStatus = orderObject->orderStatus;
int oldArriveAhead = orderObject->inAdvanceTakemeal;
orderObject->FromJson(jsonObject); orderObject->FromJson(jsonObject);
QLOG_INFO() << QString("[<<<<---FmTakeout Valid Order Map:Update orderId:%1 OldStatus:%2: curStatus:%3]--->>>>]").arg(orderObject->id).arg(oldStatus).arg(orderObject->orderStatus); QLOG_INFO() << QString("[<<<<---FmTakeout Valid Order Map:Update orderId:%1 OldStatus:%2: curStatus:%3]--->>>>]").arg(orderObject->id).arg(oldStatus).arg(orderObject->orderStatus);
if(oldStatus != orderObject->orderStatus) { if(oldStatus != orderObject->orderStatus) {
emit changeOrderStatus(orderObject, oldStatus); emit changeOrderStatus(orderObject, oldStatus);
} }
if ( oldArriveAhead != orderObject->inAdvanceTakemeal ) {
int updateOrderRet = PrintSumBillPosDB::getInstance().updateOrderDataToDB(orderObject, QString("appointed_remindTemplate"));
QLOG_INFO() << QString("[<<<<---PrintSumBillPosDB.getInstance().updateOrderDataToDB orderId:%1 updateOrderRet:%2--->>>>]")
.arg(orderObject->id).arg(updateOrderRet);
}
} }
orderObject->updateTime=QDateTime::currentDateTime().toTime_t(); orderObject->updateTime=QDateTime::currentDateTime().toTime_t();
...@@ -1504,13 +1517,14 @@ QString FlowControl::_GetJsonStr(const QJsonObject &json) ...@@ -1504,13 +1517,14 @@ QString FlowControl::_GetJsonStr(const QJsonObject &json)
return QString(QJsonDocument(json).toJson(QJsonDocument::Compact)).replace("\"",""); return QString(QJsonDocument(json).toJson(QJsonDocument::Compact)).replace("\"","");
} }
QJsonObject FlowControl::_PackHttpReplyJson(const int status, const QString &msg, const QJsonObject &data,const int& iscontinue) QJsonObject FlowControl::_PackHttpReplyJson(const int status, const QString &msg, const QJsonObject &data,const int& iscontinue, const QString &orderId)
{ {
QJsonObject rObj; QJsonObject rObj;
rObj.insert("statusCode", status); rObj.insert("statusCode", status);
rObj.insert("msg", msg); rObj.insert("msg", msg);
rObj.insert("iscontinue",iscontinue); rObj.insert("iscontinue",iscontinue);
rObj.insert("data", data); rObj.insert("data", data);
rObj.insert("orderId", orderId);
return rObj; return rObj;
} }
...@@ -2095,7 +2109,7 @@ bool FlowControl::_ResponseSimphony05Request(const QJsonObject &content, QJsonOb ...@@ -2095,7 +2109,7 @@ bool FlowControl::_ResponseSimphony05Request(const QJsonObject &content, QJsonOb
/***** 更新 POS本地数据库的商品数据是否成功;begin:*********/ /***** 更新 POS本地数据库的商品数据是否成功;begin:*********/
int retSyncOrderProductInfo = 1; //默认是同步POS商品数据成功; 目前只有 businessType: 20:WSG-杯贴祝福; 30: 拼团; int retSyncOrderProductInfo = 1; //默认是同步POS商品数据成功; 目前只有 businessType: 20:WSG-杯贴祝福; 30: 拼团;
if (order_p && ( "30"==order_p->businessType || if (order_p && ( 7 == order_p->orderType || 8 == order_p->orderType ||
("WSG-MOD" == order_p->channel && "4" == order_p->platformSource) ("WSG-MOD" == order_p->channel && "4" == order_p->platformSource)
) ) { ) ) {
if ( PrintCupStickPosDB ::getInstance().isOrderProductExist(orderId) ) { if ( PrintCupStickPosDB ::getInstance().isOrderProductExist(orderId) ) {
...@@ -2605,7 +2619,7 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -2605,7 +2619,7 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
int tempOrderType,tempOrderPayType,tempSbkAppPayType=0; int tempOrderType,tempOrderPayType,tempSbkAppPayType=0;
QString tempSbkAppPayValue="0"; QString tempSbkAppPayValue="0";
// 转换成星巴克规定的订单类型; // 转换成星巴克规定的订单类型;
//星巴克的订单类型:1:新订单; 2:预订单; 3:客诉单; 4:MOP自测订单; 5:预约订单 //星巴克的订单类型:1:新订单; 2:预订单; 3:客诉单; 4:MOP自测订单; 5:预约订单; 7:当日预约单;8拼单
if(3 == orderObject->getOrderType()) { if(3 == orderObject->getOrderType()) {
tempOrderType = 12; tempOrderType = 12;
tempOrderPayType = -1; tempOrderPayType = -1;
...@@ -2614,12 +2628,19 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -2614,12 +2628,19 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
// OMS提供的数据://订单渠道: 星巴克-MOD,百度外卖,饿了么APP,美团外卖,星巴克-MOP; // OMS提供的数据://订单渠道: 星巴克-MOD,百度外卖,饿了么APP,美团外卖,星巴克-MOP;
// MOD渠道对应的业务逻辑 ; // MOD渠道对应的业务逻辑 ;
else if ( "MOD" == orderObject->channel ) { else if ( "MOD" == orderObject->channel ) {
if ( 7 == orderObject->orderType ) {
tempOrderType = 14;
} else if ( 8 == orderObject->orderType ) {
tempOrderType = 0; // 还未申请,等待申请
} else {
// platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat ; 5 口碑; // platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat ; 5 口碑;
if ( "4" == orderObject->platformSource ) { if ( "4" == orderObject->platformSource ) {
tempOrderType = 27; tempOrderType = 27;
} else { } else {
tempOrderType = 9; tempOrderType = 9;
} }
}
tempOrderPayType = 84; tempOrderPayType = 84;
//星巴克App端支付方式: 1:支付宝; 2:微信; 3:银联; 4:SVC卡; 5/7:MOP使用券或星星抵扣 0元支付; 8:IStore订单; 9:银联支付(=3); //星巴克App端支付方式: 1:支付宝; 2:微信; 3:银联; 4:SVC卡; 5/7:MOP使用券或星星抵扣 0元支付; 8:IStore订单; 9:银联支付(=3);
if(4 == orderObject->payWay){ if(4 == orderObject->payWay){
...@@ -2647,12 +2668,19 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -2647,12 +2668,19 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
} // 兼容渠道名称不统一问题 } // 兼容渠道名称不统一问题
else if ( "WSG-MOD" == orderObject->channel ) { else if ( "WSG-MOD" == orderObject->channel ) {
if ( 7 == orderObject->orderType ) {
tempOrderType = 14;
} else if ( 8 == orderObject->orderType ) {
tempOrderType = 0; // 还未申请,等待申请
} else {
// platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑; // platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
if ( "4" == orderObject->platformSource ) { if ( "4" == orderObject->platformSource ) {
tempOrderType = 31; tempOrderType = 31;
} else { } else {
tempOrderType = 9; tempOrderType = 9;
} }
}
tempOrderPayType = 84; tempOrderPayType = 84;
tempSbkAppPayType = -1; tempSbkAppPayType = -1;
...@@ -2660,12 +2688,19 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -2660,12 +2688,19 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
}// MOP渠道对应的业务逻辑; }// MOP渠道对应的业务逻辑;
else if ( "MOP" == orderObject->channel ){ else if ( "MOP" == orderObject->channel ){
if ( 7 == orderObject->orderType ) {
tempOrderType = 14;
} else if ( 8 == orderObject->orderType ) {
tempOrderType = 0; // 还未申请,等待申请
} else {
// 区别:口碑-MOP / App-MOP; // 区别:口碑-MOP / App-MOP;
if ( "5" == orderObject->platformSource ){ if ( "5" == orderObject->platformSource ){
tempOrderType = 29; tempOrderType = 29;
} else { } else {
tempOrderType = 18; tempOrderType = 18;
} }
}
tempOrderPayType = 84; tempOrderPayType = 84;
//星巴克App端支付方式: 1:支付宝; 2:微信; 3:银联; 4:SVC卡; 5/7:MOP使用券或星星抵扣 0元支付; 8:IStore订单; 9:银联支付(=3); //星巴克App端支付方式: 1:支付宝; 2:微信; 3:银联; 4:SVC卡; 5/7:MOP使用券或星星抵扣 0元支付; 8:IStore订单; 9:银联支付(=3);
if ( 4 == orderObject->payWay ) { if ( 4 == orderObject->payWay ) {
...@@ -2720,15 +2755,26 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -2720,15 +2755,26 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
tempOrderType = 16; tempOrderType = 16;
} }
else if ( "MOD" == orderObject->channel ) { else if ( "MOD" == orderObject->channel ) {
if ( 7 == orderObject->orderType ) {
tempOrderType = 15;
} else if ( 8 == orderObject->orderType ) {
tempOrderType = 0; // 还未申请,等待申请
} else {
// platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑; // platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
if ( "4" == orderObject->platformSource ) { if ( "4" == orderObject->platformSource ) {
tempOrderType = 28; tempOrderType = 28;
} else { } else {
tempOrderType = 17; tempOrderType = 17;
} }
}
} // 兼容渠道名称不统一问题 } // 兼容渠道名称不统一问题
else if ( "WSG-MOD" == orderObject->channel ) { else if ( "WSG-MOD" == orderObject->channel ) {
if ( 7 == orderObject->orderType ) {
tempOrderType = 15;
} else if ( 8 == orderObject->orderType ) {
tempOrderType = 0; // 还未申请,等待申请
} else {
// platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑; // platformSource:平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
if ( "4" == orderObject->platformSource ) { if ( "4" == orderObject->platformSource ) {
tempOrderType = 32; tempOrderType = 32;
...@@ -2736,13 +2782,20 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -2736,13 +2782,20 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
tempOrderType = 17; tempOrderType = 17;
} }
} }
}
else if ( "MOP" == orderObject->channel ) { else if ( "MOP" == orderObject->channel ) {
if ( 7 == orderObject->orderType ) {
tempOrderType = 15;
} else if ( 8 == orderObject->orderType ) {
tempOrderType = 0; // 还未申请,等待申请
} else {
// 区分: 口碑-MOP / App-MOP; // 区分: 口碑-MOP / App-MOP;
if ( "5" == orderObject->platformSource ) { if ( "5" == orderObject->platformSource ) {
tempOrderType = 30; tempOrderType = 30;
} else { } else {
tempOrderType = 19; tempOrderType = 19;
} }
}
} //预约->配送费入机: 销售单订单类型:23; 退货单订单类型: 24; //预约->实物入机: 销售单订单类型:21;退货单订单类型:22;【此case不存在】 } //预约->配送费入机: 销售单订单类型:23; 退货单订单类型: 24; //预约->实物入机: 销售单订单类型:21;退货单订单类型:22;【此case不存在】
else if("ORS" == orderObject->channel) { else if("ORS" == orderObject->channel) {
...@@ -3080,8 +3133,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -3080,8 +3133,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
//**********************************整合包装费-begin*****************************************// //**********************************整合包装费-begin*****************************************//
// 向商品列表尾部 添加 包装费项 + 包装费折扣项; // 向商品列表尾部 添加 包装费项 + 包装费折扣项;
// 包装费 >0 + MOP 也不能入机【特别说明:WSG-MOD 配送费及配送费折扣信息存储 coupons中;故在此处排除】; // 包装费 >0 + MOP 也不能入机【特别说明:WSG-MOD 配送费及配送费折扣信息存储 coupons中;故在此处排除】;
if(orderObject->packageFee > 0 && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 29!=tempOrderType && 30!=tempOrderType && if ( orderObject->packageFee > 0 && ( 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType
31!=tempOrderType && 32!=tempOrderType ) { && 29!=tempOrderType && 30!=tempOrderType && 31!=tempOrderType && 32!=tempOrderType
&& 14!=tempOrderType && 15!=tempOrderType
|| ( (14==tempOrderType || 15==tempOrderType) && "MOD"==orderObject->channel ) )
) {
QJsonObject tPackageFeeObj; QJsonObject tPackageFeeObj;
tPackageFeeObj.insert("consume_num", orderObject->packageFee/100); tPackageFeeObj.insert("consume_num", orderObject->packageFee/100);
tPackageFeeObj.insert("pid", "6000201"); //包装费SKU; tPackageFeeObj.insert("pid", "6000201"); //包装费SKU;
...@@ -3102,8 +3158,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -3102,8 +3158,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
products.push_back(tPackDiscountObj); products.push_back(tPackDiscountObj);
} }
//打包费是0元时( MOP 包装费不能入机):需录入打包费[非-MOP(销售退货),非-MOP测试]; //打包费是0元时( MOP 包装费不能入机):需录入打包费[非-MOP(销售退货),非-MOP测试];
} else if (0 == orderObject->packageFee && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 29!=tempOrderType && 30!=tempOrderType && } else if (0 == orderObject->packageFee && ( 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType
31!=tempOrderType && 32!=tempOrderType ) { && 29!=tempOrderType && 30!=tempOrderType && 31!=tempOrderType && 32!=tempOrderType
&& 14!=tempOrderType && 15!=tempOrderType
|| ( (14==tempOrderType || 15==tempOrderType) && "MOD"==orderObject->channel ) )
) {
QJsonObject tPackageFeeObj; QJsonObject tPackageFeeObj;
tPackageFeeObj.insert("consume_num", 1); tPackageFeeObj.insert("consume_num", 1);
tPackageFeeObj.insert("pid","6000201"); //包装费SKU; tPackageFeeObj.insert("pid","6000201"); //包装费SKU;
...@@ -3114,8 +3173,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -3114,8 +3173,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
//**********************************整合配送费-begin*****************************************// //**********************************整合配送费-begin*****************************************//
//向商品列表尾部 添加 配送费项 + 配送费折扣项; 【特别说明:WSG-MOD 配送费及配送费折扣信息存储 coupons中;故在此处排除】 //向商品列表尾部 添加 配送费项 + 配送费折扣项; 【特别说明:WSG-MOD 配送费及配送费折扣信息存储 coupons中;故在此处排除】
if(orderObject->deliveryPrice > 0 && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 29!=tempOrderType && 30!=tempOrderType && if ( orderObject->deliveryPrice > 0 && ( 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType
31!=tempOrderType && 32!=tempOrderType ) { && 29!=tempOrderType && 30!=tempOrderType && 31!=tempOrderType && 32!=tempOrderType
&& 14!=tempOrderType && 15!=tempOrderType
|| ( (14==tempOrderType || 15==tempOrderType) && "MOD"==orderObject->channel ) )
) {
QJsonObject tDeliveryFeeObj; QJsonObject tDeliveryFeeObj;
tDeliveryFeeObj.insert("consume_num", orderObject->deliveryPrice/100); tDeliveryFeeObj.insert("consume_num", orderObject->deliveryPrice/100);
tDeliveryFeeObj.insert("pid", "6000101"); //配送费SKU; tDeliveryFeeObj.insert("pid", "6000101"); //配送费SKU;
...@@ -3136,8 +3198,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -3136,8 +3198,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
products.push_back(tDeliveryDiscountObj); products.push_back(tDeliveryDiscountObj);
} }
//配送费是0元时:需录入配送费[非-MOP(销售退货),非-MOP测试; ]; //配送费是0元时:需录入配送费[非-MOP(销售退货),非-MOP测试; ];
} else if(0 == orderObject->deliveryPrice && 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType && 29!=tempOrderType && 30!=tempOrderType && } else if ( 0 == orderObject->deliveryPrice && ( 18!=tempOrderType && 19!=tempOrderType && 20!=tempOrderType
31!=tempOrderType && 32!=tempOrderType) { && 29!=tempOrderType && 30!=tempOrderType && 31!=tempOrderType && 32!=tempOrderType
&& 14!=tempOrderType && 15!=tempOrderType
|| ( (14==tempOrderType || 15==tempOrderType) && "MOD"==orderObject->channel ) )
) {
QJsonObject tDeliveryFeeZoreObj; QJsonObject tDeliveryFeeZoreObj;
tDeliveryFeeZoreObj.insert("consume_num", 9); tDeliveryFeeZoreObj.insert("consume_num", 9);
tDeliveryFeeZoreObj.insert("pid","6000101"); //配送费SKU; tDeliveryFeeZoreObj.insert("pid","6000101"); //配送费SKU;
......
...@@ -475,7 +475,7 @@ public slots: ...@@ -475,7 +475,7 @@ public slots:
* 参数:NULL * 参数:NULL
* 返回:Json对象 * 返回:Json对象
* */ * */
QJsonObject _PackHttpReplyJson(const int status, const QString& msg, const QJsonObject& data, const int &iscontinue); QJsonObject _PackHttpReplyJson(const int status, const QString& msg, const QJsonObject& data, const int &iscontinue, const QString &orderId);
/** /**
*功能:FM外卖插件为响应Simphony请求准备返回数据 *功能:FM外卖插件为响应Simphony请求准备返回数据
......
...@@ -213,9 +213,9 @@ bool PrintCupStickPosDB::insertOrderProduct(OrderObject* orderObj,const QString& ...@@ -213,9 +213,9 @@ bool PrintCupStickPosDB::insertOrderProduct(OrderObject* orderObj,const QString&
} }
} }
/********************* 拼单-商品关联数据; **************************/ /********************* 预约+拼单-商品关联数据; **************************/
// "MOD" == orderObj->channel && "4" == orderObj->platformSource && "30" == orderObj->businessType // orderType: 7 预约 ; 8 拼单;
else if ( "30" == orderObj->businessType ) { else if ( 7 == orderObj->orderType || 8 == orderObj->orderType) {
for (int i=0; i < orderObj->proList.count(); i++) { for (int i=0; i < orderObj->proList.count(); i++) {
dishesObject* dish=orderObj->proList.at(i); dishesObject* dish=orderObj->proList.at(i);
query.prepare("INSERT INTO tb_main_prod_refinfo(chk_num, order_id, order_status, create_datetime, " query.prepare("INSERT INTO tb_main_prod_refinfo(chk_num, order_id, order_status, create_datetime, "
...@@ -273,6 +273,8 @@ bool PrintCupStickPosDB::insertOrderProduct(OrderObject* orderObj,const QString& ...@@ -273,6 +273,8 @@ bool PrintCupStickPosDB::insertOrderProduct(OrderObject* orderObj,const QString&
} }
return false;
} }
......
...@@ -575,10 +575,16 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj,const QString& ...@@ -575,10 +575,16 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj,const QString&
int tempBusinessType = orderObj->businessType.toInt(); int tempBusinessType = orderObj->businessType.toInt();
if ( "WSG-MOD" == orderObj->channel && "4" == orderObj->platformSource) if ( "WSG-MOD" == orderObj->channel && "4" == orderObj->platformSource)
tempBusinessType = 20; tempBusinessType = 20;
if ( 7 == orderObj->orderType ) {
tempBusinessType = 10;
} else if ( 8 == orderObj->orderType ) {
tempBusinessType = 30;
}
query.addBindValue( tempBusinessType ); // --订单业务类型: 10:预约单 20:WSG-杯贴祝福 30:拼单 query.addBindValue( tempBusinessType ); // --订单业务类型: 10:预约单 20:WSG-杯贴祝福 30:拼团
query.addBindValue(orderObj->appointedTime); // -- query.addBindValue(orderObj->expectDate); // -- 预约取餐时间
query.addBindValue(orderObj->appointedRemindTemplate); QString tempAppointedRemindTemplate = QString::number(orderObj->inAdvanceTakemeal) + ";" + orderObj->reserveMakeTime; // 预约模板;
query.addBindValue(tempAppointedRemindTemplate);
query.addBindValue(orderObj->orderType); query.addBindValue(orderObj->orderType);
QString tempChannel = ("WSG-MOD" == orderObj->channel)?"MOD" :orderObj->channel; QString tempChannel = ("WSG-MOD" == orderObj->channel)?"MOD" :orderObj->channel;
...@@ -618,8 +624,8 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj,const QString& ...@@ -618,8 +624,8 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj,const QString&
.arg((orderObj->waybillId).length()?orderObj->waybillId:QString("0")) .arg((orderObj->waybillId).length()?orderObj->waybillId:QString("0"))
.arg(orderObj->pickupCode.length()==0?0:orderObj->pickupCode.toInt()) .arg(orderObj->pickupCode.length()==0?0:orderObj->pickupCode.toInt())
.arg(orderObj->riderPhone).arg(orderObj->riderName).arg(abs(orderObj->disPlateformFee)) .arg(orderObj->riderPhone).arg(orderObj->riderName).arg(abs(orderObj->disPlateformFee))
.arg(orderObj->memo).arg(orderObj->secretSignal).arg(orderObj->consumerRemark).arg( tempBusinessType ).arg(orderObj->appointedTime) .arg(orderObj->memo).arg(orderObj->secretSignal).arg(orderObj->consumerRemark).arg( tempBusinessType ).arg(orderObj->expectDate)
.arg(orderObj->appointedRemindTemplate).arg(orderObj->orderType).arg(orderObj->channel).arg(orderObj->platformSource).arg(orderObj->payWay) .arg(tempAppointedRemindTemplate).arg(orderObj->orderType).arg(orderObj->channel).arg(orderObj->platformSource).arg(orderObj->payWay)
.arg(orderObj->customerId).arg(orderObj->customerName).arg(orderObj->msr_no).arg(orderObj->storeId).arg(orderObj->subStoreId) .arg(orderObj->customerId).arg(orderObj->customerName).arg(orderObj->msr_no).arg(orderObj->storeId).arg(orderObj->subStoreId)
.arg(orderObj->storeName).arg(orderObj->storeAddress).arg(orderObj->isPackage).arg(orderObj->orderDiscount).arg(orderObj->totalPrice); .arg(orderObj->storeName).arg(orderObj->storeAddress).arg(orderObj->isPackage).arg(orderObj->orderDiscount).arg(orderObj->totalPrice);
} else { } else {
...@@ -630,6 +636,103 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj,const QString& ...@@ -630,6 +636,103 @@ bool PrintSumBillPosDB::insertOrderSumBill(OrderObject* orderObj,const QString&
return result; return result;
} }
int PrintSumBillPosDB::syncOrderDataToDB(OrderObject* orderObj) {
// 0: 同步失败;1: 无需同步;2: 同步成功;
int syncAppointOrder = 1;
// 1、同步 预约当日订单的 "提前到店" 信息,避免出现 遗漏;
if ( OrderObject::Refunded != orderObj->orderStatus && 7 == orderObj->orderType && orderObj->inAdvanceTakemeal ) {
syncAppointOrder = syncAppointOrderInfo(orderObj);
QLOG_INFO()<<QString("[<<<<---syncOrderDataToDB syncAppointOrderInfo OrderId %1 ArriverAhead:%2 syncAppointOrder:%3--->>>>]")
.arg(orderObj->id).arg(orderObj->inAdvanceTakemeal).arg(syncAppointOrder);
}
// 2、同步其他......
return syncAppointOrder;
}
int PrintSumBillPosDB::syncAppointOrderInfo(OrderObject* orderObj) {
QMutexLocker mutex(&m_mutex);
// 0: 更新失败; 1:无需更新; 2: 更新成功;
int syncRet = 0;
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return false;
}
// 先查找记录(退单无需更新) 判断是否需要同步;在记录同步记录结果;
QSqlQuery query(m_sqlDb);
query.prepare(QString(" select appointed_remindTemplate from tb_msr_customer_info where order_id='%1' and order_status !=6").arg(orderObj->id));
if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<QString("[<<<<---SqlServer Database: select OrderId %1 appointed_remindTemplate Failed--->>>>]").arg(orderObj->id);
syncRet= 0;
} else {
if ( query.first() && query.value(0).toString().length() ) {
QString tempRemindTemplate = query.value(0).toString().split(';').first();
if ( orderObj->inAdvanceTakemeal != tempRemindTemplate.toInt() ) {
QSqlQuery updateQuery(m_sqlDb);
updateQuery.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1' where order_id='%2' and order_status !=6")
.arg(QString::number(orderObj->inAdvanceTakemeal) + ";" + orderObj->reserveMakeTime).arg(orderObj->id));
if(!updateQuery.exec()) {
QLOG_ERROR()<<updateQuery.lastError().text()<<QString("[<<<<---SqlServer Database:Sync OrderId %1 appointed_remindTemplate Failed--->>>>]").arg(orderObj->id);
syncRet= 0;
} else {
QLOG_INFO()<<QString("[<<<<---SqlServer Database:Sync OrderId %1 appointed_remindTemplate success--->>>>]").arg(orderObj->id);
syncRet= 2;
}
} else {
syncRet= 1;
}
} else {
syncRet= 1;
}
}
m_sqlDb.close();
return syncRet;
}
int PrintSumBillPosDB::updateOrderDataToDB(OrderObject* orderObj, const QString &cloumnName) {
// 0: 更新失败;1: 无需更新; 2: 更新成功;
int updateAppointOrder = 1;
if ("appointed_remindTemplate"==cloumnName ) {
// 1、更新 预约当日订单的 "提前到店" 信息,避免出现 遗漏;
if ( OrderObject::Refunded != orderObj->orderStatus && 7 == orderObj->orderType && orderObj->inAdvanceTakemeal ) {
updateAppointOrder = updateAppointOrderInfo(orderObj) ? 2: 0 ;
QLOG_INFO()<<QString("[<<<<---updateOrderDataToDB updateAppointOrderInfo OrderId %1 ArriverAhead:%2 updateAppointOrder:%3--->>>>]")
.arg(orderObj->id).arg(orderObj->inAdvanceTakemeal).arg(updateAppointOrder);
}
}
return updateAppointOrder;
}
bool PrintSumBillPosDB::updateAppointOrderInfo(OrderObject* orderObj) {
QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) {
QLOG_ERROR()<<"[<<<<---SqlServer Database:Open Failed--->>>>]"<<m_sqlDb.lastError().text();
return false;
}
// 0: 更新失败; 2: 更新成功;
bool updateRet = false;
QSqlQuery query(m_sqlDb);
query.prepare(QString("update tb_msr_customer_info set appointed_remindTemplate='%1' where order_id='%2' and order_status !=6")
.arg(QString::number(orderObj->inAdvanceTakemeal) + ";" + orderObj->reserveMakeTime).arg(orderObj->id));
if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<QString("[<<<<---SqlServer Database:update OrderId %1 appointed_remindTemplate Failed--->>>>]").arg(orderObj->id);
updateRet= false;
} else {
QLOG_INFO()<<QString("[<<<<---SqlServer Database:Update OrderId %1 appointed_remindTemplate success--->>>>]").arg(orderObj->id);
updateRet = true;
}
m_sqlDb.close();
return updateRet;
}
bool PrintSumBillPosDB::updateOrderSumBillStatus(OrderObject* orderObj, const int &OrderStatus){ bool PrintSumBillPosDB::updateOrderSumBillStatus(OrderObject* orderObj, const int &OrderStatus){
QMutexLocker mutex(&m_mutex); QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) { if(!m_sqlDb.open()) {
...@@ -651,6 +754,7 @@ bool PrintSumBillPosDB::updateOrderSumBillStatus(OrderObject* orderObj, const in ...@@ -651,6 +754,7 @@ bool PrintSumBillPosDB::updateOrderSumBillStatus(OrderObject* orderObj, const in
return result; return result;
} }
bool PrintSumBillPosDB::isOrderAndCknoSumBillExist(const QString& orderId,const QString& posCheckNo){ bool PrintSumBillPosDB::isOrderAndCknoSumBillExist(const QString& orderId,const QString& posCheckNo){
QMutexLocker mutex(&m_mutex); QMutexLocker mutex(&m_mutex);
if(!m_sqlDb.open()) { if(!m_sqlDb.open()) {
......
...@@ -58,6 +58,34 @@ public: ...@@ -58,6 +58,34 @@ public:
bool insertOrderSumBill(OrderObject* orderObj, const QString& posCheckNo); bool insertOrderSumBill(OrderObject* orderObj, const QString& posCheckNo);
/** /**
*功能: 根据订单对象指针 同步pos本地数据库中数据;
*参数:[1]订单对象指针
*返回: 0: 同步失败;1: 无需同步;2: 同步成功;
**/
int syncOrderDataToDB(OrderObject* orderObj);
/**
*功能: 根据订单对象 同步pos数据库中汇总单中的预约信息;
*参数:[1]订单对象指针
*返回: 0: 同步失败;1: 无需同步;2: 同步成功;
**/
int syncAppointOrderInfo(OrderObject* orderObj);
/**
*功能: 根据订单对象指针 更新pos本地数据库中数据;
*参数:[1]订单对象指针
*返回: 0: 更新失败;1: 无需更新; 2: 更新成功;
**/
int updateOrderDataToDB(OrderObject* orderObj, const QString &cloumnName);
/**
*功能: 根据订单对象 更新 pos数据库中汇总单中的预约信息;
*参数:[1]订单号
*返回:true操作成功,false失败
**/
bool updateAppointOrderInfo(OrderObject* orderObj);
/**
*功能: 根据订单ID 更新 pos本地数据库中汇总单状态信息; *功能: 根据订单ID 更新 pos本地数据库中汇总单状态信息;
*参数:[1]订单号[2] [3] [4] [5] [6] *参数:[1]订单号[2] [3] [4] [5] [6]
*返回:true操作成功,false失败 *返回:true操作成功,false失败
......
...@@ -28,6 +28,7 @@ void LoaclHttpServer::run() ...@@ -28,6 +28,7 @@ void LoaclHttpServer::run()
QJsonObject replyObject; QJsonObject replyObject;
int status; //解析json结果 int status; //解析json结果
QString msg; QString msg;
QString orderId = ""; //接受推单过来的订单号
QJsonObject data; //回复的内容json QJsonObject data; //回复的内容json
int iscontinue =0; int iscontinue =0;
recvObject = QJsonDocument::fromJson(recvData.toUtf8(), &jsonError).object(); recvObject = QJsonDocument::fromJson(recvData.toUtf8(), &jsonError).object();
...@@ -48,9 +49,11 @@ void LoaclHttpServer::run() ...@@ -48,9 +49,11 @@ void LoaclHttpServer::run()
if(!FlowControl::GetInstance()._SimValidOrdersListIsEmpty()) { if(!FlowControl::GetInstance()._SimValidOrdersListIsEmpty()) {
iscontinue=1; iscontinue=1;
} }
orderId = recvObject["orderId"].toString();
} }
/***将FM外卖插件中的合法有效数据返回给上面Http发过来的请求***/ /***将FM外卖插件中的合法有效数据返回给上面Http发过来的请求***/
replyObject = FlowControl::GetInstance()._PackHttpReplyJson(status, msg, data,iscontinue); replyObject = FlowControl::GetInstance()._PackHttpReplyJson(status, msg, data, iscontinue, orderId);
QLOG_INFO() << QString::fromLocal8Bit("[<<<<---FM外卖插件回应Http拉单请求后的返回结果:--->>>>]") << replyObject; QLOG_INFO() << QString::fromLocal8Bit("[<<<<---FM外卖插件回应Http拉单请求后的返回结果:--->>>>]") << replyObject;
session->replyJsonObject(replyObject); session->replyJsonObject(replyObject);
} }
......
...@@ -132,18 +132,20 @@ void OrderObject::FetchDataFromJson(const QJsonObject &json) ...@@ -132,18 +132,20 @@ void OrderObject::FetchDataFromJson(const QJsonObject &json)
QString OrderObject::getChannelName() QString OrderObject::getChannelName()
{ {
QLOG_INFO() << QString("[<<<<---OrderObject:getChannelName [%1]--->>>>]").arg(channel); QLOG_INFO() << QString("[<<<<---OrderObject:getChannelName [%1]--->>>>]").arg(channel);
if ("MOD" == channel && 3 != orderType) { if ( "MOD" == channel ) {
if ( 3 == orderType ) {
return QString::fromLocal8Bit("星-客诉");
}else if ( 7 == orderType ) {
return QString::fromLocal8Bit("预约-MOD");
}else if ( 8 == orderType ) {
return QString::fromLocal8Bit("拼团-MOD");
} else {
if ( "4" == platformSource ) { if ( "4" == platformSource ) {
if ( "30" == businessType) {
return QString::fromLocal8Bit("拼单-MOD");
}
return QString::fromLocal8Bit("微信-MOD"); return QString::fromLocal8Bit("微信-MOD");
} else { } else {
return QString::fromLocal8Bit("星-MOD"); return QString::fromLocal8Bit("星-MOD");
} }
}
}else if ("MOD" == channel && 3 == orderType) {
return QString::fromLocal8Bit("星-客诉");
}else if ("WSG-MOD" == channel) { // 兼容渠道名称不统一问题 }else if ("WSG-MOD" == channel) { // 兼容渠道名称不统一问题
return QString::fromLocal8Bit("微信用星说"); return QString::fromLocal8Bit("微信用星说");
...@@ -151,15 +153,20 @@ QString OrderObject::getChannelName() ...@@ -151,15 +153,20 @@ QString OrderObject::getChannelName()
}else if("ELE" == channel){ }else if("ELE" == channel){
return QString::fromLocal8Bit("饿了么"); return QString::fromLocal8Bit("饿了么");
}else if("MOP" == channel && 4 != orderType){ }else if ( "MOP" == channel ){
if ( 4 == orderType ) {
return QString::fromLocal8Bit("星-自测");
} else if ( 7 == orderType ) {
return QString::fromLocal8Bit("预约-MOP");
} else if ( 8 == orderType ) {
return QString::fromLocal8Bit("拼团-MOP");
} else {
if ( "5" == platformSource ) { if ( "5" == platformSource ) {
return QString::fromLocal8Bit("口碑-MOP"); return QString::fromLocal8Bit("口碑-MOP");
} else { } else {
return QString::fromLocal8Bit("星-MOP"); return QString::fromLocal8Bit("星-MOP");
} }
}
}else if("MOP" == channel && 4 == orderType){
return QString::fromLocal8Bit("星-自测");
}else{ }else{
return QString::fromLocal8Bit("未知"); return QString::fromLocal8Bit("未知");
......
...@@ -84,8 +84,9 @@ class OrderObject : public QObject ...@@ -84,8 +84,9 @@ class OrderObject : public QObject
Q_PROPERTY (QString platformSource READ getPlatformSource WRITE setPlatformSource) Q_PROPERTY (QString platformSource READ getPlatformSource WRITE setPlatformSource)
Q_PROPERTY (int orderIndex READ getOrderIndex WRITE setOrderIndex) Q_PROPERTY (int orderIndex READ getOrderIndex WRITE setOrderIndex)
Q_PROPERTY (QString appointedTime READ getAppointedTime WRITE setAppointedTime) Q_PROPERTY (QString expectDate READ getExpectDate WRITE setExpectDate)
Q_PROPERTY (QString appointedRemindTemplate READ getAppointedRemindTemplate WRITE setAppointedRemindTemplate) Q_PROPERTY (QString reserveMakeTime READ getReserveMakeTime WRITE setReserveMakeTime)
Q_PROPERTY (int inAdvanceTakemeal READ getInAdvanceTakemeal WRITE setInAdvanceTakemeal)
Q_PROPERTY (QString subStoreId READ getSubStoreId WRITE setSubStoreId) Q_PROPERTY (QString subStoreId READ getSubStoreId WRITE setSubStoreId)
public: public:
...@@ -181,8 +182,9 @@ public: ...@@ -181,8 +182,9 @@ public:
QString makeDeviceId; //PMS 更新制作状态的设备Id QString makeDeviceId; //PMS 更新制作状态的设备Id
QString businessType; //订单业务类型: 10:预约单 20:杯贴祝福 30:拼团 QString businessType; //订单业务类型: 10:预约单 20:杯贴祝福 30:拼团
QString appointedTime; // 预约日期 [预约单-预约日期] QString expectDate; // 预约时间 [预约单-顾客预计取餐时间]
QString appointedRemindTemplate; // 预约提醒模板【新增字段:string】 QString reserveMakeTime; // 预约制作时间【新增字段:string】
int inAdvanceTakemeal; // 预约单提前到店标志【新增字段:int】
QString subStoreId; // 子门店号 【新增字段:string】 QString subStoreId; // 子门店号 【新增字段:string】
int forwardPosStatus; // 正向单入机状态: 0:未知 1: 成功 2:失败; int forwardPosStatus; // 正向单入机状态: 0:未知 1: 成功 2:失败;
...@@ -424,11 +426,14 @@ public: ...@@ -424,11 +426,14 @@ public:
inline QString getSecretSignal()const{return secretSignal;} inline QString getSecretSignal()const{return secretSignal;}
inline void setSecretSignal(const QString& v){secretSignal = v;} inline void setSecretSignal(const QString& v){secretSignal = v;}
inline QString getAppointedTime()const{return appointedTime;} inline QString getExpectDate()const{return expectDate;}
inline void setAppointedTime(const QString& v){appointedTime = v;} inline void setExpectDate(const QString& v){expectDate = v;}
inline QString getAppointedRemindTemplate()const{return appointedRemindTemplate;} inline QString getReserveMakeTime()const{return reserveMakeTime;}
inline void setAppointedRemindTemplate(const QString& v){appointedRemindTemplate = v;} inline void setReserveMakeTime(const QString& v){reserveMakeTime = v;}
inline int getInAdvanceTakemeal()const{return inAdvanceTakemeal;}
inline void setInAdvanceTakemeal(const int& v){inAdvanceTakemeal = v;}
inline QString getSubStoreId()const{return subStoreId;} inline QString getSubStoreId()const{return subStoreId;}
inline void setSubStoreId(const QString& v){subStoreId = v;} inline void setSubStoreId(const QString& v){subStoreId = v;}
......
...@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico" ...@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif #endif
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***// //***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 2,2020,5,21 FILEVERSION 2,2020,5,26
PRODUCTVERSION 2,2020,5,21 PRODUCTVERSION 2,2020,5,26
//*************************************************************************// //*************************************************************************//
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
...@@ -31,8 +31,8 @@ VS_VERSION_INFO VERSIONINFO ...@@ -31,8 +31,8 @@ VS_VERSION_INFO VERSIONINFO
VALUE "OriginalFilename", "fmTakeout.exe" VALUE "OriginalFilename", "fmTakeout.exe"
VALUE "ProductName", "Delivery Order Plugin" VALUE "ProductName", "Delivery Order Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***// //***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "2.2020.5.21" VALUE "ProductVersion", "2.2020.5.26"
VALUE "FileVersion", "2.2020.5.21" VALUE "FileVersion", "2.2020.5.26"
//*************************************************************************// //*************************************************************************//
END END
END END
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
//#define APP_VERSION "2.2019.916.2" //#define APP_VERSION "2.2019.916.2"
//#define APP_VERSION "2.2020.26.1" //#define APP_VERSION "2.2020.26.1"
//#define APP_VERSION "2.2020.312.1" //#define APP_VERSION "2.2020.312.1"
#define APP_VERSION "2.2020.5.21" #define APP_VERSION "2.2020.5.26"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号 //修正版本号时,切记修正 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