Commit 34df6cbc by 陈森彬

update

parent 2d8a3116
Showing with 7 additions and 6 deletions
......@@ -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,)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment