Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
familyMart_takeaway
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
guanghui.cui
familyMart_takeaway
Commits
04ef5760
Commit
04ef5760
authored
May 09, 2018
by
guanghui.cui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
库存预警和通用预警字段修改
parent
69839807
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
29 deletions
+38
-29
src/JsonModule.cpp
+37
-28
src/main.cpp
+1
-1
No files found.
src/JsonModule.cpp
View file @
04ef5760
...
...
@@ -91,6 +91,17 @@ int GetJsonIntSafe(rapidjson::Value& obj,const char* key)
return
0
;
}
int64_t
GetJsonInt64Safe
(
rapidjson
::
Value
&
obj
,
const
char
*
key
)
{
if
(
obj
.
HasMember
(
key
))
{
rapidjson
::
Value
&
vObj
=
obj
[
key
];
if
(
vObj
.
IsInt64
())
{
return
vObj
.
GetInt64
();
}
}
return
0
;
}
void
JsonModule
::
jsonTest
()
{
std
::
string
json
=
"{
\"
title
\"
:
\"
PLAYER INFO
\"
,
\"
num
\"
:null,
\"
players
\"
:[{
\"
id
\"
:123,
\"
name
\"
:
\"
test
\"
}]}"
;
...
...
@@ -1628,10 +1639,22 @@ void JsonModule::_getStockWarnObj(IN const char* json,OUT stockWarnObj &warn_obj
detail
.
safeQty
=
safeQty
.
GetInt
();
}
rapidjson
::
Value
&
alertTime
=
document
[
"alertTime"
];
int64_t
iDatetime
=
alertTime
.
GetInt64
();
int64_t
iDatetime
=
GetJsonInt64Safe
(
document
,
"alertTime"
);
detail
.
alertTime
=
getdatetime
(
iDatetime
);
GetJsonStringSafe
(
document
,
"barCounter"
);
detail
.
source
=
GetJsonStringSafe
(
document
,
"channel"
);
GetJsonIntSafe
(
document
,
"id"
);
GetJsonStringSafe
(
document
,
"memo"
);
GetJsonStringSafe
(
document
,
"pcId"
);
GetJsonStringSafe
(
document
,
"posId"
);
detail
.
stock
=
GetJsonIntSafe
(
document
,
"qty"
);
detail
.
safeQty
=
GetJsonIntSafe
(
document
,
"saftQty"
);
GetJsonStringSafe
(
document
,
"selfMacId"
);
GetJsonStringSafe
(
document
,
"shelfNo"
);
detail
.
sku
=
GetJsonStringSafe
(
document
,
"sku"
);
GetJsonStringSafe
(
document
,
"storeId"
);
warn_obj
.
vecProducts
.
push_back
(
detail
);
}
}
...
...
@@ -1783,24 +1806,15 @@ std::string JsonModule::_convertToCommonWarnJson(IN const char* json)
}
else
{
rapidjson
::
Value
&
vNotifyDate
=
document
[
"notifyDate"
];
rapidjson
::
Value
&
vNotifyDesc
=
document
[
"notifyDesc"
];
rapidjson
::
Value
&
vNotifyType
=
document
[
"notifyType"
];
rapidjson
::
Value
&
vRackNo
=
document
[
"rackNo"
];
rapidjson
::
Value
&
vStoreId
=
document
[
"storeId"
];
rapidjson
::
Value
&
vTerminalNo
=
document
[
"terminalNo"
];
int64_t
iDate
=
vNotifyDate
.
GetInt64
();
notifyDate
=
getdatetime
(
iDate
);
if
(
!
vNotifyDesc
.
IsNull
()){
notifyDesc
=
vNotifyDesc
.
GetString
();
}
int64_t
iDate
=
GetJsonInt64Safe
(
document
,
"notifyDate"
);
notifyDate
=
getdatetime
(
iDate
);
notifyDesc
=
GetJsonStringSafe
(
document
,
"notifyDesc"
);
rackNo
=
GetJsonStringSafe
(
document
,
"rackNo"
);
storeId
=
GetJsonStringSafe
(
document
,
"storeId"
);
terminalNo
=
GetJsonStringSafe
(
document
,
"terminalNo"
);
notifyType
=
vNotifyType
.
GetInt
();
rackNo
=
vRackNo
.
GetString
();
storeId
=
vStoreId
.
GetString
();
terminalNo
=
vTerminalNo
.
GetString
();
notifyType
=
GetJsonIntSafe
(
document
,
"notifyType"
);
}
...
...
@@ -1847,15 +1861,10 @@ bool JsonModule::_getCommonWarnResponseJson(IN const std::string& posResponse, I
}
else
{
rapidjson
::
Value
&
vNotifyDate
=
document1
[
"notifyDate"
];
rapidjson
::
Value
&
vRackNo
=
document1
[
"rackNo"
];
rapidjson
::
Value
&
vStoreId
=
document1
[
"storeId"
];
rapidjson
::
Value
&
vTerminalNo
=
document1
[
"terminalNo"
];
iDatetime
=
vNotifyDate
.
GetInt64
();
rackNo
=
vRackNo
.
GetString
();
storeId
=
vStoreId
.
GetString
();
terminalNo
=
vTerminalNo
.
GetString
();
iDatetime
=
GetJsonInt64Safe
(
document1
,
"notifyDate"
);
rackNo
=
GetJsonStringSafe
(
document1
,
"rackNo"
);
storeId
=
GetJsonStringSafe
(
document1
,
"storeId"
);
terminalNo
=
GetJsonStringSafe
(
document1
,
"terminalNo"
);
pk_id
=
GetJsonIntSafe
(
document1
,
"pk_id"
);
}
document
.
Parse
(
posResponse
.
c_str
());
...
...
src/main.cpp
View file @
04ef5760
...
...
@@ -18,7 +18,7 @@
INITIALIZE_EASYLOGGINGPP
#define VERSION "1.0.3 Beta
2
" //版本号
#define VERSION "1.0.3 Beta
4
" //版本号
std
::
string
g_init_data
;
std
::
string
g_init_data_ods_back
;
...
...
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