Commit c3ce0fa4 by yunpeng.song

入账逻辑修改,日志多线程配置。

parent e4f3e361
......@@ -86,13 +86,13 @@ FlowControl::FlowControl():semaphore(0)
{
status = 0;
}
if(!m_ordersEntryMap.isEmpty())
if(!m_ordersEntryList.isEmpty())
{
iscontinue=1;
}
}
replyObject = _PackHttpReplyJson(status, msg, data,iscontinue);
QLOG_INFO() << "[Http reply data]" << _GetJsonStr(replyObject);
QLOG_INFO() << "[Http reply data]" << replyObject;
session->replyJsonObject(replyObject);
}
else
......@@ -161,7 +161,7 @@ void FlowControl::_ClickOMSAssignArea()
void FlowControl::_ClickToLogin()
{
if(!m_bLoginResult||!m_ordersEntryMap.isEmpty())
if(!m_bLoginResult||!m_ordersEntryList.isEmpty())
{
QLOG_INFO()<<"retry click after 20s";
_ClickOMSAssignArea();
......@@ -210,7 +210,7 @@ bool FlowControl::_Login()
sendJson = DataManger::GetInstance().GetLoginData(ConfigManger::GetInstance().GetPartnerId(),m_storeId,
m_password, m_posId, m_cashierId,_GetIpAddress());
emit showAlert(AlertForm::LOADING, "正在登录......");
QLOG_INFO() << QString("[---login---][requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---login---][requestData:%1]")<<sendJson;
if(ConfigManger::GetInstance().GetLoginSslConfig())
{
m_loginSocket->SetSslConfig();
......@@ -218,8 +218,8 @@ bool FlowControl::_Login()
m_loginSocket->SetUrl(QUrl(ConfigManger::GetInstance().GetLoginServerUrl()+
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_ILOGIN)));
result = m_loginSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("login finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
QLOG_INFO() << QString("login finsh. [result:%1][msg:%2][recvData:")
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "登录失败![网络错误]");
......@@ -313,6 +313,8 @@ bool FlowControl::_PullOrder()
//新数据
orderObject = new OrderObject(this);
orderObject->FromJson(jsonObject);
orderObject->isPut = false;
orderObject->isCancle = false;
m_ordersMap.insert(orderObject->order_id, orderObject);
QLOG_INFO() << QString("new order[%1:%2].[data:]")
......@@ -335,8 +337,7 @@ bool FlowControl::_PullOrder()
orderObject->FromJson(jsonObject);
QLOG_INFO() << QString("old order[%1:%2].[data:%3]")
.arg(orderObject->order_id, orderObject->status_desc)
.arg(_GetJsonStr(jsonObject));
.arg(orderObject->order_id, orderObject->status_desc)<<jsonObject;
if(oldStatus != orderObject->status)
{
emit changeOrderStatus(orderObject, oldStatus);
......@@ -351,22 +352,18 @@ bool FlowControl::_PullOrder()
{
emit startRemind(1);
}
bool breaded = false,bcancled=false;
if(Orderstatus::getInstance().isput(orderObject->order_id))
{
breaded = true;
orderObject->isPut = true;
}
if(Orderstatus::getInstance().isrefund(orderObject->order_id))
{
bcancled=true;
orderObject->isCancle = true;
}
OrderProperpy op;
QString posSaledId=m_orderIdToPosSalesIdMap.value(orderObject->order_id);
if(posSaledId.isEmpty())
{
Orderstatus::getInstance().getPosSalesId(orderObject->order_id,posSaledId);
qDebug()<<posSaledId<<"-----------------------------";
}
orderObject->possale_id=posSaledId;
switch (orderObject->status){
......@@ -376,14 +373,15 @@ bool FlowControl::_PullOrder()
case OrderObject::ToSend:
case OrderObject::Finished:
case OrderObject::RequestRefund:
if(!breaded)
if(!orderObject->isPut)
{
op.bCancled = bcancled;
op.bReaded = breaded;
op.entryType = 1;
op.pullNum=0;
orderObject->putType = 1;
orderObject->putTimes = 0;
m_OrderEntryMutex.lock();
m_ordersEntryMap.insert(orderObject->order_id, op);
if(!m_ordersEntryList.contains(orderObject->order_id))
{
m_ordersEntryList.append(orderObject->order_id);
}
m_OrderEntryMutex.unlock();
_ClickOMSAssignArea();
}
......@@ -391,30 +389,29 @@ bool FlowControl::_PullOrder()
case OrderObject::AgreeRefund:
case OrderObject::Refunded:
case OrderObject::Cancled:
if(!bcancled)
if(!orderObject->isCancle)
{
if(!breaded)
if(!orderObject->isPut)
{
m_OrderEntryMutex.lock();
m_ordersEntryMap.erase(m_ordersEntryMap.find(orderObject->order_id));
m_ordersEntryList.removeOne(orderObject->order_id);
m_OrderEntryMutex.unlock();
}
else{
if(!posSaledId.isEmpty())
{
op.bCancled = bcancled;
op.bReaded = breaded;
op.entryType = 0;
op.pullNum=0;
orderObject->putType = 0;
orderObject->putTimes = 0;
m_OrderEntryMutex.lock();
m_ordersEntryMap.insert(orderObject->order_id, op);
if(!m_ordersEntryList.contains(orderObject->order_id))
{
m_ordersEntryList.append(orderObject->order_id);
}
_ClickOMSAssignArea();
m_OrderEntryMutex.unlock();
}
}
}
break;
default:
break;
......@@ -449,12 +446,12 @@ bool FlowControl::_SendHeart()
QJsonObject recvJson;
sendJson = DataManger::GetInstance().GetHeartData(m_password,m_posId,_GetIpAddress());
QLOG_INFO() << QString("[---sendheart---][requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---sendheart---][requestData:%1]")<<sendJson;
m_loginSocket->SetUrl(QUrl(ConfigManger::GetInstance().GetLoginServerUrl()+
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_HEART)));
result = m_loginSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("sendheart finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "发送心跳失败![网络错误]");
......@@ -479,7 +476,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId)
sendJson = DataManger::GetInstance().GetConfirmOrderData(orderId,m_ordersMap[orderId]->channel);
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---confirm order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---confirm order---]. [requestData:%1]")<<sendJson;
if(ConfigManger::GetInstance().GetOrderSslConfig())
{
m_procOrderSocket->SetSslConfig();
......@@ -492,7 +489,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId)
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_CONFIRM)));
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("confirm order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "接单失败![网络错误]");
......@@ -520,10 +517,10 @@ bool FlowControl::_RefuseOrder(const QString &orderId, int refuseCode,const QStr
sendJson = DataManger::GetInstance().GetRefuseOrderData(refuseCode, orderId);
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---refuse order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---refuse order---]. [requestData:%1]")<<sendJson;
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("refuse order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "拒单失败![网络错误]");
......@@ -562,10 +559,10 @@ bool FlowControl::_SendOrder(const QString& orderId)
sendJson = DataManger::GetInstance().GetSendOrderData(orderId);
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---sendout order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---sendout order---]. [requestData:%1]")<<sendJson;
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("sendout order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "送出失败![网络错误]");
......@@ -602,10 +599,10 @@ bool FlowControl::_CompleteOrder(const QString& orderId)
sendJson = DataManger::GetInstance().GetCompleteOrderData(orderId);
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---complete order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---complete order---]. [requestData:%1]")<<sendJson;
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("complete order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "完成失败![网络错误]");
......@@ -641,10 +638,10 @@ bool FlowControl::_RefuseRefund(const QString& orderId)
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---refuseRefund order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---refuseRefund order---]. [requestData:%1]")<<sendJson;
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("refuseRefund order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "拒绝退单失败![网络错误]");
......@@ -682,7 +679,7 @@ bool FlowControl::_RefundOrder(const QString &orderId,int reasonCode,const QStri
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---Refund order---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---Refund order---]. [requestData:%1]")<<sendJson;
if(ConfigManger::GetInstance().GetOrderSslConfig())
{
m_procOrderSocket->SetSslConfig();
......@@ -695,7 +692,7 @@ bool FlowControl::_RefundOrder(const QString &orderId,int reasonCode,const QStri
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_CANCLE)));
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("Refund order finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "退单失败![网络错误]");
......@@ -747,10 +744,10 @@ void FlowControl::onPullDishes()
sendJson = DataManger::GetInstance().GetStoreChannelInfoData();
emit showAlert(AlertForm::LOADING, "正在获取平台列表......");
QLOG_INFO() << QString("[---GetStoreChannelInfo---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---GetStoreChannelInfo---]. [requestData:%1]")<<sendJson;
result = m_pullDishesSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("GetStoreChannelInfo finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "获取平台列表失败![网络错误]");
......@@ -774,10 +771,10 @@ void FlowControl::onPullDishes()
sendJson = DataManger::GetInstance().GetPullDishesData(channelCode);
emit showAlert(AlertForm::LOADING, QString("正在获取[%1]菜品信息......").arg(channelName));
QLOG_INFO() << QString("[---pullDishes %1---]. [requestData:%2]").arg(channelName, _GetJsonStr(sendJson));
QLOG_INFO() << QString("[---pullDishes %1---]. [requestData:%2]").arg(channelName)<<sendJson;
result = m_pullDishesSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("pullDishes finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, QString("获取[%1]菜品信息失败![网络超时]").arg(channelName));
......@@ -834,10 +831,10 @@ void FlowControl::onUpdDishes(QString channelCode, QMap<QString, int> dishes)
emit showAlert(AlertForm::LOADING, "正在同步菜品销售状态......");
QLOG_INFO() << QString("[---update dishes---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---update dishes---]. [requestData:%1]")<<sendJson;
result = m_pullDishesSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("update dishes finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "同步菜品销售状态失败![网络错误]");
......@@ -864,10 +861,10 @@ void FlowControl::onUpdDishesForRef(QString channelCode, QMap<QString, int> dish
sendJson = DataManger::GetInstance().GetUpdDishesData(channelCode, dishes);
QLOG_INFO() << QString("[---UpdDishesForRef---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---UpdDishesForRef---]. [requestData:%1]")<<sendJson;
result = m_pullDishesSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("UpdDishesForRef finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
}
void FlowControl::onSetStoreOperatingStatus(const QString &channelCode, const QString &channelName, int business_status)
......@@ -881,14 +878,14 @@ void FlowControl::onSetStoreOperatingStatus(const QString &channelCode, const QS
sendJson = DataManger::GetInstance().GetOperatingStatusData(channelCode, business_status);
emit showAlert(AlertForm::LOADING, "正在设置门店营业状态......");
QLOG_INFO() << QString("[---SetStoreOperatingStatus---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---SetStoreOperatingStatus---]. [requestData:%1]")<<sendJson;
m_pullDishesSocket->SetUrl(QUrl(ConfigManger::GetInstance().GetStoreServerUrl()+
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_UPDATESTATE)));
qDebug()<<QUrl(ConfigManger::GetInstance().GetStoreServerUrl()+
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_UPDATESTATE));
result = m_pullDishesSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("SetStoreOperatingStatus finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "设置门店营业状态失败![网络错误]");
......@@ -922,10 +919,10 @@ void FlowControl::onDailyReport()
emit showAlert(AlertForm::LOADING, "正在通信......");
QLOG_INFO() << QString("[---Get daily report---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---Get daily report---]. [requestData:%1]")<<sendJson;
result = m_procOrderSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("get daily finish. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "获取入账日结失败![网络错误]");
......@@ -961,8 +958,7 @@ void FlowControl::_ClearOrder()
QLOG_INFO()<<QString("clear order %1").arg(order->order_id);
emit clearorder(order->order_id,order->status);
m_ordersMap.value(order->order_id)->deleteLater();
m_ordersEntryMap.erase(m_ordersEntryMap.find(order->order_id));
m_ordersEntryList.removeOne(order->order_id);
delete m_ordersMap.take(order->order_id);
}
......@@ -1058,7 +1054,6 @@ bool FlowControl::_Get02ReplyJson(const QJsonObject &content, QJsonObject &data,
error=QString("响应超时");
}
result=m_bOperateResult;
//memset(&orderOperation,0, sizeof(orderOperation));
semaphore.release(1);
}
else{
......@@ -1126,9 +1121,11 @@ bool FlowControl::_Get04ReplyJson(const QJsonObject &content, QJsonObject &data,
QLOG_INFO()<<QString("%1订单已经成功推送给simphony").arg(orderId);
m_orderIdToPosSalesIdMap.insert(orderId,posSaleId);
}
if(m_ordersEntryMap.contains(orderId))
OrderObject* order_p = m_ordersMap.value(orderId);
if(m_ordersEntryList.contains(orderId))
{
if(m_ordersEntryMap.value(orderId).entryType==1)
if(order_p->putType==1)
{
Orderstatus::getInstance().putupdate(orderId,1);
Orderstatus::getInstance().PosSalesIdupdate(orderId,posSaleId);
......@@ -1138,17 +1135,19 @@ bool FlowControl::_Get04ReplyJson(const QJsonObject &content, QJsonObject &data,
Orderstatus::getInstance().refundupdate(orderId,1);
}
m_OrderEntryMutex.lock();
m_ordersEntryMap.erase(m_ordersEntryMap.find(orderId));
m_ordersEntryList.removeOne(orderId);
m_OrderEntryMutex.unlock();
}
else{
OrderProperpy op;
op.bCancled = false;
op.bReaded = true;
op.entryType = 0;
op.pullNum=0;
order_p->isCancle = false;
order_p->isPut = true;
order_p->putType = 0;
order_p->putTimes=0;
m_OrderEntryMutex.lock();
m_ordersEntryMap.insert(orderId,op);
if(!m_ordersEntryList.contains(orderId))
{
m_ordersEntryList.append(orderId);
}
m_OrderEntryMutex.unlock();
}
}
......@@ -1221,7 +1220,7 @@ bool FlowControl::_GetQueryReplyJson(QJsonObject &data, QString &error, const QS
error = QString("FMOMS 未登录");
return false;
}
if(m_ordersEntryMap.isEmpty())
if(m_ordersEntryList.isEmpty())
{
error = QString("没有新订单待拉取");
result = true;
......@@ -1229,31 +1228,23 @@ bool FlowControl::_GetQueryReplyJson(QJsonObject &data, QString &error, const QS
else
{
error.clear();
QString orderId=m_ordersEntryMap.firstKey();
int pullNum=4;
QMap<QString, OrderProperpy>::iterator iter ;
//auto iter=m_ordersEntryMap.Iterator();
for(iter=m_ordersEntryMap.begin();iter!=m_ordersEntryMap.end();iter++)
{
OrderProperpy op=iter.value();
int num=op.pullNum;
QString orderId=m_ordersEntryList.first();
int pullNum=MAXPUTTIMES;
foreach (auto value, m_ordersEntryList) {
int num = m_ordersMap.value(value)->putTimes;
if(pullNum>num)
{
pullNum=num;
orderId=iter.key();
orderId=value;
}
}
OrderObject* orderObject = m_ordersMap.value(orderId);
if(4==m_ordersEntryMap.value(orderId).pullNum)
if(MAXPUTTIMES==orderObject->putTimes)
{
OrderProperpy op=m_ordersEntryMap.value(orderId);
op.pullNum=0;
m_OrderEntryMutex.lock();
m_ordersEntryMap.insert(orderId,op);
m_OrderEntryMutex.unlock();
orderObject->putTimes = 0;
}
QJsonObject rObj, cObj;
if(m_ordersEntryMap.first().entryType==1)
if(orderObject->putType==1)
{
rObj.insert("fm_cmd", "put_order");
}
......@@ -1401,10 +1392,10 @@ void FlowControl::onGetBusinessStatus()
ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_GETSTORESTATE)));
qDebug()<<ConfigManger::GetInstance().GetStoreServerUrl()+ ConfigManger::GetInstance().GetInterfaceName(INI_INTERFACE_GETSTORESTATE);
emit showAlert(AlertForm::LOADING, "正在获取平台营业状态......");
QLOG_INFO() << QString("[---GetStoreChannelInfo---]. [requestData:%1]").arg(_GetJsonStr(sendJson));
QLOG_INFO() << QString("[---GetStoreChannelInfo---]. [requestData:%1]")<<sendJson;
result = m_pullDishesSocket->Request(sendJson, recvJson, error);
QLOG_INFO() << QString("GetStoreChannelInfo finsh. [result:%1][msg:%2][recvData:%3]")
.arg(result).arg(error, _GetJsonStr(recvJson));
.arg(result).arg(error)<<recvJson;
if(!result)
{
emit showAlert(AlertForm::MSGERROR, "获取平台营业状态失败![网络错误]");
......
......@@ -30,14 +30,14 @@ private:
FlowControl(FlowControl const&);
FlowControl& operator=(FlowControl const&);
typedef struct ORDER_PROPERPY
{
bool bReaded;//是否成功入账过
bool bCancled;//是否成功退款入账过
bool entryType;//入账类型
int pullNum;//入账失败次数
//QDateTime btimeStamp;
}OrderProperpy;
// typedef struct ORDER_PROPERPY
// {
// bool bReaded;//是否成功入账过
// bool bCancled;//是否成功退款入账过
// bool entryType;//入账类型
// int pullNum;//入账失败次数
// //QDateTime btimeStamp;
// }OrderProperpy;
typedef struct TOPULL_ORDER
{
......@@ -85,9 +85,8 @@ private:
JQHttpServer::TcpServerManage* m_tcpServerManage;
QMap<QString, QMultiMap<QString, dishesObject> >m_dishesMap;
// 已接单的订单
QMap<QString, OrderProperpy> m_ordersEntryMap;
// 入账list
QStringList m_ordersEntryList;
//订单号与pos短号映射
QMap<QString,QString> m_orderIdToPosSalesIdMap;
//记录当前订单操作
......@@ -174,7 +173,7 @@ signals:
* */
void showDailyReportData(QJsonObject);
void doPullOrder(const QString& orderId,const QString& channel);
void doPullOrder(const QString& orderId = QString(),const QString& channel = QString());
/* 功能:通知开始提醒
* 参数:[1]提醒类型
* 返回:NULL
......
......@@ -374,3 +374,83 @@ bool Orderstatus::deleteRecord(QString creatTime)
return result;
}
bool Orderstatus::queryValue(const QString &orderId, const QString& key, QString &error, QVariant & value)
{
QMutexLocker mutex(&m_mutex);
if(!db.open())
{
error.append(QString("db open failed").append(db.lastError().text()));
return false;
}
QSqlQuery query(db);
query.prepare(QString("select %1 from status where orderId='%1'").arg(key).arg(orderId));
if(!query.exec())
{
error.append(query.lastError().text());
db.close();
return false;
}
else{
while(query.next())
{
value= query.value(0);
}
}
db.close();
return true;
}
bool Orderstatus::updatekey(const QString &orderId, const QString &key, const int value, QString &error, bool &result)
{
QMutexLocker mutex(&m_mutex);
if(!db.open())
{
error.append(QString("数据库打开失败").append(db.lastError().text()));
return false;
}
QSqlQuery query(db);
query.prepare(QString("update status set %1=%2 where orderId='%3'").arg(key)
.arg(QString::number(value)).arg(orderId));
if(!query.exec())
{
error.append(query.lastError().text());
db.close();
return false;
}
else{
result = true;
}
db.close();
return true;
}
bool Orderstatus::queryIsNull(const QString &orderId, const QString &key, QString &error, bool &result)
{
QMutexLocker mutex(&m_mutex);
if(!db.open())
{
error.append(QString("数据库打开失败").append(db.lastError().text()));
return false;
}
QSqlQuery query(db);
query.prepare(QString("select %1 from status where orderId=%2 and %3 is null").arg(orderId,orderId,key));
if(!query.exec())
{
error.append(query.lastError().text());
db.close();
return false;
}
else{
if(query.first())
{
result= true;
}
else{
result = false;
}
}
db.close();
return true;
}
......@@ -79,6 +79,14 @@ public:
bool PosSalesIdupdate(const QString& orderId, const QString &posSalesId);
bool getPosSalesId(const QString& orderId, QString &posSalesId);
bool queryValue(const QString& orderId, const QString& key, QString& error, QVariant &value);
bool updatekey(const QString& orderId, const QString& key, const int value, QString &error, bool &result);
bool queryIsNull(const QString &orderId, const QString& key,QString &error, bool &result);
bool deleteRecord(QString creatTime);
private:
QMutex m_mutex;
......
......@@ -141,6 +141,8 @@ public:
Q_PROPERTY (int channelNum READ getchannelNum WRITE setchannelNum)
Q_PROPERTY (int order_index READ getorder_index WRITE setorder_index)
Q_PROPERTY (bool has_invoiced READ gethas_invoiced WRITE sethas_invoiced)
Q_PROPERTY (bool isPut READ getisPut WRITE setisPut)
Q_PROPERTY (bool isCancle READ getisCancle WRITE setisCancle)
Q_PROPERTY (QString invoice_title READ getinvoice_title WRITE setinvoice_title)
Q_PROPERTY (QString courier_name READ getcourier_name WRITE setcourier_name)
Q_PROPERTY (QString courier_phone READ getcourier_phone WRITE setcourier_phone)
......@@ -157,6 +159,8 @@ public:
Q_PROPERTY (int product_fee READ getproduct_fee WRITE setproduct_fee)
Q_PROPERTY (int order_type READ getorder_type WRITE setorder_type)
Q_PROPERTY (int update_time READ getupdate_time WRITE setupdate_time)
Q_PROPERTY (int putType READ getputType WRITE setputType)
Q_PROPERTY (int putTimes READ getputTimes WRITE setputTimes)
int service_fee; //平台佣金
int dis_platform_fee; //平台承担的优惠金额
......@@ -164,6 +168,10 @@ public:
int package_fee; //打包费
QString possale_id; //pos短号
bool isPut; //是否入账
bool isCancle; //是否撤单
int putType; //入账类型
int putTimes; //入账次数
QString address; //地址
QString channel; //渠道
QString channel_name; //渠道名称
......@@ -208,6 +216,22 @@ public:
protected:
inline bool getisPut() const{return isPut;}
inline void setisPut(const bool &v){isPut = v;}
inline bool getisCancle() const{return isCancle;}
inline void setisCancle(const bool &v){isCancle = v;}
inline int getputType() const{return putType;}
inline void setputType(const int &v){putType = v;}
inline int getputTimes() const{return putTimes;}
inline void setputTimes(const int &v){putTimes = v;}
inline int getupdate_time() const{return update_time;}
inline void setupdate_time(const int &v){update_time = v;}
......
INCLUDEPATH += $$PWD
#DEFINES += QS_LOG_LINE_NUMBERS # automatically writes the file and line for each log message
#DEFINES += QS_LOG_DISABLE # logging code is replaced with a no-op
#DEFINES += QS_LOG_SEPARATE_THREAD # messages are queued and written from a separate thread
DEFINES += QS_LOG_SEPARATE_THREAD # messages are queued and written from a separate thread
#DEFINES += QS_LOG_WIN_PRINTF_CONSOLE # Use fprintf instead of OutputDebugString on Windows
SOURCES += $$PWD/QsLogDest.cpp \
$$PWD/QsLog.cpp \
......
......@@ -75,7 +75,8 @@ void MainForm::MyShow()
#ifdef QT_DEBUG
this->show();
#else
this->showFullScreen();
this->show();
//this->showFullScreen();
#endif
// 考虑到坐标问题放到这里构建
......
......@@ -99,6 +99,9 @@
#define JSON_FAILEDSUM "fail_total_fee"
#define JSON_DAILYSUMMARYS "daily_summarys"
#define MAXPUTTIMES 4
// 订单的操作码
#define OPERATION_GETDELIVERS "getDelivers"
#define OPERATION_CONFRIM "confirm"
......
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