Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
tas_monitor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
34df6cbc
authored
Nov 21, 2019
by
陈森彬
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
2d8a3116
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
utils/mongo.py
utils/mongo.py
View file @
34df6cbc
...
...
@@ -41,8 +41,8 @@ class MongoOperator:
# element14 chip1stop ti
self
.
colls
=
(
'alliedelec'
,
'arrow'
,
'avnet'
,
'buerklin'
,
'digikey'
,
'master'
,
'rs'
,
'rochester'
,
'verical'
,
"powell"
,
'microchip'
,
'tme'
,
'heilind'
,
'maxim'
,
'aipco'
,
'company'
,
'rutronik'
,
'mouser'
,
'corestaff'
,
'wpg'
,
'szlc'
,
'element14'
,
'chip1stop'
,
'future'
,
"nep"
,
"cdi"
,
"nac"
,
"richardsonrfpd"
,
"pui"
)
'mouser'
,
'corestaff'
,
'wpg'
,
'szlc'
,
'element14'
,
'chip1stop'
,
'future'
,
"nep"
,
"cdi"
,
"nac"
,
"richardsonrfpd"
,
"pui"
)
...
...
@@ -54,6 +54,8 @@ class MongoOperator:
ts
=
int
(
time
.
time
())
-
3600
*
72
# 72h
elif
plat
in
(
'microchip'
,
'heilind'
,
'element14'
,
'chip1stop'
,
'future'
):
ts
=
int
(
time
.
time
())
-
3600
*
24
# 24h
elif
plat
in
(
"richardsonrfpd"
,):
ts
=
int
(
time
.
time
())
-
3600
*
96
# 96h
else
:
ts
=
int
(
time
.
time
())
-
3600
*
48
# 48
return
ts
...
...
@@ -120,20 +122,19 @@ class MongoOperator:
if
total
>
0
:
stock_rate
=
stock_num
/
total
*
100
tiered_rate
=
tiered_num
/
total
*
100
old_stock_rate
=
glo
.
get_value
(
plat
)[
"stock"
]
if
glo
.
get_value
(
plat
)
else
0
old_stock_rate
=
glo
.
get_value
(
plat
)[
"stock"
]
if
glo
.
get_value
(
plat
)
else
0
old_tiered_rate
=
glo
.
get_value
(
plat
)[
"tiered"
]
if
glo
.
get_value
(
plat
)
else
0
if
stock_rate
>=
10
or
tiered_rate
>=
10
:
msg_line
=
""
if
old_stock_rate
==
0
:
if
old_stock_rate
==
0
or
old_tiered_rate
==
0
:
print
(
plat
,
"空库存数量"
,
stock_num
,
"空价格数量"
,
stock_num
,
"总量"
,
total
,
"空库存率"
,
stock_rate
,
"空价格率"
,
tiered_rate
,
)
msg_line
=
demo1
.
format
(
plat
,
stock_rate
,
tiered_rate
)
else
:
stock__ontrast_ratio
=
stock_rate
-
old_stock_rate
tiered__ontrast_ratio
=
tiered_rate
-
old_tiered_rate
if
not
-
10
<
stock__ontrast_ratio
<
10
or
not
-
10
<
tiered__ontrast_ratio
<
10
:
if
not
-
3
<
stock__ontrast_ratio
<
3
or
not
-
3
<
tiered__ontrast_ratio
<
3
:
msg_line
=
demo2
.
format
(
plat
,
stock__ontrast_ratio
,
tiered__ontrast_ratio
)
print
(
plat
,
"空库存数量"
,
stock_num
,
"空价格数量"
,
stock_num
,
"总量"
,
total
,
"空库存率"
,
stock_rate
,
"空价格率"
,
tiered_rate
,
"空库存变化率"
,
stock__ontrast_ratio
,
"空价格变化率"
,
tiered__ontrast_ratio
,)
...
...
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