|
@@ -22,6 +22,8 @@ def diag_cal():
|
|
|
task_on=1
|
|
|
global SNnums
|
|
|
global start
|
|
|
+ factory_info=['骑享','金茂换电']
|
|
|
+ df_Diag_Ram=DataFrame(columns=['start_time','end_time','product_id','code','level','info','advice','Batpos'])
|
|
|
#..................................设置时间..........................................................
|
|
|
start=time.time()
|
|
|
end_time=datetime.datetime.now()
|
|
@@ -40,7 +42,9 @@ def diag_cal():
|
|
|
tablename2='all_fault_info'
|
|
|
DBRead = DBDw.DBDownload(host, port, db, user, password,mode)
|
|
|
with DBRead as DBRead:
|
|
|
- df_Diag_Ram = DBRead.getdata('start_time','end_time','product_id','code','level','info','advice','Batpos',tablename=tablename2,factory='',sn='',timename='',st='',sp='')
|
|
|
+ for i in range (0,len(factory_info)):
|
|
|
+ df_Diag_Ram_t = DBRead.getdata('start_time','end_time','product_id','code','level','info','advice','Batpos',tablename=tablename2,factory=factory_info[i],sn='',timename='',st='',sp='')
|
|
|
+ df_Diag_Ram=df_Diag_Ram.append(df_Diag_Ram_t)
|
|
|
df_Diag_Ram=df_Diag_Ram.dropna(axis=1,how='any')
|
|
|
df_Diag_Ram=df_Diag_Ram.reset_index(drop=True)
|
|
|
|
|
@@ -73,9 +77,10 @@ def diag_cal():
|
|
|
dbManager = DBManager.DBManager()
|
|
|
df_data = dbManager.get_data(sn=sn, start_time=start_time, end_time=end_time, data_groups=['bms'])
|
|
|
df_bms = df_data['bms']
|
|
|
- df_bms=df_bms.dropna(subset=['总电流[A]'])
|
|
|
- df_bms=df_bms.reset_index(drop=True)
|
|
|
- print(df_bms)
|
|
|
+ if not df_bms.empty:
|
|
|
+ df_bms=df_bms.dropna(subset=['总电流[A]'])
|
|
|
+ df_bms=df_bms.reset_index(drop=True)
|
|
|
+
|
|
|
#读取结果数据库数据........................................................................................................................................................
|
|
|
host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
|
|
|
port=3306
|
|
@@ -285,8 +290,8 @@ if __name__ == "__main__":
|
|
|
SNnums_C7255=SNdata_C7255['SN号'].tolist()
|
|
|
SNnums_U7255=SNdata_U7255['SN号'].tolist()
|
|
|
SNnums=SNnums_L7255 + SNnums_C7255 + SNnums_6040 + SNnums_4840 + SNnums_U7255+ SNnums_6060
|
|
|
- SNnums=['TJMCL120502305038','TJMCL120502305032','TJMCL120502305022','TJMCL120502305026','TJMCL120502305032','TJMCL120502305044','TJMCL120502305048','TJMCL120502305012','TJMCL120502305010']
|
|
|
- #SNnums = ['MGMLXN750N218N004'] #SNnums_6040
|
|
|
+ #SNnums=['TJMCL120502305038','TJMCL120502305032','TJMCL120502305022','TJMCL120502305026','TJMCL120502305032','TJMCL120502305044','TJMCL120502305048','TJMCL120502305012','TJMCL120502305010']
|
|
|
+ SNnums = ['PK504B10100004341'] #SNnums_6040
|
|
|
|
|
|
mylog=log.Mylog('log.txt','error')
|
|
|
mylog.logcfg()
|