Procházet zdrojové kódy

update upload,chnge k to K,add uploaderrtest file

Eric412V před 2 roky
rodič
revize
8c0abeec33

+ 51 - 0
LIB/MIDDLE/SaftyCenter/DataDiag_Static/BMSuploaderrortest.py

@@ -0,0 +1,51 @@
+
+__author__ = 'lmstack'
+#coding=utf-8
+import os
+import datetime
+import pandas as pd
+from LIB.BACKEND import DBManager, Log
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+import time, datetime
+import dateutil.relativedelta
+import traceback
+from LIB.MIDDLE.CellStateEstimation.Common import log
+from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import DBDownload as DBDownload
+import time, datetime
+from pandas.core.frame import DataFrame
+from apscheduler.schedulers.blocking import BlockingScheduler
+from LIB.MIDDLE.SaftyCenter.DataDiag_Static.DataStatistics import DataSta
+from LIB.MIDDLE.SaftyCenter.DataDiag_Static.SC_CtrlSafty import CtrlSafty
+from LIB.MIDDLE.SaftyCenter.DataDiag_Static.DiagDataMerge import DiagDataMerge
+from LIB.MIDDLE.SaftyCenter.DataDiag_Static.SC_SamplingSafty import SamplingSafty
+from LIB.MIDDLE.SaftyCenter.DataDiag_Static.SC_BMSUploadError import BMSReportError
+from LIB.MIDDLE.SaftyCenter.DataDiag_Static import CBMSBatDiag
+from LIB.MIDDLE.SaftyCenter.Common import DBDownload as DBDw
+from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import BatParam as QX_BatteryParam
+from urllib import parse
+import pymysql
+
+# 故障映射表
+host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
+port=3306
+db='algo_dict'
+user='qx_algo_rw'
+password=parse.quote_plus('qx@123456')
+db_engine = create_engine(
+    "mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(
+        user, password, host, port, db
+    ))
+
+errorcode_map = pd.read_sql("select * from faultcode_map", db_engine)
+db_engine.dispose()
+sn = 'PK504B10100004349'
+start_time = '2021-12-30 18:00:04'
+end_time = '2021-12-30 18:15:04'
+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)
+df_Diag_Batdiag_update=BMSReportError.main(sn,df_bms,pd.DataFrame(),1,errorcode_map)
+print(df_Diag_Batdiag_update)

+ 1 - 1
LIB/MIDDLE/SaftyCenter/DataDiag_Static/SC_BMSUploadError.py

@@ -79,7 +79,7 @@ class BMSReportError:
                         # DbSession = sessionmaker(bind=db_engine)
 
                         # errorcode_map = pd.read_sql("select * from faultcode_map", db_engine)
-                        # if 'k50' in sn:
+                        # if 'K50' in sn:
                         #     FactoryType=1
                         # elif 'MGMCL' in sn or 'UD' in sn:
                         #     FactoryType=2