Commit 587e6031 by ss.dai

修改重复入账问题

parent f31ad1b9
......@@ -11,6 +11,8 @@
#include <QJsonDocument>
#include <QJsonArray>
#include <QTimer>
#include <QDir>
#include <QFile>
FmPlugin &FmPlugin::GetInstance()
{
......@@ -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)
{
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");
QSettings set(inipath, QSettings::IniFormat);
QUrl url;
......@@ -180,6 +191,9 @@ bool FmPlugin::DoOrderEntry(const OrderObject *orderObject, const QString &cashi
error = recvJson["echoMessage"].toString();
return false;
}
QDir().mkpath(remark_file_path.mid(0,remark_file_path.lastIndexOf("/")));
file.open(QFile::WriteOnly);
file.close();
return true;
}
......
......@@ -175,18 +175,17 @@ bool FlowControl::_PullOrder()
emit changeOrderStatus(orderObject, oldStatus);
}
}
//MARK(测试)
//if(orderObject->status == 6)
//{
if(orderObject->status != 1 && orderObject->status != 2)
{
QString error;
if(FmPlugin::GetInstance().DoOrderEntry(orderObject,"","","","",error))
{
QLOG_INFO() << QString("DoOrderEntry successful") << error;
QLOG_INFO() << QString("_PullOrder DoOrderEntry successful") << error;
}else
{
QLOG_INFO() << QString("DoOrderEntry failed %1").arg(error);
QLOG_INFO() << QString("_PullOrder DoOrderEntry failed %1").arg(error);
}
//}
}
m_timestamp = orderObject->timestamp;
}
syncTime = recvJson[JSON_SYNCTIME].toInt()*1000;
......@@ -270,7 +269,7 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
{
OrderObject *orderObject = m_ordersMap.value(orderId);
emit showAlert(AlertForm::LOADING, "正在录入天天饮食......");
emit showAlert(AlertForm::LOADING, "正在录入销售单......");
QLOG_INFO() << QString("[---order entry begin---]");
// 写入销售单
// 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