|
@@ -33,14 +33,11 @@ def offline_alarm_sta(df_sns, db_iotp_engine, db_qxcas_engine, conn, db_sp_engin
|
|
|
df = df_offlinealarm_lastday[df_offlinealarm_lastday['sn']==sn]
|
|
|
sql = "select * from ff_battery_status where devcode = '{}'".format(sn)
|
|
|
df_on = pd.read_sql(sql, db_iotp_engine)
|
|
|
-<<<<<<< HEAD
|
|
|
- factory = df_sns[df_sns['sn']==sn]['factory'].values[0]
|
|
|
- df_new = df_new.append({'add_time':now, 'product_id':sn, 'factory':factory, 'start_time':pd.to_datetime(df_on['status_time'].values[0]), 'end_time':'0000-00-00 00:00:00', 'info':'离线报警','code':59, 'level':1}, ignore_index=True)
|
|
|
-=======
|
|
|
+
|
|
|
if len(df_sns[df_sns['sn']==sn]) > 0:
|
|
|
factory = df_sns[df_sns['sn']==sn]['factory'].values[0]
|
|
|
df_new = df_new.append({'add_time':now, 'product_id':sn, 'factory':factory, 'start_time':pd.to_datetime(df_on['status_time'].values[0]), 'end_time':'0000-00-00 00:00:00', 'info':'离线报警','code':59, 'level':1}, ignore_index=True)
|
|
|
->>>>>>> master
|
|
|
+
|
|
|
if not df_new.empty:
|
|
|
df_new.to_sql('all_fault_info', db_sp_engine, if_exists='append', index=False)
|
|
|
|