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
45fa6706
Commit
45fa6706
authored
Jul 25, 2018
by
wuyang.zou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug : 与OMS接口都新增 posAddress 参数;取消从插件的配置文件中读取IP地址,多次选择产品已售完,商品重复出现问题
parent
a0fce148
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
27 deletions
+48
-27
fmTakeout/Control/flowControl.cpp
+17
-4
fmTakeout/DTools/dataManger.cpp
+11
-0
fmTakeout/DTools/dataManger.h
+12
-1
fmTakeout/preDefine.h
+2
-1
fmTakeout/refdishesForm.cpp
+4
-5
fmTakeout/refdishesForm.h
+1
-1
fmTakeout/refuseForm.cpp
+1
-15
No files found.
fmTakeout/Control/flowControl.cpp
View file @
45fa6706
...
...
@@ -139,18 +139,26 @@ FlowControl::FlowControl()
QString
FlowControl
::
_GetIpAddress
()
{
/***
????需要验证IP地址是通过配置文件还是直接通过机器获取????
***/
/***
已经验证:IP地址 优先取配置文件中的[IpAddress/ip];只有没有配置的情况才会根据主机名获取ipv4的IP地址,因此为保证IP的准确性,注释通过配置文件获取ip的代码
***/
QString
ipAddress
;
ipAddress
=
ConfigManger
::
GetInstance
().
GetIpAddress
();
//ipAddress=ConfigManger::GetInstance().GetIpAddress();
//QLOG_INFO()<<QString::fromLocal8Bit("[<<<<---FlowControl::_GetIpAddress getFromConfigIni:%1--->>>>]").arg(ipAddress);
QHostInfo
info
=
QHostInfo
::
fromName
(
QHostInfo
::
localHostName
());
foreach
(
QHostAddress
address
,
info
.
addresses
())
{
if
(
address
.
protocol
()
==
QAbstractSocket
::
IPv4Protocol
)
{
QLOG_INFO
()
<<
QString
::
fromLocal8Bit
(
"[<<<<---FlowControl::_GetIpAddress getFromLocalHostName:%1--->>>>]"
).
arg
(
address
.
toString
());
//1.1.1.1 > length > 7
if
(
address
.
toString
().
length
()
>
7
){
ipAddress
=
address
.
toString
();
}
/*
if(address.toString().contains(ipAddress))
{
ipAddress=address.toString();
}
*/
}
}
return
ipAddress
+
QString
(
":"
)
+
QString
::
number
(
ConfigManger
::
GetInstance
().
GetHttpServerPort
());
...
...
@@ -228,7 +236,7 @@ void FlowControl::_OrderAnalysis(const QJsonObject& jsonObject)
m_FmOrdersMap
.
insert
(
orderObject
->
id
,
orderObject
);
QLOG_INFO
()
<<
QString
(
"[<<<<---FmTakeout Valid Orders Map:Insert New Order[%1:%2]--->>>>][data:]"
)
.
arg
(
orderObject
->
id
,
orderObject
->
getOrderStatusDec
())
<<
jsonObject
;
.
arg
(
orderObject
->
id
,
orderObject
->
getOrderStatusDec
());
if
(
!
SimProcOrderDB
::
getInstance
().
isOrderExist
(
orderObject
->
id
))
{
SimProcOrderDB
::
getInstance
().
insertSimProcOrder
(
orderObject
->
id
,
QDate
::
currentDate
().
toString
(
"yyyy-MM-dd"
));
...
...
@@ -376,7 +384,7 @@ void FlowControl::onGetNewStoreInfo()
return
;
}
//鸡肋:没有用到此函数的实际功能【仅仅用来获取门店登陆用的密码:m_password】;
bool
FlowControl
::
_GetStoreInfo
()
{
bool
result
=
true
;
...
...
@@ -433,6 +441,7 @@ bool FlowControl::_Login()
m_storeName
=
recvJson
[
JSON_STORENAME
].
toString
();
DataManger
::
GetInstance
().
SetToken
(
recvJson
[
JSON_DATA
].
toObject
()[
JSON_TOKEN
].
toString
());
DataManger
::
GetInstance
().
SetStoreId
(
m_storeId
);
DataManger
::
GetInstance
().
SetPosIpAddress
(
_GetIpAddress
());
DataManger
::
GetInstance
().
SetPartnerId
(
ConfigManger
::
GetInstance
().
GetPartnerId
());
emit
hideAlert
();
emit
setStoreInfo
(
m_storeId
);
...
...
@@ -512,6 +521,8 @@ bool FlowControl::_PullOrderDetail(const QString& orderId)
QString
url
=
ConfigManger
::
GetInstance
().
GetOrderServerUrl
()
+
ConfigManger
::
GetInstance
().
GetInterfaceName
(
INI_INTERFACE_PULLORDER
);
url
.
append
(
orderId
);
QString
posIpAddress
=
_GetIpAddress
();
url
.
append
(
QString
(
"&"
)
+
JSON_POSIPADDRESS
+
QString
(
"="
)
+
posIpAddress
);
QLOG_INFO
()
<<
QString
(
"[<<<<---Pull Order Detail--->>>>][requestUrl:]"
)
<<
url
;
m_pullOrderSocket
->
SetUrl
(
QUrl
(
url
));
result
=
m_pullOrderSocket
->
GetRequest
(
recvJson
,
error
);
...
...
@@ -668,6 +679,8 @@ bool FlowControl::_ConfirmOrder(const QString &orderId)
QString
url
=
ConfigManger
::
GetInstance
().
GetOrderServerUrl
()
+
ConfigManger
::
GetInstance
().
GetInterfaceName
(
INI_INTERFACE_CONFIRM
);
url
.
append
(
orderId
);
QString
posIpAddress
=
_GetIpAddress
();
url
.
append
(
QString
(
"&"
)
+
JSON_POSIPADDRESS
+
QString
(
"="
)
+
posIpAddress
);
QLOG_INFO
()
<<
QString
(
"[<<<<---Confirm Order Begin--->>>>][requestUrl:]"
)
<<
url
;
m_procOrderSocket
->
SetUrl
(
QUrl
(
url
));
result
=
m_procOrderSocket
->
GetRequest
(
recvJson
,
error
);
...
...
fmTakeout/DTools/dataManger.cpp
View file @
45fa6706
...
...
@@ -31,6 +31,12 @@ void DataManger::SetStoreId(const QString &storeId)
m_storeId
=
storeId
;
}
void
DataManger
::
SetPosIpAddress
(
const
QString
&
posIpAddress
)
{
m_posIpAddress
=
posIpAddress
;
}
void
DataManger
::
SetPartnerId
(
const
QString
&
partnerId
)
{
m_partnerId
=
partnerId
;
...
...
@@ -69,6 +75,7 @@ QJsonObject DataManger::GetPullOrderListData(const int& pageNumber, const int& p
rObj
.
insert
(
JSON_PAGENUMBER
,
pageNumber
);
rObj
.
insert
(
JSON_PAGESIZE
,
pageSize
);
rObj
.
insert
(
JSON_SHOPCODE
,
m_storeId
);
rObj
.
insert
(
JSON_POSIPADDRESS
,
QString
(
"http://"
)
+
m_posIpAddress
);
//rObj.insert(JSON_AUTOCONFIRM, autoconfirm);
return
rObj
;
}
...
...
@@ -90,6 +97,7 @@ QJsonObject DataManger::GetConfirmOrderData(const QString &orderId, const QStrin
rObj
.
insert
(
JSON_BUSINESSID
,
orderId
);
rObj
.
insert
(
JSON_CHANNEL
,
channel
);
rObj
.
insert
(
JSON_SHOPCODE
,
m_storeId
);
rObj
.
insert
(
JSON_POSIPADDRESS
,
QString
(
"http://"
)
+
m_posIpAddress
);
return
rObj
;
}
...
...
@@ -102,6 +110,7 @@ QJsonObject DataManger::GetRefuseOrderData(int refuseCode, const QString &orderI
rObj
.
insert
(
JSON_ORDER
,
cObj
);
rObj
.
insert
(
JSON_TOKEN
,
m_token
);
rObj
.
insert
(
JSON_POSVERSION
,
APP_VERSION
);
rObj
.
insert
(
JSON_POSIPADDRESS
,
QString
(
"http://"
)
+
m_posIpAddress
);
return
rObj
;
}
...
...
@@ -143,11 +152,13 @@ QJsonObject DataManger::GetRefundOrderData(int reasonCode,const QString &reason,
rObj
.
insert
(
JSON_ORDERID
,
orderId
);
rObj
.
insert
(
"productIds"
,
productIds
);
rObj
.
insert
(
"canceledCause"
,
reason
);
rObj
.
insert
(
JSON_POSIPADDRESS
,
QString
(
"http://"
)
+
m_posIpAddress
);
}
// 其他退单原因;
else
{
rObj
.
insert
(
JSON_ORDERID
,
orderId
);
rObj
.
insert
(
"canceledCause"
,
reason
);
rObj
.
insert
(
JSON_POSIPADDRESS
,
QString
(
"http://"
)
+
m_posIpAddress
);
//rObj.insert(JSON_CODE, reasonCode);
//rObj.insert(JSON_CHANNEL,channel);
//rObj.insert(JSON_SHOPCODE, m_storeId);
...
...
fmTakeout/DTools/dataManger.h
View file @
45fa6706
...
...
@@ -13,16 +13,25 @@ public:
* 返回:NULL
* */
void
SetToken
(
const
QString
&
token
);
/* 功能:设置门店信息
* 参数:[1]门店号
* 返回:NULL
* */
void
SetStoreId
(
const
QString
&
storeId
);
/* 功能:设置POS IP Address;
* 参数:[1]posIpAddress
* 返回:NULL
* */
void
SetPosIpAddress
(
const
QString
&
posIpAddress
);
/* 功能:设置商户号
* 参数:[1]商户号
* 返回:NULL
* */
* */
void
SetPartnerId
(
const
QString
&
partnerId
);
/* 功能:获取登录数据
* 参数:[1]门店号[2]密码[3]收银机号[4]收银员号
* 返回:登录数据
...
...
@@ -116,6 +125,8 @@ private:
QString
m_token
;
QString
m_storeId
;
QString
m_partnerId
;
QString
m_posIpAddress
;
};
#endif // DATAMANGER_H
fmTakeout/preDefine.h
View file @
45fa6706
...
...
@@ -78,7 +78,8 @@
#define JSON_REASON "reason"
#define JSON_REASONCODE "reason_code"
#define JSON_SYNCTIME "syncTime"
#define JSON_SHOPCODE "storeId"
#define JSON_SHOPCODE "storeId"
#define JSON_POSIPADDRESS "posAddress"
#define JSON_CHANNEL "channel"
#define JSON_BUSINESSSTATUS "business_status"
#define JSON_CODE "code"
...
...
fmTakeout/refdishesForm.cpp
View file @
45fa6706
...
...
@@ -19,6 +19,7 @@ refDishesForm::refDishesForm(QWidget *parent) :
refDishesForm
::~
refDishesForm
()
{
delete
ui
;
}
void
refDishesForm
::
InitData
(
OrderObject
*
obj
)
...
...
@@ -64,6 +65,7 @@ void refDishesForm::InitData(OrderObject *obj)
pWdg
->
setLayout
(
hLayout
);
connect
(
pBtn
,
&
QPushButton
::
toggled
,
this
,
&
refDishesForm
::
onDishesBtnToggled
);
ui
->
refDishesTable
->
setCellWidget
(
0
,
0
,
pWdg
);
// 商品名按钮
m_btnList
.
append
(
pBtn
);
QTableWidgetItem
*
item0
=
new
QTableWidgetItem
(
product
->
code
);
//item0->setTextAlignment(Qt::AlignLeft|Qt::AlignTop);
...
...
@@ -73,22 +75,20 @@ void refDishesForm::InitData(OrderObject *obj)
item0
->
setCheckState
(
Qt
::
Unchecked
);
ui
->
refDishesTable
->
setItem
(
0
,
1
,
item0
);
m_twiList
.
append
(
item0
);
//m_btnList.append(btn);
//i++;
}
}
void
refDishesForm
::
_Init
()
{
ui
->
refDishesBtnOk
->
setEnabled
(
false
);
/*
foreach
(
QPushButton
*
btn
,
m_btnList
)
{
disconnect
(
btn
,
&
QPushButton
::
toggled
,
this
,
&
refDishesForm
::
onDishesBtnToggled
);
delete
btn
;
}
m_btnList
.
clear
();
*/
foreach
(
QTableWidgetItem
*
twi
,
m_twiList
)
{
delete
twi
;
...
...
@@ -99,7 +99,6 @@ void refDishesForm::_Init()
{
ui
->
refDishesTable
->
removeRow
(
i
);
}
m_dishesMap
.
clear
();
}
...
...
fmTakeout/refdishesForm.h
View file @
45fa6706
...
...
@@ -32,7 +32,7 @@ private slots:
private
:
Ui
::
refDishesForm
*
ui
;
//
QList<QPushButton*> m_btnList;
QList
<
QPushButton
*>
m_btnList
;
QList
<
QTableWidgetItem
*>
m_twiList
;
...
...
fmTakeout/refuseForm.cpp
View file @
45fa6706
...
...
@@ -44,8 +44,6 @@ void RefuseForm::on_reason1_toggled(bool checked)
{
if
(
checked
)
{
m_refundDishesList
.
clear
();
m_refundDishesListString
.
clear
();
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonStr
=
QString
::
fromLocal8Bit
(
"门店已打烊"
);
m_reasonCode
=
2
;
...
...
@@ -58,8 +56,6 @@ void RefuseForm::on_reason2_toggled(bool checked)
QLOG_INFO
()
<<
QString
(
"[<<<<---RefuseForm::on_reason2_toggled: check:%1--->>>>]"
)
<<
checked
;
if
(
m_orderObject
!=
NULL
&&
checked
)
{
m_refundDishesList
.
clear
();
m_refundDishesListString
.
clear
();
m_refDishesForm
->
InitData
(
m_orderObject
);
if
(
QDialog
::
Accepted
==
m_refDishesForm
->
exec
())
{
...
...
@@ -76,16 +72,12 @@ void RefuseForm::on_reason2_toggled(bool checked)
QLOG_INFO
()
<<
QString
(
"[<<<<---RefuseForm::on_reason2_toggled: m_refundDishesList:%1--->>>>]"
)
<<
m_refundDishesList
;
on_refuseBtnOk_clicked
();
QLOG_INFO
()
<<
QString
(
"[<<<<---RefuseForm::on_refuseBtnOk_clicked--->>>>]"
);
m_refundDishesList
.
clear
();
}
else
{
}
else
{
_Init
();
}
}
if
(
checked
)
{
m_refundDishesList
.
clear
();
m_refundDishesListString
.
clear
();
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonStr
=
QString
::
fromLocal8Bit
(
"产品已售完"
);
m_reasonCode
=
3
;
...
...
@@ -96,8 +88,6 @@ void RefuseForm::on_reason3_toggled(bool checked)
{
if
(
checked
)
{
m_refundDishesList
.
clear
();
m_refundDishesListString
.
clear
();
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonStr
=
QString
::
fromLocal8Bit
(
"门店太忙"
);
m_reasonCode
=
5
;
...
...
@@ -108,8 +98,6 @@ void RefuseForm::on_reason4_toggled(bool checked)
{
if
(
checked
)
{
m_refundDishesList
.
clear
();
m_refundDishesListString
.
clear
();
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonStr
=
QString
::
fromLocal8Bit
(
"联系不上客户"
);
m_reasonCode
=
6
;
...
...
@@ -120,8 +108,6 @@ void RefuseForm::on_reason5_toggled(bool checked)
{
if
(
checked
)
{
m_refundDishesList
.
clear
();
m_refundDishesListString
.
clear
();
ui
->
refuseBtnOk
->
setEnabled
(
true
);
m_reasonStr
=
QString
::
fromLocal8Bit
(
"无人配送"
);
m_reasonCode
=-
1
;
...
...
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