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
8a8cfe1d
Commit
8a8cfe1d
authored
Sep 04, 2018
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.阿香米线券码插件守护
parent
b92fc0bc
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
112 additions
and
2 deletions
+112
-2
fmscupd/fmdefine.h
+4
-0
fmscupd/fmscupd.pro
+2
-1
fmscupd/fmtools.cpp
+104
-1
fmscupd/fmtools.h
+2
-0
fmscupd/main.cpp
+0
-0
No files found.
fmscupd/fmdefine.h
View file @
8a8cfe1d
...
...
@@ -36,4 +36,8 @@
// reportRequest
#define JSON_UPDATESTATE "UpdateState"
#define INI_BASE_STOREIDXML "all/storexml"
#define DEFAULT_STOREIDXML "D:/Choice/PosClient/PosData/store.xml"
#endif // FMDEFINE_H
fmscupd/fmscupd.pro
View file @
8a8cfe1d
...
...
@@ -10,7 +10,8 @@ CONFIG += c++11
DEFINES
+=
QUAZIP_STATIC
#DEFINES += SHIQIJIA
#DEFINES += SHAN_LIN
DEFINES
+=
BALIBEITIAN
#DEFINES += BALIBEITIAN
DEFINES
+=
AXMX
#DEFINES += AI_SEN
#DEFINES += TODAY
...
...
fmscupd/fmtools.cpp
View file @
8a8cfe1d
...
...
@@ -9,17 +9,107 @@
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QXmlStreamReader>
FmTools
&
FmTools
::
GetInstance
()
{
static
FmTools
ft
;
return
ft
;
}
bool
FmTools
::
ReadXml
(
QString
xmlfilename
,
QMap
<
QString
,
QString
>
&
value
,
QString
key
,
QString
&
outNum
,
bool
flg
)
{
QXmlStreamReader
xml
;
QFile
file
(
xmlfilename
);
bool
sign
=
false
;
//outNum = QString();
if
(
!
file
.
open
(
QFile
::
ReadOnly
|
QFile
::
Text
))
{
qDebug
()
<<
QString
(
"open %1 failed"
).
arg
(
xmlfilename
);
return
false
;
}
xml
.
setDevice
(
&
file
);
while
(
!
xml
.
atEnd
()
&&
!
xml
.
hasError
())
{
if
(
xml
.
isStartElement
())
{
if
((
xml
.
name
()
==
key
&&
value
.
size
()
==
0
)
||
(
xml
.
name
()
==
key
&&
value
.
value
(
value
.
firstKey
())
==
""
)
||
(
xml
.
name
()
==
key
&&
xml
.
attributes
().
value
(
value
.
firstKey
()).
toString
().
compare
(
value
.
value
(
value
.
firstKey
()),
Qt
::
CaseInsensitive
)
==
0
))
{
if
(
flg
==
false
)
{
flg
=
true
;
xml
.
readNext
();
continue
;
}
if
(
outNum
==
""
)
{
xml
.
readNext
();
outNum
=
xml
.
text
().
toString
();
}
else
outNum
=
xml
.
attributes
().
value
(
outNum
).
toString
();
sign
=
true
;
break
;
}
else
{
xml
.
readNext
();
}
}
else
{
xml
.
readNext
();
}
}
do
{
if
(
xml
.
hasError
())
{
qDebug
()
<<
QString
(
"%1 file error"
).
arg
(
xmlfilename
);
sign
=
false
;
break
;
}
else
if
(
file
.
error
()
!=
QFile
::
NoError
)
{
qDebug
()
<<
QString
(
"read %1 error"
).
arg
(
xmlfilename
);
sign
=
false
;
break
;
}
}
while
(
0
);
xml
.
clear
();
file
.
close
();
return
sign
;
}
FmTools
::
FmTools
()
{
QString
iniPath
=
QString
(
"%1/%2"
).
arg
(
QCoreApplication
::
applicationDirPath
(),
INIFILE_NAME
);
m_config
=
new
QSettings
(
iniPath
,
QSettings
::
IniFormat
);
#ifdef AXMX
QString
path
=
QSettings
(
iniPath
,
QSettings
::
IniFormat
).
value
(
INI_BASE_STOREIDXML
).
toString
();
if
(
path
.
isEmpty
())
path
=
DEFAULT_STOREIDXML
;
QMap
<
QString
,
QString
>
map
;
QString
storeid
=
"SCODE"
;
m_partnerId
=
"1525"
;
m_keyStoreId
=
"0000"
;
m_keyPosId
=
"1"
;
if
(
ReadXml
(
path
,
map
,
"store"
,
storeid
))
m_keyStoreId
=
storeid
;
qDebug
()
<<
"-----------------------------"
<<
storeid
;
#endif
#ifdef BALIBEITIAN
#define MY_CFG "FMPOS.ini"
...
...
@@ -208,6 +298,9 @@ QByteArray FmTools::GetUpdateData()
#ifdef SHIQIJIA
rObj
.
insert
(
JSON_STOREID
,
m_keyStoreId
);
rObj
.
insert
(
JSON_POSNO
,
m_keyPosId
);
#elif AXMX
rObj
.
insert
(
JSON_STOREID
,
m_keyStoreId
);
rObj
.
insert
(
JSON_POSNO
,
m_keyPosId
);
#else
rObj
.
insert
(
JSON_STOREID
,
setting
.
value
(
m_keyStoreId
).
toString
());
rObj
.
insert
(
JSON_POSNO
,
setting
.
value
(
m_keyPosId
).
toString
());
...
...
@@ -238,9 +331,19 @@ QByteArray FmTools::GetReportData(QString planid, QString msg, QString updateSta
QSettings
setting
(
m_siIniPath
,
QSettings
::
IniFormat
);
QJsonObject
rObj
;
rObj
.
insert
(
JSON_PARTNERID
,
m_partnerId
);
#ifdef SHIQIJIA
rObj
.
insert
(
JSON_STOREID
,
m_keyStoreId
);
rObj
.
insert
(
JSON_POSNO
,
m_keyPosId
);
#elif AXMX
rObj
.
insert
(
JSON_STOREID
,
m_keyStoreId
);
rObj
.
insert
(
JSON_POSNO
,
m_keyPosId
);
#else
rObj
.
insert
(
JSON_STOREID
,
setting
.
value
(
m_keyStoreId
).
toString
());
rObj
.
insert
(
JSON_POSNO
,
setting
.
value
(
m_keyPosId
).
toString
());
#endif
rObj
.
insert
(
JSON_PARTNERID
,
m_partnerId
);
rObj
.
insert
(
JSON_PLANID
,
planid
);
rObj
.
insert
(
JSON_UPDATESTATE
,
updateState
);
rObj
.
insert
(
JSON_MSG
,
msg
);
...
...
fmscupd/fmtools.h
View file @
8a8cfe1d
...
...
@@ -57,6 +57,8 @@ public:
* */
QByteArray
GetReportData
(
QString
planId
=
""
,
QString
msg
=
""
,
QString
state
=
""
);
bool
ReadXml
(
QString
xmlfilename
,
QMap
<
QString
,
QString
>
&
value
,
QString
key
,
QString
&
outNum
,
bool
flg
=
true
);
private
:
FmTools
();
~
FmTools
();
...
...
fmscupd/main.cpp
View file @
8a8cfe1d
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