|
@@ -15,7 +15,7 @@ def offline_alarm_sta(db_iotp_engine, db_qxcas_engine, conn, db_sp_engine, df_of
|
|
|
df_offlinealarm_lastday = pd.read_sql(sql, db_qxcas_engine)
|
|
|
sn_offline = df_offlinealarm_lastday['sn'].tolist()
|
|
|
|
|
|
- sql = "select * from all_fault_info_copy1 where end_time='{}' and code={}".format('0000-00-00 00:00:00', 59)
|
|
|
+ sql = "select * from all_fault_info where end_time='{}' and code={}".format('0000-00-00 00:00:00', 59)
|
|
|
df_all_alarm_info = pd.read_sql(sql, db_sp_engine)
|
|
|
sn_allalarm = df_all_alarm_info['product_id'].tolist()
|
|
|
|
|
@@ -33,7 +33,7 @@ def offline_alarm_sta(db_iotp_engine, db_qxcas_engine, conn, db_sp_engine, df_of
|
|
|
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)
|
|
|
if not df_new.empty:
|
|
|
- df_new.to_sql('all_fault_info_copy1', db_sp_engine, if_exists='append', index=False)
|
|
|
+ df_new.to_sql('all_fault_info', db_sp_engine, if_exists='append', index=False)
|
|
|
|
|
|
# 修改
|
|
|
now = datetime.datetime.now()
|
|
@@ -42,7 +42,7 @@ def offline_alarm_sta(db_iotp_engine, db_qxcas_engine, conn, db_sp_engine, df_of
|
|
|
df1 = df_all_alarm_info[df_all_alarm_info['product_id']==sn]
|
|
|
sql = "select * from ff_battery_status where devcode = '{}'".format(sn)
|
|
|
df_on = pd.read_sql(sql, db_iotp_engine)
|
|
|
- sql = ''' update all_fault_info_copy1 set update_time='{}', end_time='{}' where product_id = '{}' and start_time = '{}' and code = {}'''.format \
|
|
|
+ sql = ''' update all_fault_info set update_time='{}', end_time='{}' where product_id = '{}' and start_time = '{}' and code = {}'''.format \
|
|
|
(now, pd.to_datetime(df_on['status_time'].values[0]), sn, pd.to_datetime(df1['start_time'].values[0]), df1['code'].values[0])
|
|
|
cursor.execute(sql)
|
|
|
conn.commit()
|