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
feeb3bb9
Commit
feeb3bb9
authored
May 13, 2020
by
wuyang.zou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、完成 wsg 组合定义;
2、完善 拼团 数据组装 与插入;
parent
fab216f4
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
287 additions
and
70 deletions
+287
-70
fmTakeout/DTools/pmsOrdersData.cpp
+176
-27
fmTakeout/DTools/pmsOrdersData.h
+11
-1
fmTakeout/Model/couponsObject.cpp
+2
-0
fmTakeout/Model/couponsObject.h
+32
-16
fmTakeout/Model/orderObject.cpp
+10
-14
fmTakeout/Model/orderObject.h
+30
-2
fmTakeout/Model/singleProductObject.h
+17
-2
fmTakeout/detailForm.cpp
+3
-3
fmTakeout/fmTakeout.rc
+4
-4
fmTakeout/preDefine.h
+2
-1
No files found.
fmTakeout/DTools/pmsOrdersData.cpp
View file @
feeb3bb9
...
...
@@ -69,12 +69,26 @@ int PmsOrdersData::convertPosServiceTypeId( const OrderObject* orderObj, const
}
// MOD渠道对应的业务逻辑 ; 星巴克-MOD,百度外卖,饿了么APP,美团外卖,星巴克-MOP;
else
if
(
"MOD"
==
orderObj
->
channel
)
{
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat;5 口碑;
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat
【businessType:10-预约 20-WSG, 30-拼团】
;5 口碑;
if
(
"4"
==
orderObj
->
platformSource
)
{
if
(
"20"
==
orderObj
->
businessType
)
{
tempOrderTypeId
=
31
;
}
else
{
tempOrderTypeId
=
27
;
}
}
else
{
tempOrderTypeId
=
9
;
}
}
// WSG-MOD 渠道对应的业务逻辑 ;
else
if
(
"WSG-MOD"
==
orderObj
->
channel
)
{
// 兼容渠道名称不统一问题
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat 【businessType:10-预约, 30-拼团】 ;5 口碑;
if
(
"4"
==
orderObj
->
platformSource
)
{
tempOrderTypeId
=
31
;
}
}
// MOP渠道对应的业务逻辑;
else
if
(
"MOP"
==
orderObj
->
channel
){
// 区别:口碑-MOP / App-MOP;
...
...
@@ -88,8 +102,6 @@ int PmsOrdersData::convertPosServiceTypeId( const OrderObject* orderObj, const
tempOrderTypeId
=
20
;
}
}
else
if
(
"BAIDU"
==
orderObj
->
channel
){
tempOrderTypeId
=
11
;
}
else
if
(
"ELE"
==
orderObj
->
channel
){
tempOrderTypeId
=
11
;
//星巴克-预约订单: 预约实物入机: 销售单订单类型:21; 退货单订单类型: 22;
...
...
@@ -117,12 +129,24 @@ int PmsOrdersData::convertPosServiceTypeId( const OrderObject* orderObj, const
}
// MOD渠道对应的业务逻辑 ; 星巴克-MOD,百度外卖,饿了么APP,美团外卖,星巴克-MOP;
else
if
(
"MOD"
==
orderObj
->
channel
)
{
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat;5 口碑;
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat
【businessType:10-预约 20-WSG, 30-拼团】
;5 口碑;
if
(
"4"
==
orderObj
->
platformSource
)
{
if
(
"20"
==
orderObj
->
businessType
)
{
tempOrderTypeId
=
32
;
}
else
{
tempOrderTypeId
=
28
;
}
}
else
{
tempOrderTypeId
=
17
;
}
}
// WSG-MOD 渠道对应的业务逻辑 ;
else
if
(
"WSG-MOD"
==
orderObj
->
channel
)
{
// 兼容渠道名称不统一问题
// platformSource:平台来源:1 app;2 ele;3 ors;4 WeChat 【businessType:10-预约, 30-拼团】 ;5 口碑;
if
(
"4"
==
orderObj
->
platformSource
)
{
tempOrderTypeId
=
32
;
}
}
// MOP渠道对应的业务逻辑;
else
if
(
"MOP"
==
orderObj
->
channel
){
// 区别:口碑-MOP / App-MOP;
...
...
@@ -136,8 +160,6 @@ int PmsOrdersData::convertPosServiceTypeId( const OrderObject* orderObj, const
tempOrderTypeId
=
20
;
}
}
else
if
(
"BAIDU"
==
orderObj
->
channel
){
tempOrderTypeId
=
13
;
}
else
if
(
"ELE"
==
orderObj
->
channel
){
tempOrderTypeId
=
16
;
//星巴克-预约订单: 预约实物入机: 销售单订单类型:21; 退货单订单类型: 22;
...
...
@@ -170,16 +192,18 @@ bool PmsOrdersData::insertOrderData(OrderObject* orderObj,QString& pmsOrderRef)
return
false
;
}
QSqlQuery
query
(
m_sqlDb
);
query
.
prepare
(
"INSERT INTO orders(guid, order_id, order_status, update_time, "
"order_channel, order_type,order_type_id,take_no, order_total, products_total, discount_total, payment_method, "
"invoice_url, invoice_status, third_party_id, third_party_index, package_fee, package_discount, "
"accept_date, secret_signal, address_detail, consignee_name ,first_name,last_name,consignee_phone, "
"delivery_price,delivery_discount,delivery_time, order_estimation,make_finish_time,is_package, "
"last_pay_time, address_latitude, address_longitude, oms_msrno, consumer_birthday, cancel_reason, "
"confirm_time,customer_id,customer_gender,way_bill_id,store_id,store_name,store_address,store_street, "
"pos_id, lang, ext_info, rider_phone, rider_name, displateform_fee, make_status, make_source, make_device_id) "
"VALUES(?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,"
" ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?)"
);
query
.
prepare
(
"INSERT INTO orders(guid, order_id, order_status, update_time,order_channel, order_type,order_type_id,take_no, order_total, products_total, "
"discount_total, payment_method, invoice_url, invoice_status, third_party_id, third_party_index, package_fee, package_discount, accept_date, secret_signal, "
"address_detail, consignee_name ,first_name,last_name,consignee_phone, delivery_price,delivery_discount,delivery_time, order_estimation,make_finish_time,"
"is_package, last_pay_time, address_latitude, address_longitude, oms_msrno, consumer_birthday, cancel_reason, confirm_time,customer_id,customer_gender,"
"way_bill_id,store_id,store_name,store_address,store_street, pos_id, lang, ext_info, rider_phone, rider_name, "
"displateform_fee, make_status, make_source, make_device_id,reserve_type, appointed_time,appointed_remind_template,sub_store_id) "
"VALUES(?, ?, ?, ?, ?,?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?,"
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, "
"?, ?, ?, ?, ?, ?, ?, ?)"
);
query
.
addBindValue
(
orderObj
->
id
);
// --非码OMS订单号
query
.
addBindValue
(
orderObj
->
id
);
// --非码OMS订单号
...
...
@@ -245,6 +269,16 @@ bool PmsOrdersData::insertOrderData(OrderObject* orderObj,QString& pmsOrderRef)
query
.
addBindValue
(
orderObj
->
makeSource
);
// --提供制作状态来源
query
.
addBindValue
(
orderObj
->
makeDeviceId
);
// --提供制作状态设备ID
// 与 oms协定此块业务出现 歧异 故在此处转换;
int
tempBusinessType
=
orderObj
->
businessType
.
toInt
();
if
(
"WSG-MOD"
==
orderObj
->
channel
&&
"4"
==
orderObj
->
platformSource
)
tempBusinessType
=
30
;
query
.
addBindValue
(
tempBusinessType
);
// --订单业务类型
query
.
addBindValue
(
orderObj
->
appointedTime
);
// --订单预约时间
query
.
addBindValue
(
orderObj
->
appointedRemindTemplate
);
// --订单预约提醒模板
query
.
addBindValue
(
orderObj
->
subStoreId
);
// --母子门店的子门店编号;
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
"[<<<<---PmsOrdersData::insertOrderData:Insert Order Error--->>>>]"
<<
query
.
lastError
().
text
()
<<
QString
::
number
(
query
.
lastError
().
type
());
...
...
@@ -256,10 +290,11 @@ bool PmsOrdersData::insertOrderData(OrderObject* orderObj,QString& pmsOrderRef)
"delivery_price,delivery_discount,delivery_time, order_estimation,make_finish_time,is_package, "
"last_pay_time, address_latitude, address_longitude, oms_msrno, consumer_birthday, cancel_reason, "
"confirm_time,customer_id,customer_gender,way_bill_id,store_id,store_name,store_address,store_street, "
"pos_id, lang, ext_info, rider_phone, rider_name, displateform_fee, make_status, make_source, make_device_id) "
"pos_id, lang, ext_info, rider_phone, rider_name, displateform_fee, make_status, make_source, make_device_id,"
" reserve_type, appointed_time,appointed_remind_template,sub_store_id) "
"VALUES(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20, "
"%21, %22, %23, %24, %25, %26, %27, %28, %29, %30, %31, %32, %33, %34, %35, %36, %37, %38, %39, %40,"
"%41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54)"
)
"%41, %42, %43, %44, %45, %46, %47, %48, %49, %50, %51, %52, %53, %54
,%55,%56,%57,%58
)"
)
.
arg
(
orderObj
->
id
).
arg
(
orderObj
->
id
).
arg
(
orderObj
->
orderStatus
).
arg
(
updateTimeString
).
arg
(
orderObj
->
channel
)
.
arg
(
orderObj
->
orderType
).
arg
(
tempOrderTypeId
)
.
arg
(
orderObj
->
pickupCode
).
arg
(
orderObj
->
totalPrice
*
0.01
).
arg
(
orderObj
->
productPrice
*
0.01
).
arg
(
orderObj
->
orderDiscount
*
0.01
)
...
...
@@ -272,14 +307,22 @@ bool PmsOrdersData::insertOrderData(OrderObject* orderObj,QString& pmsOrderRef)
.
arg
(
orderObj
->
confirmTime
).
arg
(
orderObj
->
customerId
).
arg
(
"Female"
).
arg
(
orderObj
->
waybillId
).
arg
(
orderObj
->
storeId
)
.
arg
(
orderObj
->
storeName
).
arg
(
orderObj
->
storeAddress
).
arg
(
""
)
.
arg
(
""
).
arg
(
orderObj
->
lang
).
arg
(
orderObj
->
memo
).
arg
(
orderObj
->
riderPhone
).
arg
(
orderObj
->
riderName
)
.
arg
(
orderObj
->
disPlateformFee
*
0.01
).
arg
(
orderObj
->
makeStatus
).
arg
(
orderObj
->
makeSource
).
arg
(
orderObj
->
makeDeviceId
);
.
arg
(
orderObj
->
disPlateformFee
*
0.01
).
arg
(
orderObj
->
makeStatus
).
arg
(
orderObj
->
makeSource
).
arg
(
orderObj
->
makeDeviceId
)
.
arg
(
tempBusinessType
).
arg
(
orderObj
->
appointedTime
).
arg
(
orderObj
->
appointedRemindTemplate
)
.
arg
(
orderObj
->
subStoreId
);
}
else
{
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertOrderData:Insert OrderId %1 Into PMS Order Success--->>>>]"
).
arg
(
orderObj
->
id
);
pmsOrderRef
=
query
.
lastInsertId
().
toString
();
QString
ProInIdRef
;
// 【businessType:10-预约 20-WSG, 30-拼团】 // 兼容渠道名称不统一问题
if
(
(
"WSG-MOD"
==
orderObj
->
channel
&&
"4"
==
orderObj
->
platformSource
)
||
(
"MOD"
==
orderObj
->
channel
&&
"4"
==
orderObj
->
platformSource
&&
"20"
==
orderObj
->
businessType
)
)
{
result
=
insertConponData
(
orderObj
->
coupList
,
orderObj
->
id
,
ProInIdRef
);
}
else
{
result
=
insertProductData
(
orderObj
->
proList
,
orderObj
->
id
,
ProInIdRef
);
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertOrderData OrderId %1 insertProductData:--->>>>]"
).
arg
(
orderObj
->
id
)
<<
result
;
}
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertOrderData OrderId %1 insertProductData | insertConponData :--->>>>]"
).
arg
(
orderObj
->
id
)
<<
result
;
}
m_sqlDb
.
close
();
m_mutex
.
unlock
();
...
...
@@ -335,7 +378,7 @@ bool PmsOrdersData::insertProductData(const QList<dishesObject*> proList, const
int
availProNum
=
0
;
// Skip Some Invalid Products;
QString
MainProOptions
=
""
;
if
(
proList
.
count
()
)
{
if
(
proList
.
count
()
)
{
foreach
(
dishesObject
*
dishesObjectTemp
,
proList
){
QString
tempCodeLeftHead
=
dishesObjectTemp
->
code
.
left
(
1
);
if
(
dishesObjectTemp
->
code
.
contains
(
"Default"
,
Qt
::
CaseInsensitive
)
||
(
tempCodeLeftHead
<
QString
(
'0'
)
||
tempCodeLeftHead
>
QString
(
'9'
))
||
!
dishesObjectTemp
->
qty
){
...
...
@@ -347,8 +390,8 @@ bool PmsOrdersData::insertProductData(const QList<dishesObject*> proList, const
QSqlQuery
query
(
m_sqlDb
);
query
.
prepare
(
"INSERT INTO order_items(order_id,product_id, product_code, product_name, en_product_name, product_qty, item_total,"
"spec_id, spec_name, en_spec_name, price, promotion_name, promotion_price, promotion_qty, promotion_sku,"
"package_price, default_image) "
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
"package_price, default_image
, prod_owner
) "
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
, ?
)"
);
query
.
addBindValue
(
OrderId
);
// --非码OMS订单号
query
.
addBindValue
(
dishesObjectTemp
->
id
);
// --主商品ID
query
.
addBindValue
(
dishesObjectTemp
->
code
);
// --主商品code
...
...
@@ -366,18 +409,21 @@ bool PmsOrdersData::insertProductData(const QList<dishesObject*> proList, const
query
.
addBindValue
(
dishesObjectTemp
->
promotionSku
);
// --主商品优惠sku
query
.
addBindValue
(
dishesObjectTemp
->
packagePrice
*
0.01
);
// --主商品打包价格
query
.
addBindValue
(
dishesObjectTemp
->
defaultImage
);
// --主商品默认图片
query
.
addBindValue
(
dishesObjectTemp
->
userName
);
// --主商品-Owner 拼单人;
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
QString
(
"[<<<<---PmsOrdersData::insertProductData:Insert OrderId %1 Product code:%2 Failed --->>>>]"
)
.
arg
(
OrderId
).
arg
(
dishesObjectTemp
->
code
)
<<
query
.
lastError
().
text
()
<<
QString
::
number
(
query
.
lastError
().
type
());
QLOG_ERROR
()
<<
QString
(
"INSERT INTO order_items(order_id,order_item_id, product_id, product_name, en_product_name, product_qty,"
" item_total,spec_id, spec_name, en_spec_name, price, promotion_name, promotion_price, promotion_qty,"
" promotion_sku, package_price, default_image) "
"VALUES(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17)"
)
" promotion_sku, package_price, default_image
, prod_owner
) "
"VALUES(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17
, %18
)"
)
.
arg
(
OrderId
).
arg
(
dishesObjectTemp
->
id
).
arg
(
dishesObjectTemp
->
code
).
arg
(
dishesObjectTemp
->
name
)
.
arg
(
""
).
arg
(
dishesObjectTemp
->
qty
).
arg
(
0
).
arg
(
dishesObjectTemp
->
specId
).
arg
(
dishesObjectTemp
->
specName
)
.
arg
(
""
).
arg
(
dishesObjectTemp
->
price
*
0.01
).
arg
(
dishesObjectTemp
->
promotionName
).
arg
(
dishesObjectTemp
->
promotionPrice
*
0.01
)
.
arg
(
dishesObjectTemp
->
promotionQty
).
arg
(
dishesObjectTemp
->
promotionSku
).
arg
(
dishesObjectTemp
->
packagePrice
*
0.01
).
arg
(
""
);
.
arg
(
dishesObjectTemp
->
promotionQty
).
arg
(
dishesObjectTemp
->
promotionSku
).
arg
(
dishesObjectTemp
->
packagePrice
*
0.01
).
arg
(
""
)
.
arg
(
dishesObjectTemp
->
userName
);
}
else
{
ProInIdRef
=
query
.
lastInsertId
().
toString
();
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertOrderProductData:Insert OrderId %1 Product Success code:%2 increaseId:%3--->>>>]"
)
...
...
@@ -401,7 +447,7 @@ bool PmsOrdersData::insertProductData(const QList<dishesObject*> proList, const
}
}
else
{
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertProductData OrderId %1 Has No Products--->>>>]"
).
arg
(
OrderId
);
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertProductData OrderId %1 Has No Products
--->>>>]"
).
arg
(
OrderId
);
}
if
(
insertProSucNum
==
availProNum
){
...
...
@@ -411,6 +457,109 @@ bool PmsOrdersData::insertProductData(const QList<dishesObject*> proList, const
return
insertProRet
;
}
//此函数将会在 insertOrderData 函数中调用;顾无需加锁 否则 会导致死锁;
bool
PmsOrdersData
::
insertConponData
(
const
QList
<
CouponsObject
*>
coupList
,
const
QString
&
OrderId
,
QString
&
ProInIdRef
)
{
bool
insertCoupRet
=
false
;
bool
insertCoupSubProRet
=
false
;
int
insertCoupSucNum
=
0
;
int
availCoupNum
=
0
;
// Skip Some Invalid Coupon Products;
if
(
coupList
.
count
()
)
{
foreach
(
CouponsObject
*
coupObjTemp
,
coupList
)
{
if
(
!
coupObjTemp
->
skus
.
count
()
)
{
QLOG_ERROR
()
<<
QString
(
"[<<<<---PmsOrdersData::insertConponData: Coupon Code:%1 Sku List Is Empty --->>>>]"
).
arg
(
coupObjTemp
->
code
);
if
(
insertCoupSucNum
)
{
QSqlQuery
query
(
m_sqlDb
);
query
.
prepare
(
"delete from order_items where order_id = '"
+
OrderId
+
"' "
);
if
(
!
query
.
exec
()
)
{
QLOG_ERROR
()
<<
QString
(
"[<<<<---PmsOrdersData::insertConponData: Clear Order Coupon Data Failed orderId:%1 --->>>>]"
).
arg
(
OrderId
);
}
else
{
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertConponData: Clear Order Coupon Data Sucessed orderId:%1 --->>>>]"
).
arg
(
OrderId
);
}
}
return
false
;
}
++
availCoupNum
;
QSqlQuery
query
(
m_sqlDb
);
query
.
prepare
(
"INSERT INTO order_items(order_id,product_id, product_code, product_name, en_product_name, product_qty, item_total,"
"spec_id, spec_name, en_spec_name, price, promotion_name, promotion_price, promotion_qty, promotion_sku,"
"package_price, default_image, coupon_show_giver, coupon_giver, coupon_wishes) "
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
query
.
addBindValue
(
OrderId
);
// --非码OMS订单号
query
.
addBindValue
(
""
);
// --主商品ID
query
.
addBindValue
(
coupObjTemp
->
skus
[
0
]
->
code
);
// --券主商品code
query
.
addBindValue
(
coupObjTemp
->
skus
[
0
]
->
name
);
// --券主商品名称
query
.
addBindValue
(
""
);
// --券主商品英文名称
query
.
addBindValue
(
coupObjTemp
->
skus
[
0
]
->
qty
);
// --券主商品数量
query
.
addBindValue
(
coupObjTemp
->
skus
[
0
]
->
price
);
// --券主商品应收价格
query
.
addBindValue
(
""
);
// --券主商品规格ID
query
.
addBindValue
(
""
);
// --券主商品规格名称
query
.
addBindValue
(
""
);
// --券主商品规格英文名称
query
.
addBindValue
(
coupObjTemp
->
skus
[
0
]
->
price
*
0.01
);
// --券主商品价格
query
.
addBindValue
(
coupObjTemp
->
discountName
);
// --券主商品优惠名
query
.
addBindValue
(
coupObjTemp
->
consumeDiscountAmount
*
0.01
);
// --券主商品优惠金额
query
.
addBindValue
(
1
);
// --券主商品优惠数量
query
.
addBindValue
(
coupObjTemp
->
discount
);
// --券主商品优惠sku
query
.
addBindValue
(
0
);
// --券主商品打包价格
query
.
addBindValue
(
""
);
// --券主商品默认图片
query
.
addBindValue
(
coupObjTemp
->
isShowGiver
);
// --券主商品-是否显示赠送者;
query
.
addBindValue
(
coupObjTemp
->
giverName
);
// --券主商品-赠送者名;
query
.
addBindValue
(
coupObjTemp
->
blessingWords
);
// --券主商品-赠送祝福词;
if
(
!
query
.
exec
())
{
QLOG_ERROR
()
<<
QString
(
"[<<<<---PmsOrdersData::insertConponData:Insert OrderId %1 Product code:%2 Failed --->>>>]"
)
.
arg
(
OrderId
).
arg
(
coupObjTemp
->
skus
[
0
]
->
code
)
<<
query
.
lastError
().
text
()
<<
QString
::
number
(
query
.
lastError
().
type
());
QLOG_ERROR
()
<<
QString
(
"INSERT INTO order_items(order_id,order_item_id, product_id, product_name, en_product_name, product_qty,"
" item_total,spec_id, spec_name, en_spec_name, price, promotion_name, promotion_price, promotion_qty,"
" promotion_sku, package_price, default_image, coupon_show_giver, coupon_giver, coupon_wishes) "
"VALUES(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16, %17, %18, %19, %20)"
)
.
arg
(
OrderId
).
arg
(
""
).
arg
(
coupObjTemp
->
skus
[
0
]
->
code
).
arg
(
coupObjTemp
->
skus
[
0
]
->
name
)
.
arg
(
""
).
arg
(
coupObjTemp
->
skus
[
0
]
->
qty
).
arg
(
coupObjTemp
->
skus
[
0
]
->
price
).
arg
(
""
).
arg
(
""
)
.
arg
(
""
).
arg
(
coupObjTemp
->
skus
[
0
]
->
price
*
0.01
).
arg
(
coupObjTemp
->
discountName
).
arg
(
coupObjTemp
->
consumeDiscountAmount
*
0.01
)
.
arg
(
1
).
arg
(
coupObjTemp
->
discount
).
arg
(
0
).
arg
(
""
).
arg
(
coupObjTemp
->
isShowGiver
).
arg
(
coupObjTemp
->
giverName
).
arg
(
coupObjTemp
->
blessingWords
);
}
else
{
ProInIdRef
=
query
.
lastInsertId
().
toString
();
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertConponData:Insert OrderId %1 Conpon Success code:%2 increaseId:%3--->>>>]"
)
.
arg
(
OrderId
).
arg
(
coupObjTemp
->
skus
[
0
]
->
code
).
arg
(
ProInIdRef
);
insertCoupSucNum
++
;
//插入券商品列表 客制化数据;
/*
QString SubProInIdRef;
if( coupObjTemp->skus.count() ) {
insertCoupSubProRet = insertCounpSubProData(coupObjTemp->skus,"", ProInIdRef, SubProInIdRef);
if(insertCoupProRet){
insertCoupSucNum++;
} else{ // insertSubProductData occurred Error And Faild Need Return False Immediately;
insertCoupRet = false;
QLOG_ERROR()<<QString("[<<<<---PmsOrdersData::insertSubProductData: Insert Coupon Product code:%1's SubProduct Failed --->>>>]").arg(dishesObjectTemp->code);
return insertCoupRet;
}
} else {
insertCoupSucNum++;
}
*/
}
}
}
else
{
QLOG_INFO
()
<<
QString
(
"[<<<<---PmsOrdersData::insertConponData OrderId %1 Has No Coupons --->>>>]"
).
arg
(
OrderId
);
}
if
(
insertCoupSucNum
&&
insertCoupSucNum
==
availCoupNum
){
insertCoupRet
=
true
;
}
return
insertCoupRet
;
}
//此函数将会在 deleteOrderData 函数中调用;顾无需加锁 否则 会导致死锁;
bool
PmsOrdersData
::
deleteProductData
(
OrderObject
*
orderObj
)
{
bool
delResultRet
=
false
;
...
...
fmTakeout/DTools/pmsOrdersData.h
View file @
feeb3bb9
...
...
@@ -7,6 +7,8 @@
#include <QObject>
#include <QMutex>
#include "Model/orderObject.h"
#include <Model/couponsObject.h>
#include <Model/singleProductObject.h>
#include "preDefine.h"
class
PmsOrdersData
:
public
QObject
...
...
@@ -51,12 +53,20 @@ public:
/**
*功能:插入订单主商品列表信息到PMS数据库中;
*参数:[1]订单
对象指针 [2]
返回插入成功后的自增序号;
*参数:[1]订单
商品列表指针, [2]订单ID, [3]
返回插入成功后的自增序号;
*返回:true操作成功,false失败
**/
bool
insertProductData
(
const
QList
<
dishesObject
*>
proList
,
const
QString
&
OrderId
,
QString
&
ProInIdRef
);
/**
*功能:插入订单 券列表信息到PMS数据库中;
*参数:[1]订单券列表指针, [2]订单ID, [3] 返回插入成功后的自增序号;
*返回:true操作成功,false失败
**/
bool
insertConponData
(
const
QList
<
CouponsObject
*>
coupList
,
const
QString
&
OrderId
,
QString
&
ProInIdRef
);
/**
*功能:删除PMS数据库中的指定订单状态的商品数据;
*参数:[1]订单对象指针;
*返回:true操作成功,false失败
...
...
fmTakeout/Model/couponsObject.cpp
View file @
feeb3bb9
...
...
@@ -56,6 +56,8 @@ void CouponsObject::FetchDataFromJson(const QJsonObject &json)
//初始商品配料数据信息;
item
->
isCoupon
=
false
;
item
->
code
=
""
;
item
->
qty
=
0
;
item
->
price
=
0
;
item
->
FetchDataFromJson
(
singleProduct
.
toObject
());
this
->
skus
.
append
(
item
);
}
...
...
fmTakeout/Model/couponsObject.h
View file @
feeb3bb9
...
...
@@ -11,14 +11,18 @@ class CouponsObject : public QObject
Q_OBJECT
Q_PROPERTY
(
QString
couponSeq
READ
getCouponSeq
WRITE
setCouponSeq
)
Q_PROPERTY
(
QString
code
READ
getCode
WRITE
setCode
)
Q_PROPERTY
(
QString
couponName
READ
getCouponName
WRITE
setCoupon
Name
)
Q_PROPERTY
(
QString
name
READ
getName
WRITE
set
Name
)
Q_PROPERTY
(
QString
menuItem
READ
getMenuItem
WRITE
setMenuItem
)
Q_PROPERTY
(
QString
couponType
READ
getCouponType
WRITE
setCouponType
)
Q_PROPERTY
(
bool
storeChannel
READ
getStoreChannel
WRITE
setStoreChannel
)
Q_PROPERTY
(
QString
payMethodId
READ
getPayMethodId
WRITE
setPayMethodId
)
Q_PROPERTY
(
QString
payMethodName
READ
getPayMethodName
WRITE
setPayMethodName
)
Q_PROPERTY
(
int
consumeFactAmount
READ
getConsumeFactAmount
WRITE
setConsumeFactAmount
)
Q_PROPERTY
(
int
consumeDiscountAmount
READ
getConsumeDiscountAmount
WRITE
setConsumeDiscountAmount
)
Q_PROPERTY
(
QString
discount
READ
getDiscount
WRITE
setDiscount
)
Q_PROPERTY
(
QString
discountName
READ
getDiscountName
WRITE
setDiscountName
)
Q_PROPERTY
(
int
isShowGiver
READ
getIsShowGiver
WRITE
setIsShowGiver
)
Q_PROPERTY
(
QString
giverName
READ
getGiverName
WRITE
setGiverName
)
Q_PROPERTY
(
QString
blessingWords
READ
getBlessingWords
WRITE
setBlessingWords
)
...
...
@@ -28,19 +32,22 @@ public:
CouponsObject
(
const
CouponsObject
&
coupons
,
QObject
*
parent
=
0
);
CouponsObject
&
operator
=
(
const
CouponsObject
&
coupons
);
void
FetchDataFromJson
(
const
QJsonObject
&
json
);
QString
couponSeq
;
//券序号
QString
code
;
//券ID号
QString
couponName
;
//券名
QString
menuItem
;
// 菜单分类
QString
couponType
;
//券类型
bool
storeChannel
;
//是否门店券;
QString
payMethodId
;
//券支付方式ID
int
consumeFactAmount
;
//券实际售卖金额
int
consumeDiscountAmount
;
//券折扣金额
QString
discount
;
QString
giverName
;
//券赠送者
QString
blessingWords
;
//券赠送祝福
QString
couponSeq
=
""
;
//券序号
QString
code
=
""
;
//券ID号
QString
name
=
""
;
//券名
QString
menuItem
=
""
;
// 菜单分类
QString
couponType
=
""
;
//券类型
bool
storeChannel
=
false
;
//是否门店券;
QString
payMethodId
=
""
;
//券支付方式ID
QString
payMethodName
=
""
;
//券支付方式名
int
consumeFactAmount
=
0
;
//券实际售卖金额
int
consumeDiscountAmount
=
0
;
//券折扣金额
QString
discount
=
""
;
//券折扣码
QString
discountName
=
""
;
//券折扣名
\
int
isShowGiver
=
0
;
//是否显示 券赠送者
QString
giverName
=
""
;
//券赠送者
QString
blessingWords
=
""
;
//券赠送祝福
QList
<
SingleProductObject
*>
skus
;
...
...
@@ -52,8 +59,8 @@ protected:
inline
QString
getCode
(){
return
code
;
}
inline
void
setCode
(
const
QString
&
v
){
code
=
v
;
}
inline
QString
get
CouponName
(){
return
couponN
ame
;
}
inline
void
set
CouponName
(
const
QString
&
v
){
couponN
ame
=
v
;
}
inline
QString
get
Name
(){
return
n
ame
;
}
inline
void
set
Name
(
const
QString
&
v
){
n
ame
=
v
;
}
inline
QString
getMenuItem
(){
return
menuItem
;
}
inline
void
setMenuItem
(
const
QString
&
v
){
menuItem
=
v
;
}
...
...
@@ -67,6 +74,9 @@ protected:
inline
QString
getPayMethodId
(){
return
payMethodId
;
}
inline
void
setPayMethodId
(
const
QString
&
v
){
payMethodId
=
v
;
}
inline
QString
getPayMethodName
(){
return
payMethodName
;
}
inline
void
setPayMethodName
(
const
QString
&
v
){
payMethodName
=
v
;
}
inline
int
getConsumeFactAmount
(){
return
consumeFactAmount
;
}
inline
void
setConsumeFactAmount
(
const
int
&
v
){
consumeFactAmount
=
v
;
}
...
...
@@ -76,6 +86,12 @@ protected:
inline
QString
getDiscount
(){
return
discount
;
}
inline
void
setDiscount
(
const
QString
&
v
){
discount
=
v
;
}
inline
QString
getDiscountName
(){
return
discountName
;
}
inline
void
setDiscountName
(
const
QString
&
v
){
discountName
=
v
;
}
inline
int
getIsShowGiver
(){
return
isShowGiver
;
}
inline
void
setIsShowGiver
(
const
int
&
v
){
isShowGiver
=
v
;
}
inline
QString
getGiverName
(){
return
giverName
;
}
inline
void
setGiverName
(
const
QString
&
v
){
giverName
=
v
;
}
...
...
fmTakeout/Model/orderObject.cpp
View file @
feeb3bb9
...
...
@@ -95,8 +95,9 @@ void OrderObject::FromJson(const QJsonObject &json)
coupObject
->
consumeDiscountAmount
=
0
;
coupObject
->
consumeFactAmount
=
0
;
coupObject
->
storeChannel
=
false
;
coupObject
->
couponN
ame
=
""
;
coupObject
->
n
ame
=
""
;
coupObject
->
couponSeq
=
QString
(
'0'
);
coupObject
->
isShowGiver
=
0
;
coupObject
->
FetchDataFromJson
(
coupJson
);
coupList
.
append
(
coupObject
);
}
...
...
@@ -131,6 +132,11 @@ QString OrderObject::getChannelName()
QLOG_INFO
()
<<
QString
(
"[<<<<---OrderObject:getChannelName [%1]--->>>>]"
).
arg
(
channel
);
if
(
"MOD"
==
channel
&&
3
!=
orderType
){
if
(
"4"
==
platformSource
)
{
if
(
"20"
==
businessType
)
{
return
QString
::
fromLocal8Bit
(
"微信用星说"
);
}
else
if
(
"30"
==
businessType
)
{
return
QString
::
fromLocal8Bit
(
"拼单-MOD"
);
}
return
QString
::
fromLocal8Bit
(
"微信-MOD"
);
}
else
{
return
QString
::
fromLocal8Bit
(
"星-MOD"
);
...
...
@@ -138,12 +144,12 @@ QString OrderObject::getChannelName()
}
else
if
(
"MOD"
==
channel
&&
3
==
orderType
){
return
QString
::
fromLocal8Bit
(
"星-客诉"
);
}
else
if
(
"WSG-MOD"
==
channel
){
// 兼容渠道名称不统一问题;
return
QString
::
fromLocal8Bit
(
"微信用星说"
);
}
else
if
(
"ELE"
==
channel
){
return
QString
::
fromLocal8Bit
(
"饿了么"
);
}
else
if
(
"BAIDU"
==
channel
){
return
QString
::
fromLocal8Bit
(
"百度外卖"
);
}
else
if
(
"MOP"
==
channel
&&
4
!=
orderType
){
if
(
"5"
==
platformSource
)
{
return
QString
::
fromLocal8Bit
(
"口碑-MOP"
);
...
...
@@ -154,17 +160,7 @@ QString OrderObject::getChannelName()
}
else
if
(
"MOP"
==
channel
&&
4
==
orderType
){
return
QString
::
fromLocal8Bit
(
"星-自测"
);
}
else
if
(
"ORS"
==
channel
){
return
QString
::
fromLocal8Bit
(
"星-预约"
);
}
else
if
(
"STC"
==
channel
){
return
QString
::
fromLocal8Bit
(
"SmartCase"
);
}
else
{
if
(
"HM"
==
channel
)
{
return
QString
::
fromLocal8Bit
(
"盒马"
);
}
return
QString
::
fromLocal8Bit
(
"未知"
);
}
}
...
...
fmTakeout/Model/orderObject.h
View file @
feeb3bb9
...
...
@@ -81,6 +81,8 @@ class OrderObject : public QObject
Q_PROPERTY
(
QString
makeSource
READ
getMakeSource
WRITE
setMakeSource
)
Q_PROPERTY
(
QString
makeDeviceId
READ
getMakeDeviceId
WRITE
setMakeDeviceId
)
Q_PROPERTY
(
QString
businessType
READ
getBusinessType
WRITE
setBusinessType
)
Q_PROPERTY
(
int
forwardPosStatus
READ
getForwardPosStatus
WRITE
setForwardPosStatus
)
Q_PROPERTY
(
int
negativePosStatus
READ
getNegativePosStatus
WRITE
setNegativePosStatus
)
Q_PROPERTY
(
int
deliveryStatus
READ
getDeliveryStatus
WRITE
setDeliveryStatus
)
Q_PROPERTY
(
int
payStatus
READ
getPayStatus
WRITE
setPayStatus
)
Q_PROPERTY
(
int
refundStatus
READ
getRefundStatus
WRITE
setRefundStatus
)
...
...
@@ -88,6 +90,10 @@ class OrderObject : public QObject
Q_PROPERTY
(
QString
customerSex
READ
getCustomerSex
WRITE
setCustomerSex
)
Q_PROPERTY
(
QString
platformSource
READ
getPlatformSource
WRITE
setPlatformSource
)
Q_PROPERTY
(
int
orderIndex
READ
getOrderIndex
WRITE
setOrderIndex
)
Q_PROPERTY
(
QString
appointedTime
READ
getAppointedTime
WRITE
setAppointedTime
)
Q_PROPERTY
(
QString
appointedRemindTemplate
READ
getAppointedRemindTemplate
WRITE
setAppointedRemindTemplate
)
Q_PROPERTY
(
QString
subStoreId
READ
getSubStoreId
WRITE
setSubStoreId
)
public
:
OrderObject
(
QObject
*
parent
=
0
)
:
QObject
(
parent
){}
...
...
@@ -162,7 +168,7 @@ public:
int
orderIndex
=
0
;
int
updateTime
=
0
;
QString
customerSex
=
""
;
//用户性别 1-男; 2-女
QString
platformSource
;
//订单平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
QString
platformSource
=
""
;
//订单平台来源:1 app; 2 ele; 3 ors; 4 WeChat; 5 口碑;
int
needInvoice
=
0
;
int
deliveryPrice
=
0
;
// 配送费
int
deliveryDiscount
=
0
;
// 配送费折扣
...
...
@@ -183,7 +189,14 @@ public:
QString
makeStatus
=
""
;
// PMS 制作状态
QString
makeSource
=
""
;
//PMS 制作来源: 普通扫描枪、扫描枪Now、顾客、PMS-kds、
QString
makeDeviceId
=
""
;
//PMS 更新制作状态的设备Id
QString
businessType
;
//订单业务类型: 10:预约单 20:杯贴祝福 30:拼团
QString
businessType
=
"0"
;
//订单业务类型: 10:预约单 20:杯贴祝福 30:拼团
QString
appointedTime
=
"0000-00-00 00:00:00"
;
// 预约日期 [预约单-预约日期] 必须设置默认值否则插库失败;
QString
appointedRemindTemplate
=
""
;
// 预约提醒模板【新增字段:string】
QString
subStoreId
=
""
;
// 子门店号 【新增字段:string】
int
forwardPosStatus
=
0
;
// 正向单入机状态: 0:未知 1: 成功 2:失败;
int
negativePosStatus
=
0
;
// 负向单同上;
int
deliveryStatus
=
0
;
int
payStatus
=
0
;
...
...
@@ -401,6 +414,12 @@ public:
inline
QString
getBusinessType
()
const
{
return
businessType
;}
inline
void
setBusinessType
(
const
QString
&
v
){
businessType
=
v
;}
inline
int
getForwardPosStatus
()
const
{
return
forwardPosStatus
;}
inline
void
setForwardPosStatus
(
const
int
&
v
){
forwardPosStatus
=
v
;}
inline
int
getNegativePosStatus
()
const
{
return
negativePosStatus
;}
inline
void
setNegativePosStatus
(
const
int
&
v
){
negativePosStatus
=
v
;}
inline
int
getDeliveryStatus
()
const
{
return
deliveryStatus
;}
inline
void
setDeliveryStatus
(
const
int
&
v
){
deliveryStatus
=
v
;}
...
...
@@ -427,6 +446,15 @@ public:
inline
QString
getSecretSignal
()
const
{
return
secretSignal
;}
inline
void
setSecretSignal
(
const
QString
&
v
){
secretSignal
=
v
;}
inline
QString
getAppointedTime
()
const
{
return
appointedTime
;}
inline
void
setAppointedTime
(
const
QString
&
v
){
appointedTime
=
v
;}
inline
QString
getAppointedRemindTemplate
()
const
{
return
appointedRemindTemplate
;}
inline
void
setAppointedRemindTemplate
(
const
QString
&
v
){
appointedRemindTemplate
=
v
;}
inline
QString
getSubStoreId
()
const
{
return
subStoreId
;}
inline
void
setSubStoreId
(
const
QString
&
v
){
subStoreId
=
v
;}
};
#endif // ORDEROBJECT_H
fmTakeout/Model/singleProductObject.h
View file @
feeb3bb9
...
...
@@ -10,6 +10,9 @@ class SingleProductObject : public QObject
{
Q_OBJECT
Q_PROPERTY
(
QString
code
READ
getCode
WRITE
setCode
)
Q_PROPERTY
(
QString
name
READ
getName
WRITE
setName
)
Q_PROPERTY
(
int
qty
READ
getQty
WRITE
setQty
)
Q_PROPERTY
(
int
price
READ
getPrice
WRITE
setPrice
)
Q_PROPERTY
(
bool
isCoupon
READ
getIsCoupon
WRITE
setIsCoupon
)
public
:
...
...
@@ -17,13 +20,25 @@ public:
SingleProductObject
(
const
SingleProductObject
&
singleProduct
,
QObject
*
parent
=
0
);
SingleProductObject
&
operator
=
(
const
SingleProductObject
&
singleProduct
);
void
FetchDataFromJson
(
const
QJsonObject
&
json
);
QString
code
;
bool
isCoupon
;
//此单品是否是券;
QString
code
=
""
;
QString
name
=
""
;
int
qty
=
0
;
int
price
=
0
;
bool
isCoupon
=
false
;
//此单品是否是券;
protected
:
inline
QString
getCode
(){
return
code
;
}
inline
void
setCode
(
const
QString
&
v
){
code
=
v
;
}
inline
QString
getName
(){
return
name
;
}
inline
void
setName
(
const
QString
&
v
){
name
=
v
;
}
inline
int
getQty
(){
return
qty
;
}
inline
void
setQty
(
const
int
&
v
){
qty
=
v
;
}
inline
int
getPrice
(){
return
price
;
}
inline
void
setPrice
(
const
int
&
v
){
price
=
v
;
}
inline
bool
getIsCoupon
(){
return
isCoupon
;
}
inline
void
setIsCoupon
(
const
bool
&
v
){
isCoupon
=
v
;
}
...
...
fmTakeout/detailForm.cpp
View file @
feeb3bb9
...
...
@@ -138,10 +138,10 @@ void DetailForm::InitData(OrderObject *orderObject)
{
CouponsObject
*
tempCouponObj
=
orderObject
->
coupList
[
coupNum
];
ui
->
detailTable0
->
insertRow
(
pNum
);
QString
temp
CouponName
=
tempCouponObj
->
couponName
.
length
()
?
tempCouponObj
->
couponName
:
QString
::
fromLocal8Bit
(
"预约
券"
);
ui
->
detailTable0
->
setItem
(
pNum
,
0
,
new
QTableWidgetItem
(
temp
CouponName
));
// 预约
券名
QString
temp
Name
=
tempCouponObj
->
name
.
length
()
?
tempCouponObj
->
name
:
QString
::
fromLocal8Bit
(
"
券"
);
ui
->
detailTable0
->
setItem
(
pNum
,
0
,
new
QTableWidgetItem
(
temp
Name
));
//
券名
ui
->
detailTable0
->
item
(
pNum
,
0
)
->
setTextAlignment
(
Qt
::
AlignCenter
);
ui
->
detailTable0
->
setItem
(
pNum
,
1
,
new
QTableWidgetItem
(
QString
(
'-'
)));
//
预约
券价格
ui
->
detailTable0
->
setItem
(
pNum
,
1
,
new
QTableWidgetItem
(
QString
(
'-'
)));
// 券价格
ui
->
detailTable0
->
item
(
pNum
,
1
)
->
setTextAlignment
(
Qt
::
AlignCenter
);
ui
->
detailTable0
->
setItem
(
pNum
,
2
,
new
QTableWidgetItem
(
QString
::
number
(
1
)));
// 券数量
ui
->
detailTable0
->
item
(
pNum
,
2
)
->
setTextAlignment
(
Qt
::
AlignCenter
);
...
...
fmTakeout/fmTakeout.rc
View file @
feeb3bb9
...
...
@@ -7,8 +7,8 @@ IDI_ICON ICON DISCARDABLE "logo.ico"
#endif
VS_VERSION_INFO VERSIONINFO
//***每次修改后编译发版必须变更版本号(preDefine.h中APP_VERSION 需要一致)***//
FILEVERSION 4,2020,5
08
,1
PRODUCTVERSION 4,2020,5
08
,1
FILEVERSION 4,2020,5
20
,1
PRODUCTVERSION 4,2020,5
20
,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.2020.5
08
.1"
VALUE "FileVersion", "4.2020.5
08
.1"
VALUE "ProductVersion", "4.2020.5
20
.1"
VALUE "FileVersion", "4.2020.5
20
.1"
//*************************************************************************//
END
END
...
...
fmTakeout/preDefine.h
View file @
feeb3bb9
...
...
@@ -7,7 +7,8 @@
//#define APP_VERSION "4.2019.1225.1"
//#define APP_VERSION "4.2020.318.1"
#define APP_VERSION "4.2020.508.1"
//#define APP_VERSION "4.2020.423.1"
#define APP_VERSION "4.2020.520.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