|
@@ -11,30 +11,52 @@ import datacompy
|
|
|
from LIB.MIDDLE.SaftyCenter.Common import QX_BatteryParam
|
|
|
from LIB.MIDDLE.SaftyCenter.Common import DBDownload as DBDw
|
|
|
from low_soc_alarm import Low_soc_alarm
|
|
|
+import pymysql
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
def Low_Soc_Alarm():
|
|
|
end_time=datetime.datetime.now()
|
|
|
start_time=end_time-datetime.timedelta(days=1)
|
|
|
start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
#-------------------------读取数据-------------------------------------------------------------------
|
|
|
- excelpath=r'D:\ZLWORK\code\data_analyze_platform\USER\eric\SaftyCenter_CODE_V1\sn-20210903.xlsx'
|
|
|
- SNdata_6060 = pd.read_excel(excelpath, sheet_name='科易6060')
|
|
|
- SNdata_6040 = pd.read_excel(excelpath, sheet_name='科易6040')
|
|
|
- SNdata_4840 = pd.read_excel(excelpath, sheet_name='科易4840')
|
|
|
- SNdata_L7255 = pd.read_excel(excelpath, sheet_name='格林美-力信7255')
|
|
|
- SNdata_C7255 = pd.read_excel(excelpath, sheet_name='格林美-CATL7255')
|
|
|
- SNdata_U7255 = pd.read_excel(excelpath, sheet_name='优旦7255')
|
|
|
- SNnums_6060=SNdata_6060['SN号'].tolist()
|
|
|
- SNnums_6040=SNdata_6040['SN号'].tolist()
|
|
|
- SNnums_4840=SNdata_4840['SN号'].tolist()
|
|
|
- SNnums_L7255=SNdata_L7255['SN号'].tolist()
|
|
|
- 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
|
|
|
+ host='rm-bp10j10qy42bzy0q7.mysql.rds.aliyuncs.com'
|
|
|
+ port=3306
|
|
|
+ db='qixiang_oss'
|
|
|
+ user='qixiang_oss'
|
|
|
+ password='Qixiang2021'
|
|
|
+ conn = pymysql.connect(host=host, port=port, user=user, password=password, database=db)
|
|
|
+ cursor = conn.cursor()
|
|
|
+ cursor.execute("select sn from app_device")
|
|
|
+ res = cursor.fetchall()
|
|
|
+ df_sn = pd.DataFrame(res, columns=['sn'])
|
|
|
+ df_sn = df_sn.reset_index(drop=True)
|
|
|
+ conn.close();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ # excelpath=r'D:\ZLWORK\code\data_analyze_platform\USER\eric\SaftyCenter_CODE_V1\sn-20210903.xlsx'
|
|
|
+ # SNdata_6060 = pd.read_excel(excelpath, sheet_name='科易6060')
|
|
|
+ # SNdata_6040 = pd.read_excel(excelpath, sheet_name='科易6040')
|
|
|
+ # SNdata_4840 = pd.read_excel(excelpath, sheet_name='科易4840')
|
|
|
+ # SNdata_L7255 = pd.read_excel(excelpath, sheet_name='格林美-力信7255')
|
|
|
+ # SNdata_C7255 = pd.read_excel(excelpath, sheet_name='格林美-CATL7255')
|
|
|
+ # SNdata_U7255 = pd.read_excel(excelpath, sheet_name='优旦7255')
|
|
|
+ # SNnums_6060=SNdata_6060['SN号'].tolist()
|
|
|
+ # SNnums_6040=SNdata_6040['SN号'].tolist()
|
|
|
+ # SNnums_4840=SNdata_4840['SN号'].tolist()
|
|
|
+ # SNnums_L7255=SNdata_L7255['SN号'].tolist()
|
|
|
+ # 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=['MGMCLN750N215I009']
|
|
|
+ #SNnums=df_sn
|
|
|
#-------------------------执行循环----------------------------------------------------------------------
|
|
|
low_soc_bat_list=DataFrame(columns=['sn','time','level'])
|
|
|
- for sn in SNnums:#SN遍历
|
|
|
+ for sn in df_sn['sn']:#SN遍历
|
|
|
print(sn)
|
|
|
if 'PK500' in sn:
|
|
|
celltype=1 #6040三元电芯
|
|
@@ -71,11 +93,12 @@ def Low_Soc_Alarm():
|
|
|
|
|
|
#执行主程序-------------------------------------------------------------------------------------------
|
|
|
low_soc_bat_list=Low_soc_alarm.low_soc_alarm(param,df_bms,low_soc_bat_list,sn,df_OprtnSta)
|
|
|
-
|
|
|
+ if len(low_soc_bat_list):
|
|
|
+ print(low_soc_bat_list)
|
|
|
|
|
|
return low_soc_bat_list
|
|
|
-mylog=log.Mylog('log_diag.txt','error')
|
|
|
-mylog.logcfg()
|
|
|
+# mylog=log.Mylog('log_diag.txt','error')
|
|
|
+# mylog.logcfg()
|
|
|
|
|
|
|
|
|
try:
|
|
@@ -83,4 +106,4 @@ try:
|
|
|
low_soc_bat_list.to_excel('low_soc_bat_list.xlsx')
|
|
|
except Exception as e:
|
|
|
print(repr(e))
|
|
|
- mylog.logopt(e)
|
|
|
+ # mylog.logopt(e)
|