Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
takeout_sbk
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
yunpeng.song
takeout_sbk
Commits
656314a7
Commit
656314a7
authored
Oct 31, 2019
by
wuyang.zou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug: 压测pms插件死锁 , 优化Redis List 时间戳 属性,方便后续清理数据;
parent
edc9a098
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
15 deletions
+36
-15
fmTakeout/Control/flowControl.cpp
+29
-6
fmTakeout/DTools/qtRedisClient.cpp
+2
-0
fmTakeout/fmTakeout.rc
+4
-4
fmTakeout/preDefine.h
+1
-5
No files found.
fmTakeout/Control/flowControl.cpp
View file @
656314a7
...
...
@@ -1199,8 +1199,13 @@ bool FlowControl::_RefundOrder(const QString &orderId,int reasonCode,const QStri
void
FlowControl
::
_AddOrderInfo2ReportList
(
const
OrderObject
*
orderObject
,
const
QString
&
operatStatus
,
const
QString
&
remarkMessage
)
{
// 将订单 添加到 向OMS汇报入机情况的队列中;
m_RepOMSRecordOrderMutex
.
lock
();
// 将订单 添加到 向OMS汇报入机情况的队列中: 防止出现 m_RepOMSRecordOrderMutex 把整个 FlowControl 主进程死锁;
//m_RepOMSRecordOrderMutex.lock();
bool
btryLock
=
m_RepOMSRecordOrderMutex
.
tryLock
(
VALUE_TRYLOCKNETTIMEOUT
);
if
(
!
btryLock
){
//加锁失败后,直接return;
return
;
}
RepOMSRecordOrderInfo
*
repOMSRecordOrder
=
nullptr
;
if
(
!
m_orderRecordRepOMSList
.
isEmpty
()){
QList
<
RepOMSRecordOrderInfo
*>::
iterator
i
;
...
...
@@ -1226,7 +1231,7 @@ void FlowControl::_AddOrderInfo2ReportList(const OrderObject* orderObject,const
repOMSRecordOrder
->
type
=
QString
::
number
(
orderObject
->
orderStatus
);
repOMSRecordOrder
->
status
=
operatStatus
;
repOMSRecordOrder
->
opUser
=
m_cashierName
;
repOMSRecordOrder
->
recordDate
=
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd hh:mm:ss"
);
;
repOMSRecordOrder
->
recordDate
=
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd hh:mm:ss"
);
repOMSRecordOrder
->
storeId
=
m_storeId
;
repOMSRecordOrder
->
remark
=
remarkMessage
;
repOMSRecordOrder
->
checkNo
=
QString
(
"PMSNoCheckNo"
);
...
...
@@ -1255,10 +1260,12 @@ void FlowControl::_ReportOMSRecordOrderInfo()
}
}
//POST请求比较耗时,将会可能导致死锁,为避免,提前解锁;
m_RepOMSRecordOrderMutex
.
unlock
();
if
(
!
RepOMSRecOrderIn
){
QLOG_INFO
()
<<
"[<<<<----FlowControl::_ReportOMSRecordOrderInfo m_orderRecordRepOMSList size: ---->>>>>]"
<<
m_orderRecordRepOMSList
.
size
();
//上面的汇报OMS订单入机状态的汇报列表 遍历循环后:如果出现 RepOMSRecOrderIn == NULL;不能从List容器的头部移除已汇报成功结果【注意,必须是订单已经成功入机的订单,而非是入机失败,汇报OMS成功的订单】;
m_RepOMSRecordOrderMutex
.
unlock
();
return
;
}
//准备https请求,准备向OMS汇报订单的入机情况;
...
...
@@ -1283,6 +1290,8 @@ void FlowControl::_ReportOMSRecordOrderInfo()
sendJson
.
insert
(
"ipAddress"
,
m_ipAddress
);
sendJson
.
insert
(
JSON_PMSMACHINENO
,
m_pmsMachineNo
);
QString
orderNoTemp
=
RepOMSRecOrderIn
->
orderNo
;
QLOG_INFO
()
<<
QString
(
"[<<<<---_ReportOMSRecordOrderInfo:Begin--->>>>][requestData:%1]"
)
<<
sendJson
;
QUrl
TempQUrl
=
ConfigManger
::
GetInstance
().
GetLoginServerUrl
()
+
ConfigManger
::
GetInstance
().
GetInterfaceName
(
INI_INTERFACE_REPORTOMSRECORDORDER
);
...
...
@@ -1291,10 +1300,21 @@ void FlowControl::_ReportOMSRecordOrderInfo()
ConfigManger
::
GetInstance
().
GetInterfaceName
(
INI_INTERFACE_REPORTOMSRECORDORDER
);
result
=
m_reportOMSRecordOrderSocket
->
PostRequest
(
sendJson
,
recvJson
,
error
);
QLOG_INFO
()
<<
QString
(
"[<<<<---Report OMS Record Order Entry POS Info Finish--->>>>][result:%1][msg:%2][orderId:%3]"
)
.
arg
(
result
).
arg
(
error
).
arg
(
RepOMSRecOrderIn
->
orderNo
)
<<
recvJson
;
.
arg
(
result
).
arg
(
error
).
arg
(
orderNoTemp
)
<<
recvJson
;
if
(
!
result
)
{
emit
setNetStatus
(
QString
::
fromLocal8Bit
(
"<font color='#ff0000'>网络不稳定,正在重试</font>"
));
}
else
{
if
(
!
RepOMSRecOrderIn
)
{
QLOG_INFO
()
<<
QString
(
"[<<<<---Report OMS Record Order Entry POS Info Finish But RepOMSRecOrderIn Is Null--->>>>][orderId:%3]"
).
arg
(
orderNoTemp
);
return
;
}
bool
bResultTryLock
=
m_RepOMSRecordOrderMutex
.
tryLock
(
VALUE_TRYLOCKNETTIMEOUT
);
if
(
!
bResultTryLock
){
//加锁失败后,直接return;
return
;
}
emit
setNetStatus
(
QString
::
fromLocal8Bit
(
"正常"
));
if
(
JSON_STATUSCODE_OK
!=
recvJson
[
JSON_ERRCODE
].
toInt
())
{
QString
error
=
recvJson
[
JSON_ERRMSG
].
toString
();
...
...
@@ -1316,8 +1336,11 @@ void FlowControl::_ReportOMSRecordOrderInfo()
QLOG_INFO
()
<<
QString
(
"[<<<<---Report OMS Record Order Entry POS Info successful,Reserve orderId:%1--->>>>][msg->%2]"
).
arg
(
RepOMSRecOrderIn
->
orderNo
).
arg
(
RepOMSRecOrderIn
->
remark
);
}
}
m_RepOMSRecordOrderMutex
.
unlock
();
}
m_RepOMSRecordOrderMutex
.
unlock
();
//减少此锁的加锁时间范围;
//m_RepOMSRecordOrderMutex.unlock();
}
...
...
fmTakeout/DTools/qtRedisClient.cpp
View file @
656314a7
...
...
@@ -74,6 +74,8 @@ bool QtRedisClient::pushOrder2Redis(const QString& orderId,const int& orderStatu
QJsonObject
orderStatusObj
;
orderStatusObj
.
insert
(
"ID"
,
orderId
);
orderStatusObj
.
insert
(
"STATUS"
,
orderStatus
);
QString
timeStamp
=
QDateTime
::
currentDateTime
().
toString
(
"yyyy-MM-dd hh:mm:ss"
);
orderStatusObj
.
insert
(
"TIMESTAMP"
,
timeStamp
);
QJsonDocument
orderStatusDoc
=
QJsonDocument
(
orderStatusObj
);
cmdString
.
append
(
orderStatusDoc
.
toJson
());
...
...
fmTakeout/fmTakeout.rc
View file @
656314a7
...
...
@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif
VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 4,2019,
70
1,1
PRODUCTVERSION 4,2019,
70
1,1
FILEVERSION 4,2019,
103
1,1
PRODUCTVERSION 4,2019,
103
1,1
//*************************************************************************//
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
...
...
@@ -31,8 +31,8 @@ VS_VERSION_INFO VERSIONINFO
VALUE "OriginalFilename", "PmsPlugin.exe"
VALUE "ProductName", "PMS Plugin"
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
VALUE "ProductVersion", "4.2019.
70
1.1"
VALUE "FileVersion", "4.2019.
70
1.1"
VALUE "ProductVersion", "4.2019.
103
1.1"
VALUE "FileVersion", "4.2019.
103
1.1"
//*************************************************************************//
END
END
...
...
fmTakeout/preDefine.h
View file @
656314a7
...
...
@@ -5,11 +5,7 @@
#define APP_THEME "deaufult"
//#define APP_VERSION "2.2019.520.1"
//#define APP_VERSION "2.2019.528.1"
#define APP_VERSION "4.2019.701.1"
#define APP_VERSION "4.2019.1031.1"
//修正版本号时,切记修正 FmTakeout.rc 中的版本号
#define SERVER_PASSWORD "posoperator@freemud.cn"
...
...
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