Commit 587e6031 by ss.dai

修改重复入账问题

parent f31ad1b9
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonArray> #include <QJsonArray>
#include <QTimer> #include <QTimer>
#include <QDir>
#include <QFile>
FmPlugin &FmPlugin::GetInstance() FmPlugin &FmPlugin::GetInstance()
{ {
...@@ -142,6 +144,15 @@ bool FmPlugin::GetOnDutyCashiers(QList<CashierObject> &cashiersList, QString &er ...@@ -142,6 +144,15 @@ bool FmPlugin::GetOnDutyCashiers(QList<CashierObject> &cashiersList, QString &er
bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, const QString &cashierId, const QString &cashierName, const QString &shiftId, const QString &shiftName, QString &error) bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, const QString &cashierId, const QString &cashierName, const QString &shiftId, const QString &shiftName, QString &error)
{ {
QString apppath=QCoreApplication::applicationDirPath(); QString apppath=QCoreApplication::applicationDirPath();
// 检查这单之前是否写过
QString remark_file_path = QString("%1/orders/%2/%3_%4").arg(apppath, QDateTime::fromTime_t(orderObject->create_time).toString("yyyy-MM-dd"), orderObject->channel ,orderObject->order_id);
QFile file(remark_file_path);
if(file.exists())
{
error = "aready writed to haiding";
return true;
}
QString inipath=apppath+QString("/config.ini"); QString inipath=apppath+QString("/config.ini");
QSettings set(inipath, QSettings::IniFormat); QSettings set(inipath, QSettings::IniFormat);
QUrl url; QUrl url;
...@@ -180,6 +191,9 @@ bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, const QString &cashi ...@@ -180,6 +191,9 @@ bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, const QString &cashi
error = recvJson["echoMessage"].toString(); error = recvJson["echoMessage"].toString();
return false; return false;
} }
QDir().mkpath(remark_file_path.mid(0,remark_file_path.lastIndexOf("/")));
file.open(QFile::WriteOnly);
file.close();
return true; return true;
} }
......
...@@ -175,18 +175,17 @@ bool FlowControl::_PullOrder() ...@@ -175,18 +175,17 @@ bool FlowControl::_PullOrder()
emit changeOrderStatus(orderObject, oldStatus); emit changeOrderStatus(orderObject, oldStatus);
} }
} }
//MARK(测试) if(orderObject->status != 1 && orderObject->status != 2)
//if(orderObject->status == 6) {
//{
QString error; QString error;
if(FmPlugin::GetInstance().DoOrderEntry(orderObject,"","","","",error)) if(FmPlugin::GetInstance().DoOrderEntry(orderObject,"","","","",error))
{ {
QLOG_INFO() << QString("DoOrderEntry successful") << error; QLOG_INFO() << QString("_PullOrder DoOrderEntry successful") << error;
}else }else
{ {
QLOG_INFO() << QString("DoOrderEntry failed %1").arg(error); QLOG_INFO() << QString("_PullOrder DoOrderEntry failed %1").arg(error);
} }
//} }
m_timestamp = orderObject->timestamp; m_timestamp = orderObject->timestamp;
} }
syncTime = recvJson[JSON_SYNCTIME].toInt()*1000; syncTime = recvJson[JSON_SYNCTIME].toInt()*1000;
...@@ -270,7 +269,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del ...@@ -270,7 +269,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
{ {
OrderObject *orderObject = m_ordersMap.value(orderId); OrderObject *orderObject = m_ordersMap.value(orderId);
emit showAlert(AlertForm::LOADING, "正在录入天天饮食......"); emit showAlert(AlertForm::LOADING, "正在录入销售单......");
QLOG_INFO() << QString("[---order entry begin---]"); QLOG_INFO() << QString("[---order entry begin---]");
// 写入销售单 // 写入销售单
// TODO(用于鲜丰演示) // TODO(用于鲜丰演示)
......
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