Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmTakeaway
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shangshang.dai
FmTakeaway
Commits
6766623a
Commit
6766623a
authored
Sep 09, 2019
by
戴尚尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改网络异常提示(改为更明显)
parent
192955d9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
10 deletions
+30
-10
fmTakeaway/Control/flowControl.cpp
+13
-7
fmTakeaway/main.cpp
+1
-1
fmTakeaway/mainForm.cpp
+11
-1
fmTakeaway/mainForm.h
+5
-1
run/skin/float_normal——1.png
+0
-0
No files found.
fmTakeaway/Control/flowControl.cpp
View file @
6766623a
...
@@ -112,16 +112,16 @@ bool FlowControl::_PullOrder()
...
@@ -112,16 +112,16 @@ bool FlowControl::_PullOrder()
QLOG_INFO
()
<<
QString
(
"[---pull order---][requestData:%1]"
).
arg
(
_GetJsonStr
(
sendJson
));
QLOG_INFO
()
<<
QString
(
"[---pull order---][requestData:%1]"
).
arg
(
_GetJsonStr
(
sendJson
));
result
=
m_pullOrderSocket
->
Request
(
sendJson
,
recvJson
,
error
);
result
=
m_pullOrderSocket
->
Request
(
sendJson
,
recvJson
,
error
);
//
qDebug() << "---------------------------------------------------------------";
qDebug
()
<<
"---------------------------------------------------------------"
;
//
qDebug() << recvJson;
qDebug
()
<<
recvJson
;
//
qDebug() << "---------------------------------------------------------------";
qDebug
()
<<
"---------------------------------------------------------------"
;
QLOG_INFO
()
<<
QString
(
"pull order finsh. [result:%1][msg:%2]"
)
QLOG_INFO
()
<<
QString
(
"pull order finsh. [result:%1][msg:%2]"
)
.
arg
(
result
).
arg
(
error
);
.
arg
(
result
).
arg
(
error
);
if
(
!
result
)
if
(
!
result
)
{
{
netErrorIndex
++
;
netErrorIndex
++
;
emit
setNetStatus
(
"<font color='#ff0000'>异常</font>"
);
emit
setNetStatus
(
"<font color='#ff0000'>异常</font>"
);
if
(
netErrorIndex
>
50
)
if
(
netErrorIndex
>
1
)
{
{
if
(
neterror
)
//如果之前网络正常,则开始语音提示网络错误
if
(
neterror
)
//如果之前网络正常,则开始语音提示网络错误
{
{
...
@@ -140,9 +140,10 @@ bool FlowControl::_PullOrder()
...
@@ -140,9 +140,10 @@ bool FlowControl::_PullOrder()
neterror
=
true
;
neterror
=
true
;
if
(
JSON_STATUSCODE_OK
!=
recvJson
[
JSON_STATUSCODE
].
toInt
())
if
(
JSON_STATUSCODE_OK
!=
recvJson
[
JSON_STATUSCODE
].
toInt
())
{
{
QString
error
=
recvJson
[
JSON_MESSAGE
].
toString
();
error
=
recvJson
[
JSON_MESSAGE
].
toString
();
QLOG_ERROR
()
<<
QString
(
"pull orders error.[msg->%1]"
).
arg
(
error
);
QLOG_ERROR
()
<<
QString
(
"pull orders error.[msg->%1]"
).
arg
(
error
);
emit
showAlert
(
AlertForm
::
ERROR
,
QString
(
"获取订单失败![%1]"
).
arg
(
error
));
emit
showAlert
(
AlertForm
::
ERROR
,
QString
(
"获取订单失败![%1]"
).
arg
(
error
));
}
else
}
else
{
{
// 获取门店营业状态
// 获取门店营业状态
...
@@ -299,9 +300,14 @@ bool FlowControl::_PullOrder()
...
@@ -299,9 +300,14 @@ bool FlowControl::_PullOrder()
syncTime
=
recvJson
[
JSON_SYNCTIME
].
toInt
()
*
1000
;
syncTime
=
recvJson
[
JSON_SYNCTIME
].
toInt
()
*
1000
;
}
}
}
}
if
(
error
.
contains
(
QString
(
"重启"
))){
QTimer
::
singleShot
(
2000
,
this
,
&
FlowControl
::
_Login
);
}
else
{
QLOG_INFO
()
<<
QString
(
"%1 msec after pull order..."
).
arg
(
syncTime
);
QTimer
::
singleShot
(
syncTime
,
this
,
&
FlowControl
::
_PullOrder
);
}
QLOG_INFO
()
<<
QString
(
"%1 msec after pull order..."
).
arg
(
syncTime
);
QTimer
::
singleShot
(
syncTime
,
this
,
&
FlowControl
::
_PullOrder
);
return
result
;
return
result
;
}
}
...
...
fmTakeaway/main.cpp
View file @
6766623a
#include "mainForm.h"
#
include
"mainForm.h"
#include <QApplication>
#include <QApplication>
#include <QDir>
#include <QDir>
#include <QResource>
#include <QResource>
...
...
fmTakeaway/mainForm.cpp
View file @
6766623a
...
@@ -62,6 +62,8 @@ MainForm::MainForm(QWidget *parent) :
...
@@ -62,6 +62,8 @@ MainForm::MainForm(QWidget *parent) :
_Init
();
_Init
();
// 开启时间定时器
// 开启时间定时器
m_timeTimer
.
start
(
1000
);
m_timeTimer
.
start
(
1000
);
connect
(
&
FlowControl
::
GetInstance
(),
&
FlowControl
::
startNetErrorRemind
,
this
,
&
MainForm
::
onNetError
);
}
}
MainForm
::~
MainForm
()
MainForm
::~
MainForm
()
...
@@ -89,6 +91,8 @@ void MainForm::MyShow()
...
@@ -89,6 +91,8 @@ void MainForm::MyShow()
connect
(
m_padForm
,
&
PadForm
::
numDelete
,
this
,
&
MainForm
::
onNumDelete
);
connect
(
m_padForm
,
&
PadForm
::
numDelete
,
this
,
&
MainForm
::
onNumDelete
);
connect
(
m_padForm
,
&
PadForm
::
numClear
,
ui
->
mainEdtSearch
,
&
ClickedLineEdit
::
clear
);
connect
(
m_padForm
,
&
PadForm
::
numClear
,
ui
->
mainEdtSearch
,
&
ClickedLineEdit
::
clear
);
connect
(
m_detailForm
,
&
DetailForm
::
showAlert
,
this
,
&
MainForm
::
onShowAlert
);
connect
(
m_detailForm
,
&
DetailForm
::
showAlert
,
this
,
&
MainForm
::
onShowAlert
);
m_resultForm
=
new
QListWidget
(
this
);
m_resultForm
=
new
QListWidget
(
this
);
m_resultForm
->
setObjectName
(
"mainListWdg0"
);
m_resultForm
->
setObjectName
(
"mainListWdg0"
);
m_resultForm
->
setFixedSize
(
240
,
200
);
m_resultForm
->
setFixedSize
(
240
,
200
);
...
@@ -123,7 +127,7 @@ void MainForm::_Init()
...
@@ -123,7 +127,7 @@ void MainForm::_Init()
// 初始化文字
// 初始化文字
ui
->
mainLabStoreid
->
setText
(
UI_STOREID
);
ui
->
mainLabStoreid
->
setText
(
UI_STOREID
);
ui
->
mainLabVersion
->
setText
(
"1.
3.9
"
);
ui
->
mainLabVersion
->
setText
(
"1.
4.0
"
);
ui
->
mainLabCashier
->
setText
(
UI_CASHIER
);
ui
->
mainLabCashier
->
setText
(
UI_CASHIER
);
// 初始化表
// 初始化表
...
@@ -315,6 +319,12 @@ QPushButton *MainForm::_GetTabBtnByOrderStatus(int orderStatus)
...
@@ -315,6 +319,12 @@ QPushButton *MainForm::_GetTabBtnByOrderStatus(int orderStatus)
}
}
}
}
void
MainForm
::
onNetError
()
{
showFullScreen
();
this
->
onShowAlert
(
AlertForm
::
ERROR
,
QString
(
"网络通信出现异常,请及时关注商家手机版订单"
));
}
void
MainForm
::
onHideAlert
()
void
MainForm
::
onHideAlert
()
{
{
m_alertForm
->
hide
();
m_alertForm
->
hide
();
...
...
fmTakeaway/mainForm.h
View file @
6766623a
#ifndef MAINFORM_H
#
ifndef
MAINFORM_H
#define MAINFORM_H
#define MAINFORM_H
#include <QDialog>
#include <QDialog>
...
@@ -153,6 +153,10 @@ signals:
...
@@ -153,6 +153,10 @@ signals:
void
GetBusinessStatus
();
void
GetBusinessStatus
();
private
slots
:
private
slots
:
//响应网络错误
void
onNetError
();
/* 功能:初始化
/* 功能:初始化
* 参数:NULL
* 参数:NULL
* 返回:NULL
* 返回:NULL
...
...
run/skin/float_normal——1.png
0 → 100644
View file @
6766623a
2.41 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment