Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FMDbMonitor_linux
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
guanghui.cui
FMDbMonitor_linux
Commits
ae18c821
Commit
ae18c821
authored
Nov 03, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新pos打印计数
parent
f531d5aa
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
27 deletions
+72
-27
base/CommonStruct.h
+2
-0
base/IOperation.h
+3
-0
pos_bft/OrderInfo.cpp
+12
-1
pos_bft/OrderInfo.h
+1
-0
src/PayProcess.cpp
+25
-9
src/json.cpp
+29
-17
No files found.
base/CommonStruct.h
View file @
ae18c821
...
...
@@ -106,8 +106,10 @@ struct LableItem
struct
LableObj
{
std
::
string
strCmd
;
//命令类型
std
::
string
strDevice
;
//设备
int
iBaud
;
//波特率
std
::
string
strOrderId
;
//订单id
std
::
vector
<
LableItem
>
vecItem
;
//打印内容
};
...
...
base/IOperation.h
View file @
ae18c821
...
...
@@ -53,7 +53,10 @@ public:
//获取套餐信息(套餐包含项目)
virtual
std
::
map
<
std
::
string
,
std
::
vector
<
SetMenuItem
>>&
GetSetMenu
()
=
0
;
//打印小票
virtual
int
PrintLable
(
LableObj
&
print
)
=
0
;
//更新打印计数
virtual
int
updatePrintCount
(
LableObj
&
print
)
=
0
;
};
#ifdef WIN32
...
...
pos_bft/OrderInfo.cpp
View file @
ae18c821
...
...
@@ -261,7 +261,7 @@ int COrderInfo::SetTakeawayOrder(IN TakeawayOrder &order,OUT std::string &posOrd
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"INSERT INTO tbl_Check(`Date`,`Check`,BarCode,Outlet,`Floor`,TableNo,Cover,OpenTime,OpenPeriod,OpenStation,\
OpenStationRef,OpenEmp,CloseTime,ClosePeriod,CloseStation,CloseEmp,PrintCount,LastPrintTime,CheckTot,ItemTot,DiscBefore,PayTot,IsPaid,SCRate1,\
IsModified,LastModifiedTime)\
VALUES('%s',%d,'%s',%d,1,'1',1,'%s',3,99,99,4,'%s',4,99,4,
1
,'%s',%.2f,%.2f,%.2f,%.2f,'1',0.1,1,'%s')"
,
\
VALUES('%s',%d,'%s',%d,1,'1',1,'%s',3,99,99,4,'%s',4,99,4,
0
,'%s',%.2f,%.2f,%.2f,%.2f,'1',0.1,1,'%s')"
,
\
strDate
.
data
(),
orderId
,
orderIdStr
,
iOutlet
,
chTime
,
chTime
,
chTime
,
merchantTot
,
order
.
shop_fee
/
100.00
,
-
discount
,
merchantTot
,
chTime
);
nErrCode
=
mysql
->
insert
();
if
(
nErrCode
!=
EC_OK
)
...
...
@@ -803,6 +803,17 @@ int COrderInfo::PrintLable(LableObj &printObj)
return
EC_OK
;
}
int
COrderInfo
::
updatePrintCount
(
LableObj
&
printObj
)
{
int
nErrCode
=
EC_OK
;
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"UPDATE tbl_Check SET PrintCount=PrintCount+1,LastPrintTime=NOW() WHERE `Check`=%d;"
,
atoi
(
printObj
.
strOrderId
.
data
()));
LOG
(
INFO
)
<<
mysql
->
sqlStr
;
nErrCode
=
mysql
->
update
();
return
nErrCode
;
}
int
COrderInfo
::
charset_convert
(
const
char
*
charset_from
,
const
char
*
charset_to
,
const
std
::
string
&
string_from
,
std
::
string
&
string_to
)
{
...
...
pos_bft/OrderInfo.h
View file @
ae18c821
...
...
@@ -73,6 +73,7 @@ public:
//小票打印
int
PrintLable
(
LableObj
&
print
);
int
updatePrintCount
(
LableObj
&
print
);
std
::
string
m_FMPay
;
...
...
src/PayProcess.cpp
View file @
ae18c821
...
...
@@ -215,18 +215,34 @@ void *FunPrintLable(void* lpParamter)
int
statusCode
;
std
::
string
msg
;
nErrCode
=
dbOperation
->
PrintLable
(
printObj
);
LOG
(
INFO
)
<<
"---------------print result:"
<<
nErrCode
;
if
(
nErrCode
==
EC_OK
)
{
statusCode
=
100
;
msg
=
""
;
if
(
printObj
.
strCmd
==
"print_lable"
){
nErrCode
=
dbOperation
->
PrintLable
(
printObj
);
LOG
(
INFO
)
<<
"---------------print result:"
<<
nErrCode
;
if
(
nErrCode
==
EC_OK
)
{
statusCode
=
100
;
msg
=
""
;
}
else
{
statusCode
=
101
;
msg
=
"print failed"
;
}
}
else
{
statusCode
=
101
;
msg
=
"print failed"
;
else
if
(
printObj
.
strCmd
==
"update_count"
){
nErrCode
=
dbOperation
->
updatePrintCount
(
printObj
);
LOG
(
INFO
)
<<
"update print count result:"
<<
nErrCode
;
if
(
nErrCode
==
EC_OK
)
{
statusCode
=
100
;
msg
=
""
;
}
else
{
statusCode
=
101
;
msg
=
"update print count failed"
;
}
}
std
::
string
strReturnJson
=
GetTakeawayResultJson
(
statusCode
,
msg
.
data
(),
""
);
//发送返回数据
int
result
=
socketSendData
(
strReturnJson
.
data
(),
connect_fd
);
...
...
src/json.cpp
View file @
ae18c821
...
...
@@ -276,25 +276,36 @@ bool GetTakeawayPrintInfo(const char* json, LableObj &print)
}
else
{
rapidjson
::
Value
&
strDevice
=
document
[
"device"
];
rapidjson
::
Value
&
iBaud
=
document
[
"baud"
];
print
.
strDevice
=
strDevice
.
GetString
();
print
.
iBaud
=
iBaud
.
GetInt
();
rapidjson
::
Value
&
printObjs
=
document
[
"print"
];
if
(
printObjs
.
IsArray
()){
for
(
unsigned
int
i
=
0
;
i
<
printObjs
.
Size
();
i
++
){
LableItem
obj
;
rapidjson
::
Value
&
printValue
=
printObjs
[
i
];
rapidjson
::
Value
&
vText
=
printValue
[
"text"
];
rapidjson
::
Value
&
vType
=
printValue
[
"type"
];
obj
.
strText
=
vText
.
GetString
();
obj
.
type
=
vType
.
GetInt
();
print
.
vecItem
.
push_back
(
obj
);
rapidjson
::
Value
&
fm_cmd
=
document
[
"fm_cmd"
];
print
.
strCmd
=
fm_cmd
.
GetString
();
if
(
print
.
strCmd
==
"print_lable"
)
{
rapidjson
::
Value
&
strDevice
=
document
[
"device"
];
rapidjson
::
Value
&
iBaud
=
document
[
"baud"
];
print
.
strDevice
=
strDevice
.
GetString
();
print
.
iBaud
=
iBaud
.
GetInt
();
rapidjson
::
Value
&
printObjs
=
document
[
"print"
];
if
(
printObjs
.
IsArray
()){
for
(
unsigned
int
i
=
0
;
i
<
printObjs
.
Size
();
i
++
){
LableItem
obj
;
rapidjson
::
Value
&
printValue
=
printObjs
[
i
];
rapidjson
::
Value
&
vText
=
printValue
[
"text"
];
rapidjson
::
Value
&
vType
=
printValue
[
"type"
];
obj
.
strText
=
vText
.
GetString
();
obj
.
type
=
vType
.
GetInt
();
print
.
vecItem
.
push_back
(
obj
);
}
}
}
else
if
(
print
.
strCmd
==
"update_count"
){
rapidjson
::
Value
&
orderId
=
document
[
"order_id"
];
print
.
strOrderId
=
orderId
.
GetString
();
}
}
return
true
;
}
\ No newline at end of file
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