Преглед на файлове

update 低电量和离线报警

lmstack преди 3 години
родител
ревизия
9bfd87c496
променени са 2 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 2 2
      LIB/MIDDLE/SaftyCenter/Low_Soc_Alarm/low_soc_alarm_sta.py
  2. 2 2
      LIB/MIDDLE/SaftyCenter/Offline/offline_alarm_sta.py

+ 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', 'level'])
+    df_new = pd.DataFrame(columns=['add_time', 'product_id', 'start_time', 'end_time', 'code', 'level', 'info'])
     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, 'level':1}, 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', 'info':"低电量报警", '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', 'level'])
+    df_new = pd.DataFrame(columns=['add_time', 'product_id', 'start_time', 'end_time', 'code', 'level', 'info'])
     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, 'level':1}, 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', 'info':'离线报警','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)