Browse Source

写入odo里程

Eric412V 3 years ago
parent
commit
07dd1373fb
1 changed files with 10 additions and 14 deletions
  1. 10 14
      LIB/MIDDLE/SaftyCenter/DataSta/main.py

+ 10 - 14
LIB/MIDDLE/SaftyCenter/DataSta/main.py

@@ -35,20 +35,16 @@ def Week_Task():
     end_time=end_time.strftime('%Y-%m-%d')
     FltAlarmInfo,Celltype=DataSta.SaftyWarningSta(CS_Data,df_fltinfo,start_time,end_time)
     FaultLvlCount=DataSta.WeekInfoSta(df_fltinfo,start_time,end_time)
-    lvl1=FaultLvlCount[FaultLvlCount['level']==1]['product_id'].values
-    lvl2=FaultLvlCount[FaultLvlCount['level']==2]['product_id'].values
-    lvl3=FaultLvlCount[FaultLvlCount['level']==3]['product_id'].values
-    lvl4=FaultLvlCount[FaultLvlCount['level']==4]['product_id'].values
-    lvl5=FaultLvlCount[FaultLvlCount['level']==5]['product_id'].values
+    for i in range(1,6):
+        if not FaultLvlCount[FaultLvlCount['level']==i]['product_id'].empty:
+            all_period_fault_info.loc[0,'level'+str(i)+'_count']=int(FaultLvlCount[FaultLvlCount['level']==i]['product_id'].values)
+        else:
+            all_period_fault_info.loc[0,'level'+str(i)+'_count']=int(0)
     all_period_fault_info.loc[0,'factory']='骑享'
     all_period_fault_info.loc[0,'week']=toweek
-    all_period_fault_info.loc[0,'level1_count']=lvl1
-    all_period_fault_info.loc[0,'level2_count']=lvl2
-    all_period_fault_info.loc[0,'level3_count']=lvl3
-    all_period_fault_info.loc[0,'level4_count']=lvl4
-    all_period_fault_info.loc[0,'level5_count']=lvl5
     all_period_fault_info.loc[0,'solve_rate']=FltAlarmInfo.loc[0,'OprationManageRate']
-    
+    all_period_fault_info.fillna(0,inplace=False)
+    print(all_period_fault_info)
 def Minutes_Task():
     
     #............................获取数据................................
@@ -106,11 +102,11 @@ def Minutes_Task():
     all_statistic_info.loc[0,'alarm_uregent_not_close_today']=FltAlarmInfo.loc[0,'SftyPlt_EmgcyData_day']-FltAlarmInfo.loc[0,'SftyPlt_EmgcyData_day_Finish_Count']
     all_statistic_info.loc[0,'run_time_total']=TotalRunHour
     all_statistic_info.loc[0,'dischrg_total']=TotalAccumAh
-    all_statistic_info.loc[0,'odo_total']=0
+    all_statistic_info.loc[0,'odo_total']=68232156
     all_statistic_info.loc[0,'max_dischrg_one']=MaxAccumAh
     all_statistic_info.loc[0,'max_runtime_one']=MaxRunningHour
     all_statistic_info.loc[0,'max_cycle_one']=MaxCycle
-    all_statistic_info.loc[0,'max_odo_one']=0
+    all_statistic_info.loc[0,'max_odo_one']=79124
     all_statistic_info.loc[0,'alarm_close_total']=FltAlarmInfo.loc[0,'CS_Warning_Total_Finish_Count']
     all_statistic_info.loc[0,'alarm_total']=FltAlarmInfo.loc[0,'SftyPlt_Data_Total']
     CellType=Celltype.columns.tolist()
@@ -129,7 +125,7 @@ def Minutes_Task():
     all_statistic_info.loc[0,'controller_safety_risk_count']=SatftyCount.loc[0,'CtrlSaftyCodeCount']
     all_statistic_info.loc[0,'design_safety_risk_count']=SatftyCount.loc[0,'DsnSaftyCodeCount']
 #定时任务....................................................................................................................................................................... 
-#Week_Task()
+Week_Task()
 Minutes_Task()
 scheduler = BlockingScheduler()
 scheduler.add_job(Week_Task, 'interval', days=7, id='Week_Task')