Commit 0d33c109 by wuyang.zou

fix some bug

Version:8.20.8.23
parent 0c81956c
...@@ -2254,8 +2254,6 @@ bool FlowControl::_ResponseSimphony05Request(const QJsonObject &content, QJsonOb ...@@ -2254,8 +2254,6 @@ bool FlowControl::_ResponseSimphony05Request(const QJsonObject &content, QJsonOb
error=QString::fromLocal8Bit("Request Action05: Pragram Error"); error=QString::fromLocal8Bit("Request Action05: Pragram Error");
} }
// 便于解锁,便于查看;
emit doUnLockFloatFrom(); //****************解锁悬浮框*****************//
return result; return result;
} }
...@@ -2441,7 +2439,7 @@ bool FlowControl::_ResponseSimphony06Request(const QJsonObject &content, QJsonOb ...@@ -2441,7 +2439,7 @@ bool FlowControl::_ResponseSimphony06Request(const QJsonObject &content, QJsonOb
m_RepOMSRecordOrderMutex.unlock(); m_RepOMSRecordOrderMutex.unlock();
//************* 新增业务逻辑,针对汇报异常的订单需要;添加到 向OMS汇报入机情况的队列中; end*************// //************* 新增业务逻辑,针对汇报异常的订单需要;添加到 向OMS汇报入机情况的队列中; end*************//
} else { } else {
result=false; result=true;
error=QString::fromLocal8Bit("Request Action06: Delivery OrderId And Sim Exception ErrorCode Can't Empty"); error=QString::fromLocal8Bit("Request Action06: Delivery OrderId And Sim Exception ErrorCode Can't Empty");
} }
} else { } else {
...@@ -3021,6 +3019,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso ...@@ -3021,6 +3019,11 @@ bool FlowControl::_ResponseSimReqFristOrderData(const QJsonObject &content, QJso
// 优先使用OMS传递的 globalServiceType 与 globalOrderType 值为准; // 优先使用OMS传递的 globalServiceType 与 globalOrderType 值为准;
if ( orderObject->globalServiceType ) { if ( orderObject->globalServiceType ) {
tempServiceType = orderObject->globalServiceType; tempServiceType = orderObject->globalServiceType;
// 线下模拟入机;
if ( 1== tempServiceType || 8== tempServiceType) {
tempOrderPayType = 53;
tempSbkAppPayValue = orderObject->id;
}
} }
//需要重点注意订单对象的数据初始化问题; //需要重点注意订单对象的数据初始化问题;
......
...@@ -6,15 +6,16 @@ ...@@ -6,15 +6,16 @@
#include "simProcOrderDB.h" #include "simProcOrderDB.h"
ReadExcel::ReadExcel() ReadExcel::ReadExcel()
:m_row(2), m_col(1), m_readExcelOrderFinish(false), m_filename("") : m_filename("")
{ {
m_totolExcelRow = 0; m_totolExcelRow = 0;
m_vaildOrderNum = 0; m_vaildOrderNum = 0;
m_continueReadExcelRet = true;
m_readMaxRowLimit = ConfigManger::GetInstance().GetPostOrderLimitSize(); m_readMaxRowLimit = ConfigManger::GetInstance().GetPostOrderLimitSize();
if ( !m_readMaxRowLimit ) { if ( !m_readMaxRowLimit ) {
m_readMaxRowLimit = 20; m_readMaxRowLimit = 10;
} }
m_excel = new QAxObject("Excel.Application");
m_readExcelTimer = new QTimer(this); m_readExcelTimer = new QTimer(this);
m_postExcelSocket = new BillSocket(this); m_postExcelSocket = new BillSocket(this);
...@@ -39,8 +40,8 @@ bool ReadExcel::SelectExcelFile(QWidget* p) { ...@@ -39,8 +40,8 @@ bool ReadExcel::SelectExcelFile(QWidget* p) {
return false; return false;
} else { } else {
m_filename = strFile; m_filename = strFile;
m_excel = new QAxObject("Excel.Application");
openExcel(); openExcel();
m_readExcelTimer->start(1000*5); //打开文件 5s 后开始读取文件内容;
} }
QLOG_INFO()<<"[<<<<---ReadExcel:: Select Excel File All Name Path strFile--->>>>]"<< m_filename; QLOG_INFO()<<"[<<<<---ReadExcel:: Select Excel File All Name Path strFile--->>>>]"<< m_filename;
return true; return true;
...@@ -79,12 +80,21 @@ bool ReadExcel::openExcel() ...@@ -79,12 +80,21 @@ bool ReadExcel::openExcel()
return false; return false;
}; };
try { try {
m_row = 2; //从第二行开始读记录;
m_col = 1; //从第一列开始读;
m_totolExcelRow = 0; //Excel表总行
m_vaildOrderNum = 0; //累计有效订单总数 需要记录上一次的;
m_readExcelOrderFinish = false; // 重置读取Excel 表结束 标志;
m_continueReadExcelRet = true;
m_excel->setProperty("Visible", 0); m_excel->setProperty("Visible", 0);
m_excel->setProperty("EnableEvents", false); m_excel->setProperty("EnableEvents", false);
m_workbooks = m_excel->querySubObject("WorkBooks"); m_workbooks = m_excel->querySubObject("WorkBooks");
m_workbooks->dynamicCall("Open (const QString&)", m_filename); m_workbooks->dynamicCall("Open (const QString&)", m_filename);
m_workbook = m_excel->querySubObject("ActiveWorkBook"); m_workbook = m_excel->querySubObject("ActiveWorkBook");
m_worksheet = m_workbook->querySubObject("Sheets(int)", 1); //worksheet number m_worksheet = m_workbook->querySubObject("Sheets(int)", 1); //worksheet number
m_readExcelTimer->start(1000*5); //打开文件 5s 后开始读取文件内容;
} catch (...) { } catch (...) {
return false; return false;
} }
...@@ -145,7 +155,7 @@ bool ReadExcel::openSkuExcelRead(QString strFile, int &suc, int &fail) ...@@ -145,7 +155,7 @@ bool ReadExcel::openSkuExcelRead(QString strFile, int &suc, int &fail)
//bLastRow = true; // 代表EXCEL 的最后一行了; 正常退出读取; //bLastRow = true; // 代表EXCEL 的最后一行了; 正常退出读取;
bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum) bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum)
{ {
// Sales Item (posKey) | SKU | 2个字段; // Sales Item (posKey) | SKU | Price | 3个字段;
int intSumRows = 1000; //! 假定 1000 行, 一旦识别到 第一列的数据非有效 SKU 则跳出此行继续下一行; int intSumRows = 1000; //! 假定 1000 行, 一旦识别到 第一列的数据非有效 SKU 则跳出此行继续下一行;
int intReadRowNum=0; int intReadRowNum=0;
...@@ -155,7 +165,6 @@ bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum) ...@@ -155,7 +165,6 @@ bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum)
QString keyCode = ""; QString keyCode = "";
int keyPrice = 0; int keyPrice = 0;
QString sku = ""; QString sku = "";
PosKeyObject* posKeyPtr = new PosKeyObject();
for (intReadRowNum = 2; intReadRowNum < intSumRows; intReadRowNum++) for (intReadRowNum = 2; intReadRowNum < intSumRows; intReadRowNum++)
{ {
...@@ -167,8 +176,6 @@ bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum) ...@@ -167,8 +176,6 @@ bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum)
colthirdCell = m_skuExcel->querySubObject("Cells(Int, Int)", intReadRowNum, 3 ); colthirdCell = m_skuExcel->querySubObject("Cells(Int, Int)", intReadRowNum, 3 );
keyPrice = colthirdCell->dynamicCall("value").toInt(); keyPrice = colthirdCell->dynamicCall("value").toInt();
//QLOG_INFO()<<QString("[ intReadRowNum:%1 posKey:%2 sku: %3]").arg(intReadRowNum).arg(keyCode).arg(sku);
if ( keyCode.length() == 0 && sku.length() == 0 ) { if ( keyCode.length() == 0 && sku.length() == 0 ) {
bLastRow = true; bLastRow = true;
lastRowNum = intReadRowNum - 1; lastRowNum = intReadRowNum - 1;
...@@ -181,6 +188,7 @@ bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum) ...@@ -181,6 +188,7 @@ bool ReadExcel::getSkufromExcel(bool &bLastRow, int &lastRowNum)
continue; continue;
} }
if ( !m_exlSkuMap.contains( sku) ) { if ( !m_exlSkuMap.contains( sku) ) {
PosKeyObject* posKeyPtr = new PosKeyObject();
posKeyPtr->keyCode = keyCode; posKeyPtr->keyCode = keyCode;
posKeyPtr->keyOriginPrice = keyPrice * 100; posKeyPtr->keyOriginPrice = keyPrice * 100;
m_exlSkuMap.insert( sku, posKeyPtr); m_exlSkuMap.insert( sku, posKeyPtr);
...@@ -283,8 +291,14 @@ bool ReadExcel::getALLfromExcel(QJsonArray &exlOrderList, bool &bLastRow) ...@@ -283,8 +291,14 @@ bool ReadExcel::getALLfromExcel(QJsonArray &exlOrderList, bool &bLastRow)
if ( !excelNextOrderJson.contains("channel") ) { if ( !excelNextOrderJson.contains("channel") ) {
excelNextOrderJson.insert("channel", "MOP"); excelNextOrderJson.insert("channel", "MOP");
} }
if ( !excelNextOrderJson.contains("globalServiceType") ) { if ( !excelNextOrderJson.contains("globalServiceType") ) {
excelNextOrderJson.insert("globalServiceType", 1); // 根据订单状态更新 GlobalServiceType
if ( excelNextOrderJson.contains("orderStatus") && ( 6 == excelNextOrderJson["orderStatus"].toInt() ) ) {
excelNextOrderJson.insert("globalServiceType", 8);
} else {
excelNextOrderJson.insert("globalServiceType", 1);
}
} }
if ( !excelNextOrderJson.contains("orderType") ) { if ( !excelNextOrderJson.contains("orderType") ) {
excelNextOrderJson.insert("orderType", 1); excelNextOrderJson.insert("orderType", 1);
...@@ -295,6 +309,7 @@ bool ReadExcel::getALLfromExcel(QJsonArray &exlOrderList, bool &bLastRow) ...@@ -295,6 +309,7 @@ bool ReadExcel::getALLfromExcel(QJsonArray &exlOrderList, bool &bLastRow)
// 添加到 JsonArray // 添加到 JsonArray
excelProdsArrayJson.append(excelProdJson); excelProdsArrayJson.append(excelProdJson);
excelNextOrderJson.insert("products",excelProdsArrayJson); excelNextOrderJson.insert("products",excelProdsArrayJson);
QLOG_INFO()<<"[<<<<---getALLfromExcel:: excelNextOrderJson: --->>>>]"<<excelNextOrderJson;
exlOrderList.append(excelNextOrderJson); exlOrderList.append(excelNextOrderJson);
} }
// 当前订单号 与 上一订单号相同; // 当前订单号 与 上一订单号相同;
...@@ -306,6 +321,7 @@ bool ReadExcel::getALLfromExcel(QJsonArray &exlOrderList, bool &bLastRow) ...@@ -306,6 +321,7 @@ bool ReadExcel::getALLfromExcel(QJsonArray &exlOrderList, bool &bLastRow)
excelProdsArrayJson.append(excelProdJson); excelProdsArrayJson.append(excelProdJson);
// 需要确定之前 product Key Wether Exist; // 需要确定之前 product Key Wether Exist;
excelOrderJson.insert("products",excelProdsArrayJson); excelOrderJson.insert("products",excelProdsArrayJson);
QLOG_INFO()<<"[<<<<---getALLfromExcel:: excelOrderJson: --->>>>]"<<excelOrderJson;
exlOrderList.append(excelOrderJson); exlOrderList.append(excelOrderJson);
} else { } else {
QLOG_INFO()<<"[<<<<---getALLfromExcel:: Prev Order key: 'products' don't exist; curOrderId: --->>>>]" QLOG_INFO()<<"[<<<<---getALLfromExcel:: Prev Order key: 'products' don't exist; curOrderId: --->>>>]"
...@@ -333,17 +349,17 @@ bool ReadExcel::convertOrderObject(QString &curOrderId, QJsonObject &OrderJson , ...@@ -333,17 +349,17 @@ bool ReadExcel::convertOrderObject(QString &curOrderId, QJsonObject &OrderJson ,
bIgnoreRow = false; bIgnoreRow = false;
//订单数据; //订单数据;
static QString rowOrderId; QString rowOrderId;
static int rowProductPrice = 0; int rowProductPrice = 0;
static int rowPayPrice = 0; int rowPayPrice = 0;
static int rowOrderStatus = 0; int rowOrderStatus = 0;
// static QString rowProductName; // static QString rowProductName;
//商品数据 + 折扣数据; //商品数据 + 折扣数据;
static int rowProPrice = 0; int rowProPrice = 0;
static int rowProQty = 0; int rowProQty = 0;
static QString rowProSku; QString rowProSku;
static int rowProDisc = 0; int rowProDisc = 0;
switch ( colNum ) { switch ( colNum ) {
case 1: { case 1: {
...@@ -439,6 +455,9 @@ bool ReadExcel::convertOrderObject(QString &curOrderId, QJsonObject &OrderJson , ...@@ -439,6 +455,9 @@ bool ReadExcel::convertOrderObject(QString &curOrderId, QJsonObject &OrderJson ,
if ( !productJson.contains("promotionPrice") ) { if ( !productJson.contains("promotionPrice") ) {
rowProDisc = posKeyPtr->keyOriginPrice - productJson["price"].toInt(); rowProDisc = posKeyPtr->keyOriginPrice - productJson["price"].toInt();
productJson.insert("promotionPrice", rowProDisc ); productJson.insert("promotionPrice", rowProDisc );
QLOG_INFO()<<QString("[<<<<---convertOrderObject:: SKU: %1 PosKey:%2 DiscountPrice:%3--->>>>]")
.arg(rowProSku).arg(posKeyPtr->keyCode).arg(rowProDisc);
} }
} else { } else {
...@@ -459,9 +478,7 @@ bool ReadExcel::convertOrderObject(QString &curOrderId, QJsonObject &OrderJson , ...@@ -459,9 +478,7 @@ bool ReadExcel::convertOrderObject(QString &curOrderId, QJsonObject &OrderJson ,
void ReadExcel::onReadOrdersFromExcel() void ReadExcel::onReadOrdersFromExcel()
{ {
static bool continueReadExcelRet = true; if ( !m_continueReadExcelRet && m_failedOrderArrayList.size() ) {
if ( !continueReadExcelRet && m_failedOrderArrayList.size() ) {
QJsonObject tempJson = m_failedOrderArrayList.takeFirst(); QJsonObject tempJson = m_failedOrderArrayList.takeFirst();
QLOG_INFO() << QString("[<<<<---onReadOrdersFromExcel:: Repeat Send Failed List, m_failedOrderArrayList.size(): %1--->>>>]") QLOG_INFO() << QString("[<<<<---onReadOrdersFromExcel:: Repeat Send Failed List, m_failedOrderArrayList.size(): %1--->>>>]")
...@@ -469,7 +486,7 @@ void ReadExcel::onReadOrdersFromExcel() ...@@ -469,7 +486,7 @@ void ReadExcel::onReadOrdersFromExcel()
QJsonArray tempOrderArry = tempJson["orders"].toArray(); QJsonArray tempOrderArry = tempJson["orders"].toArray();
onPostExcelOrderListData( tempOrderArry, tempOrderArry.size() ); onPostExcelOrderListData( tempOrderArry, tempOrderArry.size() );
m_readExcelTimer->start(1000*60); m_readExcelTimer->start(1000*90);
// 读EXCEL 完成, 对读的文件进行释放; // 读EXCEL 完成, 对读的文件进行释放;
if (m_excel) { if (m_excel) {
...@@ -483,10 +500,10 @@ void ReadExcel::onReadOrdersFromExcel() ...@@ -483,10 +500,10 @@ void ReadExcel::onReadOrdersFromExcel()
return; return;
} }
if ( !continueReadExcelRet && !m_failedOrderArrayList.size() ) { if ( !m_continueReadExcelRet && !m_failedOrderArrayList.size() ) {
QLOG_INFO()<<"ReadExcel::onReadOrdersFromExcel: static continueReadExcelRet had been false && m_failedOrderArrayList Is Empty"; QLOG_INFO()<<"ReadExcel::onReadOrdersFromExcel: static continueReadExcelRet had been false && m_failedOrderArrayList Is Empty";
emit infoReadOrdersExcelRet(true, m_totolExcelRow, m_vaildOrderNum); emit infoReadOrdersExcelRet(true, m_totolExcelRow, m_vaildOrderNum);
m_readExcelTimer->start(1000*60*60); m_readExcelTimer->start(1000*60*2);
return; return;
} }
...@@ -496,18 +513,18 @@ void ReadExcel::onReadOrdersFromExcel() ...@@ -496,18 +513,18 @@ void ReadExcel::onReadOrdersFromExcel()
return; return;
} }
m_readExcelTimer->start(1000*10); //15s 触发一次读取 Excel文件; 分批循环读取; m_readExcelTimer->start(1000*20); //20s 触发一次读取 Excel文件; 分批循环读取;
QJsonArray exlOrderList; QJsonArray exlOrderList;
bool bLastRow = false; //判断是否已经读取到 Excel 表最后一行; bool bLastRow = false; //判断是否已经读取到 Excel 表最后一行;
bool readExcelRet = getALLfromExcel( exlOrderList , bLastRow); bool readExcelRet = getALLfromExcel( exlOrderList , bLastRow);
if ( !readExcelRet && !bLastRow) { if ( !readExcelRet && !bLastRow) {
QLOG_INFO()<<"ReadExcel::onReadOrdersFromExcel: getALLfromExcel Failed "; QLOG_INFO()<<"ReadExcel::onReadOrdersFromExcel: getALLfromExcel Failed ";
continueReadExcelRet = false; m_continueReadExcelRet = false;
} else { } else {
QLOG_INFO()<<"ReadExcel::onReadOrdersFromExcel: getALLfromExcel Sucessed "; QLOG_INFO()<<"ReadExcel::onReadOrdersFromExcel: getALLfromExcel Sucessed ";
if ( bLastRow ) { if ( bLastRow ) {
continueReadExcelRet = false; m_continueReadExcelRet = false;
} }
} }
......
...@@ -125,7 +125,8 @@ private: ...@@ -125,7 +125,8 @@ private:
//一次读取最多读取多少行记录; 需要考虑恰好切断 一笔订单多条商品数据记录; //一次读取最多读取多少行记录; 需要考虑恰好切断 一笔订单多条商品数据记录;
int m_readMaxRowLimit; int m_readMaxRowLimit;
bool m_readExcelOrderFinish; //读取Excel 表结束; bool m_readExcelOrderFinish; //每批读取Excel 表结束的标识;
bool m_continueReadExcelRet; //定时器触发读取Excel时机
QString m_filename; QString m_filename;
QString m_exportFileName; QString m_exportFileName;
......
...@@ -723,7 +723,7 @@ bool SimProcOrderDB::exportOrderPosResult(QVector<QStringList> &vec) ...@@ -723,7 +723,7 @@ bool SimProcOrderDB::exportOrderPosResult(QVector<QStringList> &vec)
bool result=true; bool result=true;
QLOG_INFO()<<QString("[<<<<---SimProcOrderDB::begin exportOrderPosResult --->>>>]"); QLOG_INFO()<<QString("[<<<<---SimProcOrderDB::begin exportOrderPosResult --->>>>]");
QSqlQuery query(m_sqlDb); QSqlQuery query(m_sqlDb);
query.prepare(QString("select orderId, isPushed, isRefund, isnull( posCheckNo, 0 ), creatTime from SimProcOrderTable where 1=1") ); query.prepare(QString("select orderId, isPushed, isRefund, isnull( posCheckNo, 0 ), creatTime from SimProcOrderTable where 1=1 order by posCheckNo ") );
if(!query.exec()) { if(!query.exec()) {
QLOG_ERROR()<<query.lastError().text()<<__FUNCTION__; QLOG_ERROR()<<query.lastError().text()<<__FUNCTION__;
result= false; result= false;
......
...@@ -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 8,2020,8,15 FILEVERSION 8,2020,8,23
PRODUCTVERSION 8,2020,8,15 PRODUCTVERSION 8,2020,8,23
//*************************************************************************// //*************************************************************************//
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", "8.2020.8.15" VALUE "ProductVersion", "8.2020.8.23"
VALUE "FileVersion", "8.2020.8.15" VALUE "FileVersion", "8.2020.8.23"
//*************************************************************************// //*************************************************************************//
END END
END END
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
//#define APP_VERSION "2.2020.312.1" //#define APP_VERSION "2.2020.312.1"
//#define APP_VERSION "2.2020.5.26" //#define APP_VERSION "2.2020.5.26"
//#define APP_VERSION "2.2020.6.29" //#define APP_VERSION "2.2020.6.29"
#define APP_VERSION "8.2020.8.15" #define APP_VERSION "8.2020.8.23"
//修正版本号时,切记修正 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