Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmp_takeout
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
zhenfei.zhang
fmp_takeout
Commits
e5ce05bd
Commit
e5ce05bd
authored
Apr 20, 2017
by
jackalone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决退出不能正常退出的bug问题。(打印的操作待打印机来了一并测试)
parent
6f71ce4d
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
199 additions
and
82 deletions
+199
-82
Thread/threadcontroller.cpp
+31
-18
Thread/workThread/flowcontroll.cpp
+56
-7
Thread/workThread/flowcontroll.h
+7
-0
Thread/workThread/reufusecontrol.cpp
+1
-0
Tool/HttpSocket.cpp
+12
-5
Tool/HttpSocket.h
+2
-0
Tool/initclass.cpp
+30
-3
Tool/initclass.h
+3
-0
Ui/DetailForm.cpp
+10
-6
Ui/MainWindow.cpp
+18
-11
Ui/MainWindow.h
+2
-0
fmp_takeout.cpp
+1
-3
fmp_takeout.pro
+2
-1
fmp_takeout_p.cpp
+13
-19
fmp_takeout_p.h
+2
-2
fmp_takeout_plugin.cpp
+8
-6
fmp_takeout_plugin_p.h
+1
-1
No files found.
Thread/threadcontroller.cpp
View file @
e5ce05bd
...
...
@@ -19,20 +19,20 @@ ThreadController::ThreadController(QObject *parent) :
connect
(
&
_flowcontroll
,
SIGNAL
(
finished
()),
this
,
SLOT
(
deleteLater
()));
//拒单线程
_refusecontroll
.
setObjectName
(
QString
(
"refusecontrollThread"
));
reufuseControl
::
GetInstance
().
moveToThread
(
&
_refusecontroll
);
reufuseControl
::
GetInstance
().
SetListenPort
(
ConfigManger
::
GetInstance
().
GetListenPort
());
connect
(
&
_refusecontroll
,
SIGNAL
(
started
()),
this
,
SLOT
(
sltThreadStarted
()));
connect
(
&
_refusecontroll
,
&
QThread
::
started
,
&
reufuseControl
::
GetInstance
(),
&
reufuseControl
::
run
);
_refusecontroll
.
start
();
connect
(
&
_refusecontroll
,
SIGNAL
(
finished
()),
this
,
SLOT
(
deleteLater
()));
//
_refusecontroll.setObjectName(QString("refusecontrollThread"));
//
reufuseControl::GetInstance().moveToThread(&_refusecontroll);
//
reufuseControl::GetInstance().SetListenPort(ConfigManger::GetInstance().GetListenPort());
//
connect(&_refusecontroll, SIGNAL(started()), this, SLOT(sltThreadStarted()));
//
connect(&_refusecontroll,&QThread::started, &reufuseControl::GetInstance(),&reufuseControl::run);
//
_refusecontroll.start();
//
connect(&_refusecontroll, SIGNAL(finished()), this, SLOT(deleteLater()));
//其他辅助线程
_othercontroll
.
setObjectName
(
QString
(
"_othercontrollThread"
));
otherThreadctr
::
GetInstance
().
moveToThread
(
&
_othercontroll
);
connect
(
&
_othercontroll
,
SIGNAL
(
started
()),
this
,
SLOT
(
sltThreadStarted
()));
_othercontroll
.
start
();
connect
(
&
_othercontroll
,
SIGNAL
(
finished
()),
this
,
SLOT
(
deleteLater
()));
//
_othercontroll.setObjectName(QString("_othercontrollThread"));
//
otherThreadctr::GetInstance().moveToThread(&_othercontroll);
//
connect(&_othercontroll, SIGNAL(started()), this, SLOT(sltThreadStarted()));
//
_othercontroll.start();
//
connect(&_othercontroll, SIGNAL(finished()), this, SLOT(deleteLater()));
#if 0
// 网络连接获取门店的信息进程
...
...
@@ -52,24 +52,37 @@ ThreadController::ThreadController(QObject *parent) :
ThreadController
::~
ThreadController
()
{
}
void
ThreadController
::
terminateFlowcontrollThread
()
{
_flowcontroll
.
terminate
();
_flowcontroll
.
wait
(
500
);
_flowcontroll
.
quit
();
_flowcontroll
.
wait
();
//_flowcontroll.terminate();
// _flowcontroll.wait(500);
}
void
ThreadController
::
terminateRefusecontrollThread
()
{
_refusecontroll
.
terminate
();
_refusecontroll
.
wait
(
500
);
while
(
QThread
::
currentThread
()
->
isRunning
())
{
QThread
::
currentThread
()
->
quit
();
}
//_refusecontroll.terminate();
// _refusecontroll.wa//t(500);
}
void
ThreadController
::
terminateOthercontrollThread
()
{
_othercontroll
.
terminate
();
_othercontroll
.
wait
(
500
);
while
(
QThread
::
currentThread
()
->
isRunning
())
{
QThread
::
currentThread
()
->
quit
();
}
//_othercontroll.terminate();
// _othercontroll.wait(500);
}
//void ThreadController::terminateNetstoreinfoctrlThread()
...
...
Thread/workThread/flowcontroll.cpp
View file @
e5ce05bd
...
...
@@ -17,6 +17,7 @@
#include "Ui/DetailForm.h"
#include <QNetworkInterface>
#if 0
int getdata(void* ptr, int size, int nmemb, void* stream)
{
unsigned int i = size * nmemb;
...
...
@@ -24,11 +25,11 @@ int getdata(void* ptr, int size, int nmemb, void* stream)
memcpy((char *)stream + totalSize, ptr, i);
return size*nmemb;
}
#endif
flowControll
::
flowControll
(
QObject
*
parent
)
:
QObject
(
parent
),
m_loginSocket
(
0
),
m_pullOrderSocket
(
0
),
m_procOrderSocket
(
0
),
m_syncStockSocket
(
0
)
m_syncStockSocket
(
0
)
,
m_follow
(
0
),
m_syncTime
(
0
)
{
m_storeId
=
""
,
...
...
@@ -37,6 +38,8 @@ flowControll::flowControll(QObject *parent) : QObject(parent),m_loginSocket(0),
m_cashierId
=
""
,
m_cashiername
=
""
;
m_timestamp
=
"0"
;
m_time
=
new
QTimer
();
}
...
...
@@ -54,6 +57,8 @@ void flowControll::onStartFlow()
m_procOrderSocket
=
new
HttpSocket
(
this
);
m_syncStockSocket
=
new
HttpSocket
(
this
);
qDebug
()
<<
"~~~~~~~~~~~~~~~~~~~~~flowControll work is~~~~~~~~~~~~~~~~~~~~~"
<<
QThread
::
currentThread
();
if
(
_GetStoreInfo
())
{
_Login
();
...
...
@@ -76,7 +81,6 @@ bool flowControll::_Login()
if
(
!
result
)
{
QLOG_INFO
()
<<
"11111111111111111111111111111111"
;
emit
showAlert
(
alertForm
::
ERROR
,
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"登录失败![网络错误]"
));
}
else
...
...
@@ -84,7 +88,7 @@ bool flowControll::_Login()
if
(
JSON_STATUSCODE_OK
!=
recvJson
[
JSON_STATUSCODE
].
toInt
())
{
result
=
false
;
//
emit showAlert(alertForm::ERROR, InitClass::GetInstance().GB2312ToUnicode("登录失败![%1]").arg( InitClass::GetInstance().GB2312ToUnicode(recvJson[JSON_MESSAGE].toString().toLatin1().data())));
emit
showAlert
(
alertForm
::
ERROR
,
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"登录失败![%1]"
).
arg
(
InitClass
::
GetInstance
().
GB2312ToUnicode
(
recvJson
[
JSON_MESSAGE
].
toString
().
toLatin1
().
data
())));
}
else
{
...
...
@@ -109,6 +113,35 @@ bool flowControll::_Login()
return
result
;
}
void
flowControll
::
onStopTimer
()
{
m_time
->
stop
();
m_follow
=
1
;
if
(
m_loginSocket
)
{
delete
m_loginSocket
;
m_loginSocket
=
0
;
}
if
(
m_pullOrderSocket
)
{
delete
m_pullOrderSocket
;
m_pullOrderSocket
=
0
;
}
if
(
m_syncStockSocket
)
{
delete
m_syncStockSocket
;
m_syncStockSocket
=
0
;
}
if
(
m_procOrderSocket
)
{
delete
m_procOrderSocket
;
m_procOrderSocket
=
0
;
}
emit
sgnKillThread
();
}
void
flowControll
::
_netData
(
QJsonObject
&
sendJson
)
{
#if 0
...
...
@@ -168,7 +201,21 @@ bool flowControll::_PullOrder()
qDebug
()
<<
"m_timestamp is"
<<
m_timestamp
;
sendJson
=
DataManger
::
GetInstance
().
GetPullOrderData
(
m_timestamp
,
ConfigManger
::
GetInstance
().
GetAutoConfirm
());
QLOG_INFO
()
<<
QString
(
"[---pull order---][requestData:%1]"
).
arg
(
_GetJsonStr
(
sendJson
));
result
=
m_pullOrderSocket
->
HttpRequest
(
sendJson
,
recvJson
,
error
);
if
(
m_follow
)
{
emit
sgnKillThread
();
return
0
;
}
else
{
if
(
m_pullOrderSocket
)
{
result
=
m_pullOrderSocket
->
HttpRequest
(
sendJson
,
recvJson
,
error
);
}
else
{
return
0
;
}
}
QLOG_INFO
()
<<
QString
(
"pull order finsh. [result:%1][msg:%2]"
)
.
arg
(
result
).
arg
(
error
);
...
...
@@ -219,6 +266,7 @@ bool flowControll::_PullOrder()
.
arg
(
_GetJsonStr
(
jsonObject
));
WriteData
(
orderObject
->
order_id
);
emit
changeOrderStatus
(
orderObject
);
// DetailForm::GetInstance().printData();
}
else
{
...
...
@@ -237,11 +285,12 @@ bool flowControll::_PullOrder()
m_timestamp
=
orderObject
->
timestamp
;
}
syncTime
=
recvJson
[
JSON_SYNCTIME
].
toInt
()
*
1000
;
m_syncTime
=
syncTime
;
}
}
QLOG_INFO
()
<<
QString
(
"%1 msec after pull order..."
).
arg
(
syncTime
);
QTimer
::
singleShot
(
syncTime
,
this
,
&
flowControll
::
_PullOrder
);
m_time
->
singleShot
(
syncTime
,
this
,
&
flowControll
::
_PullOrder
);
return
result
;
...
...
@@ -323,7 +372,7 @@ bool flowControll::_SynStock()
}
QLOG_INFO
()
<<
QString
(
"%1 msec after synStock..."
).
arg
(
synInterval
);
QTimer
::
singleShot
(
synInterval
,
this
,
&
flowControll
::
_SynStock
);
m_time
->
singleShot
(
synInterval
,
this
,
&
flowControll
::
_SynStock
);
return
result
;
}
...
...
Thread/workThread/flowcontroll.h
View file @
e5ce05bd
...
...
@@ -10,6 +10,7 @@
#include "Model/cashierObject.h"
#include "global/externalinterface.h"
#include "Tool/HttpSocket.h"
#include <QTimer>
class
flowControll
:
public
QObject
{
...
...
@@ -35,6 +36,8 @@ public:
HttpSocket
*
m_pullOrderSocket
;
HttpSocket
*
m_procOrderSocket
;
HttpSocket
*
m_syncStockSocket
;
QTimer
*
m_time
;
int
m_syncTime
;
private
:
// 门店信息
...
...
@@ -48,6 +51,7 @@ private:
QMap
<
QString
,
OrderObject
*>
m_ordersMap
;
// 订单容器
// 当前收银员
CashierObject
m_cashierObject
;
bool
m_follow
;
signals
:
void
showAlert
(
alertForm
::
Type
type
,
const
QString
&
msg
);
//显示通知窗口
void
hideAlert
();
//隐藏通知窗口
...
...
@@ -60,6 +64,8 @@ signals:
void
showOrderDetails
(
OrderObject
*
orderObject
);
//获取订单详情信号
void
TodetailForm
(
const
QString
&
str
);
void
updateCashier
(
QString
str
);
void
sgnThreadFollow
();
void
sgnKillThread
();
public
slots
:
void
onStartFlow
();
//线程的初始化工作
...
...
@@ -80,6 +86,7 @@ public slots:
void
onNetReEntryOrder
(
const
QString
&
orderId
);
//发送数据到服务端
void
onProcessRejectOrder
(
const
QString
&
orderId
,
const
int
&
reason
,
const
int
&
reasontype
);
bool
_RefundOrder
(
const
QString
&
orderId
,
QString
reason
);
//退单
void
onStopTimer
();
};
...
...
Thread/workThread/reufusecontrol.cpp
View file @
e5ce05bd
...
...
@@ -13,6 +13,7 @@ reufuseControl::reufuseControl(QObject *parent) :
m_tcpServer
(
0
),
QObject
(
parent
)
{
qDebug
()
<<
"~~~~~~~~~~~~~~~~~~~~~reufuseControl work is~~~~~~~~~~~~~~~~~~~~~ "
<<
QThread
::
currentThread
();
refuseSocket
=
new
HttpSocket
(
this
);
m_tcpServer
=
new
QTcpServer
(
this
);
}
...
...
Tool/HttpSocket.cpp
View file @
e5ce05bd
...
...
@@ -5,15 +5,20 @@
#include <QTimer>
#include <QNetworkReply>
HttpSocket
::
HttpSocket
(
QObject
*
parent
)
:
QObject
(
parent
)
HttpSocket
::
HttpSocket
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_time
(
0
)
{
m_time
=
new
QTimer
();
m_networkRequest
.
setUrl
(
ConfigManger
::
GetInstance
().
GetServerUrl
());
m_networkRequest
.
setRawHeader
(
"Content-Type"
,
"text/json"
);
}
HttpSocket
::~
HttpSocket
()
{
if
(
m_time
)
{
delete
m_time
;
m_time
=
0
;
}
}
...
...
@@ -23,7 +28,6 @@ HttpSocket::~HttpSocket()
{
m_networkManger
.
setNetworkAccessible
(
QNetworkAccessManager
::
Accessible
);
}
QByteArray
sendArray
=
QJsonDocument
(
requestJson
).
toJson
(
QJsonDocument
::
Compact
);
QEventLoop
eventLoop
;
QNetworkReply
*
reply
=
m_networkManger
.
post
(
m_networkRequest
,
sendArray
);
...
...
@@ -31,9 +35,12 @@ HttpSocket::~HttpSocket()
connect
(
reply
,
SIGNAL
(
finished
()),
&
eventLoop
,
SLOT
(
quit
()));
connect
(
reply
,
SIGNAL
(
error
(
QNetworkReply
::
NetworkError
)),
&
eventLoop
,
SLOT
(
quit
()));
QTimer
::
singleShot
(
VALUE_NETTIMEOUT
,
&
eventLoop
,
&
QEventLoop
::
quit
);
// m_time->
singleShot(VALUE_NETTIMEOUT, &eventLoop, &QEventLoop::quit);
eventLoop
.
exec
();
if
(
reply
)
{
qDebug
()
<<
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
;
}
if
(
reply
->
error
()
!=
QNetworkReply
::
NoError
)
{
error
=
reply
->
errorString
();
...
...
Tool/HttpSocket.h
View file @
e5ce05bd
...
...
@@ -6,6 +6,7 @@
#include <QJsonDocument>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QTimer>
class
HttpSocket
:
public
QObject
{
...
...
@@ -17,6 +18,7 @@ public:
private
:
QNetworkAccessManager
m_networkManger
;
QNetworkRequest
m_networkRequest
;
QTimer
*
m_time
;
};
#endif // HTTPSOCKET_H
Tool/initclass.cpp
View file @
e5ce05bd
...
...
@@ -37,7 +37,7 @@ int m_netflag = 0;
char getch[40960] = {0};
Request req = {0};
#endif
DbsetForm
*
m_dbsetWidget
=
0
;
FloatWidget
*
m_floatWidget
=
0
;
MainWindow
*
m_mainWidget
=
0
;
...
...
@@ -253,6 +253,27 @@ InitClass::~InitClass()
}
void
InitClass
::
slotThread
()
{
g_threadCtl
->
terminateFlowcontrollThread
();
if
(
g_threadCtl
)
{
delete
g_threadCtl
;
g_threadCtl
=
0
;
}
if
(
m_floatWidget
)
{
delete
m_floatWidget
;
m_floatWidget
=
0
;
}
if
(
m_mainWidget
)
{
delete
m_mainWidget
;
m_mainWidget
=
0
;
}
}
void
InitClass
::
initnetData
()
{
...
...
@@ -336,7 +357,7 @@ void InitClass::startInit()
void
InitClass
::
initTheme
(
const
QString
&
theme
)
{
QString
rccPath
=
QString
(
"%1/image/%2.rcc"
).
arg
(
strpath
).
arg
(
theme
);
QString
rccPath
=
QString
(
"%1/
../rcc/
image/%2.rcc"
).
arg
(
strpath
).
arg
(
theme
);
qDebug
()
<<
"rccPath is"
<<
rccPath
;
if
(
!
QFile
(
rccPath
).
exists
())
{
...
...
@@ -381,11 +402,17 @@ void InitClass::InitDialog()
m_floatWidget
=
new
FloatWidget
;
m_mainWidget
=
new
MainWindow
;
//响声音
connect
(
m_mainWidget
,
&
MainWindow
::
sgnSound
,
m_floatWidget
,
&
FloatWidget
::
onStartRemind
);
//
connect(m_mainWidget,&MainWindow::sgnSound,m_floatWidget,&FloatWidget::onStartRemind);
connect
(
m_mainWidget
,
&
MainWindow
::
sgnMainHome
,
this
,
&
InitClass
::
sgnHome
);
connect
(
this
,
&
InitClass
::
sgnMainUi
,
m_mainWidget
,
&
MainWindow
::
OnshowMainUi
);
connect
(
this
,
&
InitClass
::
sgnMainUi
,
m_mainWidget
,
&
MainWindow
::
show
);
connect
(
m_mainWidget
,
&
MainWindow
::
sgnStopRemind
,
this
,
&
InitClass
::
sgnStopRemind
);
// 退出线程
connect
(
this
,
SIGNAL
(
sgnGetThreadnet
()),
m_mainWidget
,
SIGNAL
(
sgnThreadNet
()));
connect
(
m_mainWidget
,
SIGNAL
(
sgnThreadKillMain
()),
this
,
SLOT
(
slotThread
()));
//打印接口
connect
(
m_mainWidget
,
&
MainWindow
::
sgnPrintNameInit
,
this
,
&
InitClass
::
sgnPrintName2
);
//发出信号
...
...
Tool/initclass.h
View file @
e5ce05bd
...
...
@@ -43,5 +43,8 @@ public:
Q_SIGNAL
void
sgnPrintName2
();
Q_SIGNAL
void
sgnSendPrintName
(
QString
str
);
Q_SIGNAL
void
sgnReceStatus
(
bool
var
);
Q_SIGNAL
void
sgnGetThreadnet
();
Q_SIGNAL
void
sgnGetThread
();
Q_SLOT
void
slotThread
();
};
#endif // INITCLASS_H
Ui/DetailForm.cpp
View file @
e5ce05bd
...
...
@@ -390,10 +390,10 @@ QString DetailForm::PrintdataNormal(OrderObject *pData) //传入一般模式的
QString
str_comd_list
;
total
=
pData
->
proList
.
count
()
*
2
;
QString
filePath
=
QString
(
"%1/Printer
Modle.txt
"
).
arg
(
QCoreApplication
::
applicationDirPath
());
QString
filePath
=
QString
(
"%1/Printer
.template
"
).
arg
(
QCoreApplication
::
applicationDirPath
());
QFile
file
(
filePath
);
if
(
!
file
.
open
(
QFile
::
ReadOnly
)){
return
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"无法打开Printer
Modle.txt!
"
);
return
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"无法打开Printer
.template
"
);
}
QLOG_INFO
()
<<
"GetPrintData Normal is star"
;
...
...
@@ -415,17 +415,17 @@ QString DetailForm::PrintdataNormal(OrderObject *pData) //传入一般模式的
{
if
(
!
v
.
compare
(
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"顾客留存"
)))
{
fee
=
Penny2Dollar
(
pData
->
user_fee
);
fee
=
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"应付金额:¥ "
)
+
Penny2Dollar
(
pData
->
user_fee
);
}
else
if
(
!
v
.
compare
(
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"商户留存"
)))
{
if
(
!
pData
->
pay_type
.
compare
(
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"货到付款"
)))
{
fee
=
Penny2Dollar
(
pData
->
shop_fee
);
fee
=
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"应收现金:¥ "
)
+
Penny2Dollar
(
pData
->
shop_fee
);
}
else
{
fee
=
"0"
;
fee
=
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"应收金额:¥ 0"
)
;
}
}
...
...
@@ -433,7 +433,11 @@ QString DetailForm::PrintdataNormal(OrderObject *pData) //传入一般模式的
{
if
(
!
pData
->
pay_type
.
compare
(
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"货到付款"
)))
{
fee
=
Penny2Dollar
(
pData
->
user_fee
);
fee
=
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"应收金额:¥"
)
+
Penny2Dollar
(
pData
->
user_fee
);
}
else
{
fee
=
InitClass
::
GetInstance
().
GB2312ToUnicode
(
"应收金额:¥ 0"
);
}
}
print
=
str_print
.
append
(
v
).
append
(
"|"
).
append
(
pData
->
channelName
).
append
(
"|"
).
append
(
pData
->
order_id
).
append
(
"|"
).
append
(
pData
->
pay_type
).
append
(
"|"
)
...
...
Ui/MainWindow.cpp
View file @
e5ce05bd
...
...
@@ -91,7 +91,9 @@ MainWindow::MainWindow(QWidget *parent) :
connect
(
&
flowControll
::
GetInstance
(),
&
flowControll
::
showCashierChooseForm
,
this
,
&
MainWindow
::
onShowCashierChooseForm
);
//显示收银员选择窗
connect
(
&
flowControll
::
GetInstance
(),
&
flowControll
::
showOrderDetails
,
this
,
&
MainWindow
::
onShowOrderDetails
);
//显示订单的详情
connect
(
&
flowControll
::
GetInstance
(),
&
flowControll
::
updateCashier
,
this
,
&
MainWindow
::
onUpdateshowCashier
);
connect
(
this
,
&
MainWindow
::
sgnThreadNet
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
sgnThreadFollow
);
//kill线程
connect
(
&
flowControll
::
GetInstance
(),
&
flowControll
::
sgnThreadFollow
,
&
flowControll
::
GetInstance
(),
&
flowControll
::
onStopTimer
);
connect
(
&
flowControll
::
GetInstance
(),
&
flowControll
::
sgnKillThread
,
this
,
&
MainWindow
::
sgnThreadKillMain
);
psetting
=
new
PrintSetting
(
this
);
m_keyBoadForm
=
new
KeyBoardForm
(
this
);
...
...
@@ -139,19 +141,23 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow
::~
MainWindow
()
{
g_threadCtl
->
terminateFlowcontrollThread
();
g_threadCtl
->
terminateRefusecontrollThread
();
// g_threadCtl->terminateFlowcontrollThread();
// g_threadCtl->terminateRefusecontrollThread();
// g_threadCtl->terminateOthercontrollThread();
delete
g_threadCtl
;
g_threadCtl
=
0
;
//FM_Destroy();
delete
m_dbsetWidget
;
delete
m_floatWidget
;
//
delete m_dbsetWidget;
//
delete m_floatWidget;
// FM_deletpr();
delete
ui
;
//
delete ui;
}
void
MainWindow
::
InitstyleMain
()
{
QString
strpath
=
QCoreApplication
::
applicationDirPath
();
rccPath
=
QString
(
"%1/image/%2.rcc"
).
arg
(
strpath
).
arg
(
APP_THEME
);
rccPath
=
QString
(
"%1/
../rcc/
image/%2.rcc"
).
arg
(
strpath
).
arg
(
APP_THEME
);
qDebug
()
<<
"rccPath is"
<<
rccPath
;
if
(
!
QFile
(
rccPath
).
exists
())
{
...
...
@@ -182,7 +188,7 @@ void MainWindow::unRegisterInitstyle()
{
QString
strpath
=
QCoreApplication
::
applicationDirPath
();
qDebug
()
<<
"strpath is"
<<
strpath
;
rccPath
=
QString
(
"%1/image/%2.rcc"
).
arg
(
strpath
).
arg
(
APP_THEME
);
rccPath
=
QString
(
"%1/
../rcc/
image/%2.rcc"
).
arg
(
strpath
).
arg
(
APP_THEME
);
qDebug
()
<<
"rccPath is"
<<
rccPath
;
if
(
!
QFile
(
rccPath
).
exists
())
{
...
...
@@ -450,19 +456,20 @@ void MainWindow::onChangeOrderStatus(OrderObject *orderObject, int oldStatus)
// 检测是否需要提示
if
(
ui
->
mainTableNew
->
rowCount
()
>
0
)
{
emit
sgnMainHome
(
QCoreApplication
::
applicationDirPath
()
+
"/image/float_remind.png"
);
emit
sgnMainHome
(
QString
(
"%1/../rcc/image/float_remind.png"
).
arg
(
QCoreApplication
::
applicationDirPath
()));
// emit sgnSound(0);
}
else
if
(
orderObject
->
status
==
2
)
{
if
(
!
ReadData
(
orderObject
->
order_id
))
{
emit
sgnMainHome
(
Q
CoreApplication
::
applicationDirPath
()
+
"/image/float_remind.png"
);
emit
sgnMainHome
(
Q
String
(
"%1/../rcc/image/float_remind.png"
).
arg
(
QCoreApplication
::
applicationDirPath
())
);
}
}
else
if
(
ui
->
mainTableRefund
->
rowCount
()
>
0
)
{
emit
sgnMainHome
(
QCoreApplication
::
applicationDirPath
()
+
"/image/float_remind.png"
);
emit
sgnMainHome
(
QString
(
"%1/../rcc/image/float_remind.png"
).
arg
(
QCoreApplication
::
applicationDirPath
())
);
// emit sgnSound(1);
}
else
...
...
Ui/MainWindow.h
View file @
e5ce05bd
...
...
@@ -76,6 +76,8 @@ public:
Q_SIGNAL
void
sgnSendPrintNameInit
(
QString
str
);
Q_SIGNAL
void
sgnReceiveStatusInit
(
bool
var
);
Q_SIGNAL
void
sgnResetHide
(
bool
var
);
Q_SIGNAL
void
sgnThreadNet
();
Q_SIGNAL
void
sgnThreadKillMain
();
//
// Q_SIGNAL void getOrderDetails(const QString& orderId,int i);//获取订单详情信号
Q_SLOT
void
OnBtnCashier
();
//查看在线收银员
...
...
fmp_takeout.cpp
View file @
e5ce05bd
...
...
@@ -19,9 +19,7 @@ FMPTakeout::~FMPTakeout()
void
FMPTakeout
::
InitService
()
{
if
(
!
_inited
)
{
d_func
()
->
Init
();
}
d_func
()
->
Init
();
}
void
FMPTakeout
::
UninitService
()
...
...
fmp_takeout.pro
View file @
e5ce05bd
TEMPLATE
=
lib
QT
+=
core
gui
network
sql
printsupport
QT
+=
core
gui
network
sql
printsupport
greaterThan
(
QT_MAJOR_VERSION
,
4
)
:
QT
+=
widgets
DESTDIR
=
.
/
bin
MOC_DIR
=
.
/
tmp
...
...
fmp_takeout_p.cpp
View file @
e5ce05bd
...
...
@@ -10,9 +10,9 @@
#include <QDebug>
#include "fmp_home_i.h"
#include "fmp_printer_i.h"
FMPTakeoutPrivate
::
FMPTakeoutPrivate
(
FMPTakeout
*
q
)
:
q_ptr
(
q
)
#include "fmp_te_handlers.h"
FMPTakeoutPrivate
::
FMPTakeoutPrivate
(
FMPTakeout
*
parent
)
:
q_ptr
(
parent
)
{
}
...
...
@@ -38,15 +38,17 @@ int FMPTakeoutPrivate::Init()
connect
(
&
InitClass
::
GetInstance
(),
&
InitClass
::
sgnPrintName2
,
this
,
&
FMPTakeoutPrivate
::
sltPrintName
);
connect
(
this
,
&
FMPTakeoutPrivate
::
sgnSendPrintName
,
&
InitClass
::
GetInstance
(),
&
InitClass
::
sgnSendPrintName
);
connect
(
this
,
&
FMPTakeoutPrivate
::
sgnReceiveStatus
,
&
InitClass
::
GetInstance
(),
&
InitClass
::
sgnReceStatus
);
// FMPStartEventHandler* handler = new FMPStartEventHandler(q->_ctx, q);
connect
(
this
,
&
FMPTakeoutPrivate
::
sgnStopTime
,
&
InitClass
::
GetInstance
(),
&
InitClass
::
sgnGetThreadnet
);
FMPStartEventHandler
*
handler
=
new
FMPStartEventHandler
(
q
->
_ctx
,
q
);
InitClass
::
GetInstance
().
inItGloal
();
// InitClass::GetInstance().LoadDll();
InitClass
::
GetInstance
().
InitLogger
();
InitClass
::
GetInstance
().
InitDialog
();
q
->
_inited
=
true
;
q
->
_inited
=
true
;
return
FMP_SUCCESS
;
}
else
{
//InitClass::GetInstance().inItGloal();
emit
sgnGetFromHome
();
return
1
;
}
...
...
@@ -61,32 +63,24 @@ FMPTakeoutPrivate::~FMPTakeoutPrivate()
int
FMPTakeoutPrivate
::
Uninit
()
{
Q_Q
(
FMPTakeout
);
emit
sgnStopTime
();
if
(
_Printer
!=
nullptr
)
{
delete
_Printer
;
_Printer
=
0
;
}
if
(
_Home
!=
nullptr
)
{
delete
_Home
;
_Home
=
0
;
}
if
(
_settings
!=
nullptr
)
{
delete
_settings
;
_settings
=
0
;
}
q
->
_inited
=
false
;
return
FMP_SUCCESS
;
}
void
FMPTakeoutPrivate
::
ShowForm
()
{
}
// home 提供接口
void
FMPTakeoutPrivate
::
sltHome
(
QString
path
)
{
...
...
@@ -101,14 +95,14 @@ void FMPTakeoutPrivate::sltStopBlink(int type)
void
FMPTakeoutPrivate
::
sltPrint
(
QString
data
)
{
//
emit sgnReceiveStatus(_Printer->DoPrint(data));
emit
sgnReceiveStatus
(
_Printer
->
DoPrint
(
data
));
}
void
FMPTakeoutPrivate
::
sltPrintName
()
{
//
if(_Printer)
//
{
//
emit sgnSendPrintName(_Printer->GetPrintName());
//
}
if
(
_Printer
)
{
emit
sgnSendPrintName
(
_Printer
->
GetPrintName
());
}
}
fmp_takeout_p.h
View file @
e5ce05bd
...
...
@@ -14,7 +14,6 @@ public:
int
Init
();
int
Uninit
();
~
FMPTakeoutPrivate
();
void
ShowForm
();
private
:
...
...
@@ -22,15 +21,16 @@ public:
FMPTakeout
*
q_ptr
;
FMPHomeInterface
*
_Home
;
FMPPrinterInterface
*
_Printer
;
private
:
FMPSettingsInterface
*
_settings
;
Q_SLOT
void
sltHome
(
QString
path
);
Q_SLOT
void
sltStopBlink
(
int
type
);
Q_SLOT
void
sltPrint
(
QString
data
);
Q_SLOT
void
sltPrintName
();
Q_SIGNAL
void
sgnGetFromHome
();
Q_SIGNAL
void
sgnQuitThread
();
Q_SIGNAL
void
sgnSendPrintName
(
QString
str
);
Q_SIGNAL
void
sgnReceiveStatus
(
bool
var
);
Q_SIGNAL
void
sgnStopTime
();
};
#endif // FMP_TAKEOUT_P_H
fmp_takeout_plugin.cpp
View file @
e5ce05bd
...
...
@@ -29,24 +29,26 @@
#include <QDebug>
FMPTakeoutPlugin
::
FMPTakeoutPlugin
()
:
_
T
akeout_service
(
0
)
:
_
t
akeout_service
(
0
)
{
}
void
FMPTakeoutPlugin
::
start
(
ctkPluginContext
*
context
)
{
_
T
akeout_service
=
new
FMPTakeout
(
context
);
context
->
registerService
<
FMPTakeoutInterface
>
(
_
T
akeout_service
);
_
t
akeout_service
=
new
FMPTakeout
(
context
);
context
->
registerService
<
FMPTakeoutInterface
>
(
_
t
akeout_service
);
}
void
FMPTakeoutPlugin
::
stop
(
ctkPluginContext
*
context
)
{
Q_UNUSED
(
context
)
if
(
_
T
akeout_service
)
if
(
_
t
akeout_service
)
{
delete
_
T
akeout_service
;
_
T
akeout_service
=
0
;
delete
_
t
akeout_service
;
_
t
akeout_service
=
0
;
}
int
a
=
0
;
}
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
...
...
fmp_takeout_plugin_p.h
View file @
e5ce05bd
...
...
@@ -21,7 +21,7 @@ public:
private
:
FMPTakeout
*
_
T
akeout_service
;
FMPTakeout
*
_
t
akeout_service
;
};
// FMPTakeoutPlugin
...
...
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