南方电网标准版(紫晶版)初始带UKEY版通讯程序
V2.111 lijun	2021-06-04
1.修复历史实时数据记录是默认添加一组历史数据bug
2.修改记录历史放电数据时,同时记录一笔当前电池组的单体内阻数据
2个文件已添加
12个文件已修改
600 ■■■■■ 已修改文件
iec61850fornfdw_stand/bin/.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT$InsertDataToMysql_Task.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/battdata_rt/BattStatData.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/com/version_inf/version_inf.txt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/src/com/battdata_rt/BattData_RT.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/src/com/battdata_rt/BattData_RT_SQL.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/src/com/battdata_rt/BattStatData.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/src/com/dec/fbs9100/BattResStorePro_Thread.java 489 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/src/com/version_inf/version_inf.txt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iec61850fornfdw_stand/bin/.gitignore
New file
@@ -0,0 +1 @@
/com/
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT$InsertDataToMysql_Task.class
Binary files differ
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT.class
Binary files differ
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class
Binary files differ
iec61850fornfdw_stand/bin/com/battdata_rt/BattData_RT_SQL.class
Binary files differ
iec61850fornfdw_stand/bin/com/battdata_rt/BattStatData.class
Binary files differ
iec61850fornfdw_stand/bin/com/dec/fbs9100/main_BTS_APP_IEC61850.class
Binary files differ
iec61850fornfdw_stand/bin/com/version_inf/version_inf.txt
@@ -1,3 +1,7 @@
V2.110 lijun    2021-06-04    
协转V5.004   南网标准版+公司版UKEY
V2.111 lijun    2021-06-04
    1.修复历史实时数据记录是默认添加一组历史数据bug
    2.修改记录历史放电数据时,同时记录一笔当前电池组的单体内阻数据
iec61850fornfdw_stand/src/com/battdata_rt/BattData_RT.java
@@ -750,7 +750,11 @@
                        }
                    }
                    //------------------------------------------------------------//
                    sql_str = BattData_RT_SQL.getInsertOrUpdateBattTestDataInfStr(BattData_RT.this, test_stoptype_t);
                    /**
                    *     2021-08-17 edit @lijun 注释为原方法,下面的方法为了在记录历史放电放电数据时记录一笔当前电池组的内阻数据
                    */
                    //sql_str = BattData_RT_SQL.getInsertOrUpdateBattTestDataInfStr(BattData_RT.this, test_stoptype_t);
                    sql_str = BattData_RT_SQL.getInsertOrUpdateBattTestDataInfStr(m_Conn_Pool,BattData_RT.this, test_stoptype_t);
                    sql_v.sqlMysqlExecute(sql_str);
                    //------------------------------------------------------------//
                    sql_v.mysql_con.commit();
