Commit eb44202a by unknown

增加断网提示音,修复重复不断拉单

parent 24732623
...@@ -61,6 +61,11 @@ bool FlowControl::_Login() ...@@ -61,6 +61,11 @@ bool FlowControl::_Login()
if(!result) if(!result)
{ {
emit showAlert(AlertForm::ERROR, "登录失败![网络错误]"); emit showAlert(AlertForm::ERROR, "登录失败![网络错误]");
if(neterror)//如果之前网络是正常的,则开始语音提示网络错误
{
emit startNetErrorRemind();
}
neterror=false;
}else }else
{ {
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
...@@ -107,9 +112,19 @@ bool FlowControl::_PullOrder() ...@@ -107,9 +112,19 @@ bool FlowControl::_PullOrder()
if(!result) if(!result)
{ {
emit setNetStatus("<font color='#ff0000'>异常</font>"); emit setNetStatus("<font color='#ff0000'>异常</font>");
if(neterror)//如果之前网络正常,则开始语音提示网络错误
{
emit startNetErrorRemind();
}
neterror=false;
}else }else
{ {
emit setNetStatus("正常"); emit setNetStatus("正常");
if(!neterror)//如果之前网络异常,现在正常,则停止语音提示
{
emit stopNetErrorRemind();
}
neterror=true;
if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt()) if(JSON_STATUSCODE_OK != recvJson[JSON_STATUSCODE].toInt())
{ {
QString error = recvJson[JSON_MESSAGE].toString(); QString error = recvJson[JSON_MESSAGE].toString();
...@@ -201,7 +216,7 @@ bool FlowControl::_PullOrder() ...@@ -201,7 +216,7 @@ bool FlowControl::_PullOrder()
// QLOG_INFO() << QString("_PullOrder 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;
} }
......
...@@ -33,6 +33,7 @@ private: ...@@ -33,6 +33,7 @@ private:
QString m_cashierId; QString m_cashierId;
QDateTime m_bDate; QDateTime m_bDate;
// 网络通信 // 网络通信
bool neterror=true;//标记之前的网络
BillSocket *m_loginSocket; BillSocket *m_loginSocket;
BillSocket *m_pullOrderSocket; BillSocket *m_pullOrderSocket;
BillSocket *m_procOrderSocket; BillSocket *m_procOrderSocket;
...@@ -100,6 +101,8 @@ signals: ...@@ -100,6 +101,8 @@ signals:
* 返回:NULL * 返回:NULL
* */ * */
void showSearchOrderResult(const QStringList& orderIdList); void showSearchOrderResult(const QStringList& orderIdList);
void startNetErrorRemind();
void stopNetErrorRemind();
void startRemind(int type); void startRemind(int type);
private slots: private slots:
......
...@@ -15,6 +15,7 @@ FloatForm::FloatForm(QWidget *parent) : ...@@ -15,6 +15,7 @@ FloatForm::FloatForm(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
m_bReminding = false; m_bReminding = false;
msgsound = new QSound("");
QPixmap imgNormal(":float_normal.png"); QPixmap imgNormal(":float_normal.png");
m_imgNormalSize = imgNormal.size(); m_imgNormalSize = imgNormal.size();
...@@ -160,12 +161,15 @@ void FloatForm::_Blink() ...@@ -160,12 +161,15 @@ void FloatForm::_Blink()
void FloatForm::_PlayWav() void FloatForm::_PlayWav()
{ {
QSound::play(m_remindWav); //QSound::play(m_remindWav);
msgsound->play(m_remindWav);
if(m_bReminding) if(m_bReminding)
{ {
QTimer::singleShot(m_wavPlayInterval, this, &FloatForm::_PlayWav); QTimer::singleShot(m_wavPlayInterval, this, &FloatForm::_PlayWav);
} }
else{
msgsound->stop();
}
} }
void FloatForm::onStartRemind(int type) void FloatForm::onStartRemind(int type)
...@@ -204,6 +208,19 @@ void FloatForm::onStopRemind() ...@@ -204,6 +208,19 @@ void FloatForm::onStopRemind()
m_bReminding = false; m_bReminding = false;
} }
void FloatForm::onStartNetRemind()
{
m_remindWav = QString("%1/wav/msg2.wav").arg(QApplication::applicationDirPath());
m_wavPlayInterval=1000*60*5;
m_bReminding=true;
_PlayWav();
}
void FloatForm::onStopNetRemind()
{
m_bReminding=false;
}
void FloatForm::onShow() void FloatForm::onShow()
{ {
QLOG_INFO()<<"show the floatform"; QLOG_INFO()<<"show the floatform";
......
...@@ -52,6 +52,7 @@ private: ...@@ -52,6 +52,7 @@ private:
// 置顶定时器 // 置顶定时器
QTimer m_raiseTimer; QTimer m_raiseTimer;
QTimer m_remindTimer; QTimer m_remindTimer;
QSound *msgsound;
/* 功能:初始化 /* 功能:初始化
* 参数:NULL * 参数:NULL
...@@ -93,6 +94,8 @@ public slots: ...@@ -93,6 +94,8 @@ public slots:
* 参数:NULL * 参数:NULL
* 返回:NULL * 返回:NULL
* */ * */
void onStartNetRemind();
void onStopNetRemind();
void onShow(); void onShow();
void onRaise(); void onRaise();
}; };
......
...@@ -95,7 +95,10 @@ int main(int argc, char *argv[]) ...@@ -95,7 +95,10 @@ int main(int argc, char *argv[])
QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow); QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow);
QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind); QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::startRemind, &f, &FloatForm::onStartRemind); QObject::connect(&FlowControl::GetInstance(), &FlowControl::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::startNetErrorRemind, &f, &FloatForm::onStartNetRemind);
QObject::connect(&FlowControl::GetInstance(), &FlowControl::stopNetErrorRemind, &f, &FloatForm::onStopNetRemind);
QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind); QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind);
QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::onshow); QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::onshow);
w.MyShow(); w.MyShow();
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#define APP_VERSION "1.20160923.01" //TODO #define APP_VERSION "1.20160923.01" //TODO
#define SERVER_PASSWORD "posoperator@freemud.cn" #define SERVER_PASSWORD "posoperator@freemud.cn"
//#define SERVER_PASSWORD "pos@freemud.cn"
#define CONFIG_NAME "config.ini" #define CONFIG_NAME "config.ini"
#define USERCONFIG_NAME "userConfig.ini" #define USERCONFIG_NAME "userConfig.ini"
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.0, 2017-02-23T18:02:33. --> <!-- Written by QtCreator 4.1.0, 2017-03-08T17:25:57. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{042357ee-9101-48ac-bf1d-2c241fdf6544}</value> <value type="QByteArray">{4b727d6b-8adb-4560-aded-4083fff25375}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
...@@ -59,21 +59,21 @@ ...@@ -59,21 +59,21 @@
<data> <data>
<variable>ProjectExplorer.Project.Target.0</variable> <variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap"> <valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">桌面</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{6c6796ef-4feb-46bd-be7b-581170645c49}</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{71d2a3a8-fb84-4f0f-89e6-23308737ddf5}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value> <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Alan/Work/build/takeaway-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/daima/xfsg/build-takeaway-unknown-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Alan/Work/build/takeaway-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/daima/xfsg/build-takeaway-unknown-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">0</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
...@@ -232,13 +232,14 @@ ...@@ -232,13 +232,14 @@
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fmTakeaway</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fmTakeaway</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Alan/Work/takeaway/fmTakeaway/fmTakeaway.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/daima/xfsg/takeaway/fmTakeaway/fmTakeaway.pro</value>
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value> <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fmTakeaway/fmTakeaway.pro</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fmTakeaway/fmTakeaway.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">C:/Users/Alan/Work/build/takeaway-Release/fmTakeaway</value> <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/daima/xfsg/build-takeaway-unknown-Release/fmTakeaway</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value> <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
......
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