Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmtakeout
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
李定达
fmtakeout
Commits
0bd05c61
Commit
0bd05c61
authored
Jul 12, 2019
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加rpa拉取全量订单处理
parent
1d1d516e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
19 deletions
+68
-19
takeout/control/ordergetwork.cpp
+5
-8
takeout/control/rpainterface.cpp
+37
-10
takeout/control/rpainterface.h
+9
-0
takeout/model/orderObject.h
+1
-1
takeout/model/posorderpool.cpp
+14
-0
takeout/model/posorderpool.h
+2
-0
No files found.
takeout/control/ordergetwork.cpp
View file @
0bd05c61
...
@@ -622,15 +622,12 @@ void OrderGetWork::optOrder(const QJsonArray &orders)
...
@@ -622,15 +622,12 @@ void OrderGetWork::optOrder(const QJsonArray &orders)
//是否发送给rpa。这里测试,先写死,后面从配置文件读取
//是否发送给rpa。这里测试,先写死,后面从配置文件读取
bool
isSendToRPA
=
true
;
bool
isSendToRPA
=
true
;
if
(
isSendToRPA
){
if
(
isSendToRPA
){
//已完成的订单才发送给RPA
if
(
orderObject
.
status
==
ServiceOrder
||
orderObject
.
status
==
CompleteOrder
){
//if(orderObject.status == FirmOrder){
//if(orderObject.status == FirmOrder){
QString
error
;
QString
error
;
if
(
!
RpaInterface
::
Instance
().
sendToRPA
(
QJsonDocument
(
jsonObject
).
toJson
(
QJsonDocument
::
Compact
),
error
)){
if
(
!
RpaInterface
::
Instance
().
sendToRPA
(
QJsonDocument
(
jsonObject
).
toJson
(
QJsonDocument
::
Compact
),
error
)){
QLOG_ERROR
()
<<
"send to rpa failed:"
<<
error
;
QLOG_ERROR
()
<<
"send to rpa failed:"
<<
error
;
}
else
{
}
else
{
QLOG_INFO
()
<<
"send data to RPA,orderid:"
<<
orderObject
.
order_id
;
QLOG_INFO
()
<<
"send data to RPA,orderid:"
<<
orderObject
.
order_id
;
}
}
}
}
}
}
}
...
...
takeout/control/rpainterface.cpp
View file @
0bd05c61
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <QJsonParseError>
#include <QJsonParseError>
#include "event/posevent.h"
#include "event/posevent.h"
#include "event/fmapplication.h"
#include "event/fmapplication.h"
#include "model/posorderpool.h"
#define BUFFER_SIZE 1024 //缓冲区大小
#define BUFFER_SIZE 1024 //缓冲区大小
#define SEND_PORT 30001 //socket发送端口
#define SEND_PORT 30001 //socket发送端口
...
@@ -53,16 +54,9 @@ void RpaInterface::onReadyRead()
...
@@ -53,16 +54,9 @@ void RpaInterface::onReadyRead()
if
(
length
>
0
){
if
(
length
>
0
){
QLOG_INFO
()
<<
"onReadyRead data:"
<<
recvBuf
;
QLOG_INFO
()
<<
"onReadyRead data:"
<<
recvBuf
;
QJsonObject
recvObj
=
QJsonDocument
::
fromJson
(
recvBuf
).
object
();
QJsonObject
recvObj
=
QJsonDocument
::
fromJson
(
recvBuf
).
object
();
if
(
recvObj
.
contains
(
"show_window"
)){
if
(
recvObj
.
contains
(
"fm_cmd"
)){
bool
show
=
recvObj
[
"show_window"
].
toBool
();
int
fm_cmd
=
recvObj
[
"fm_cmd"
].
toInt
();
if
(
show
){
onResponseMessage
(
fm_cmd
);
QLOG_INFO
()
<<
"s_show_float show"
;
DEFAULTPOSTEVENT
(
PosEvent
::
s_show_float
,
""
);
}
else
{
QLOG_INFO
()
<<
"s_show_float hide"
;
DEFAULTPOSTEVENT
(
PosEvent
::
s_hide_mainform
,
""
);
DEFAULTPOSTEVENT
(
PosEvent
::
s_hide_float
,
""
);
}
}
}
}
}
}
}
...
@@ -174,3 +168,36 @@ bool RpaInterface::sendToRPA(const QByteArray &orderData,QString& error)
...
@@ -174,3 +168,36 @@ bool RpaInterface::sendToRPA(const QByteArray &orderData,QString& error)
delete
[]
m_pFmPackage
;
delete
[]
m_pFmPackage
;
return
result
;
return
result
;
}
}
void
RpaInterface
::
onResponseMessage
(
const
int
fm_cmd
)
{
switch
(
fm_cmd
)
{
case
RPA_REQ_SHOW_WINDOW
:
QLOG_INFO
()
<<
"s_show_float show"
;
DEFAULTPOSTEVENT
(
PosEvent
::
s_show_float
,
""
);
break
;
case
RPA_REQ_HIDE_WINDOW
:
QLOG_INFO
()
<<
"s_show_float hide"
;
DEFAULTPOSTEVENT
(
PosEvent
::
s_hide_mainform
,
""
);
DEFAULTPOSTEVENT
(
PosEvent
::
s_hide_float
,
""
);
break
;
case
RPA_REQ_GET_ALL_ORDER
:
{
QVector
<
OrderObject
>
vecOrders
;
PosOrderPool
::
GetAllOrders
(
vecOrders
);
for
(
int
i
=
0
;
i
<
vecOrders
.
size
();
i
++
){
OrderObject
orderObj
=&
vecOrders
[
i
];
QString
error
;
if
(
!
RpaInterface
::
Instance
().
sendToRPA
(
QJsonDocument
(
orderObj
.
getOrderObject
()).
toJson
(
QJsonDocument
::
Compact
),
error
)){
QLOG_ERROR
()
<<
"send to rpa failed:"
<<
error
<<
" orderid:"
<<
orderObj
.
order_id
;
}
else
{
QLOG_INFO
()
<<
"send data to RPA,orderid:"
<<
orderObj
.
order_id
;
}
}
break
;
}
default
:
break
;
}
}
takeout/control/rpainterface.h
View file @
0bd05c61
...
@@ -12,6 +12,9 @@ typedef struct {
...
@@ -12,6 +12,9 @@ typedef struct {
int
len
;
int
len
;
}
FMSOCKEHEADER
;
}
FMSOCKEHEADER
;
const
int
RPA_REQ_SHOW_WINDOW
=
1000
;
//显示窗口
const
int
RPA_REQ_HIDE_WINDOW
=
1001
;
//隐藏窗口
const
int
RPA_REQ_GET_ALL_ORDER
=
1002
;
//获取全部订单
class
RpaInterface
:
public
QTcpServer
class
RpaInterface
:
public
QTcpServer
{
{
...
@@ -25,6 +28,12 @@ private slots:
...
@@ -25,6 +28,12 @@ private slots:
void
onDisconnected
();
void
onDisconnected
();
void
onReadyRead
();
void
onReadyRead
();
/* 功能:响应RPA请求信息
* 参数:[1]请求命令
* 返回:NULL
* */
void
onResponseMessage
(
const
int
fm_cmd
);
int
socketRecvData
(
char
*
recvBuf
,
int
bufSize
,
QTcpSocket
*
sockClient
);
int
socketRecvData
(
char
*
recvBuf
,
int
bufSize
,
QTcpSocket
*
sockClient
);
private
:
private
:
RpaInterface
();
RpaInterface
();
...
...
takeout/model/orderObject.h
View file @
0bd05c61
...
@@ -147,7 +147,6 @@ public:
...
@@ -147,7 +147,6 @@ public:
int
getSrcdlv_time
()
const
;
int
getSrcdlv_time
()
const
;
void
setSrcdlv_time
(
int
value
);
void
setSrcdlv_time
(
int
value
);
protected
:
QJsonObject
getOrderObject
()
const
QJsonObject
getOrderObject
()
const
{
{
return
_orderObject
;
return
_orderObject
;
...
@@ -156,6 +155,7 @@ protected:
...
@@ -156,6 +155,7 @@ protected:
{
{
_orderObject
=
orderObject
;
_orderObject
=
orderObject
;
}
}
protected
:
QString
getstore_name
()
const
;
QString
getstore_name
()
const
;
void
setstore_name
(
const
QString
&
value
);
void
setstore_name
(
const
QString
&
value
);
...
...
takeout/model/posorderpool.cpp
View file @
0bd05c61
...
@@ -947,3 +947,17 @@ void PosOrderPool::UpdateOrderNum(const OrderObject *order, const OrderObject *o
...
@@ -947,3 +947,17 @@ void PosOrderPool::UpdateOrderNum(const OrderObject *order, const OrderObject *o
}
}
}
}
void
PosOrderPool
::
GetAllOrders
(
QVector
<
OrderObject
>
&
vecOrders
)
{
if
(
PosOrderPool
::
s_mutex
.
tryLock
())
{
if
(
!
s_order_pool
.
empty
())
{
for
(
auto
it
=
s_order_pool
.
begin
();
it
!=
s_order_pool
.
end
();
++
it
)
{
vecOrders
.
push_back
(
it
.
value
().
order_data
);
}
}
s_mutex
.
unlock
();
}
}
takeout/model/posorderpool.h
View file @
0bd05c61
...
@@ -245,6 +245,8 @@ public:
...
@@ -245,6 +245,8 @@ public:
static
bool
GetSearchOrder
(
QString
key
,
QMap
<
QString
,
QString
>
&
map
,
int
condition
);
static
bool
GetSearchOrder
(
QString
key
,
QMap
<
QString
,
QString
>
&
map
,
int
condition
);
static
void
GetAllOrders
(
QVector
<
OrderObject
>
&
vecOrders
);
private
:
private
:
static
void
UpdateOrderNum
(
const
OrderObject
*
order
,
const
OrderObject
*
orderold
=
NULL
);
static
void
UpdateOrderNum
(
const
OrderObject
*
order
,
const
OrderObject
*
orderold
=
NULL
);
...
...
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