Commit e9f6f75a by shangshang.dai

新增

1:订单长时间没有配送员配送则提醒门店
parent 77ab336c
......@@ -11,6 +11,7 @@
#include <QTimer>
#include <QDir>
#include <QApplication>
#include <QTime>
FlowControl &FlowControl::GetInstance()
{
......@@ -27,6 +28,30 @@ FlowControl::FlowControl()
m_procOrderSocket = NULL;
FmPlugin::GetInstance().SetRemoteInfo(ConfigManger::GetInstance().GetDbServerIp(), ConfigManger::GetInstance().GetDbServerPort());
m_tChekDelivery.start(1000);
connect(&m_tChekDelivery, &QTimer::timeout, this, &FlowControl::_ChekDeliveryStatus);
}
void FlowControl::_ChekDeliveryStatus()
{
qDebug() << __FUNCTION__;
qint64 alramTime = (qint64)ConfigManger::GetInstance().GetDeliveryAlramTime();
qint64 crtTimestamp = QDateTime::currentMSecsSinceEpoch()/1000;
foreach(OrderObject* obj, m_listOrder)
{
if(obj->order_type ==1 && obj->courier_name.isEmpty() && obj->status == 2)
{
qDebug() << "11111111111111" << crtTimestamp << " '" << obj->create_time << " "<<alramTime ;
if((crtTimestamp - obj->create_time) > alramTime)
{
emit showAlert(AlertForm::ERROR, QString("请注意,%1[%2]号订单[%3]长时间无人配送.").arg(obj->channelName).arg(obj->order_index).arg(obj->order_id));
m_listOrder.removeOne(obj);
break;
}
}
}
}
void FlowControl::onGetNewStoreInfo(const QString &operator_id, const QString &pos_id, const QString &store_id, const QString &business_date)
......@@ -172,6 +197,8 @@ bool FlowControl::_PullOrder()
}
emit changeOrderStatus(orderObject, -100, bRed);
m_listOrder.append(orderObject);
}else
{
//旧数据有更新
......@@ -217,7 +244,6 @@ bool FlowControl::_PullOrder()
}
}
}
if(orderObject->delivery_status==1)
{
// 打印
......@@ -240,7 +266,6 @@ bool FlowControl::_PullOrder()
{
QLOG_INFO() << QString("print failed, %1").arg(error);
}
}
}
......@@ -598,6 +623,8 @@ QString FlowControl::_GetJsonStr(const QJsonObject &json)
return QString(QJsonDocument(json).toJson(QJsonDocument::Compact)).replace("\"","");
}
void FlowControl::onProcessOrder(const QString &operation, const QString &orderId, const DeliverObject &deliverObj)
{
if(!operation.compare(OPERATION_GETDELIVERS))
......
......@@ -12,6 +12,7 @@
#include "Model/cashierObject.h"
#include "alertForm.h"
#include <QMap>
#include <QTimer>
class FlowControl : public QObject
{
......@@ -41,6 +42,10 @@ private:
// 是否第一次获取到门店信息
bool m_bFirstRecvInfo;
// 待检测订单配送状态的容器
QList<OrderObject*> m_listOrder;
QTimer m_tChekDelivery;
signals:
/* 功能:隐藏通知窗口
* 参数:NULL
......@@ -145,6 +150,12 @@ private slots:
* */
QString _GetJsonStr(const QJsonObject& json);
/* 功能:检测订单配送状态
* 参数:NULL
* 返回:NULL
* */
void _ChekDeliveryStatus();
public slots:
/* 功能:获取到新的门店信息
* 参数:[1]操作员ID[2]POS机ID
......
......@@ -122,5 +122,10 @@ int ConfigManger::GetDbServerPort()
return m_config->value(INI_DBSERVERPORT).toInt();
}
int ConfigManger::GetDeliveryAlramTime()
{
return m_config->value(INI_ALRAMTIME).toInt()*60;
}
......@@ -104,6 +104,12 @@ public:
* */
int GetDbServerPort();
/* 功能:获取检测订单配送状态的提醒时间
* 参数:NULL
* 返回:有效的时间(ms)
* */
int GetDeliveryAlramTime();
private:
ConfigManger();
ConfigManger(ConfigManger const&);
......
......@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
FloatForm f;
MainForm w;
QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow);
QObject::connect(&w, &MainForm::hideFloatForm, &f, &FloatForm::hide);
QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind);
QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::show);
......
......@@ -272,6 +272,12 @@ void MainForm::onHideAlert()
void MainForm::onShowAlert(AlertForm::Type type, const QString &msg)
{
m_alertForm->hide();
if(isHidden())
{
emit hideFloatForm();
show();
}
m_alertForm->SetContent(type, msg);
m_alertForm->show();
}
......
......@@ -98,6 +98,7 @@ signals:
* 返回:NULL
* */
void showFloatForm();
void hideFloatForm();
/* 功能:通知悬浮窗开始提示
* 参数:[1]提示类型 0新订单1退款申请
* 返回:NULL
......@@ -114,7 +115,6 @@ signals:
* */
void getOrderDetails(const QString& orderId);
private slots:
/* 功能:初始化
* 参数:NULL
......
......@@ -28,6 +28,7 @@
#define INI_BLINKINTERVAL "Float/blinkInterval"
#define INI_SOUNDINTERVAL "Float/soundInterval"
#define INI_REENTRY "Features/reEntry"
#define INI_ALRAMTIME "Features/alramTime"
#define INI_TCPPORT "TcpServer/Port"
#define INI_DBSERVERIP "DbServer/ip"
#define INI_DBSERVERPORT "DbServer/port"
......
......@@ -12,3 +12,5 @@ port=7776
;是否有重新录单的按钮
[Features]
reEntry=1
;检测订单的配送状态的提醒时间阈值(min)
alramTime=20
\ No newline at end of file
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