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
17176ed5
Commit
17176ed5
authored
Sep 15, 2017
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、订单信息添加写入折扣字段
2、订单号产生规则修改,确保不重复
parent
8d0a64f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
15 deletions
+54
-15
bin/monitor.ini
+10
-0
pos_bft/OrderInfo.cpp
+44
-15
No files found.
bin/monitor.ini
0 → 100644
View file @
17176ed5
[DB]
ip
=
localhost
dbName
=
pos
user
=
root
password
=
123
[SYS]
pos
=
bifengtang
serverip
=
192.168.0.111
\ No newline at end of file
pos_bft/OrderInfo.cpp
View file @
17176ed5
...
...
@@ -146,28 +146,33 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
return
EC_EX_SQL_FAILED
;
}
if
(
NULL
!=
(
mysql
->
_row
=
mysql_fetch_row
(
mysql
->
_result
))){
pthread_mutex_unlock
(
&
mutex
);
//解锁
LOG
(
INFO
)
<<
"订单已存在"
;
mysql_free_result
(
mysql
->
_result
);
pthread_mutex_unlock
(
&
mutex
);
//解锁
return
EC_EXIST_ORDER
;
//订单已存在
}
mysql_free_result
(
mysql
->
_result
);
int
orderId
=
0
;
//查询订单表中订单id,获取到的最大订单id加1即为新的订单id
sprintf
(
mysql
->
sqlStr
,
"%s"
,
"SELECT MAX(`Check`) AS id FROM tbl_Check;"
);
nErrCode
=
mysql
->
query
();
if
(
nErrCode
!=
EC_OK
){
pthread_mutex_unlock
(
&
mutex
);
//解锁
return
EC_EX_SQL_FAILED
;
}
sprintf
(
mysql
->
sqlStr
,
"%s"
,
"SELECT `Check` FROM tbl_Check WHERE `Check` BETWEEN 660000000 AND 669999999;"
);
mysql
->
query
();
if
(
NULL
==
(
mysql
->
_row
=
mysql_fetch_row
(
mysql
->
_result
))){
orderId
=
99000000
;
//初始订单id
LOG
(
INFO
)
<<
"初始订单,id:99000000"
;
orderId
=
660000000
;
//初始订单id
LOG
(
INFO
)
<<
"初始订单,id:660000000"
;
mysql_free_result
(
mysql
->
_result
);
}
else
{
mysql_free_result
(
mysql
->
_result
);
sprintf
(
mysql
->
sqlStr
,
"%s"
,
"SELECT MAX(`Check`) AS id FROM tbl_Check WHERE `Check` BETWEEN 660000000 AND 669999999;"
);
mysql
->
query
();
if
(
NULL
!=
(
mysql
->
_row
=
mysql_fetch_row
(
mysql
->
_result
))){
orderId
=
atoi
(
mysql
->
_row
[
0
]);
}
mysql_free_result
(
mysql
->
_result
);
}
orderId
+=
1
;
//orderid加1
char
orderIdStr
[
10
]
=
{
0
};
sprintf
(
orderIdStr
,
"%d"
,
orderId
);
...
...
@@ -220,20 +225,43 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
mysql_free_result
(
mysql
->
_result
);
//订单写入“订单表”
float
discount
=
0.00
;
//折扣金额
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,PayTot,IsPaid,SCRate1,\
OpenStationRef,OpenEmp,CloseTime,ClosePeriod,CloseStation,CloseEmp,PrintCount,LastPrintTime,CheckTot,ItemTot,
DiscBefore,
PayTot,IsPaid,SCRate1,\
IsModified,LastModifiedTime)\
VALUES('%s',%d,'%s',%d,1,'1',4,'%s',3,99,99,4,'%s',4,99,4,1,'%s',%.2f,%.2f,%.2f,'1',0.1,1,'%s')"
,
\
strDate
.
data
(),
orderId
,
orderIdStr
,
iOutlet
,
chTime
,
chTime
,
chTime
,
order
.
shop_fee
/
100.00
,
order
.
shop_fee
/
100.00
,
order
.
shop_fee
/
100.00
,
chTime
);
VALUES('%s',%d,'%s',%d,1,'1',4,'%s',3,99,99,4,'%s',4,99,4,1,'%s',%.2f,%.2f,%.2f,
%.2f,
'1',0.1,1,'%s')"
,
\
strDate
.
data
(),
orderId
,
orderIdStr
,
iOutlet
,
chTime
,
chTime
,
chTime
,
order
.
shop_fee
/
100.00
,
order
.
shop_fee
/
100.00
,
discount
,
order
.
shop_fee
/
100.00
,
chTime
);
nErrCode
=
mysql
->
insert
();
//订单商品写入“订单详情表”
for
(
std
::
vector
<
TakeawayProduct
>::
size_type
i
=
0
;
i
<
order
.
vecProducts
.
size
();
i
++
){
float
discount_product
=
0.00
;
//折扣金额
float
price_product
=
order
.
vecProducts
[
i
].
original_price
/
100.00
;
//商品单价
float
tot_product
=
order
.
vecProducts
[
i
].
original_price
*
order
.
vecProducts
[
i
].
consume_num
/
100.00
;
//商品总额
std
::
string
dish_name
=
""
;
int
print1
=
0
,
print2
=
0
,
print3
=
0
,
print4
=
0
,
print5
=
0
,
cat
=
0
;
//查询商品详细信息
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"SELECT Name3,PrintQ1,PrintQ2,PrintQ3,PrintQ4,PrintQ5,Category FROM tbl_Menu WHERE Item='%s';"
,
order
.
vecProducts
[
i
].
pid
.
data
());
nErrCode
=
mysql
->
query
();
if
(
NULL
!=
(
mysql
->
_row
=
mysql_fetch_row
(
mysql
->
_result
))){
dish_name
=
mysql
->
_row
[
0
];
print1
=
atoi
(
mysql
->
_row
[
1
]);
print2
=
atoi
(
mysql
->
_row
[
2
]);
print3
=
atoi
(
mysql
->
_row
[
3
]);
print4
=
atoi
(
mysql
->
_row
[
4
]);
print5
=
atoi
(
mysql
->
_row
[
5
]);
cat
=
atoi
(
mysql
->
_row
[
6
]);
}
mysql_free_result
(
mysql
->
_result
);
snprintf
(
mysql
->
sqlStr
,
SQL_BUFFER_SIZE
,
"INSERT INTO tbl_Item(`Date`,`Check`,Outlet,ItemIdx,Item,Name3,NameS3,`Type`,OrderTime,OrderStation,OrderEmp,\
PrintQ1,PrintQ2,PrintQ3,PrintQ4,PrintQ5,IsPrintOnCheck,PrintStatus,PrintCheckStatus,PrintedOnCheck,OgnPrice,Price,PriceLevel,ModiMethod,\
UnitQty,Qty,ItemTot,RvItemTot,Dept,Category,IsItemModified,LastModifiedTime)\
VALUES('%s',%d,%d,%d,'%s','rolls','rolls',1,'%s',99,4,1,1,1,1,1,'1',4,'1',1,10.00,10,1,-1,1,1,10,10,3,104,1,'%s')"
,
\
strDate
.
data
(),
orderId
,
iOutlet
,
i
+
1
,
order
.
vecProducts
[
i
].
pid
.
data
(),
chTime
,
chTime
);
DiscBefore,UnitQty,Qty,ItemTot,RvDiscBefore,RvItemTot,Dept,Category,IsItemModified,LastModifiedTime)\
VALUES('%s',%d,%d,%d,'%s','%s','%s',1,'%s',99,4,%d,%d,%d,%d,%d,'1',4,'1',1,%.2f,%.2f,1,-1,%.2f,1,%d,%.2f,%.2f,%.2f,3,%d,1,'%s')"
,
\
strDate
.
data
(),
orderId
,
iOutlet
,
i
+
1
,
order
.
vecProducts
[
i
].
pid
.
data
(),
dish_name
.
data
(),
dish_name
.
data
(),
chTime
,
print1
,
print2
,
print3
,
print4
,
\
print5
,
price_product
,
price_product
,
discount_product
,
\
order
.
vecProducts
[
i
].
consume_num
,
tot_product
,
discount_product
,
tot_product
,
cat
,
chTime
);
nErrCode
=
mysql
->
insert
();
}
...
...
@@ -243,6 +271,7 @@ int COrderInfo::SetTakeawayOrder(TakeawayOrder &order)
VALUES('%s',%d,%d,1,%d,'%s',4,'%s',99,10.00,1,'',1,'%s')"
,
\
strDate
.
data
(),
orderId
,
iOutlet
,
atoi
(
posTakeway
.
merchantTypeId
.
data
()),
posTakeway
.
strName
.
data
(),
chTime
,
chTime
);
nErrCode
=
mysql
->
insert
();
pthread_mutex_unlock
(
&
mutex
);
//解锁
return
0
;
}
...
...
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