Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmupdate
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
李定达
fmupdate
Commits
b92fc0bc
Commit
b92fc0bc
authored
Jun 15, 2017
by
LIDINGDA\ldd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加服务启动失败后自动重试的功能;2.添加巴黎贝甜的支持
parent
aab611e5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
3 deletions
+104
-3
fmscupd/fmscupd.pro
+3
-2
fmscupd/fmservice.h
+1
-1
fmscupd/fmtools.cpp
+81
-0
fmscupd/main.cpp
+2
-0
fmscupd/qtservice/src/qtservice_win.cpp
+17
-0
No files found.
fmscupd/fmscupd.pro
View file @
b92fc0bc
...
...
@@ -2,14 +2,15 @@ include("QsLog/QsLog.pri")
include
(
"QtService/src/qtservice.pri"
)
include
(
"Quazip/quazip.pri"
)
QT
+=
core
network
sql
QT
+=
core
network
sql
xml
QT
-=
gui
CONFIG
+=
c
++
11
DEFINES
+=
QUAZIP_STATIC
#DEFINES += SHIQIJIA
DEFINES
+=
SHAN_LIN
#DEFINES += SHAN_LIN
DEFINES
+=
BALIBEITIAN
#DEFINES += AI_SEN
#DEFINES += TODAY
...
...
fmscupd/fmservice.h
View file @
b92fc0bc
...
...
@@ -17,7 +17,7 @@ public:
:
QtService
<
QCoreApplication
>
(
argc
,
argv
,
SERVICE_NAME
)
{
setServiceDescription
(
SERVICE_DESC
);
setServiceDescription
(
QString
::
fromLocal8Bit
(
SERVICE_DESC
)
);
setStartupType
(
QtServiceController
::
AutoStartup
);
SetUnhandledExceptionFilter
(
FMExcpHandler
);
}
...
...
fmscupd/fmtools.cpp
View file @
b92fc0bc
...
...
@@ -3,6 +3,8 @@
#include <QJsonObject>
#include <QJsonDocument>
#include <QSqlDatabase>
#include <QDomComment>
#include <QDomElement>
#include <QSqlQuery>
#include <QFile>
#include <QDir>
...
...
@@ -18,6 +20,85 @@ FmTools::FmTools()
QString
iniPath
=
QString
(
"%1/%2"
).
arg
(
QCoreApplication
::
applicationDirPath
(),
INIFILE_NAME
);
m_config
=
new
QSettings
(
iniPath
,
QSettings
::
IniFormat
);
#ifdef BALIBEITIAN
#define MY_CFG "FMPOS.ini"
QFile
file
(
"C:/SPCINT/DATA/DBPOS/SHOPINFO.INI"
);
if
(
file
.
exists
())
m_siIniPath
=
"C:/SPCINT/DATA/DBPOS/SHOPINFO.INI"
;
else
{
m_siIniPath
=
qApp
->
applicationDirPath
()
+
"/"
+
MY_CFG
;
m_partnerId
=
"1321"
;
m_keyStoreId
=
"SHOPINFO/STORECD"
;
m_keyPosId
=
"SHOPINFO/POSNO"
;;
QString
tmppath
=
"C:/SPC/POS/INI/PosConfig.ini"
;
QDomDocument
doc
;
QFile
file
(
tmppath
);
if
(
!
file
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
{
return
;
}
QString
strs
;
int
line
,
row
;
if
(
!
doc
.
setContent
(
&
file
,
&
strs
,
&
line
,
&
row
))
{
file
.
close
();
return
;
}
file
.
close
();
QDomElement
root
=
doc
.
documentElement
();
if
(
root
.
tagName
().
compare
(
"MESSAGE"
,
Qt
::
CaseInsensitive
)
!=
0
)
{
return
;
}
QDomNode
n
=
root
.
firstChild
();
QString
tmpposno
,
tmpstoreid
;
while
(
!
n
.
isNull
())
{
QDomElement
e
=
n
.
toElement
();
if
(
e
.
nodeName
().
compare
(
"pos"
,
Qt
::
CaseInsensitive
)
==
0
)
{
QDomNode
ser
=
e
.
firstChild
();
while
(
!
ser
.
isNull
())
{
QDomElement
na
=
ser
.
toElement
();
if
(
na
.
nodeName
().
compare
(
"StoreNo"
,
Qt
::
CaseInsensitive
)
==
0
)
{
tmpstoreid
=
na
.
firstChild
().
nodeValue
();
}
if
(
na
.
nodeName
().
compare
(
"PosNo"
,
Qt
::
CaseInsensitive
)
==
0
)
{
tmpposno
=
na
.
firstChild
().
nodeValue
();
}
ser
=
ser
.
nextSibling
();
}
}
n
=
n
.
nextSibling
();
}
QSettings
set
(
m_siIniPath
,
QSettings
::
IniFormat
);
set
.
setValue
(
m_keyStoreId
,
tmpstoreid
);
set
.
setValue
(
m_keyPosId
,
tmpposno
);
}
m_partnerId
=
"1321"
;
m_keyStoreId
=
"SHOPINFO/STORECD"
;
m_keyPosId
=
"SHOPINFO/POSNO"
;
#endif
#ifdef SHIQIJIA
QSqlDatabase
db
=
QSqlDatabase
::
addDatabase
(
"QODBC"
);
QString
dsn
=
QString
(
"DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=C:/ZGIT/MST.ACCDB"
);
...
...
fmscupd/main.cpp
View file @
b92fc0bc
#include <QCoreApplication>
#include <QDir>
#include "fmservice.h"
#include "fmtools.h"
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
@@ -11,5 +12,6 @@ int main(int argc, char *argv[])
// FmControl m_control;
// m_control.Start();
// return a.exec();
// FmTools::GetInstance();
}
fmscupd/qtservice/src/qtservice_win.cpp
View file @
b92fc0bc
...
...
@@ -897,6 +897,23 @@ bool QtServiceBasePrivate::install(const QString &account, const QString &passwo
sdesc
.
lpDescription
=
(
wchar_t
*
)
serviceDescription
.
utf16
();
pChangeServiceConfig2
(
hService
,
SERVICE_CONFIG_DESCRIPTION
,
&
sdesc
);
}
SERVICE_FAILURE_ACTIONS
servFailActions
;
SC_ACTION
failActions
[
3
];
failActions
[
0
].
Type
=
SC_ACTION_RESTART
;
//Failure action: Restart Service
failActions
[
0
].
Delay
=
120000
;
//number of seconds to wait before performing failure action, in milliseconds = 2minutes
failActions
[
1
].
Type
=
SC_ACTION_RESTART
;
failActions
[
1
].
Delay
=
120000
;
failActions
[
2
].
Type
=
SC_ACTION_RESTART
;
failActions
[
2
].
Delay
=
120000
;
servFailActions
.
dwResetPeriod
=
86400
;
// Reset Failures Counter, in Seconds = 1day
servFailActions
.
lpCommand
=
NULL
;
//Command to perform due to service failure, not used
servFailActions
.
lpRebootMsg
=
NULL
;
//Message during rebooting computer due to service failure, not used
servFailActions
.
cActions
=
3
;
// Number of failure action to manage
servFailActions
.
lpsaActions
=
failActions
;
pChangeServiceConfig2
(
hService
,
SERVICE_CONFIG_FAILURE_ACTIONS
,
&
servFailActions
);
pCloseServiceHandle
(
hService
);
}
pCloseServiceHandle
(
hSCM
);
...
...
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