Eric412V 3 лет назад
Родитель
Сommit
25f2f6dd4e
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      LIB/MIDDLE/SaftyCenter/DataDiag_Static/DiagDataMerge.py

+ 9 - 2
LIB/MIDDLE/SaftyCenter/DataDiag_Static/DiagDataMerge.py

@@ -9,6 +9,7 @@ class DiagDataMerge():
         
         df_Diag_Cal_finish = pd.DataFrame(columns=['start_time', 'end_time', 'product_id', 'code', 'level', 'info','advice','Batpos'])
         df_Diag_Cal_unfinish = pd.DataFrame(columns=['start_time', 'end_time', 'product_id', 'code', 'level', 'info','advice','Batpos'])
+        print('处理前',df_Diag_Cal_unfinish)
         if not df_Diag_Batdiag_update.empty:
             #------------------------------合并两者故障,并将同一sn号下的车辆故障放一起----------------------------------------------
             df_Diag_Cal_finish = df_Diag_Batdiag_update[df_Diag_Batdiag_update['end_time'] != '0000-00-00 00:00:00']
@@ -16,11 +17,17 @@ class DiagDataMerge():
             df_Diag_Cal_finish['Batpos'] = [1]*len(df_Diag_Cal_finish)
             if len(df_OprtnSta):
                 if df_OprtnSta.loc[0,'status'] !=1:#0禁用 1正常 2故障 3返修 4 损毁 5丢失已赔偿,6丢失未赔偿
-                    df_Diag_Cal_unfinish['Batpos'] = [1]*len(df_Diag_Cal_unfinish)
+                    if df_Diag_Cal_unfinish['level'].max()>3:
+                        if df_OprtnSta.loc[0,'status'] ==3:
+                            df_Diag_Cal_unfinish['Batpos'] = [1]*len(df_Diag_Cal_unfinish)
+                        else:
+                            df_Diag_Cal_unfinish['Batpos'] = [0]*len(df_Diag_Cal_unfinish)
+                    else:
+                        df_Diag_Cal_unfinish['Batpos'] = [1]*len(df_Diag_Cal_unfinish)
                 else:
                     df_Diag_Cal_unfinish['Batpos'] = [0]*len(df_Diag_Cal_unfinish)
                     
-                    
+        print('处理后',df_Diag_Cal_unfinish)
         df_Diag_Cal_Update=pd.concat([df_Diag_Cal_finish,df_Diag_Cal_unfinish])    
         df_Diag_Ram_add = pd.concat([df_Diag_Cal_Update,df_Diag_Ram_sn,df_Diag_Ram_sn]).drop_duplicates(subset=['start_time','code'],keep=False)#此次判断中新增故障
         df_Diag_Ram_Update_old = pd.concat([df_Diag_Cal_Update,df_Diag_Ram_add,df_Diag_Ram_add]).drop_duplicates(subset=['start_time','code'],keep=False)#此次判断中新增故障