lmstack 3 tahun lalu
induk
melakukan
f1cae4f3ea

+ 2 - 2
LIB/MIDDLE/SaftyCenter/Low_Soc_Alarm/low_soc_alarm_sta.py

@@ -31,11 +31,11 @@ def low_soc_alarm_sta(db_qxcas_engine, conn, db_sp_engine):
     sn_close = list(set(sn_allalarm)-set(sn_lowsoc)-set(sn_offline))
     # sn_cross = list(set(sn_lowsoc) & set(sn_allalarm))
     # 新增
-    df_new = pd.DataFrame(columns=['add_time', 'product_id', 'start_time', 'end_time', 'code'])
+    df_new = pd.DataFrame(columns=['add_time', 'product_id', 'start_time', 'end_time', 'code', 'level'])
     now = datetime.datetime.now()
     for sn in sn_new:
         df = df_lowsocalarm_lastday[df_lowsocalarm_lastday['sn']==sn]
-        df_new = df_new.append({'add_time':now, 'product_id':sn, 'start_time':df['time'].values[0], 'end_time':'0000-00-00 00:00:00', 'code':58}, ignore_index=True)
+        df_new = df_new.append({'add_time':now, 'product_id':sn, 'start_time':df['time'].values[0], 'end_time':'0000-00-00 00:00:00', 'code':58, 'level':1}, ignore_index=True)
     if not df_new.empty:
         df_new.to_sql('all_fault_info', db_sp_engine, if_exists='append', index=False)
 

+ 2 - 2
LIB/MIDDLE/SaftyCenter/Offline/offline_alarm_sta.py

@@ -27,11 +27,11 @@ def offline_alarm_sta(db_iotp_engine, db_qxcas_engine, conn, db_sp_engine):
     # sn_cross = list(set(sn_offline) & set(sn_allalarm))
 
     # 新增
-    df_new = pd.DataFrame(columns=['add_time', 'product_id', 'start_time', 'end_time', 'code'])
+    df_new = pd.DataFrame(columns=['add_time', 'product_id', 'start_time', 'end_time', 'code', 'level'])
     now = datetime.datetime.now()
     for sn in sn_new:
         df = df_offlinealarm_lastday[df_offlinealarm_lastday['sn']==sn]
-        df_new = df_new.append({'add_time':now, 'product_id':sn, 'start_time':df['time'].values[0], 'end_time':'0000-00-00 00:00:00', 'code':59}, ignore_index=True)
+        df_new = df_new.append({'add_time':now, 'product_id':sn, 'start_time':df['time'].values[0], 'end_time':'0000-00-00 00:00:00', 'code':59, 'level':1}, ignore_index=True)
     if not df_new.empty:
         df_new.to_sql('all_fault_info', db_sp_engine, if_exists='append', index=False)