| | |
| | | from datetime import datetime, timedelta |
| | | |
| | | import sys |
| | | # sys.path.append('D:\\z\workplace\\VsCode\\pyvenv\\venv') |
| | | sys.path.append('../../') |
| | | import src.core_modules.remove_duplicates_methods as rdm |
| | | |
| | |
| | | temp=[] |
| | | temp.append(item[2]) #设备编号 |
| | | temp.append('设备故障') #设备编号 |
| | | temp.append('1') #设备故障 |
| | | temp.append('1') #供电异常 |
| | | temp.append('徐汇区') |
| | | temp.append(item[11]) #故障开始时间 |
| | | startTimeSub= datetime.strptime(startTime,"%Y-%m-%d %H:%M") - timedelta(minutes = 10) #结果为datetime.datetime类型 ,需要再转为字符串类型 |
| | |
| | | for i in power_supply_abnormal : |
| | | print(i) |
| | | |
| | | |
| | | #将供电异常的信息写入数据库异常表中 |
| | | abnormal_write_to_SQL(power_supply_abnormal,con) #将设备故障信息写入异常表 |
| | | print('供电异常的信息写入异常表完成!') |
| | |
| | | def refind_ea(list): #一条记录,也就是一个列表 |
| | | temp=[] |
| | | temp.append(generate_short_uuid()) |
| | | # 设备编号 |
| | | temp.append(list[2]) |
| | | # 店铺名字 |
| | | temp.append(list[1]) |
| | | temp.append(list[0]) |
| | | # 供应商 |
| | | temp.append(list[3]) |
| | | temp.append(1) |
| | | print(temp) |
| | | return temp |
| | |
| | | temp.append(list[7]) #净化器电流 7 |
| | | temp.append(list[4]) #进油烟浓度值 |
| | | temp.append(list[5]) #排油烟浓度值 |
| | | temp.append(list[14]) #重复的次数 |
| | | temp.append(list[13]) #重复的次数 |
| | | |
| | | print(temp) |
| | | return temp |
| | |
| | | Key_period_night_end = datetime.strptime('21:00',"%H:%M") |
| | | |
| | | |
| | | engine = create_engine("mysql+mysqlconnector://root:1234@localhost:3306/fume?charset=utf8") |
| | | engine = create_engine("mysql+pymysql://fumeRemote:feiyu2023@114.215.109.124:3306/fume?charset=utf8") |
| | | # 专门读取设备信息表 |
| | | con_read = engine.connect() |
| | | |
| | | def write(data): |
| | | engine = create_engine("mysql+mysqlconnector://root:1234@localhost:3306/fume?charset=utf8") |
| | | engine = create_engine("mysql+pymysql://fumeRemote:feiyu2023@114.215.109.124:3306/fume?charset=utf8") |
| | | con = engine.connect() |
| | | write_all(data,con) |
| | | con.close() |