Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmTakeaway
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
shangshang.dai
FmTakeaway
Commits
f3616d7b
Commit
f3616d7b
authored
Jul 26, 2017
by
shangshang.dai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
76ee0f47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
53 deletions
+50
-53
fmTakeaway/Control/flowControl.cpp
+49
-53
fmTakeaway/DTools/dataManger.cpp
+1
-0
No files found.
fmTakeaway/Control/flowControl.cpp
View file @
f3616d7b
...
@@ -519,25 +519,6 @@ bool FlowControl::_CompleteOrder(const QString& orderId)
...
@@ -519,25 +519,6 @@ bool FlowControl::_CompleteOrder(const QString& orderId)
{
{
emit
showAlert
(
AlertForm
::
SUCCESS
,
"完成成功!"
);
emit
showAlert
(
AlertForm
::
SUCCESS
,
"完成成功!"
);
if
(
m_ordersMap
.
value
(
orderId
)
->
order_type
==
3
)
{
// 打印
QLOG_INFO
()
<<
QString
(
"[---begin print---]"
);
QSettings
tmpIni
(
QString
(
"%1/%2"
).
arg
(
QApplication
::
applicationDirPath
()).
arg
(
"printerConfig_tmp.ini"
),
QSettings
::
IniFormat
);
int
num
=
tmpIni
.
value
(
QString
(
"%1/num"
).
arg
(
m_ordersMap
.
value
(
orderId
)
->
channel
),
1
).
toInt
();
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
if
(
FmPrinter
::
GetInstance
().
DoPrint
(
ConfigManger
::
GetInstance
().
GetPrinterName
(),
m_ordersMap
.
value
(
orderId
)))
{
QLOG_INFO
()
<<
QString
(
"print sucessful"
);
Orderstatus
::
getInstance
().
printupdate
(
orderId
,
1
);
}
else
{
emit
showAlert
(
AlertForm
::
ERROR
,
QString
(
"打印冲突,请稍后手动打印或重启收银程序"
));
QLOG_INFO
()
<<
QString
(
"print failed"
);
}
}
}
// 通知主界面移动订单
// 通知主界面移动订单
OrderObject
*
orderObject
=
m_ordersMap
.
value
(
orderId
);
OrderObject
*
orderObject
=
m_ordersMap
.
value
(
orderId
);
int
oldStatus
=
orderObject
->
status
;
int
oldStatus
=
orderObject
->
status
;
...
@@ -551,7 +532,7 @@ bool FlowControl::_CompleteOrder(const QString& orderId)
...
@@ -551,7 +532,7 @@ bool FlowControl::_CompleteOrder(const QString& orderId)
}
}
bool
FlowControl
::
_ReportBillEntryResult
(
const
QString
&
orderId
,
int
status
,
const
QString
&
error
)
bool
FlowControl
::
_ReportBillEntryResult
(
const
QString
&
orderId
,
int
status
,
const
QString
&
error
)
{
{
bool
result
;
bool
result
;
QJsonObject
sendJson
;
QJsonObject
sendJson
;
QJsonObject
recvJson
;
QJsonObject
recvJson
;
...
@@ -575,12 +556,54 @@ bool FlowControl::_ChargeOffOrder(const QString &orderId)
...
@@ -575,12 +556,54 @@ bool FlowControl::_ChargeOffOrder(const QString &orderId)
sendJson
=
DataManger
::
GetInstance
().
GetChargeOffData
(
orderId
);
sendJson
=
DataManger
::
GetInstance
().
GetChargeOffData
(
orderId
);
emit
showAlert
(
AlertForm
::
LOADING
,
"正在通信......"
);
QLOG_INFO
()
<<
QString
(
"[---chargeoff order---]. [requestData:%1]"
).
arg
(
_GetJsonStr
(
sendJson
));
QLOG_INFO
()
<<
QString
(
"[---chargeoff order---]. [requestData:%1]"
).
arg
(
_GetJsonStr
(
sendJson
));
QString
error1
;
QString
error1
;
result
=
m_procOrderSocket
->
Request
(
sendJson
,
recvJson
,
error1
);
result
=
m_procOrderSocket
->
Request
(
sendJson
,
recvJson
,
error1
);
QLOG_INFO
()
<<
QString
(
"chargeoff order finsh. [result:%1][msg:%2][recvData:%3]"
)
QLOG_INFO
()
<<
QString
(
"chargeoff order finsh. [result:%1][msg:%2][recvData:%3]"
)
.
arg
(
result
).
arg
(
error1
,
_GetJsonStr
(
recvJson
));
.
arg
(
result
).
arg
(
error1
,
_GetJsonStr
(
recvJson
));
if
(
!
result
)
{
emit
showAlert
(
AlertForm
::
ERROR
,
"核销失败![网络错误]"
);
}
else
{
if
(
JSON_STATUSCODE_OK
!=
recvJson
[
JSON_STATUSCODE
].
toInt
())
{
result
=
false
;
emit
showAlert
(
AlertForm
::
ERROR
,
QString
(
"核销失败![%1]"
).
arg
(
recvJson
[
JSON_MESSAGE
].
toString
()));
}
else
{
emit
showAlert
(
AlertForm
::
SUCCESS
,
"核销成功!"
);
if
(
m_ordersMap
.
value
(
orderId
)
->
order_type
==
3
)
{
// 打印
QLOG_INFO
()
<<
QString
(
"[---begin print---]"
);
QSettings
tmpIni
(
QString
(
"%1/%2"
).
arg
(
QApplication
::
applicationDirPath
()).
arg
(
"printerConfig_tmp.ini"
),
QSettings
::
IniFormat
);
int
num
=
tmpIni
.
value
(
QString
(
"%1/num"
).
arg
(
m_ordersMap
.
value
(
orderId
)
->
channel
),
1
).
toInt
();
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
if
(
FmPrinter
::
GetInstance
().
DoPrint
(
ConfigManger
::
GetInstance
().
GetPrinterName
(),
m_ordersMap
.
value
(
orderId
)))
{
QLOG_INFO
()
<<
QString
(
"print sucessful"
);
Orderstatus
::
getInstance
().
printupdate
(
orderId
,
1
);
}
else
{
emit
showAlert
(
AlertForm
::
ERROR
,
QString
(
"打印冲突,请稍后手动打印或重启收银程序"
));
QLOG_INFO
()
<<
QString
(
"print failed"
);
}
}
}
// 通知主界面移动订单
OrderObject
*
orderObject
=
m_ordersMap
.
value
(
orderId
);
int
oldStatus
=
orderObject
->
status
;
orderObject
->
status
=
recvJson
[
JSON_STATUS
].
toInt
();
orderObject
->
status_desc
=
recvJson
[
JSON_STATUSDESC
].
toString
();
emit
changeOrderStatus
(
orderObject
,
oldStatus
);
}
}
return
result
;
return
result
;
}
}
...
@@ -782,32 +805,11 @@ void FlowControl::onConnectDb(const QString &host, const QString &username, cons
...
@@ -782,32 +805,11 @@ void FlowControl::onConnectDb(const QString &host, const QString &username, cons
void
FlowControl
::
onProcessOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
)
void
FlowControl
::
onProcessOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
)
{
{
// TODO(用于鲜丰演示)
// 如果是自提订单则核销
// if(!operation.compare(OPERATION_GETDELIVERS))
if
(
m_ordersMap
.
value
(
orderId
)
->
order_type
==
3
)
// {
{
// // 放在这检测收银员的合法性因为接单前会获取配送员
_ChargeOffOrder
(
orderId
);
// if(_CheckCashiers())
}
else
if
(
!
operation
.
compare
(
OPERATION_GETDELIVERS
))
// {
// _GetDelivers(orderId);
// }
// }else if(!operation.compare(OPERATION_CONFRIM))
// {
// _ConfirmOrder(orderId, deliverObj);
// }else if(!operation.compare(OPERATION_REFUSE))
// {
// _RefuseOrder(orderId, 2);
// }else if(!operation.compare(OPERATION_SENDOUT))
// {
// _SendOrder(orderId);
// }else if(!operation.compare(OPERATION_COMPLETE))
// {
// _CompleteOrder(orderId);
// }else if(!operation.compare(OPERATION_REFUSEREFUND))
// {
// _RefuseRefund(orderId);
// }
if
(
!
operation
.
compare
(
OPERATION_GETDELIVERS
))
{
{
_GetDelivers
(
orderId
);
_GetDelivers
(
orderId
);
}
else
if
(
!
operation
.
compare
(
OPERATION_CONFRIM
))
}
else
if
(
!
operation
.
compare
(
OPERATION_CONFRIM
))
...
@@ -818,14 +820,8 @@ void FlowControl::onProcessOrder(const QString &operation, const QString &orderI
...
@@ -818,14 +820,8 @@ void FlowControl::onProcessOrder(const QString &operation, const QString &orderI
_RefuseOrder
(
orderId
,
2
);
_RefuseOrder
(
orderId
,
2
);
}
else
if
(
!
operation
.
compare
(
OPERATION_SENDOUT
))
}
else
if
(
!
operation
.
compare
(
OPERATION_SENDOUT
))
{
{
// 如果是自提订单则核销
if
(
m_ordersMap
.
value
(
orderId
)
->
order_type
==
3
)
{
_ChargeOffOrder
(
orderId
);
}
else
{
_SendOrder
(
orderId
,
deliverObj
);
_SendOrder
(
orderId
,
deliverObj
);
}
}
else
if
(
!
operation
.
compare
(
OPERATION_COMPLETE
))
}
else
if
(
!
operation
.
compare
(
OPERATION_COMPLETE
))
{
{
...
...
fmTakeaway/DTools/dataManger.cpp
View file @
f3616d7b
...
@@ -174,6 +174,7 @@ QJsonObject DataManger::GetChargeOffData(const QString &orderId)
...
@@ -174,6 +174,7 @@ QJsonObject DataManger::GetChargeOffData(const QString &orderId)
// 暂时没有取餐码
// 暂时没有取餐码
cObj
.
insert
(
"delivery_code"
,
orderId
);
cObj
.
insert
(
"delivery_code"
,
orderId
);
rObj
.
insert
(
JSON_ORDER
,
cObj
);
rObj
.
insert
(
JSON_ORDER
,
cObj
);
rObj
.
insert
(
JSON_TOKEN
,
m_token
);
rObj
.
insert
(
JSON_POSVERSION
,
APP_VERSION
);
rObj
.
insert
(
JSON_POSVERSION
,
APP_VERSION
);
return
rObj
;
return
rObj
;
}
}
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