Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fmPOS
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
fmPOS
Commits
3d636b36
Commit
3d636b36
authored
Sep 11, 2017
by
gujin.wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新建鲜芋仙分支
parent
780286d3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
59 deletions
+43
-59
FreemudPOS/FreemudPOS.pro
+9
-0
debug/bins/FreemudPOS.ini
+4
-2
fmp_logger/fmp_logger_p.cpp
+4
-4
fmp_logger/fmp_logstream.h
+2
-4
fmp_redeem/fmp_redeem.cpp
+3
-42
fmp_redeem/fmp_redeem.h
+1
-3
fmp_redeem/fmp_redeem_i.h
+1
-1
include/application/fm_singleton.h
+17
-1
release/bins/FreemudPOS.ini
+2
-2
No files found.
FreemudPOS/FreemudPOS.pro
View file @
3d636b36
...
@@ -9,6 +9,15 @@ TEMPLATE = app
...
@@ -9,6 +9,15 @@ TEMPLATE = app
INCLUDEPATH
+=
$$
PWD
/../
include
/
ctk
\
INCLUDEPATH
+=
$$
PWD
/../
include
/
ctk
\
$$
PWD
/../
include
/
interface
\
$$
PWD
/../
include
/
interface
\
LIBS
+=
-
L
$$
PWD
/../
lib
CONFIG
(
debug
,
debug
|
release
)
{
#
Linking
library
LIBS
+=
-
lCTKCored
-
lCTKPluginFrameworkd
}
else
{
LIBS
+=
-
lCTKCore
-
lCTKPluginFramework
}
CONFIG
(
debug
,
debug
|
release
)
{
CONFIG
(
debug
,
debug
|
release
)
{
DESTDIR
=
$$
PWD
/../
debug
/
bins
DESTDIR
=
$$
PWD
/../
debug
/
bins
}
}
...
...
debug/bins/FreemudPOS.ini
View file @
3d636b36
...
@@ -15,8 +15,10 @@ Level=4
...
@@ -15,8 +15,10 @@ Level=4
[Home]
[Home]
Server
=
http://115.159.226.87:20001/api/user/login
Server
=
http://115.159.226.87:20001/api/user/login
PartnerId
=
1371
;PartnerId=1371
StoreId
=
fm99999
;StoreId=fm99999
PartnerId
=
1670
StoreId
=
99999
PosId
=
01
PosId
=
01
Position
=
1479, 521
Position
=
1479, 521
CashierId
=
001
CashierId
=
001
...
...
fmp_logger/fmp_logger_p.cpp
View file @
3d636b36
#include "fmp_logger_p.h"
#
include
"fmp_logger_p.h"
#include <fmp_settings_i.h>
#include <fmp_settings_i.h>
#include <QDateTime>
#include <QDateTime>
#include <QDir>
#include <QDir>
...
@@ -64,19 +64,19 @@ void FMPLoggerPrivate::Log(short level, const QString &msg, const char* file, co
...
@@ -64,19 +64,19 @@ void FMPLoggerPrivate::Log(short level, const QString &msg, const char* file, co
LoggerPtr
logger
=
Logger
::
getLogger
(
q
->
currentModule
.
toUtf8
().
data
());
LoggerPtr
logger
=
Logger
::
getLogger
(
q
->
currentModule
.
toUtf8
().
data
());
switch
(
level
)
switch
(
level
)
{
{
case
FMPLogStream
:
:
ERROR
:
case
FMPLogStream
:
:
LOG_
ERROR
:
if
(
logger
->
isErrorEnabled
())
{
if
(
logger
->
isErrorEnabled
())
{
::
log4cxx
::
helpers
::
MessageBuffer
oss_
;
::
log4cxx
::
helpers
::
MessageBuffer
oss_
;
logger
->
forcedLog
(
::
log4cxx
::
Level
::
getError
(),
oss_
.
str
(
oss_
<<
msg
.
toUtf8
().
data
()),
LocationInfo
(
file
,
func
,
line
));
logger
->
forcedLog
(
::
log4cxx
::
Level
::
getError
(),
oss_
.
str
(
oss_
<<
msg
.
toUtf8
().
data
()),
LocationInfo
(
file
,
func
,
line
));
}
}
break
;
break
;
case
FMPLogStream
:
:
WARNING
:
case
FMPLogStream
:
:
LOG_
WARNING
:
if
(
logger
->
isWarnEnabled
())
{
if
(
logger
->
isWarnEnabled
())
{
::
log4cxx
::
helpers
::
MessageBuffer
oss_
;
::
log4cxx
::
helpers
::
MessageBuffer
oss_
;
logger
->
forcedLog
(
::
log4cxx
::
Level
::
getWarn
(),
oss_
.
str
(
oss_
<<
msg
.
toUtf8
().
data
()),
LocationInfo
(
file
,
func
,
line
));
logger
->
forcedLog
(
::
log4cxx
::
Level
::
getWarn
(),
oss_
.
str
(
oss_
<<
msg
.
toUtf8
().
data
()),
LocationInfo
(
file
,
func
,
line
));
}
}
break
;
break
;
case
FMPLogStream
:
:
DEBUG
:
case
FMPLogStream
:
:
LOG_
DEBUG
:
if
(
LOG4CXX_UNLIKELY
(
logger
->
isDebugEnabled
()))
{
if
(
LOG4CXX_UNLIKELY
(
logger
->
isDebugEnabled
()))
{
::
log4cxx
::
helpers
::
MessageBuffer
oss_
;
::
log4cxx
::
helpers
::
MessageBuffer
oss_
;
logger
->
forcedLog
(
::
log4cxx
::
Level
::
getDebug
(),
oss_
.
str
(
oss_
<<
msg
.
toUtf8
().
data
()),
LocationInfo
(
file
,
func
,
line
));
logger
->
forcedLog
(
::
log4cxx
::
Level
::
getDebug
(),
oss_
.
str
(
oss_
<<
msg
.
toUtf8
().
data
()),
LocationInfo
(
file
,
func
,
line
));
...
...
fmp_logger/fmp_logstream.h
View file @
3d636b36
#ifndef FMP_LOGGERSTREAM_H
#
ifndef
FMP_LOGGERSTREAM_H
#define FMP_LOGGERSTREAM_H
#define FMP_LOGGERSTREAM_H
#include <QObject>
#include <QObject>
#include <QDebug>
#include <QDebug>
...
@@ -8,9 +8,7 @@
...
@@ -8,9 +8,7 @@
class
FMPLogStream
class
FMPLogStream
{
{
public
:
public
:
enum
{
enum
{
LOG_ERROR
=
1
,
LOG_WARNING
,
LOG_INFO
,
LOG_DEBUG
};
ERROR
=
1
,
WARNING
,
INFO
,
DEBUG
};
explicit
FMPLogStream
(
short
level
,
const
char
*
file
,
const
char
*
func
,
int
line
)
explicit
FMPLogStream
(
short
level
,
const
char
*
file
,
const
char
*
func
,
int
line
)
:
_level
(
level
),
:
_level
(
level
),
_file
(
file
),
_file
(
file
),
...
...
fmp_redeem/fmp_redeem.cpp
View file @
3d636b36
...
@@ -113,11 +113,10 @@ QJsonObject FMPRedeem::Reverse(QJsonObject request)
...
@@ -113,11 +113,10 @@ QJsonObject FMPRedeem::Reverse(QJsonObject request)
return
retJson
;
return
retJson
;
}
}
QJsonObject
FMPRedeem
::
Redeem
(
const
double
needPay
,
const
QJsonArray
&
productsInfo
)
QJsonObject
FMPRedeem
::
Redeem
(
const
QJsonArray
&
productsInfo
)
{
{
FMP_DEBUG
()
<<
"Recv redeem data: "
<<
QJsonDocument
(
productsInfo
).
toJson
(
QJsonDocument
::
Compact
);
FMP_DEBUG
()
<<
"Recv redeem data: "
<<
QJsonDocument
(
productsInfo
).
toJson
(
QJsonDocument
::
Compact
);
_products_info
=
productsInfo
;
_products_info
=
productsInfo
;
_needPay
=
needPay
;
//读取门店信息
//读取门店信息
QString
apppath
=
QCoreApplication
::
applicationDirPath
();
QString
apppath
=
QCoreApplication
::
applicationDirPath
();
QSettings
settings
(
QString
(
"%1/FreemudPOS.ini"
).
arg
(
apppath
),
QSettings
::
IniFormat
);
QSettings
settings
(
QString
(
"%1/FreemudPOS.ini"
).
arg
(
apppath
),
QSettings
::
IniFormat
);
...
@@ -252,15 +251,7 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
...
@@ -252,15 +251,7 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
_redeem_json
[
"operator_id"
]
=
_operator_id
;
_redeem_json
[
"operator_id"
]
=
_operator_id
;
_redeem_json
[
"business_date"
]
=
QDate
::
currentDate
().
toString
(
"yyyyMMdd"
);
_redeem_json
[
"business_date"
]
=
QDate
::
currentDate
().
toString
(
"yyyyMMdd"
);
if
(
couponType
==
0
){
//商品券
if
(
couponType
==
0
){
//商品券
if
(
!
IsContinue
(
SearchJsonObject
(
json
,
"paid"
).
toInt
()))
{
QJsonObject
result
;
result
[
"statusCode"
]
=
FM_API_WINDOWCLOSE
;
result
[
"msg"
]
=
QString
::
fromLocal8Bit
(
"窗口关闭"
);
return
result
;
}
QJsonObject
transaction
;
QJsonObject
transaction
;
QJsonArray
transactions
;
QJsonArray
transactions
;
transaction
[
"code"
]
=
coupon
;
transaction
[
"code"
]
=
coupon
;
...
@@ -294,15 +285,7 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
...
@@ -294,15 +285,7 @@ QJsonObject FMPRedeem::ShowForUnConsum(QJsonObject json)
transactions
.
append
(
transaction
);
transactions
.
append
(
transaction
);
_redeem_json
[
"transactions"
]
=
transactions
;
_redeem_json
[
"transactions"
]
=
transactions
;
}
}
if
(
couponType
==
1
){
//代金券
if
(
couponType
==
1
){
//代金券
if
(
!
IsContinue
(
SearchJsonObject
(
json
,
"amount"
).
toInt
()))
{
QJsonObject
result
;
result
[
"statusCode"
]
=
FM_API_WINDOWCLOSE
;
result
[
"msg"
]
=
QString
::
fromLocal8Bit
(
"窗口关闭"
);
return
result
;
}
QJsonObject
transaction
;
QJsonObject
transaction
;
transaction
[
"code"
]
=
coupon
;
transaction
[
"code"
]
=
coupon
;
transaction
[
"ebcode"
]
=
ebcode
;
transaction
[
"ebcode"
]
=
ebcode
;
...
@@ -400,28 +383,6 @@ QJsonObject FMPRedeem::GetRedeemJson() const
...
@@ -400,28 +383,6 @@ QJsonObject FMPRedeem::GetRedeemJson() const
return
_redeem_json
;
return
_redeem_json
;
}
}
bool
FMPRedeem
::
IsContinue
(
int
couponAmount
)
{
if
(
_needPay
<
couponAmount
/
100.0
)
{
//如果卡券抵扣额已大于待付金额,则给出警告提示
QMessageBox
msg
;
msg
.
setWindowTitle
(
QString
::
fromLocal8Bit
(
"警告"
));
msg
.
setText
(
QString
::
fromLocal8Bit
(
"卡券总额已超出应付金额!是否继续?"
));
msg
.
setStandardButtons
(
QMessageBox
::
Yes
|
QMessageBox
::
Cancel
);
msg
.
setIcon
(
QMessageBox
::
Warning
);
//msg.setWindowModality(Qt::ApplicationModal);
msg
.
setWindowFlags
(
msg
.
windowFlags
()
|
Qt
::
WindowStaysOnTopHint
);
msg
.
setAttribute
(
Qt
::
WA_QuitOnClose
,
false
);
int
choice
=
msg
.
exec
();
if
(
choice
!=
QMessageBox
::
Yes
)
{
return
false
;
}
}
return
true
;
}
int
FMPRedeem
::
ZH_caclChkValue
(
char
*
pJsonData
,
int
startPos
,
int
endPos
)
int
FMPRedeem
::
ZH_caclChkValue
(
char
*
pJsonData
,
int
startPos
,
int
endPos
)
{
{
/* startPos <= && < endPos */
/* startPos <= && < endPos */
...
...
fmp_redeem/fmp_redeem.h
View file @
3d636b36
...
@@ -29,7 +29,7 @@ public:
...
@@ -29,7 +29,7 @@ public:
explicit
FMPRedeem
(
const
FMPContext
context
);
explicit
FMPRedeem
(
const
FMPContext
context
);
virtual
~
FMPRedeem
();
virtual
~
FMPRedeem
();
QJsonObject
Redeem
(
const
double
needPay
,
const
QJsonArray
&
productsInfo
);
//券码核销
QJsonObject
Redeem
(
const
QJsonArray
&
productsInfo
);
//券码核销
QJsonObject
Reverse
(
QJsonObject
request
);
QJsonObject
Reverse
(
QJsonObject
request
);
QJsonObject
GetRedeemJson
()
const
;
QJsonObject
GetRedeemJson
()
const
;
...
@@ -50,12 +50,10 @@ private:
...
@@ -50,12 +50,10 @@ private:
QJsonObject
ShowForMismatch
(
QJsonObject
json
);
QJsonObject
ShowForMismatch
(
QJsonObject
json
);
int
ZH_caclChkValue
(
char
*
pJsonData
,
int
startPos
,
int
endPos
);
int
ZH_caclChkValue
(
char
*
pJsonData
,
int
startPos
,
int
endPos
);
QByteArray
CheckSendArray
(
QByteArray
&
jsonArray
);
QByteArray
CheckSendArray
(
QByteArray
&
jsonArray
);
bool
IsContinue
(
int
couponAmount
);
QJsonValue
SearchJsonObject
(
QJsonObject
&
searchJson
,
QString
searchKey
);
QJsonValue
SearchJsonObject
(
QJsonObject
&
searchJson
,
QString
searchKey
);
QJsonValue
SearchJsonArray
(
QJsonArray
&
searchJson
,
QString
searchKey
);
QJsonValue
SearchJsonArray
(
QJsonArray
&
searchJson
,
QString
searchKey
);
private
:
private
:
bool
_inited
;
bool
_inited
;
double
_needPay
;
QString
_store_id
;
QString
_store_id
;
QString
_station_id
;
QString
_station_id
;
QString
_operator_id
;
QString
_operator_id
;
...
...
fmp_redeem/fmp_redeem_i.h
View file @
3d636b36
...
@@ -20,7 +20,7 @@ public:
...
@@ -20,7 +20,7 @@ public:
connect
(
this
,
&
FMPRedeemInterface
::
TriggerUninit
,
this
,
&
FMPRedeemInterface
::
OnTriggerUninit
);
connect
(
this
,
&
FMPRedeemInterface
::
TriggerUninit
,
this
,
&
FMPRedeemInterface
::
OnTriggerUninit
);
}
}
virtual
QJsonObject
Redeem
(
const
double
needPay
,
const
QJsonArray
&
productsInfo
)
=
0
;
//券码核销
virtual
QJsonObject
Redeem
(
const
QJsonArray
&
productsInfo
)
=
0
;
//券码核销
virtual
QJsonObject
Reverse
(
QJsonObject
request
)
=
0
;
//卡券冲正
virtual
QJsonObject
Reverse
(
QJsonObject
request
)
=
0
;
//卡券冲正
virtual
QJsonObject
GetRedeemJson
()
const
=
0
;
virtual
QJsonObject
GetRedeemJson
()
const
=
0
;
...
...
include/application/fm_singleton.h
View file @
3d636b36
...
@@ -6,7 +6,8 @@
...
@@ -6,7 +6,8 @@
#include <QLocalSocket>
#include <QLocalSocket>
#include <QLocalServer>
#include <QLocalServer>
#include <QApplication>
#include <QApplication>
#include <QJsonArray>
#include "fmp_redeem_i.h"
class
FMSingleApplication
:
public
QApplication
class
FMSingleApplication
:
public
QApplication
{
{
...
@@ -81,6 +82,21 @@ private:
...
@@ -81,6 +82,21 @@ private:
widget
->
raise
();
widget
->
raise
();
widget
->
activateWindow
();
widget
->
activateWindow
();
}
}
//程序已启动,则直接显示核销界面
FMPRedeemInterface
*
svcRedeem
=
FMP
::
GetService
<
FMPRedeemInterface
>
();
if
(
svcRedeem
)
{
svcRedeem
->
StartService
();
QJsonArray
products
;
QJsonObject
product
;
product
[
"consume_num"
]
=
1
;
product
[
"pid"
]
=
"1607271"
;
product
[
"price"
]
=
500
;
products
.
append
(
product
);
QJsonObject
result
=
svcRedeem
->
Redeem
(
products
);
FMP_DEBUG
()
<<
result
;
}
return
;
return
;
}
}
...
...
release/bins/FreemudPOS.ini
View file @
3d636b36
...
@@ -15,8 +15,8 @@ Level=0
...
@@ -15,8 +15,8 @@ Level=0
[Home]
[Home]
Server
=
http://115.159.226.87:20001/api/user/login
Server
=
http://115.159.226.87:20001/api/user/login
PartnerId
=
1
521
PartnerId
=
1
670
StoreId
=
9999
StoreId
=
9999
9
PosId
=
01
PosId
=
01
Position
=
1382, 776
Position
=
1382, 776
CashierId
=
001
CashierId
=
001
...
...
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