iec61850fornfdw_stand/src/com/battdata_rt/BattData_RT_SQL.java
@@ -6,6 +6,7 @@
import java.util.Date;
import com.base.Com;
import com.dec.fbs9100.BattResStorePro_Thread;
import com.dec.fbs9100.MysqlConnPool;
import com.dec.fbs9100.Sql_Mysql;
@@ -548,6 +549,96 @@
        return sql_str;
    }
    
    /**
     *
     *     @lijun 2021-08-16向tb_batttestdata_inf表中添加数据或者更新数据
     * @param rt_data
     * @return
     */
    public static String getInsertOrUpdateBattTestDataInfStr(MysqlConnPool pool,BattData_RT rt_data, int test_stoptype_t)
    {
        String sql_str = " ";
        BattStatData tmp_test_data = rt_data.mTestData.clone();
        tmp_test_data.test_stoptype = test_stoptype_t;
        if(false == rt_data.MysqlRecordInf_Exist)
        {
            sql_str = "INSERT INTO " + Sql_Mysql.BattTestDataInf_Table
                    + " (BattGroupId, "
                    + "test_record_count, "
                    + "test_type, "
                    + "record_time_interval, "
                    + "data_new, "
                    + "data_available, "
                    + "record_num, "
                    + "test_starttime, "
                    + "test_starttype, "
                    + "record_time, "
                    + "test_timelong, "
                    + "test_stoptype, "
                    + "group_vol, "
                    + "test_curr, "
                    + "test_cap, "
                    + "max_monnum, "
                    + "max_monvol, "
                    + "min_monnum, "
                    + "min_monvol) "
                    + " VALUES "
                    + "("+ rt_data.BattGroupId + ", "
                    + tmp_test_data.testRecordCount + ", "
                    + tmp_test_data.battTestType_For_DataSave + ", "
                    + rt_data.mSaveDataTimeInterval + ", "
                    + true + ", "
                    + true + ", "
                    + (tmp_test_data.recordNum + 1) + ", "
                    + "'" + Com.getDateTimeFormat(tmp_test_data.startTestTime, Com.DTF_YMDhms) + "', "
                    + tmp_test_data.testLoaderType + ", "
                    + "'" + Com.getDateTimeFormat(tmp_test_data.recordTime, Com.DTF_YMDhms) + "', "
                    + tmp_test_data.testTimeLong + ", "
                    + tmp_test_data.test_stoptype + ", "
                    + tmp_test_data.groupVol + ", "
                    + tmp_test_data.testCurr + ", "
                    + tmp_test_data.testCap + ", "
                    + rt_data.mMaxMonNum + ", "
                    + rt_data.mMaxMonVol + ", "
                    + rt_data.mMinMonNum + ", "
                    + rt_data.mMinMonVol + ") ";
            /**
             * 2021-08-16 @lijun    向插入batttestdata_inf表中插入历史数据时记录当前电池组的内阻数据
             *
             */
            BattResStorePro_Thread.insertMonDataToResTable(pool, rt_data, tmp_test_data.startTestTime, BattStatData.BATTDATA_RES);
        }
        else
        {
            sql_str = "UPDATE " + Sql_Mysql.BattTestDataInf_Table
                    + " SET "
                    + "test_type=" + tmp_test_data.battTestType_For_DataSave + ", "
                    + "record_time_interval=" + rt_data.mSaveDataTimeInterval + ", "
                    + "data_new=" + true + ", "
                    + "data_available=" + true + ", "
                    + "record_num=" + (tmp_test_data.recordNum + 1) + ", "
                    + "test_starttime='" +  Com.getDateTimeFormat(tmp_test_data.startTestTime, Com.DTF_YMDhms) + "', "
                    + "test_starttype=" + tmp_test_data.testLoaderType + ", "
                    + "record_time='" +  Com.getDateTimeFormat(tmp_test_data.recordTime, Com.DTF_YMDhms) + "', "
                    + "test_timelong=" + tmp_test_data.testTimeLong + ", "
                    + "test_stoptype=" + tmp_test_data.test_stoptype + ", "
                    + "group_vol=" + tmp_test_data.groupVol + ", "
                    + "test_curr=" + tmp_test_data.testCurrAbsMax + ", "
                    + "test_cap=" + tmp_test_data.testCap + ", "
                    + "max_monnum=" + rt_data.mMaxMonNum + ", "
                    + "max_monvol=" + rt_data.mMaxMonVol + ", "
                    + "min_monnum=" + rt_data.mMinMonNum + ", "
                    + "min_monvol=" + rt_data.mMinMonVol + " "
                    + " WHERE "
                    + " BattGroupId=" + rt_data.BattGroupId
                    + " AND "
                    //+ " test_starttime='" + Com.getDateTimeFormat(tmp_test_data.startTestTime, Com.DTF_YMDhms) + "'";
                    + " test_record_count=" + tmp_test_data.testRecordCount;
        }
        return sql_str;
    }
    
    /**
     * ��������������������rt_data����������������������������������������tb_batttestdata_id,tb_testdatastop_id,tb_batttestdata_inf��������������������������SQL���������������
iec61850fornfdw_stand/src/com/battdata_rt/BattStatData.java
@@ -75,6 +75,9 @@
    public float battRestCap;
    public int battRestTime;
    
    public int batt_res_test_cnt_last = 0;
    public int batt_res_test_cnt = 0;
    public int batt_res_test_state = 0;
    //--------------------------------//
    public BattStatData(int type, boolean syb_srv_curr_charge_dir_pos)
    {
iec61850fornfdw_stand/src/com/dec/fbs9100/BattResStorePro_Thread.java
New file
@@ -0,0 +1,489 @@
package com.dec.fbs9100;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;
import com.base.AppConfig;
import com.base.Com;
import com.battdata_rt.BattData_RT;
import com.battdata_rt.BattData_RT_Array;
import com.battdata_rt.BattStatData;
public class BattResStorePro_Thread extends Thread {
    private BattData_RT_Array m_Data;
    private MysqlConnPool m_Conn_Pool;
    //private int battResStoreDelayForTestManual = 1200;
    //private int mSaveBattResDayInterval = 7;
    //private Main_Com_Data m_Main_Com_Data = null;
    public BattResStorePro_Thread(MysqlConnPool pool, AppConfig cfg, BattData_RT_Array data)
    {
        m_Conn_Pool = pool;
        m_Data = data;
        //battResStoreDelayForTestManual = cfg.getBattResStoreDelayForTestManual();
        //mSaveBattResDayInterval = cfg.getBattResStoreDayInterval();
        //m_Main_Com_Data = Com_Data;
    }
    /**
     *     创建及添加数据到tb_battresdata_id表;添加数据,以及更新tb_battresdata_inf数据表,并且向表中添加数据
     * @param conn_pool
     * @param data_rt
     * @param test_type
     */
    public static void insertDataToResTable(MysqlConnPool conn_pool, BattData_RT data_rt, int test_type)
    {
        int mon_count = data_rt.MonCount;
        if(mon_count < 1)
            return;
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        String sql_str = null;
        try {
            sql.sqlMysqlUseDB(Sql_Mysql.DB_BATT_TESTDATA);
            boolean result = true;
            Date rc_time = new Date();
            String tb_name = "tb_BattResData_" + data_rt.BattGroupId;
            if(false == sql.sqlMysqlCheckIfTableExist(tb_name))
            {
                sql_str = "CREATE TABLE IF NOT EXISTS " + tb_name + " "
                        + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                        + "`BattGroupId` INT NOT NULL DEFAULT 0, "
                        + "`test_record_count` INT NOT NULL DEFAULT 0, "
                        + "`test_type` INT NOT NULL DEFAULT 0, "
                        + "`data_new` BOOLEAN NOT NULL DEFAULT false, "
                        + "`data_available` BOOLEAN NOT NULL DEFAULT false, "
                        + "`test_starttime` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                        + "`group_vol` FLOAT NOT NULL DEFAULT 0, "
                        + "`test_curr` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_num` INT NOT NULL DEFAULT 0, "
                        + "`mon_vol` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_tmp` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_res` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_ser` FLOAT NOT NULL DEFAULT 0, "
                        + "`conn_res` FLOAT NOT NULL DEFAULT 0, "
                        + "INDEX index_test_record_count (`test_record_count`), "
                        + "PRIMARY KEY (`num`));";
                //System.out.println(sql_str);
                sql.sqlMysqlExecute(sql_str);
            }
            int mtest_record_count = 0;//sql.getBattTestRecordCountNew(data_rt.BattGroupId, Sql_Mysql.BattResDataInf_Table);
            for(int c=0; c<3; c++)
            {
                try {
                    sql_str = "INSERT INTO " + tb_name + " "
                            + " (BattGroupId, "
                            + "test_record_count, "
                            + "test_type, "
                            + "data_new, "
                            + "data_available, "
                            + "test_starttime, "
                            + "group_vol, "
                            + "test_curr, "
                            + "mon_num, "
                            + "mon_vol,"
                            + "mon_tmp,"
                            + "mon_res,"
                            + "mon_ser,"
                            + "conn_res)"
                            + " VALUES ";
                    try {
                        for(int n=0; n<mon_count; n++) {
                            String tmp_sql_str = "("
                                        + data_rt.BattGroupId + ", "
                                        + mtest_record_count + ", "
                                        + test_type + ", "
                                        + true + ", "
                                        + true + ", "
                                        + "'" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                        + data_rt.mTestData.groupVol + ", "
                                        + data_rt.mTestData.testCurr + ", "
                                        + ((n+1)*10 + 1) + ", "
                                        + data_rt.al_MonVol.get(n).monVol + ","
                                        + data_rt.al_MonVol.get(n).monTmp + ","
                                        + data_rt.al_MonVol.get(n).monRes + ","
                                        + data_rt.al_MonVol.get(n).monSer + ","
                                        + data_rt.al_MonVol.get(n).connRes
                                        + ")";
                            if(n > 0) {
                                sql_str += ", ";
                            }
                            sql_str += tmp_sql_str;
                        }
                    } catch (Exception e) {
                        System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
                    }
                    String sql_str2 = "INSERT INTO " + Sql_Mysql.BattResDataInf_Table
                                + " (BattGroupId, "
                                + "test_record_count, "
                                + "test_type, "
                                + "data_new, "
                                + "data_available, "
                                + "test_starttime, "
                                + "test_devtype, "
                                + "record_time, "
                                + "group_vol, "
                                + "test_curr, "
                                + "upload_usr_id) "
                                + " VALUES "
                                + "("+ data_rt.BattGroupId + ", "
                                + mtest_record_count + ", "
                                + test_type + ", "
                                + true + ", "
                                + true + ", "
                                + "'" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                + 0 + ", "
                                + "'" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "', "
                                + 0 + ", "
                                + 0 + ", "
                                + 0 + ") ";
                    if(1 == mtest_record_count) {
                        sql_str2 = "UPDATE " + Sql_Mysql.BattResDataInf_Table + " SET "
                                + "test_type=" + test_type + ", "
                                + "data_new=" + true + ", "
                                + "data_available=" + true + ", "
                                + "test_starttime='" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                + "test_devtype=" + 0 + ", "
                                + "record_time='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "', "
                                + "group_vol=" + 0 + ", "
                                + "test_curr=" + 0 + ", "
                                + "upload_usr_id=" + 0 + " "
                                + " WHERE BattGroupId=" + data_rt.BattGroupId
                                + " AND test_record_count=" + mtest_record_count;
                    }
                    //System.out.println(sql_str);
                    //System.out.println(sql_str2);
                    sql.mysql_con.setAutoCommit(false);
                    sql.sqlMysqlExecute(sql_str);
                    sql.sqlMysqlExecute(sql_str2);
                    sql.mysql_con.commit();
                } catch (SQLException e) {
                    sql.mysql_con.rollback();
                    //System.out.println(sql_str);
                    System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
                    result = false;
                } finally {
                    sql.mysql_con.setAutoCommit(true);
                    if(true == result)
                    {
                        break;
                    }
                    else
                    {
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e) {
                            System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
                        }
                    }
                }
            }
        } catch (SQLException e) {
            System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
        } finally {
            sql.close_con();
        }
    }
    /**
     *
     *     @lijun  2021-08-16 重写记录单体内阻数据方法,为记录放电数据时记录当前单体的内阻数据
     *
     *     创建及添加数据到tb_battresdata_id表;添加数据,以及更新tb_battresdata_inf数据表,并且向表中添加数据
     * @param conn_pool
     * @param data_rt
     * @param test_type
     */
    public static void insertMonDataToResTable(MysqlConnPool conn_pool, BattData_RT data_rt,Date test_starttime, int test_type)
    {
        int mon_count = data_rt.MonCount;
        if(mon_count < 1)
            return;
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        String sql_str = null;
        try {
            sql.sqlMysqlUseDB(Sql_Mysql.DB_BATT_TESTDATA);
            boolean result = true;
            Date rc_time = test_starttime;
            String tb_name = "tb_BattResData_" + data_rt.BattGroupId;
            if(false == sql.sqlMysqlCheckIfTableExist(tb_name))
            {
                sql_str = "CREATE TABLE IF NOT EXISTS " + tb_name + " "
                        + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                        + "`BattGroupId` INT NOT NULL DEFAULT 0, "
                        + "`test_record_count` INT NOT NULL DEFAULT 0, "
                        + "`test_type` INT NOT NULL DEFAULT 0, "
                        + "`data_new` BOOLEAN NOT NULL DEFAULT false, "
                        + "`data_available` BOOLEAN NOT NULL DEFAULT false, "
                        + "`test_starttime` DATETIME NOT NULL DEFAULT '1982-01-01 00:00:00', "
                        + "`group_vol` FLOAT NOT NULL DEFAULT 0, "
                        + "`test_curr` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_num` INT NOT NULL DEFAULT 0, "
                        + "`mon_vol` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_tmp` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_res` FLOAT NOT NULL DEFAULT 0, "
                        + "`mon_ser` FLOAT NOT NULL DEFAULT 0, "
                        + "`conn_res` FLOAT NOT NULL DEFAULT 0, "
                        + "INDEX index_test_record_count (`test_record_count`), "
                        + "PRIMARY KEY (`num`));";
                //System.out.println(sql_str);
                sql.sqlMysqlExecute(sql_str);
            }
            int mtest_record_count = 0;//sql.getBattTestRecordCountNew(data_rt.BattGroupId, Sql_Mysql.BattResDataInf_Table);
            for(int c=0; c<3; c++)
            {
                try {
                    sql_str = "INSERT INTO " + tb_name + " "
                            + " (BattGroupId, "
                            + "test_record_count, "
                            + "test_type, "
                            + "data_new, "
                            + "data_available, "
                            + "test_starttime, "
                            + "group_vol, "
                            + "test_curr, "
                            + "mon_num, "
                            + "mon_vol,"
                            + "mon_tmp,"
                            + "mon_res,"
                            + "mon_ser,"
                            + "conn_res)"
                            + " VALUES ";
                    try {
                        for(int n=0; n<mon_count; n++) {
                            String tmp_sql_str = "("
                                        + data_rt.BattGroupId + ", "
                                        + mtest_record_count + ", "
                                        + test_type + ", "
                                        + true + ", "
                                        + true + ", "
                                        + "'" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                        + data_rt.mTestData.groupVol + ", "
                                        + data_rt.mTestData.testCurr + ", "
                                        + ((n+1)*10 + 1) + ", "
                                        + data_rt.al_MonVol.get(n).monVol + ","
                                        + data_rt.al_MonVol.get(n).monTmp + ","
                                        + data_rt.al_MonVol.get(n).monRes + ","
                                        + data_rt.al_MonVol.get(n).monSer + ","
                                        + data_rt.al_MonVol.get(n).connRes
                                        + ")";
                            if(n > 0) {
                                sql_str += ", ";
                            }
                            sql_str += tmp_sql_str;
                        }
                    } catch (Exception e) {
                        System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
                    }
                    String sql_str2 = "INSERT INTO " + Sql_Mysql.BattResDataInf_Table
                                + " (BattGroupId, "
                                + "test_record_count, "
                                + "test_type, "
                                + "data_new, "
                                + "data_available, "
                                + "test_starttime, "
                                + "test_devtype, "
                                + "record_time, "
                                + "group_vol, "
                                + "test_curr, "
                                + "upload_usr_id) "
                                + " VALUES "
                                + "("+ data_rt.BattGroupId + ", "
                                + mtest_record_count + ", "
                                + test_type + ", "
                                + true + ", "
                                + true + ", "
                                + "'" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                + 0 + ", "
                                + "'" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                + 0 + ", "
                                + 0 + ", "
                                + 0 + ") ";
                    if(1 == mtest_record_count) {
                        sql_str2 = "UPDATE " + Sql_Mysql.BattResDataInf_Table + " SET "
                                + "test_type=" + test_type + ", "
                                + "data_new=" + true + ", "
                                + "data_available=" + true + ", "
                                + "test_starttime='" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                + "test_devtype=" + 0 + ", "
                                + "record_time='" + Com.getDateTimeFormat(rc_time, Com.DTF_YMDhms) + "', "
                                + "group_vol=" + 0 + ", "
                                + "test_curr=" + 0 + ", "
                                + "upload_usr_id=" + 0 + " "
                                + " WHERE BattGroupId=" + data_rt.BattGroupId
                                + " AND test_record_count=" + mtest_record_count;
                    }
                    //System.out.println(sql_str);
                    //System.out.println(sql_str2);
                    sql.mysql_con.setAutoCommit(false);
                    sql.sqlMysqlExecute(sql_str);
                    sql.sqlMysqlExecute(sql_str2);
                    sql.mysql_con.commit();
                } catch (SQLException e) {
                    sql.mysql_con.rollback();
                    //System.out.println(sql_str);
                    System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
                    result = false;
                } finally {
                    sql.mysql_con.setAutoCommit(true);
                    if(true == result)
                    {
                        break;
                    }
                    else
                    {
                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e) {
                            System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
                        }
                    }
                }
            }
        } catch (SQLException e) {
            System.err.println("BattResStorePro_Thread.insertDataToResTable():" + e.toString());
        } finally {
            sql.close_con();
        }
    }
    //-----------------------------------------------------------------------------//
    @Override
    public void run() {
        System.out.println("BattResStorePro_Thread Started ...");
        try {
            for(int s=0; s<6; s++) {
                sleep(1000);
            }
        } catch (InterruptedException e) {
            System.err.println(e.toString());
        }
        while(true) {
            try {
                sleep(2000);
                for(int n=0; n<m_Data.getItemCount(); n++) {
                    BattData_RT rt_data = m_Data.getItem(n);
                    if(((rt_data.FBSDeviceId/1000000) != 910)
                            && ((rt_data.FBSDeviceId/1000000) != 911)
                            && ((rt_data.FBSDeviceId/1000000) != 91)
                            && ((rt_data.FBSDeviceId/10000) != 9600)
                            && ((rt_data.FBSDeviceId/10000) != 9610)
                            && ((rt_data.FBSDeviceId/100000) != 9616)
                            && ((rt_data.FBSDeviceId/100000) != 3601)) //技术部7寸显示屏
                    {
                        get_MonData_From_BattData_RT_RamDB_Table(m_Conn_Pool, rt_data);
                        get_ResTestState_From_FBS9100State_RT_RamDB_Table(m_Conn_Pool, rt_data);
                    }
                    if(0x00 == rt_data.mTestData.batt_res_test_state) {
                        try {
                            if(rt_data.al_MonVol.size() > 0) {
                                if(rt_data.al_MonVol.get(0).monRes > 0) {
                                    if(rt_data.mTestData.batt_res_test_cnt_last != rt_data.mTestData.batt_res_test_cnt) {
                                        rt_data.mTestData.batt_res_test_cnt_last = rt_data.mTestData.batt_res_test_cnt;
                                        if(rt_data.mTestData.batt_res_test_cnt > 0) {
                                            rt_data.setStoreBattRes_DataEnStat(true);
                                        }
                                    }
                                }
                            }
                        } catch (Exception e) {
                            System.err.println(e.toString());
                        }
                    }
                    if(true == rt_data.getStoreBattRes_DataEnStat()) {
                        System.out.println("dev_id:" + rt_data.FBSDeviceId + " bg_id:" + rt_data.BattGroupId
                                    + " Insert Batt Res Data Into DB");
                        insertDataToResTable(m_Conn_Pool, rt_data, BattStatData.BATTDATA_RES);
                        rt_data.setStoreBattRes_DataEnStat(false);
                    }
                }
                //------------------------------------------------------------------------//
            } catch (InterruptedException e) {
                System.err.println(e.toString());
            }
        }
    }
    public static void get_MonData_From_BattData_RT_RamDB_Table(MysqlConnPool conn_pool, BattData_RT bd_rt)
    {
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try  {
            String sql_str = "SELECT mon_num,mon_vol,mon_tmp,mon_res,mon_ser,mon_conn_res FROM " + Sql_Mysql.BattRtData_Table
                            + " WHERE BattGroupId=" + bd_rt.BattGroupId
                            + " ORDER BY mon_num ASC";
            //System.out.println(sql_str);
            ResultSet res = sql.sqlMysqlQuery(sql_str);
            try {
                while(res.next()) {
                    int mon_index = res.getInt("mon_num");
                    if(mon_index > 0) {
                        mon_index -= 1;
                    }
                    if(mon_index < bd_rt.al_MonVol.size()) {
                        bd_rt.al_MonVol.get(mon_index).monVol = res.getFloat("mon_vol");
                        bd_rt.al_MonVol.get(mon_index).monTmp = res.getFloat("mon_tmp");
                        bd_rt.al_MonVol.get(mon_index).monRes = res.getFloat("mon_res");
                        bd_rt.al_MonVol.get(mon_index).monSer = res.getFloat("mon_ser");
                        bd_rt.al_MonVol.get(mon_index).connRes = res.getFloat("mon_conn_res");
                    }
                }
            } catch (Exception e) {
                System.err.println("InsertDataToMysql_Task_SQL.get_MonData_From_BattData_RT_RamDB_Table():" + e.toString());
            }
            res.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            System.err.println("InsertDataToMysql_Task_SQL.get_MonData_From_BattData_RT_RamDB_Table():" + e.toString());
        } finally {
            sql.close_con();
        }
    }
    /************************************************************************************************/
    public static void get_ResTestState_From_FBS9100State_RT_RamDB_Table(MysqlConnPool conn_pool, BattData_RT bd_rt)
    {
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        try  {
            String sql_str = "SELECT dev_res_test_state,dev_restest_count FROM " + Sql_Mysql.FBS9100State_Table
                            + " WHERE dev_id=" + bd_rt.FBSDeviceId;
            //System.out.println(sql_str);
            ResultSet res = sql.sqlMysqlQuery(sql_str);
            if(res.next()) {
                bd_rt.mTestData.batt_res_test_state = res.getInt("dev_res_test_state");
                bd_rt.mTestData.batt_res_test_cnt = res.getInt("dev_restest_count");
            }
            res.close();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            System.err.println("InsertDataToMysql_Task_SQL.get_ResTestState_From_FBS9100State_RT_RamDB_Table():" + e.toString());
        } finally {
            sql.close_con();
        }
    }
}
iec61850fornfdw_stand/src/com/dec/fbs9100/main_BTS_APP_IEC61850.java
@@ -27,7 +27,7 @@
    /**************************************************************************/
    /**************************************************************************/
    public final static boolean app_debug = false;
    public final static double m_VersionNum = 2.110;
    public final static double m_VersionNum = 2.111;
    public final static String m_Version = "Welcome To Use BattMonitor_BTS_IEC61850 V" 
                                            + m_VersionNum + " RC_20180907";
    /**************************************************************************/
iec61850fornfdw_stand/src/com/version_inf/version_inf.txt
@@ -1,3 +1,7 @@
V2.110 lijun    2021-06-04    
协转V5.004   南网标准版+公司版UKEY
V2.111 lijun    2021-06-04
    1.修复历史实时数据记录是默认添加一组历史数据bug
    2.修改记录历史放电数据时,同时记录一笔当前电池组的单体内阻数据