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
a088791e
Commit
a088791e
authored
Oct 27, 2016
by
ss.dai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注释部分内容用于鲜丰演示
parent
9e1683e2
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
20 deletions
+75
-20
fmPlugin/fmPlugin.cpp
+24
-0
fmTakeaway/Control/flowControl.cpp
+31
-7
fmTakeaway/Control/refundControl.cpp
+7
-7
fmTakeaway/floatForm.cpp
+1
-1
fmTakeaway/main.cpp
+5
-5
fmTakeaway/mainForm.cpp
+4
-0
run/skin/deaufult.rcc
+0
-0
run/skin/make当前目录.bat
+3
-0
run/skin/takeaway.ico
+0
-0
No files found.
fmPlugin/fmPlugin.cpp
View file @
a088791e
...
...
@@ -3,6 +3,7 @@
#include <QtSql/QSqlQuery>
#include <QVariant>
#include <QDebug>
#include <QSettings>
FmPlugin
&
FmPlugin
::
GetInstance
()
{
...
...
@@ -12,6 +13,9 @@ FmPlugin &FmPlugin::GetInstance()
bool
FmPlugin
::
ConnectDb
(
const
QString
&
host
,
const
QString
&
username
,
const
QString
&
password
,
const
QString
&
dbname
,
QString
&
error
)
{
// TODO(用于鲜丰演示)
return
true
;
// 清除之前的连接
QSqlDatabase
::
removeDatabase
(
m_db
.
connectionName
());
...
...
@@ -36,6 +40,14 @@ bool FmPlugin::ConnectDb(const QString &host, const QString &username, const QSt
bool
FmPlugin
::
GetStoreInfo
(
QString
&
storeId
,
QString
&
posId
,
QString
&
cashierId
,
QDateTime
&
dateTime
,
QString
&
error
)
{
// TODO(用于鲜丰演示)
QSettings
set
(
"tmp.ini"
,
QSettings
::
IniFormat
);
storeId
=
set
.
value
(
"storeId"
).
toString
();
posId
=
QString
(
"001"
);
cashierId
=
QString
(
"001"
);
return
true
;
if
(
!
m_db
.
open
())
{
error
=
m_db
.
lastError
().
text
();
...
...
@@ -77,6 +89,14 @@ bool FmPlugin::GetStoreInfo(QString &storeId, QString &posId, QString &cashierId
bool
FmPlugin
::
GetOnDutyCashiers
(
QList
<
CashierObject
>
&
cashiersList
,
QString
&
error
)
{
// TODO(用于鲜丰演示)
CashierObject
obj
;
obj
.
id
=
"001"
;
obj
.
name
=
"鲜丰测试"
;
cashiersList
.
append
(
obj
);
return
true
;
if
(
!
m_db
.
open
())
{
error
=
m_db
.
lastError
().
text
();
...
...
@@ -109,6 +129,10 @@ bool FmPlugin::GetOnDutyCashiers(QList<CashierObject> &cashiersList, QString &er
bool
FmPlugin
::
DoOrderEntry
(
const
OrderObject
*
orderObject
,
const
QString
&
cashierId
,
const
QString
&
cashierName
,
const
QString
&
shiftId
,
const
QString
&
shiftName
,
QString
&
error
)
{
// TODO(用于鲜丰演示)
return
true
;
m_orderObject
=
orderObject
;
if
(
!
m_db
.
open
())
{
...
...
fmTakeaway/Control/flowControl.cpp
View file @
a088791e
...
...
@@ -75,7 +75,8 @@ bool FlowControl::_Login()
emit
setStoreInfo
(
m_storeId
);
_PullOrder
();
_SynStock
();
// TODO(用于鲜丰演示)
//_SynStock();
}
}
...
...
@@ -245,7 +246,9 @@ bool FlowControl::_ConfirmOrder(const QString &orderId, const DeliverObject &del
emit
showAlert
(
AlertForm
::
LOADING
,
"正在录入天天饮食......"
);
QLOG_INFO
()
<<
QString
(
"[---order entry begin---]"
);
// 写入销售单
QString
orderEntryError
(
"[此单录入天天饮食成功]"
);
// TODO(用于鲜丰演示)
//QString orderEntryError("[此单录入天天饮食成功]");
QString
orderEntryError
(
""
);
if
(
!
FmPlugin
::
GetInstance
().
DoOrderEntry
(
orderObject
,
m_cashierObject
.
id
,
m_cashierObject
.
name
,
m_cashierObject
.
shiftId
,
m_cashierObject
.
shiftName
,
error
))
{
...
...
@@ -567,13 +570,34 @@ void FlowControl::onConnectDb(const QString &host, const QString &username, cons
void
FlowControl
::
onProcessOrder
(
const
QString
&
operation
,
const
QString
&
orderId
,
const
DeliverObject
&
deliverObj
)
{
// TODO(用于鲜丰演示)
// if(!operation.compare(OPERATION_GETDELIVERS))
// {
// // 放在这检测收银员的合法性因为接单前会获取配送员
// if(_CheckCashiers())
// {
// _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
))
{
// 放在这检测收银员的合法性因为接单前会获取配送员
if
(
_CheckCashiers
())
{
_GetDelivers
(
orderId
);
}
_ConfirmOrder
(
orderId
,
deliverObj
);
}
else
if
(
!
operation
.
compare
(
OPERATION_CONFRIM
))
{
_ConfirmOrder
(
orderId
,
deliverObj
);
...
...
fmTakeaway/Control/refundControl.cpp
View file @
a088791e
...
...
@@ -46,7 +46,7 @@ void RefundControl::run()
QJsonDocument
jsonDoc
;
while
(
m_bContinue
)
{
QLOG_INFO
()
<<
"waiting new connection...."
;
//
QLOG_INFO() << "waiting new connection....";
if
(
!
m_tcpServer
->
waitForNewConnection
(
1000
))
{
continue
;
...
...
@@ -63,16 +63,16 @@ void RefundControl::run()
continue
;
}
recvData
=
m_tcpSocket
->
readAll
();
QLOG_INFO
()
<<
QString
(
"recv data.[%1]"
).
arg
(
QString
(
recvData
));
QLOG_INFO
()
<<
QString
(
"recv data.[%1]"
).
arg
(
QString
::
fromLocal8Bit
(
recvData
));
jsonDoc
=
QJsonDocument
::
fromJson
(
QString
::
from
Utf8
(
recvData
).
toUtf8
(),
&
jsonError
);
jsonDoc
=
QJsonDocument
::
fromJson
(
QString
::
from
Local8Bit
(
recvData
).
toUtf8
(),
&
jsonError
);
if
(
jsonError
.
error
==
QJsonParseError
::
NoError
)
{
QJsonObject
jsonObject
=
jsonDoc
.
object
();
version
=
jsonObject
[
"ver"
].
toInt
();
reqtype
=
jsonObject
[
"reqtype"
].
toInt
();
orderId
=
jsonObject
[
"order_id"
].
toString
();
reason
=
jsonObject
[
"reason"
].
toString
();
reason
=
jsonObject
[
"reason"
].
toString
();
;
if
(
version
==
1
)
{
if
(
reqtype
==
17
)
...
...
@@ -91,7 +91,7 @@ void RefundControl::run()
.
arg
(
QString
(
QJsonDocument
(
httpRecvJson
).
toJson
(
QJsonDocument
::
Compact
).
replace
(
"
\"
"
,
""
)));
if
(
httpResult
)
{
if
(
100
==
httpRecvJson
[
"statusCode"
].
toInt
())
if
(
100
==
httpRecvJson
[
"statusCode"
].
toInt
()
||
104
==
httpRecvJson
[
"statusCode"
].
toInt
()
)
{
replyData
=
QString
(
"{
\"
ver
\"
:1,
\"
order_id
\"
:
\"
%1
\"
,
\"
statusCode
\"
:100,
\"
msg
\"
:
\"\"
}"
).
arg
(
orderId
);
m_tcpSocket
->
write
(
replyData
.
toUtf8
());
...
...
@@ -100,7 +100,7 @@ void RefundControl::run()
continue
;
}
else
{
error
=
httpRecvJson
[
"msg"
].
toString
(
);
error
=
QString
(
httpRecvJson
[
"msg"
].
toString
()
);
}
}
else
{
...
...
@@ -121,7 +121,7 @@ void RefundControl::run()
// 发生错误
replyData
=
QString
(
"{
\"
ver
\"
:1,
\"
order_id
\"
:
\"
%1
\"
,
\"
statusCode
\"
:101,
\"
msg
\"
:
\"
%2
\"
}"
).
arg
(
orderId
).
arg
(
error
);
m_tcpSocket
->
write
(
replyData
.
to
Utf8
());
m_tcpSocket
->
write
(
replyData
.
to
Local8Bit
());
m_tcpSocket
->
waitForBytesWritten
(
5000
);
m_tcpSocket
->
close
();
continue
;
...
...
fmTakeaway/floatForm.cpp
View file @
a088791e
...
...
@@ -163,7 +163,7 @@ void FloatForm::onStartRemind(int type)
break
;
case
1
:
m_remindWav
=
QString
(
"%1/wav/msg1.wav"
).
arg
(
QApplication
::
applicationDirPath
());
m_wavPlayInterval
=
ConfigManger
::
GetInstance
().
GetSoundInterval
()
+
VALUE_REFUNDORDERTIME
;
m_wavPlayInterval
=
20000
+
VALUE_REFUNDORDERTIME
;
break
;
}
...
...
fmTakeaway/main.cpp
View file @
a088791e
...
...
@@ -78,11 +78,11 @@ int main(int argc, char *argv[])
workThread
.
start
();
// 将退款控制器移到工作线程
RefundControl
::
GetInstance
().
SetListenPort
(
ConfigManger
::
GetInstance
().
GetListenPort
());
RefundControl
::
GetInstance
().
moveToThread
(
&
refundThread
);
QObject
::
connect
(
&
refundThread
,
&
QThread
::
started
,
&
RefundControl
::
GetInstance
(),
&
RefundControl
::
run
);
refundThread
.
start
();
// TODO(用于鲜丰演示)
//
RefundControl::GetInstance().SetListenPort(ConfigManger::GetInstance().GetListenPort());
//
RefundControl::GetInstance().moveToThread(&refundThread);
//
QObject::connect(&refundThread, &QThread::started, &RefundControl::GetInstance(), &RefundControl::run);
//
refundThread.start();
DbsetForm
d
;
if
(
QDialog
::
Rejected
==
d
.
exec
())
...
...
fmTakeaway/mainForm.cpp
View file @
a088791e
...
...
@@ -141,6 +141,10 @@ void MainForm::_Init()
// 门店营业状态详情暂时屏蔽
// TODO
ui
->
mainBtnOpeDetails
->
hide
();
// TODO(用于鲜丰演示)
ui
->
mainSlabLogo0
->
hide
();
ui
->
mainSlabLogo1
->
hide
();
}
void
MainForm
::
onSetCurrentTime
()
...
...
run/skin/deaufult.rcc
0 → 100644
View file @
a088791e
File added
run/skin/make当前目录.bat
0 → 100644
View file @
a088791e
rcc -binary deaufult.qrc -o deaufult.rcc
rcc -binary deaufult.qrc -o deaufult.rcc
pause
run/skin/takeaway.ico
View file @
a088791e
No preview for this file type
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