Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmclientUi
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
shuai.liu
FmclientUi
Commits
ec88357c
Commit
ec88357c
authored
Dec 26, 2017
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入打印小票功能
parent
d305132f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
bin/测试数据.txt
+2
-3
qfmclient.cpp
+25
-0
qfmclient.h
+1
-1
No files found.
bin/测试数据.txt
View file @
ec88357c
{
{
...
@@ -2,10 +2,9 @@
...
@@ -2,10 +2,9 @@
"business_date": "20171214",
"business_date": "20171214",
"clientReqCount": 1,
"clientReqCount": 1,
"operator_id": "001",
"operator_id": "001",
"partnerId": "1371",
"reqtype": 72,
"reqtype": 72,
"station_id": "1",
"station_id": "1",
"store_id": "
fm99999
",
"store_id": "
99992
",
"trans_id": "201712140003",
"trans_id": "201712140003",
"transactions": [
"transactions": [
{
{
...
...
qfmclient.cpp
View file @
ec88357c
...
@@ -79,6 +79,9 @@ bool QFmClient::Init(QString proxy_IP, unsigned short proxy_port, unsigned short
...
@@ -79,6 +79,9 @@ bool QFmClient::Init(QString proxy_IP, unsigned short proxy_port, unsigned short
rlt
=
fscanf
(
cfgFile
,
"%u"
,
&
value
);
rlt
=
fscanf
(
cfgFile
,
"%u"
,
&
value
);
_codeFlag
=
(
char
)
value
;
_codeFlag
=
(
char
)
value
;
fscanf
(
cfgFile
,
"%s"
,
_receiptPath
);
qDebug
()
<<
"_receiptPath "
<<
_receiptPath
;
fclose
(
cfgFile
);
fclose
(
cfgFile
);
cfgFile
=
0
;
cfgFile
=
0
;
...
@@ -678,6 +681,7 @@ int QFmClient::CheckRecvedData()
...
@@ -678,6 +681,7 @@ int QFmClient::CheckRecvedData()
QByteArray
recvdata
(
_recvbuf
);
QByteArray
recvdata
(
_recvbuf
);
QJsonParseError
json_error
;
QJsonParseError
json_error
;
QJsonDocument
doc
=
QJsonDocument
::
fromJson
(
recvdata
,
&
json_error
);
QJsonDocument
doc
=
QJsonDocument
::
fromJson
(
recvdata
,
&
json_error
);
if
(
json_error
.
error
!=
QJsonParseError
::
NoError
||
!
doc
.
isObject
())
if
(
json_error
.
error
!=
QJsonParseError
::
NoError
||
!
doc
.
isObject
())
...
@@ -685,6 +689,27 @@ int QFmClient::CheckRecvedData()
...
@@ -685,6 +689,27 @@ int QFmClient::CheckRecvedData()
qDebug
()
<<
"error request json data!
\r\n
"
;
qDebug
()
<<
"error request json data!
\r\n
"
;
return
-
1
;
return
-
1
;
}
}
QJsonObject
json
=
doc
.
object
();
if
(
json
.
contains
(
"statusCode"
)
&&
json
[
"statusCode"
].
toInt
()
==
100
)
{
if
(
json
.
contains
(
"ext"
)
&&
json
[
"ext"
].
isObject
()
&&
json
[
"ext"
].
toObject
().
contains
(
"print"
)
&&
json
[
"ext"
].
toObject
()[
"print"
].
isString
())
{
QFile
file
(
_receiptPath
);
if
(
file
.
open
(
QFile
::
WriteOnly
))
{
QString
PrintInfo
=
json
[
"ext"
].
toObject
()[
"print"
].
toString
();
QLOG_INFO
()
<<
"print:
\r\n
"
<<
PrintInfo
<<
"
\r\n
"
;
file
.
write
(
PrintInfo
.
toUtf8
());
file
.
close
();
}
}
}
return
0
;
return
0
;
}
}
...
...
qfmclient.h
View file @
ec88357c
...
@@ -60,7 +60,7 @@ private:
...
@@ -60,7 +60,7 @@ private:
char
_sendbuf
[
MAX_BUF_LEN
];
char
_sendbuf
[
MAX_BUF_LEN
];
char
_codeBuf
[
MAX_BUF_LEN
];
char
_codeBuf
[
MAX_BUF_LEN
];
char
_receiptPath
[
MAX_PATH
];
unsigned
char
_codeKey
[
MAX_CODE_KEY
];
unsigned
char
_codeKey
[
MAX_CODE_KEY
];
//proxy IP
//proxy IP
...
...
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