package com.dev.btse.comm;
|
|
import java.sql.ResultSet;
|
import java.sql.SQLException;
|
import java.util.ArrayList;
|
import java.util.Date;
|
|
import com.battmonitor.base.Com;
|
import com.battmonitor.data.BattData_RT;
|
import com.battmonitor.sql.MysqlConnPool;
|
import com.battmonitor.sql.Sql_Mysql;
|
import com.dev.btse.data.FBS9100S_NT_DCDC_Data;
|
import com.dev.btse.data.FBS9100S_NT_DCDC_State;
|
import com.dev.btse.data.FBS9100_CMCC_Power;
|
import com.dev.btse.data.FBS9100_ComBase;
|
import com.dev.btse.data.FBS9100_ParamBatt;
|
import com.dev.btse.data.FBS9100_ParamDischarge;
|
import com.dev.btse.data.FBS9100_ParamSystem;
|
import com.dev.btse.data.FBS9100_StatAndParam;
|
import com.dev.btse.data.FBS9100_VCData;
|
|
public class FBS9100_Task_Thread_SQL {
|
|
/**
|
* ´´½¨ tb_fbs9100_state ±í²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100StateTableOnRam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100State_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100State_Table
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
|
+ "`dev_version` varchar(20) NOT NULL DEFAULT '0', "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`op_cmd` INT NOT NULL DEFAULT 0, "
|
+ "`record_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
|
+ "`dev_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
|
+ "`dev_testtype` INT NOT NULL DEFAULT 0, "
|
+ "`dev_testgroupnum` INT NOT NULL DEFAULT 0, "
|
+ "`dev_workstate` INT NOT NULL DEFAULT 0, "
|
+ "`dev_alarmstate` INT NOT NULL DEFAULT 0, "
|
+ "`dev_temp` float NOT NULL DEFAULT 0, "
|
+ "`dev_res_test_state` INT NOT NULL DEFAULT 0, " //ÄÚ×è²âÊÔ״̬
|
+ "`dev_onlinevollow` BOOLEAN NOT NULL DEFAULT false, "
|
+ "`dev_eachgroup_battsum` INT NOT NULL DEFAULT 0, "
|
+ "`dev_captest_onlinevol` float NOT NULL DEFAULT 0, "
|
+ "`dev_captest_groupvol` float NOT NULL DEFAULT 0, "
|
+ "`dev_captest_curr` float NOT NULL DEFAULT 0, "
|
+ "`dev_captest_cap` float NOT NULL DEFAULT 0, "
|
+ "`dev_captest_timelong` INT NOT NULL DEFAULT 0, "
|
+ "`dev_restest_count` INT NOT NULL DEFAULT 0, "
|
+ "`dev_restest_moncount` INT NOT NULL DEFAULT 0, "
|
+ "`dev_restest_monindex` INT NOT NULL DEFAULT 0, "
|
+ "`dev_commcount` INT NOT NULL DEFAULT 0, "
|
+ "`dev_errcommcount` INT NOT NULL DEFAULT 0, "
|
+ "`dev_rxnullerrcount` INT NOT NULL DEFAULT 0, "
|
|
+ "`dev_last_captest_stop_type` INT NOT NULL DEFAULT 0, "
|
+ "`dev_concurr` float NOT NULL DEFAULT 0, "
|
+ "`dev_condvoldp` float NOT NULL DEFAULT 0, "
|
+ "`dev_conresist` float NOT NULL DEFAULT 0, "
|
+ "`dev_condcurr` float NOT NULL DEFAULT 0, "
|
+ "`dev_61850alarms` varchar(64) NOT NULL DEFAULT '', "
|
|
+ " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=InnoDB DEFAULT CHARSET=utf8";
|
|
String str3 = "";
|
if(al_param.size() > 0) {
|
str3 = "INSERT INTO " + Sql_Mysql.FBS9100State_Table
|
+ " (dev_ip, dev_id) VALUES";
|
}
|
for(int n=0; n<al_param.size(); n++)
|
{
|
if(n > 0) {
|
str3 += ", ";
|
}
|
str3 += " ('" + al_param.get(n).dev_ipaddr + "'," + al_param.get(n).dev_id + ")";
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
if(str3.length() > 0) {
|
sql.sqlMysqlExecute(str3);
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100s_dcdc_data ±í²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100S_DCDC_DataTableOnRam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100S_DcDcState_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100S_DcDcState_Table
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`dcdc_num` BIGINT NOT NULL DEFAULT 0, "
|
+ "`dcdc_Vsys` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_Vout` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_Vbat` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_Iout` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_Ibuck` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_Tmp_Dis` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_Tmp_Chr` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_SMR_Alarm1` INT NOT NULL DEFAULT 0, "
|
+ "`dcdc_SMR_Alarm2` INT NOT NULL DEFAULT 0, "
|
+ "`dcdc_version` INT NOT NULL DEFAULT 0, "
|
+ "`dcdc_ModeSetComm` INT NOT NULL DEFAULT 0, "
|
+ "`dcdc_RunSetComm` INT NOT NULL DEFAULT 0, "
|
+ "`dcdc_BuckISet` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_DisVolSet` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_DisCurrSet` float NOT NULL DEFAULT 0, "
|
+ "`dcdc_CommTxCnt` INT NOT NULL DEFAULT 0, "
|
+ "`dcdc_CommRxCnt` INT NOT NULL DEFAULT 0, "
|
+ " UNIQUE INDEX index_dcdc_num_uniq (`dcdc_num`), "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=MEMORY DEFAULT CHARSET=utf8";
|
|
String str3 = "";
|
if(al_param.size() > 0) {
|
str3 = "INSERT INTO " + Sql_Mysql.FBS9100S_DcDcState_Table
|
+ " (dev_id) VALUES";
|
}
|
for(int n=0; n<al_param.size(); n++)
|
{
|
if(n > 0) {
|
str3 += ", ";
|
}
|
str3 += " (" + al_param.get(n).dev_id + ")";
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
if(str3.length() > 0) {
|
sql.sqlMysqlExecute(str3);
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ½«É豸idºÍÉ豸ip²åÈë»òÕ߸üе½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
/*
|
public static void insertorupdateFBS9100StateTableOnRam(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String str1 = "";
|
String str2 = "";
|
String str3 = "";
|
if(param != null) {
|
str1 = "SELECT num,dev_id,dev_errcommcount,dev_commcount from " +Sql_Mysql.FBS9100State_Table+ " where dev_id = " + param.dev_id;
|
str2 = "INSERT INTO " + Sql_Mysql.FBS9100State_Table
|
+ " (dev_ip, dev_id) VALUES";
|
str2 += " ('" + param.dev_ipaddr + "'," + param.dev_id + ")";
|
|
str3 = "UPDATE " +Sql_Mysql.FBS9100State_Table+ " SET dev_ip = '"+param.dev_ipaddr+"' where dev_id = " + param.dev_id;
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
if(param != null){
|
ResultSet rs = sql.sqlMysqlQuery(str1);
|
if(rs.next()){
|
param.m_FBS_VCData.m_SysState.ErrCommCount = rs.getInt("dev_errcommcount");
|
param.m_FBS_VCData.m_SysState.CommCount = rs.getInt("dev_commcount");
|
sql.sqlMysqlExecute(str3);
|
}else{
|
sql.sqlMysqlExecute(str2);
|
}
|
}
|
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
*/
|
/**
|
* ´´½¨ tb_fbs9100_setparam ±í£¬²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100SetTestParamTableOnRam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SetParam_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SetParam_Table
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`op_cmd` INT NOT NULL DEFAULT 0, "
|
+ "`TestCmd` INT NOT NULL DEFAULT 0, "
|
+ "`HourRate` INT NOT NULL DEFAULT 0, "
|
+ "`DisCurr` FLOAT NOT NULL DEFAULT 0, "
|
+ "`DisCap` FLOAT NOT NULL DEFAULT 0, "
|
+ "`DisTime` INT NOT NULL DEFAULT 0, "
|
+ "`GroupVol_LOW` FLOAT NOT NULL DEFAULT 0, "
|
+ "`MonomerVol_LOW` FLOAT NOT NULL DEFAULT 0, "
|
+ "`MonomerLowCount` INT NOT NULL DEFAULT 0, "
|
+ "`BattGroupNum` INT NOT NULL DEFAULT 0, "
|
+ "`OnlineVolLowAction` INT NOT NULL DEFAULT 0, "
|
+ "`DCVolHighLimit` FLOAT NOT NULL DEFAULT 0, "
|
+ "`ChargeCurrSet` FLOAT NOT NULL DEFAULT 0, "
|
+ "`MonomerTmp_High` FLOAT NOT NULL DEFAULT 0, "
|
+ " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=MEMORY DEFAULT CHARSET=utf8";
|
|
String str3 = "";
|
if(al_param.size() > 0) {
|
str3 = "INSERT INTO " + Sql_Mysql.FBS9100SetParam_Table
|
+ " (dev_ip, dev_id) VALUES";
|
}
|
for(int n=0; n<al_param.size(); n++)
|
{
|
if(n > 0) {
|
str3 += ", ";
|
}
|
str3 += " ('" + al_param.get(n).dev_ipaddr + "'," + al_param.get(n).dev_id + ")";
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
if(str3.length() > 0) {
|
sql.sqlMysqlExecute(str3);
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ´´½¨ tb_fbs9100_system_param ±í£¬²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100SystemParamTableOnRam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SysParam_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SysParam_Table
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`op_cmd` INT NOT NULL DEFAULT 0, "
|
+ "`IPADDR` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
|
+ "`SubIPADDR` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
|
+ "`NetGateADDR` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
|
+ "`GroupVolRange` INT NOT NULL DEFAULT 0, "
|
+ "`GroupVolSorce` INT NOT NULL DEFAULT 0, "
|
+ "`CurrentRange` INT NOT NULL DEFAULT 0, "
|
+ "`CurrentTyte` INT NOT NULL DEFAULT 0, "
|
+ "`MonomerOrder` INT NOT NULL DEFAULT 0, "
|
+ "`BackLightTime` INT NOT NULL DEFAULT 0, "
|
+ "`MACADDR` varchar(30) NOT NULL DEFAULT '0.0.0.0.0.0', "
|
+ "`LoaderCount` INT NOT NULL DEFAULT 0, "
|
+ "`DtCardCount` INT NOT NULL DEFAULT 0, "
|
+ "`PowerBreakChargeCurr` FLOAT NOT NULL DEFAULT 0, "
|
+ "`MajorBattGroupNum` INT NOT NULL DEFAULT 0, "
|
+ "`POF_BG_Boost_Cnt` INT NOT NULL DEFAULT 0, "
|
+ "`POF_BG_Boost_VolStop` FLOAT NOT NULL DEFAULT 0, "
|
+ "`POF_BG_Boost_VolStart` FLOAT NOT NULL DEFAULT 0, "
|
+ " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=MEMORY DEFAULT CHARSET=utf8";
|
|
String str3 = "";
|
if(al_param.size() > 0) {
|
str3 = "INSERT INTO " + Sql_Mysql.FBS9100SysParam_Table
|
+ " (dev_ip, dev_id) VALUES";
|
}
|
for(int n=0; n<al_param.size(); n++)
|
{
|
if(n > 0) {
|
str3 += ", ";
|
}
|
str3 += " ('" + al_param.get(n).dev_ipaddr + "'," + al_param.get(n).dev_id + ")";
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
if(str3.length() > 0) {
|
sql.sqlMysqlExecute(str3);
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ½«É豸idºÍÉ豸ip²åÈë»òÕ߸üе½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
/*
|
public static void insertorupdateFBS9100SetTestParamTableOnRam(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String str1 = "";
|
String str2 = "";
|
String str3 = "";
|
if(param != null) {
|
str1 = "SELECT num,dev_id from " +Sql_Mysql.FBS9100SetParam_Table+ " where dev_id = " + param.dev_id;
|
|
str2 = "INSERT INTO " + Sql_Mysql.FBS9100SetParam_Table
|
+ " (dev_ip, dev_id) VALUES";
|
|
str2 += " ('" + param.dev_ipaddr + "'," + param.dev_id + ")";
|
|
str3 = "UPDATE " +Sql_Mysql.FBS9100SetParam_Table+ " SET dev_ip = '"+param.dev_ipaddr+"' where dev_id = " + param.dev_id;
|
}
|
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
if(param != null){
|
ResultSet rs = sql.sqlMysqlQuery(str1);
|
if(rs.next()){
|
sql.sqlMysqlExecute(str3);
|
}else{
|
sql.sqlMysqlExecute(str2);
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
*/
|
/**
|
* ´´½¨ Sql_Mysql.RamDB_CMCC_POWER_Data ±í²¢ÇÒ½«É豸id²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100CmccPowerDataOnRam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.RamDB_CMCC_POWER_Data;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.RamDB_CMCC_POWER_Data
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`vol1` float NOT NULL DEFAULT 0, "
|
+ "`vol2` float NOT NULL DEFAULT 0, "
|
+ "`vol3` float NOT NULL DEFAULT 0, "
|
+ "`vol4` float NOT NULL DEFAULT 0, "
|
+ "`vol5` float NOT NULL DEFAULT 0, "
|
+ "`curr1` float NOT NULL DEFAULT 0, "
|
+ "`curr2` float NOT NULL DEFAULT 0, "
|
+ "`curr3` float NOT NULL DEFAULT 0, "
|
+ "`curr4` float NOT NULL DEFAULT 0, "
|
+ "`curr5` float NOT NULL DEFAULT 0, "
|
+ " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=InnoDB DEFAULT CHARSET=utf8";
|
|
String str3 = "";
|
if(al_param.size() > 0) {
|
str3 = "INSERT INTO " + Sql_Mysql.RamDB_CMCC_POWER_Data
|
+ " (dev_id) VALUES";
|
}
|
for(int n=0; n<al_param.size(); n++)
|
{
|
if(n > 0) {
|
str3 += ", ";
|
}
|
str3 += " (" + al_param.get(n).dev_id + ")";
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
if(str3.length() > 0) {
|
sql.sqlMysqlExecute(str3);
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ½«É豸idºÍÉ豸ip²åÈë»òÕ߸üе½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
/*
|
public static void insertorupdateFBS9100CmccPowerDataTableOnRam(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String str1 = "";
|
String str2 = "";
|
if(param != null) {
|
str1 = "SELECT num,dev_id from " +Sql_Mysql.RamDB_CMCC_POWER_Data+ " where dev_id = " + param.dev_id;
|
str2 = "INSERT INTO " + Sql_Mysql.RamDB_CMCC_POWER_Data
|
+ " (dev_id) VALUES";
|
str2 += " (" + param.dev_id + ")";
|
}
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
if(param != null) {
|
ResultSet rs = sql.sqlMysqlQuery(str1);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute(str2);
|
}
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
*/
|
/***********************************************************************************/
|
/**
|
* ´´½¨ Sql_Mysql.AppDevCommTask_Table ±í²¢ÇÒ½«É豸id²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createBTSCommTaskStateTable(MysqlConnPool con_pool)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.AppDevCommTask_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.AppDevCommTask_Table
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`thread_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`dev_mcu_uid` varchar(48) NOT NULL DEFAULT 'null',"
|
+ "`battgroup_cnt` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_id1` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_index1` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_id2` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_index2` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_id3` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_index3` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_id4` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_index4` INT NOT NULL DEFAULT 0, "
|
+ "`connet_time` varchar(20) NOT NULL DEFAULT '1980-01-01 01:01:00', "
|
+ "`dev_comm_runtime` varchar(20) NOT NULL DEFAULT '1980-01-01 01:01:00', "
|
+ "`break_type` INT NOT NULL DEFAULT 0, "
|
+ " INDEX index_dev_id_uniq (`dev_id`), "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=InnoDB DEFAULT CHARSET=utf8";
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/***********************************************************************************/
|
/**
|
* ´´½¨ Sql_Mysql.AppDevBattGroup_Table ±í²¢ÇÒ½«É豸id²åÈëµ½±íÖÐ
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createBTS_BattGroupState_Table(MysqlConnPool con_pool)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.AppDevBattGroup_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.AppDevBattGroup_Table
|
+ " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
|
+ "`dev_id` BIGINT NOT NULL DEFAULT 0, "
|
+ "`battgroup_id` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_index` INT NOT NULL DEFAULT -1, "
|
+ "`battgroup_mon_cnt` INT NOT NULL DEFAULT 0, "
|
+ "`battgroup_float_vol` float NOT NULL DEFAULT 0, "
|
+ "`battgroup_float_curr` float NOT NULL DEFAULT 0, "
|
+ "`battgroup_register_code` varchar(48) NOT NULL DEFAULT 'null', "
|
+ " PRIMARY KEY (`num`) ) "
|
+ " ENGINE=InnoDB DEFAULT CHARSET=utf8";
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str1);
|
sql.sqlMysqlExecute(str2);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_bts_battgoup_inf ±í
|
* @param con_pool
|
* @param dev_id
|
*/
|
public static void insert_BTS_BattGroupState_Table(MysqlConnPool con_pool, int dev_id, int bg_id,
|
int bg_index, int mon_cnt, float f_vol, float f_curr,
|
String reg_code)
|
{
|
String sql_str_insert = "INSERT INTO " + Sql_Mysql.AppDevBattGroup_Table
|
+ " ( "
|
+ "dev_id,"
|
+ "battgroup_id,"
|
+ "battgroup_index,"
|
+ "battgroup_mon_cnt,"
|
+ "battgroup_float_vol,"
|
+ "battgroup_float_curr,"
|
+ "battgroup_register_code"
|
+ " ) "
|
+ " VALUES "
|
+ " ( "
|
+ dev_id + ", "
|
+ bg_id + ", "
|
+ bg_index + ", "
|
+ mon_cnt + ", "
|
+ f_vol + ", "
|
+ f_curr + ", "
|
+ "'" + reg_code + "'"
|
+ " ) ";
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_insert);
|
sql.sqlMysqlExecute(sql_str_insert);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_bts_battgoup_inf ±í
|
* @param con_pool
|
* @param dev_id
|
*/
|
public static void update_BTS_BattGroupState_Table(MysqlConnPool con_pool, int dev_id, int bg_id,
|
int bg_index, int mon_cnt, float f_vol, float f_curr,
|
String reg_code)
|
{
|
String sql_str_insert = "UPDATE " + Sql_Mysql.AppDevBattGroup_Table
|
+ " SET "
|
+ "battgroup_index=" + bg_index + ","
|
+ "battgroup_mon_cnt=" + mon_cnt + ","
|
+ "battgroup_float_vol=" + f_vol + ","
|
+ "battgroup_float_curr=" + f_curr + ","
|
+ "battgroup_register_code='" + reg_code + "'"
|
+ " WHERE "
|
+ " dev_id=" + dev_id + " AND battgroup_id=" + bg_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_insert);
|
sql.sqlMysqlExecute(sql_str_insert);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_bts_commtask_state ±í
|
* @param con_pool
|
* @param dev_id
|
*/
|
public static void insertBTSCommTaskStateByDev_Id(MysqlConnPool con_pool, long thread_id, int dev_id, String mcu_uid,
|
int bg_cnt, int bg_id_1, int bg_id_2, int bg_id_3, int bg_id_4,
|
int bg_index1, int bg_index2, int bg_index3, int bg_index4,
|
String connet_time, String dev_comm_runtime,
|
int break_type)
|
{
|
String sql_str_insert = "INSERT INTO " + Sql_Mysql.AppDevCommTask_Table
|
+ " ( "
|
+ "thread_id,"
|
+ "dev_id,"
|
+ "dev_mcu_uid,"
|
+ "battgroup_cnt,"
|
+ "battgroup_id1,"
|
+ "battgroup_index1,"
|
+ "battgroup_id2,"
|
+ "battgroup_index2,"
|
+ "battgroup_id3,"
|
+ "battgroup_index3,"
|
+ "battgroup_id4,"
|
+ "battgroup_index4,"
|
+ "connet_time,"
|
+ "dev_comm_runtime,"
|
+ "break_type"
|
+ " ) "
|
+ " VALUES "
|
+ " ( "
|
+ thread_id + ", "
|
+ dev_id + ", "
|
+ "'" + mcu_uid + "', "
|
+ bg_cnt + ", "
|
+ bg_id_1 + ", "
|
+ bg_index1 + ", "
|
+ bg_id_2 + ", "
|
+ bg_index2 + ", "
|
+ bg_id_3 + ", "
|
+ bg_index3 + ", "
|
+ bg_id_4 + ", "
|
+ bg_index4 + ", "
|
+ "'" + connet_time + "', "
|
+ "'" + dev_comm_runtime + "', "
|
+ break_type
|
+ " ) ";
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_insert);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_bts_commtask_state ±í
|
* @param con_pool
|
* @param dev_id
|
*/
|
public static void updateBTSCommTaskStateRunTimeByThread_Id(MysqlConnPool con_pool, long thread_id)
|
{
|
String sql_str_update = "UPDATE " + Sql_Mysql.AppDevCommTask_Table
|
+ " SET dev_comm_runtime='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "' "
|
+ " WHERE thread_id=" + thread_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_bts_commtask_state ±í
|
* @param con_pool
|
* @param dev_id
|
*/
|
public static void deleteBTSCommTaskStateByThread_Id(MysqlConnPool con_pool, long thread_id)
|
{
|
String sql_str_del = "DELETE FROM " + Sql_Mysql.AppDevCommTask_Table + " WHERE thread_id=" + thread_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_del);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
public static void deleteBTSCommTaskStateByDev_Id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String sql_str_del = "DELETE FROM " + Sql_Mysql.AppDevCommTask_Table
|
+ " WHERE "
|
+ " dev_id=" + param.dev_id
|
+ " AND "
|
+ " dev_mcu_uid='" + param.dev_reg_code.trim() + "'";
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_del);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_cmcc_power_data ±í
|
* @param con_pool
|
* @param v_data
|
* @param dev_id
|
*/
|
public static void updateFbs9100CmccPowerDataByDev_Id(MysqlConnPool con_pool, FBS9100_CMCC_Power cmcc_data, int dev_id)
|
{
|
String sql_str_base = Sql_Mysql.RamDB_CMCC_POWER_Data
|
+ " SET "
|
+ "dev_id=" + dev_id + ", "
|
+ "vol1=" + cmcc_data.Vol[0] + ", "
|
+ "vol2=" + cmcc_data.Vol[1] + ", "
|
+ "vol3=" + cmcc_data.Vol[2] + ", "
|
+ "vol4=" + cmcc_data.Vol[3] + ", "
|
+ "vol5=" + cmcc_data.Vol[4] + ", "
|
+ "curr1=" + cmcc_data.Curr[0] + ", "
|
+ "curr2=" + cmcc_data.Curr[1] + ", "
|
+ "curr3=" + cmcc_data.Curr[2] + ", "
|
+ "curr4=" + cmcc_data.Curr[3] + ", "
|
+ "curr5=" + cmcc_data.Curr[4];
|
//+ " WHERE dev_id=" + dev_id;
|
//String sql_str_update = "UPDATE " + sql_str_base;
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
public static int getFbs9100StationState_ById(MysqlConnPool con_pool, FBS9100_StatAndParam m_pm)
|
{
|
String sql_str_base = "SELECT station_stat FROM " + Sql_Mysql.BTSStationState_Table
|
+ " WHERE dev_id=" + m_pm.dev_id;
|
int state_t = 0;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
ResultSet res = sql.sqlMysqlQuery(sql_str_base);
|
if(res.next()) {
|
state_t = res.getInt("station_stat");
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
return state_t;
|
}
|
/***********************************************************************************/
|
public static long getFbs9100DataCommFlowSum_ById(MysqlConnPool con_pool, FBS9100_StatAndParam m_pm)
|
{
|
String sql_str_base = "SELECT dev_data_flowsum FROM " + Sql_Mysql.FBS9100State_Table
|
+ " WHERE dev_id=" + m_pm.dev_id;
|
long flow_sum = 0;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
ResultSet res = sql.sqlMysqlQuery(sql_str_base);
|
if(res.next()) {
|
flow_sum = res.getLong("dev_data_flowsum");
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
return flow_sum;
|
}
|
/***********************************************************************************/
|
public static void updateFbs9100StateOnlyByDev_Id(MysqlConnPool con_pool, FBS9100_StatAndParam m_pm)
|
{
|
int TestGroup_index = m_pm.m_SysState.TestGroupNum;
|
if(TestGroup_index > 0) {
|
TestGroup_index -= 1;
|
}
|
if((TestGroup_index>=FBS9100_ComBase.BattGroupCountMax) || (TestGroup_index<0)) {
|
TestGroup_index = 0;
|
}
|
|
int batt_online_state = 0;
|
if(true == m_pm.m_SysState.BG_1_IsOFFLine) {
|
batt_online_state |= (1<<1);
|
}
|
if(true == m_pm.m_SysState.BG_2_IsOFFLine) {
|
batt_online_state |= (1<<2);
|
}
|
if(true == m_pm.m_SysState.SD_Card_Err) {
|
batt_online_state |= (1<<5);
|
}
|
|
String sql_str_base = Sql_Mysql.FBS9100State_Table
|
+ " SET "
|
+ "dev_id=" + m_pm.dev_id + ", "
|
+ "dev_ip='" + m_pm.dev_ipaddr + "', "
|
+ "dev_version='" + m_pm.m_DevVersion + "', "
|
+ "record_datetime="
|
+ "'" + Com.getDateTimeFormat(m_pm.m_SysState.Record_DateTime, Com.DTF_YMDhms) + "',"
|
+ "dev_datetime='" + m_pm.m_SysState.DTime.year + "-"
|
+ m_pm.m_SysState.DTime.month + "-"
|
+ m_pm.m_SysState.DTime.day + " "
|
+ m_pm.m_SysState.DTime.hour + ":"
|
+ m_pm.m_SysState.DTime.minute + ":"
|
+ m_pm.m_SysState.DTime.second + "', "
|
+ "dev_testtype=" + m_pm.m_SysState.TestType+ ", "
|
+ "dev_testgroupnum=" + m_pm.m_SysState.TestGroupNum + ", "
|
+ "dev_workstate=" + m_pm.m_SysState.WorkState + ", "
|
+ "dev_alarmstate=" + m_pm.m_SysState.AlarmState + ", "
|
+ "dev_res_test_state=" + m_pm.m_SysState.ResTestState + ", "
|
+ "dev_onlinevollow=" + (1==m_pm.m_SysState.OnlineVolLow) + ", "
|
+ "dev_restest_count=" + m_pm.m_SysState.ResTestCnt + ", "
|
+ "dev_restest_monindex=" + m_pm.m_SysState.ResBattIndex + ", "
|
+ "dev_restest_moncount=" + m_pm.m_SysState.ResBattIndexMax + ", "
|
+ "dev_data_flowsum=" + m_pm.dev_comm_data_flowsum + ", "
|
+ "batt_online_state=" + batt_online_state + ", "
|
+ "dev_commcount=" + m_pm.m_SysState.CommCount + ", "
|
+ "dev_errcommcount=" + m_pm.m_SysState.ErrCommCount + ", "
|
+ "dev_rxnullerrcount=" + m_pm.m_SysState.RxNullErrCount;
|
if((m_pm.m_SysState.CapTestStopType>=0) && (m_pm.m_SysState.CapTestStopType<50)) {
|
sql_str_base += ", ";
|
sql_str_base += "dev_last_captest_stop_type=" + m_pm.m_SysState.CapTestStopType;
|
}
|
|
String sql_str_update = "UPDATE " + sql_str_base + " WHERE dev_id=" + m_pm.dev_id;
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_fbs9100_state ±í
|
* @param con_pool
|
* @param v_data
|
* @param dev_id
|
*/
|
public static void updateFbs9100StateByDev_Id(MysqlConnPool con_pool, FBS9100_VCData vc_data, FBS9100_StatAndParam m_pm)
|
{
|
int TestGroup_index = m_pm.m_SysState.TestGroupNum;
|
if(TestGroup_index > 0) {
|
TestGroup_index -= 1;
|
}
|
if((TestGroup_index>=FBS9100_ComBase.BattGroupCountMax) || (TestGroup_index<0)) {
|
TestGroup_index = 0;
|
}
|
|
int batt_online_state = 0;
|
if(true == m_pm.m_SysState.BG_1_IsOFFLine) {
|
batt_online_state |= (1<<1);
|
}
|
if(true == m_pm.m_SysState.BG_2_IsOFFLine) {
|
batt_online_state |= (1<<2);
|
}
|
if(true == m_pm.m_SysState.SD_Card_Err) {
|
batt_online_state |= (1<<5);
|
}
|
|
String sql_str_base = Sql_Mysql.FBS9100State_Table
|
+ " SET "
|
+ "dev_id=" + m_pm.dev_id + ", "
|
+ "dev_ip='" + m_pm.dev_ipaddr + "', "
|
+ "dev_version='" + m_pm.m_DevVersion + "', "
|
+ "record_datetime="
|
+ "'" + Com.getDateTimeFormat(m_pm.m_SysState.Record_DateTime, Com.DTF_YMDhms) + "',"
|
+ "dev_datetime='" + m_pm.m_SysState.DTime.year + "-"
|
+ m_pm.m_SysState.DTime.month + "-"
|
+ m_pm.m_SysState.DTime.day + " "
|
+ m_pm.m_SysState.DTime.hour + ":"
|
+ m_pm.m_SysState.DTime.minute + ":"
|
+ m_pm.m_SysState.DTime.second + "', "
|
+ "dev_testtype=" + m_pm.m_SysState.TestType+ ", "
|
+ "dev_testgroupnum=" + m_pm.m_SysState.TestGroupNum + ", "
|
+ "dev_workstate=" + m_pm.m_SysState.WorkState + ", "
|
+ "dev_alarmstate=" + m_pm.m_SysState.AlarmState + ", "
|
+ "dev_temp=" + vc_data.batttemp[0] + ", "
|
+ "dev_res_test_state=" + m_pm.m_SysState.ResTestState + ", "
|
+ "dev_onlinevollow=" + (1==m_pm.m_SysState.OnlineVolLow) + ", "
|
+ "dev_captest_onlinevol=" + vc_data.onlinevol[TestGroup_index] + ", "
|
+ "dev_captest_groupvol=" + vc_data.groupvol[TestGroup_index] + ", "
|
+ "dev_captest_curr=" + vc_data.battcurr[TestGroup_index] + ", "
|
+ "dev_captest_cap=" + vc_data.battcap[TestGroup_index] + ", "
|
+ "dev_captest_timelong=" + vc_data.testTime.getSecondCount() + ", "
|
+ "dev_restest_count=" + m_pm.m_SysState.ResTestCnt + ", "
|
+ "dev_restest_monindex=" + m_pm.m_SysState.ResBattIndex + ", "
|
+ "dev_restest_moncount=" + m_pm.m_SysState.ResBattIndexMax + ", "
|
+ "dev_data_flowsum=" + m_pm.dev_comm_data_flowsum + ", "
|
+ "batt_online_state=" + batt_online_state + ", "
|
+ "dev_commcount=" + m_pm.m_SysState.CommCount + ", "
|
+ "dev_errcommcount=" + m_pm.m_SysState.ErrCommCount + ", "
|
+ "dev_rxnullerrcount=" + m_pm.m_SysState.RxNullErrCount;
|
if((m_pm.m_SysState.CapTestStopType>=0) && (m_pm.m_SysState.CapTestStopType<50)) {
|
sql_str_base += ", ";
|
sql_str_base += "dev_last_captest_stop_type=" + m_pm.m_SysState.CapTestStopType;
|
}
|
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
//String sql_str_update = "UPDATE " + Sql_Mysql.FBS9100State_Table + " SET dev_data_flowsum=dev_data_flowsum+"
|
// + v_data.dev_comm_data_flowsum + " WHERE dev_id=" + m_pm.dev_id;
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/*
|
public static void updateFbs9100State_ResTestCNT_ByDev_Id(MysqlConnPool con_pool, FBS9100_StatAndParam m_pm)
|
{
|
String sql_str = "UPDATE " + Sql_Mysql.FBS9100State_Table
|
+ " SET "
|
+ "record_datetime="
|
+ "'" + Com.getDateTimeFormat(m_pm.m_FBS_VCData.m_SysState.Record_DateTime, Com.DTF_YMDhms) + "', "
|
+ "dev_restest_count=" + m_pm.m_FBS_VCData.m_SysState.ResTestCnt
|
+ " WHERE dev_id=" + m_pm.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
*/
|
/***********************************************************************************/
|
public static int queryBTS_DCDC_AlarmStat(MysqlConnPool con_pool, int dev_id, FBS9100S_NT_DCDC_State[] dcdc_stat)
|
{
|
String sql_str = "SELECT dcdc_SMR_Alarm1 FROM " + Sql_Mysql.FBS9100S_DcDcState_Table + " WHERE dev_id=" + dev_id;
|
int test_cnt = 0;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
int index_t = 0;
|
while(res.next()) {
|
if(index_t < dcdc_stat.length) {
|
dcdc_stat[index_t].SMR_Alarm1 = res.getInt("dcdc_SMR_Alarm1");
|
dcdc_stat[index_t].ModeSetComm = res.getInt("dcdc_ModeSetComm");
|
dcdc_stat[index_t].RunSetComm = res.getInt("dcdc_RunSetComm");
|
index_t += 1;
|
}
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
return test_cnt;
|
}
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_fbs9100s_dcdc_data ±í
|
* @param con_pool
|
* @param v_data
|
* @param dev_id
|
*/
|
public static void updateFbs9100S_DCDC_Data_ByDev_Id(MysqlConnPool con_pool,
|
FBS9100S_NT_DCDC_Data[] dcdc_data, int dev_id)
|
{
|
for(int n=0; n<dcdc_data.length; n++) {
|
if(0 == dcdc_data[n].Version) {
|
continue;
|
}
|
|
String sql_str_base = Sql_Mysql.FBS9100S_DcDcState_Table
|
+ " SET "
|
+ "dev_id=" + dev_id + ", "
|
+ "dcdc_num=" + ((dev_id%1000000)*10 + (n+1)) + ", "
|
+ "dcdc_Vsys=" + dcdc_data[n].Vsys + ", "
|
+ "dcdc_Vout=" + dcdc_data[n].Vout + ", "
|
+ "dcdc_Vbat=" + dcdc_data[n].Vbat + ", "
|
+ "dcdc_Iout=" + dcdc_data[n].Iout + ", "
|
+ "dcdc_Ibuck=" + dcdc_data[n].Ibuck + ", "
|
+ "dcdc_Tmp_Dis=" + dcdc_data[n].Tmp_Dis + ", "
|
+ "dcdc_Tmp_Chr=" + dcdc_data[n].Tmp_Chr + ", "
|
+ "dcdc_SMR_Alarm1=" + dcdc_data[n].SMR_Alarm1 + ", "
|
+ "dcdc_SMR_Alarm2=" + dcdc_data[n].SMR_Alarm2 + ", "
|
+ "dcdc_version=" + dcdc_data[n].Version + ", "
|
+ "dcdc_ModeSetComm=" + dcdc_data[n].ModeSetComm + ", "
|
+ "dcdc_RunSetComm=" + dcdc_data[n].RunSetComm + ", "
|
+ "dcdc_BuckISet=" + dcdc_data[n].SetBuckI + ", "
|
+ "dcdc_DisVolSet=" + dcdc_data[n].SetDisVol + ", "
|
+ "dcdc_DisCurrSet=" + dcdc_data[n].SetDisCurr + ", "
|
+ "dcdc_CommTxCnt=" + dcdc_data[n].CommTxCnt + ", "
|
+ "dcdc_CommRxCnt=" + dcdc_data[n].CommRxCnt;
|
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÉ豸id¸üРtb_fbs9100s_dcdc_data ±í
|
* @param con_pool
|
* @param v_data
|
* @param dev_id
|
*/
|
public static void resetFbs9100S_DCDC_Data_ByDev_Id(MysqlConnPool con_pool, int dev_id)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100S_DcDcState_Table
|
+ " SET "
|
+ "dcdc_ModeSetComm=" + 0 + ", "
|
+ "dcdc_RunSetComm=" + 0;
|
|
String sql_str_update = "UPDATE " + sql_str_base + " WHERE dev_id=" + dev_id;
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/***********************************************************************************/
|
public static int queryFBS9100_ResTestCnt(MysqlConnPool con_pool, int dev_id)
|
{
|
String sql_str = "SELECT dev_restest_count FROM " + Sql_Mysql.FBS9100State_Table + " WHERE dev_id=" + dev_id;
|
int test_cnt = 0;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
test_cnt = res.getInt("dev_restest_count");
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
return test_cnt;
|
}
|
|
/**
|
* ¸ù¾Ýtb_fbs9100_setparam±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
/*
|
public static void queryFbs9100SetParam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
String sql_str = "SELECT * FROM " + Sql_Mysql.FBS9100SetParam_Table;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
while(res.next())
|
{
|
FBS9100_StatAndParam param = null;
|
int devid = res.getInt("dev_id");
|
|
for(int n=0; n<al_param.size(); n++) {
|
param = al_param.get(n);
|
if(devid == param.dev_id) {
|
break;
|
}
|
}
|
|
if(null != param) {
|
param.m_FBS_DiscParam.op_cmd = res.getInt("op_cmd");
|
param.m_FBS_DiscParam.BattGroupNum = res.getInt("BattGroupNum");
|
param.m_FBS_DiscParam.test_cmd = res.getInt("TestCmd");
|
param.m_FBS_DiscParam.HourRate = res.getInt("HourRate");
|
param.m_FBS_DiscParam.DisCurr = res.getFloat("DisCurr");
|
param.m_FBS_DiscParam.DisCap = res.getFloat("DisCap");
|
param.m_FBS_DiscParam.DisTime = res.getInt("DisTime");
|
param.m_FBS_DiscParam.GroupVol_LOW = res.getFloat("GroupVol_LOW");
|
param.m_FBS_DiscParam.MonomerVol_LOW = res.getFloat("MonomerVol_LOW");
|
param.m_FBS_DiscParam.MonomerLowCount = res.getInt("MonomerLowCount");
|
param.m_FBS_DiscParam.OnlineVolLowAction = res.getInt("OnlineVolLowAction");
|
param.m_FBS_DiscParam.DCVolHighLimit = res.getFloat("DCVolHighLimit");
|
param.m_FBS_DiscParam.ChargeCurrSet = res.getFloat("ChargeCurrSet");
|
param.m_FBS_DiscParam.MonomerTmp_High = res.getFloat("MonomerTmp_High");
|
}
|
}
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
*/
|
/**
|
* ¸ù¾Ýtb_fbs9100_setparam±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void queryFbs9100SetParamCmdBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String sql_str = "SELECT op_cmd FROM " + Sql_Mysql.FBS9100SetParam_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
param.op_cmd = res.getInt("op_cmd");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
|
/**
|
* ¸ù¾Ýtb_fbs9100_setparam±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void queryFbs9100SetParamBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, FBS9100_ParamDischarge dis_pm)
|
{
|
String sql_str = "SELECT * FROM " + Sql_Mysql.FBS9100SetParam_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next())
|
{
|
if(null != param) {
|
//param.m_FBS_DiscParam.op_cmd = res.getInt("op_cmd");
|
dis_pm.BattGroupNum = res.getInt("BattGroupNum");
|
dis_pm.test_cmd = res.getInt("TestCmd");
|
dis_pm.HourRate = res.getInt("HourRate");
|
dis_pm.DisCurr = res.getFloat("DisCurr");
|
dis_pm.DisCap = res.getFloat("DisCap");
|
dis_pm.DisTime = res.getInt("DisTime");
|
dis_pm.GroupVol_LOW = res.getFloat("GroupVol_LOW");
|
dis_pm.MonomerVol_LOW = res.getFloat("MonomerVol_LOW");
|
dis_pm.MonomerLowCount = res.getInt("MonomerLowCount");
|
dis_pm.OnlineVolLowAction = res.getInt("OnlineVolLowAction");
|
dis_pm.DCVolHighLimit = res.getFloat("DCVolHighLimit");
|
dis_pm.ChargeCurrSet = res.getFloat("ChargeCurrSet");
|
dis_pm.MonomerTmp_High = res.getFloat("MonomerTmp_High");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾ÝÖ¸¶¨µÄÉ豸id Ð޸ıí tb_fbs9100_setparam ÖеÄop_cmdÖµ
|
*/
|
/*
|
public static void updateFbs9100SetParamCmd(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
for(int n=0; n<al_param.size(); n++) {
|
FBS9100_StatAndParam param = al_param.get(n);
|
if((param.op_cmd_ack == FBS9100_ComBase.CMD_StartAck)
|
|| (param.op_cmd_ack == FBS9100_ComBase.CMD_StopAck)
|
|| (param.op_cmd_ack == FBS9100_ComBase.CMD_SetDischargeParmAck))
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SetParam_Table + " SET "
|
+ "op_cmd=" + param.op_cmd_ack;
|
String sql_str_update = "UPDATE " + sql_str_base + " WHERE dev_id=" + param.dev_id;
|
//String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_DiscParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
}
|
*/
|
|
/**
|
* ¸ù¾ÝÖ¸¶¨µÄÉ豸id Ð޸ıí tb_fbs9100_setparam ÖеÄop_cmdÖµ
|
*/
|
public static void updateFbs9100SetParamCmdAckBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
if((param.op_cmd_ack == FBS9100_ComBase.CMD_StartAck)
|
|| (param.op_cmd_ack == FBS9100_ComBase.CMD_StopAck)
|
|| (param.op_cmd_ack == FBS9100_ComBase.CMD_SetDischargeParmAck)
|
|| (param.op_cmd_ack == FBS9100_ComBase.CMD_ResetSystemAck)
|
|| (param.op_cmd_ack == FBS9100_ComBase.CMD_GetDeviceTaskInfAck))
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SetParam_Table + " SET "
|
+ "op_cmd=" + param.op_cmd_ack;
|
String sql_str_update = "UPDATE " + sql_str_base + " WHERE dev_id=" + param.dev_id;
|
//String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_DiscParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ý Êý×éÖеÄÖµÐÞ¸Ätb_fbs9100_setparam±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
/*
|
public static void updateFbs9100SetParam(MysqlConnPool con_pool, ArrayList<FBS9100_StatAndParam> al_param)
|
{
|
for(int n=0; n<al_param.size(); n++)
|
{
|
FBS9100_StatAndParam param = al_param.get(n);
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_GetDischargeParmAck)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SetParam_Table
|
+ " SET "
|
+ "dev_id=" + param.dev_id + ", "
|
+ "op_cmd=" + FBS9100_ComBase.CMD_GetDischargeParmAck + ", "
|
+ "TestCmd=" + param.m_FBS_DiscParam.test_cmd + ", "
|
+ "HourRate=" + param.m_FBS_DiscParamFromDev.HourRate + ", "
|
+ "DisCurr=" + param.m_FBS_DiscParamFromDev.DisCurr + ", "
|
+ "DisCap=" + param.m_FBS_DiscParamFromDev.DisCap + ", "
|
+ "DisTime=" + param.m_FBS_DiscParamFromDev.DisTime + ", "
|
+ "GroupVol_LOW=" + param.m_FBS_DiscParamFromDev.GroupVol_LOW + ", "
|
+ "MonomerVol_LOW=" + param.m_FBS_DiscParamFromDev.MonomerVol_LOW + ", "
|
+ "MonomerLowCount=" + param.m_FBS_DiscParamFromDev.MonomerLowCount + ", "
|
+ "BattGroupNum=" + param.m_FBS_DiscParamFromDev.BattGroupNum + ", "
|
+ "OnlineVolLowAction=" + param.m_FBS_DiscParamFromDev.OnlineVolLowAction + ", "
|
+ "DCVolHighLimit=" + param.m_FBS_DiscParamFromDev.DCVolHighLimit + ", "
|
+ "ChargeCurrSet=" + param.m_FBS_DiscParamFromDev.ChargeCurrSet + ", "
|
+ "MonomerTmp_High=" + param.m_FBS_DiscParamFromDev.MonomerTmp_High;
|
//+ " WHERE dev_id=" + param.dev_id;
|
//String sql_str_update = "UPDATE " + sql_str_base;
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
param.m_FBS_DiscParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
}
|
*/
|
/**
|
* ¸ù¾Ý Ö¸¶¨¶ÔÏóµÄÉ豸idÐÞ¸Ätb_fbs9100_setparam±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void updateFbs9100SetParamBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, FBS9100_ParamDischarge dis_pm)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_GetDischargeParmAck)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SetParam_Table
|
+ " SET "
|
+ "dev_id=" + param.dev_id + ", "
|
+ "op_cmd=" + param.op_cmd_ack + ", "
|
+ "TestCmd=" + dis_pm.test_cmd + ", "
|
+ "HourRate=" + dis_pm.HourRate + ", "
|
+ "DisCurr=" + dis_pm.DisCurr + ", "
|
+ "DisCap=" + dis_pm.DisCap + ", "
|
+ "DisTime=" + dis_pm.DisTime + ", "
|
+ "GroupVol_LOW=" + dis_pm.GroupVol_LOW + ", "
|
+ "MonomerVol_LOW=" +dis_pm.MonomerVol_LOW + ", "
|
+ "MonomerLowCount=" + dis_pm.MonomerLowCount + ", "
|
+ "BattGroupNum=" + dis_pm.BattGroupNum + ", "
|
+ "OnlineVolLowAction=" + dis_pm.OnlineVolLowAction + ", "
|
+ "DCVolHighLimit=" + dis_pm.DCVolHighLimit + ", "
|
+ "ChargeCurrSet=" + dis_pm.ChargeCurrSet + ", "
|
+ "MonomerTmp_High=" + dis_pm.MonomerTmp_High;
|
//String sql_str_update = "UPDATE " + sql_str_base;
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_DiscParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ýtb_fbs9100_setparam±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void queryFbs9100SysParamCmdBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String sql_str = "SELECT op_cmd FROM " + Sql_Mysql.FBS9100SysParam_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
param.op_cmd = res.getInt("op_cmd");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ý Ö¸¶¨¶ÔÏóµÄÉ豸idÐÞ¸Ätb_fbs9100_sysparam±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void updateFbs9100SysParamCmdAckBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_SetSYSSetParamAck)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SysParam_Table
|
+ " SET "
|
+ "op_cmd=" + param.op_cmd_ack;
|
String sql_str_update = "UPDATE " + sql_str_base + " WHERE dev_id=" + param.dev_id;
|
//String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_SystemParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ýtb_fbs9100_setparam±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void queryFbs9100SysParamBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, FBS9100_ParamSystem sys_param)
|
{
|
String sql_str = "SELECT * FROM " + Sql_Mysql.FBS9100SysParam_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
//param.m_FBS_SystemParam.op_cmd = res.getInt("op_cmd");
|
sys_param.GroupVolRange = res.getInt("GroupVolRange");
|
sys_param.GroupVolSorce = res.getInt("GroupVolSorce");
|
sys_param.CurrentRange = res.getInt("CurrentRange");
|
sys_param.CurrentType = res.getInt("CurrentTyte");
|
sys_param.MonomerOrder = res.getInt("MonomerOrder");
|
|
sys_param.BackLightTime = res.getInt("BackLightTime");
|
sys_param.LoaderCount = res.getInt("LoaderCount");
|
sys_param.DtCardCount = res.getInt("DtCardCount");
|
sys_param.PowerBreakChargeCurr = res.getFloat("PowerBreakChargeCurr");
|
sys_param.MajorBattGroupNum = res.getInt("MajorBattGroupNum");
|
sys_param.POF_BG_Boost_Cnt = res.getInt("POF_BG_Boost_Cnt");
|
sys_param.POF_BG_Boost_VolStop = res.getFloat("POF_BG_Boost_VolStop");
|
sys_param.POF_BG_Boost_VolStart = res.getFloat("POF_BG_Boost_VolStart");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ý Ö¸¶¨¶ÔÏóµÄÉ豸idÐÞ¸Ätb_fbs9100_sysparam±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void updateFbs9100SysParamBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, FBS9100_ParamSystem sys_param)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_GetSYSSetParamAck)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SysParam_Table
|
+ " SET "
|
+ "dev_id=" + param.dev_id + ", "
|
+ "op_cmd=" + param.op_cmd_ack + ", "
|
+ "GroupVolRange=" + sys_param.GroupVolRange + ", "
|
+ "GroupVolSorce=" + sys_param.GroupVolSorce + ", "
|
+ "CurrentRange=" + sys_param.CurrentRange + ", "
|
+ "CurrentTyte=" + sys_param.CurrentType + ", "
|
+ "MonomerOrder=" + sys_param.MonomerOrder + ", "
|
+ "BackLightTime=" + sys_param.BackLightTime + ", "
|
+ "LoaderCount=" + sys_param.LoaderCount + ", "
|
+ "DtCardCount=" + sys_param.DtCardCount + ", "
|
+ "PowerBreakChargeCurr=" + sys_param.PowerBreakChargeCurr + ", "
|
+ "MajorBattGroupNum=" + sys_param.MajorBattGroupNum + ", "
|
+ "POF_BG_Boost_Cnt=" + sys_param.POF_BG_Boost_Cnt + ", "
|
+ "POF_BG_Boost_VolStop=" + sys_param.POF_BG_Boost_VolStop + ", "
|
+ "POF_BG_Boost_VolStart=" + sys_param.POF_BG_Boost_VolStart;
|
//String sql_str_update = "UPDATE " + sql_str_base;
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_SystemParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ýtb_fbs9100_battparam±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void queryFbs9100BattParamCmdBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String sql_str = "SELECT op_cmd FROM " + Sql_Mysql.FBS9100BattParam_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
param.op_cmd = res.getInt("op_cmd");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ý Ö¸¶¨¶ÔÏóµÄÉ豸idÐÞ¸Ätb_fbs9100_battparam±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void updateFbs9100BattParamCmdAckBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_SetBattParamACK)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100BattParam_Table
|
+ " SET "
|
+ "op_cmd=" + param.op_cmd_ack;
|
String sql_str_update = "UPDATE " + sql_str_base + " WHERE dev_id=" + param.dev_id;
|
//String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_BattParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ýtb_fbs9100_battparam±í²éѯ²ÎÊý
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void queryFbs9100BattParamBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, FBS9100_ParamBatt batt_pm)
|
{
|
String sql_str = "SELECT * FROM " + Sql_Mysql.FBS9100BattParam_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
batt_pm.STD_CAP = res.getInt("STD_CAP");
|
batt_pm.STD_RES = res.getInt("STD_RES");
|
batt_pm.BattGroupCount = res.getInt("BattGroupCount");
|
batt_pm.EachGroupBattCount = res.getInt("EachGroupBattCount");
|
|
batt_pm.MonomerVol = res.getFloat("MonomerVol");
|
batt_pm.GroupVol = res.getFloat("GroupVol");
|
batt_pm.BattTemp = res.getFloat("BattTemp");
|
batt_pm.FloatChargeVol = res.getFloat("FloatChargeVol");
|
batt_pm.FloatChargeCurr = res.getFloat("FloatChargeCurr");
|
batt_pm.OnlineVolLow = res.getFloat("OnlineVolLow");
|
batt_pm.GroupConnType = res.getInt("GroupConnType");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ý Ö¸¶¨¶ÔÏóµÄÉ豸idÐÞ¸Ätb_fbs9100_sysparam±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void updateFbs9100BattParamBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, FBS9100_ParamBatt batt_pm)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_GetBattParamACK)
|
{
|
String sql_str_base = Sql_Mysql.FBS9100BattParam_Table
|
+ " SET "
|
+ "dev_id=" + param.dev_id + ", "
|
+ "op_cmd=" + param.op_cmd_ack + ", "
|
+ "STD_CAP=" + batt_pm.STD_CAP + ", "
|
+ "STD_RES=" + batt_pm.STD_RES + ", "
|
+ "BattGroupCount=" + batt_pm.BattGroupCount + ", "
|
+ "EachGroupBattCount=" + batt_pm.EachGroupBattCount + ", "
|
+ "MonomerVol=" + batt_pm.MonomerVol + ", "
|
+ "GroupVol=" + batt_pm.GroupVol + ", "
|
+ "BattTemp=" + batt_pm.BattTemp + ", "
|
+ "FloatChargeVol=" + batt_pm.FloatChargeVol + ", "
|
+ "FloatChargeCurr=" + batt_pm.FloatChargeCurr + ", "
|
+ "OnlineVolLow=" + batt_pm.OnlineVolLow + ", "
|
+ "GroupConnType=" + batt_pm.GroupConnType;
|
//String sql_str_update = "UPDATE " + sql_str_base;
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
//param.m_FBS_BattParam.op_cmd = param.op_cmd_ack;
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ýtb_bts_gprs_state±í¸üÐÂal_paramÊý×é
|
* @param con_pool
|
* @param al_param
|
*/
|
public static int queryBTSGPRSCmdBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
int cmd_t = 0;
|
String sql_str = "SELECT op_cmd FROM " + Sql_Mysql.BTSGPRSState_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
cmd_t = res.getInt("op_cmd");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
return cmd_t;
|
}
|
/***********************************************************************************/
|
public static String queryBTSGPRS_ATCmd_Bydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param)
|
{
|
String cmd_at = "";
|
String sql_str = "SELECT AT_cmd FROM " + Sql_Mysql.BTSGPRSState_Table + " where dev_id = " + param.dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next()) {
|
if(null != param) {
|
cmd_at = res.getString("AT_cmd").trim();
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
return cmd_at;
|
}
|
/***********************************************************************************/
|
/**
|
* ¸ù¾Ý Ö¸¶¨¶ÔÏóµÄÉ豸idÐÞ¸Ätb_bts_gprs_state±íÖÐÖ¸¶¨É豸µÄÐÅÏ¢
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void updateBTSGPRSSateBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param,
|
String at_cmd, String val)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_ReadGPRSCSQAck)
|
{
|
String tmp_val = "null";
|
if(null != val) {
|
if((val.length() > 6) && (val.contains("usr.cn"))) {
|
tmp_val = val;
|
}
|
}
|
String sql_str_base = Sql_Mysql.BTSGPRSState_Table
|
+ " SET "
|
+ "dev_id=" + param.dev_id + ", "
|
+ "op_cmd=" + param.op_cmd_ack + ", "
|
+ "AT_cmd='" + at_cmd + "', "
|
+ "ack_inf='" + tmp_val + "'";
|
//String sql_str_update = "UPDATE " + sql_str_base;
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
public static void updateBTS_TaskInf_To_GPRSTableBydev_id(MysqlConnPool con_pool, FBS9100_StatAndParam param, String val)
|
{
|
if(param.op_cmd_ack == FBS9100_ComBase.CMD_GetDeviceTaskInfAck)
|
{
|
String sql_str_base = Sql_Mysql.BTSGPRSState_Table
|
+ " SET "
|
+ "dev_id=" + param.dev_id + ", "
|
+ "bts_task_inf='" + val + "'";
|
String sql_str_update = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_update);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
|
param.op_cmd_ack = FBS9100_ComBase.CMD_NULL;
|
}
|
}
|
/***********************************************************************************/
|
public static void updateBattState_RT_RamDB_Table(MysqlConnPool conn_pool, ArrayList<BattData_RT> bd_al)
|
{
|
Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
try
|
{
|
String sql_str = "UPDATE " + Sql_Mysql.BattRtState_Table
|
+ " SET "
|
+ " rec_datetime='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "',";
|
|
sql_str += " batt_count = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.MonCount;
|
}
|
|
sql_str += " END, " + " online_vol = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getOnlineVol();
|
}
|
|
sql_str += " END, " + " group_vol = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getGroupVol();
|
}
|
|
sql_str += " END, " + " group_tmp = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getGroupTmp();
|
}
|
|
sql_str += " END, " + " group_curr = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getTestCurr();
|
}
|
|
sql_str += " END, " + " batt_state = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getBattState();
|
}
|
|
sql_str += " END, " + " batt_test_type = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getBattTestType();
|
}
|
|
sql_str += " END, " + " batt_test_starttime = CASE BattGroupId ";
|
Date dt = new Date();
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
dt.setTime(brt.getTestStartTime());
|
sql_str += " WHEN " + brt.BattGroupId + " THEN '" + Com.getDateTimeFormat(dt, Com.DTF_YMDhms) + "'";
|
}
|
|
sql_str += " END, " + " batt_test_recordtime = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
dt.setTime(brt.getTestRecordTime());
|
sql_str += " WHEN " + brt.BattGroupId + " THEN '" + Com.getDateTimeFormat(dt, Com.DTF_YMDhms) + "'";
|
}
|
|
sql_str += " END, " + " batt_test_tlong = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getTestTimeLong();
|
}
|
|
sql_str += " END, " + " batt_test_cap = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getTestCap();
|
}
|
|
sql_str += " END, " + " batt_real_cap = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getBattRealCap();
|
}
|
|
sql_str += " END, " + " batt_rest_cap = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getBattRestCap();
|
}
|
|
sql_str += " END, " + " batt_rest_power1_time = CASE BattGroupId ";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
sql_str += " WHEN " + brt.BattGroupId + " THEN " + brt.getBattRestTime();
|
}
|
|
sql_str += " END WHERE BattGroupId IN (";
|
for(int n=0; n<bd_al.size(); n++) {
|
BattData_RT brt = bd_al.get(n);
|
if(n > 0) {
|
sql_str += ",";
|
}
|
sql_str += brt.BattGroupId;
|
}
|
sql_str += ")";
|
System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/************************************************************************************************/
|
public static void UpdateBTS_Station_Stat(MysqlConnPool conn_pool, FBS9100_StatAndParam m_pm, int start_stat) {
|
String sql_str = "UPDATE " + Sql_Mysql.BTSStationState_Table + " SET "
|
+ "record_datetime='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "',"
|
+ "station_stat=" + m_pm.m_SysState.Station_State;
|
|
if((start_stat & (1<<FBS9100S_SocketClient2.EveType_StationPOFF)) > 0) {
|
sql_str += ", station_poff_start_time='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "'";
|
}
|
|
if((start_stat & (1<<FBS9100S_SocketClient2.EveType_StationXuHang)) > 0) {
|
sql_str += ", station_xuhang_start_time='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "'";
|
sql_str += ", station_xuhang_end_time='1980-01-01 00:00:00'";
|
} else {
|
if((start_stat & (1<<FBS9100S_SocketClient2.EveType_StationXuHangEnd)) > 0) {
|
sql_str += ", station_xuhang_end_time='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "'";
|
}
|
}
|
|
if((start_stat & (1<<FBS9100S_SocketClient2.EveType_StationDiaoZhan)) > 0) {
|
sql_str += ", station_diaozhan_start_time='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "'";
|
}
|
|
sql_str += " WHERE dev_id=" + m_pm.dev_id;
|
|
Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
public static void insertBTS_Station_Event_IntoDB(MysqlConnPool conn_pool, FBS9100_StatAndParam m_pm,
|
int eve_type, int eve_trig, String dt_str) {
|
String sql_str = "INSERT INTO " + Sql_Mysql.BTSStationEvent_Table
|
+ "( station_id, dev_id, record_datetime, station_event_type, station_event_trig )"
|
+ " VALUES "
|
+ "(" + m_pm.dev_station_id + ","
|
+ m_pm.dev_id + ","
|
+ "'" + dt_str + "',"
|
+ eve_type + ","
|
+ eve_trig + ")";
|
|
Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/***********************************************************************************/
|
public static void insertFBS_EventToTable(MysqlConnPool conn_pool, int fbsdev_id,
|
int eve_type, int module_num,
|
int last_stat, int now_stat, int stat_change_reason)
|
{
|
Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
try {
|
String sql_str = "INSERT INTO " + Sql_Mysql.FBSDevStateChangeInf_Table
|
+ " (dev_id,rec_time,eve_type,module_num,last_stat,now_stat,state_change_reason) "
|
+ " VALUES (" +
|
+ fbsdev_id + ","
|
+ "'" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "',"
|
+ eve_type + ","
|
+ module_num + ","
|
+ last_stat + ","
|
+ now_stat + ","
|
+ stat_change_reason + ")";
|
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
/************************************************************************************************/
|
|
/************************************************************************************************/
|
/**
|
* ´´½¨ tb_fbs9100s_fod_state ±í
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100SFODStateOnRam(MysqlConnPool con_pool)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SFODState_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SFODState_Table
|
+ " (`num` int(11) NOT NULL AUTO_INCREMENT,"
|
+ " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id',"
|
+ " `record_time` datetime NOT NULL DEFAULT '1970-01-01 00:00:00' COMMENT '¼Ç¼ʱ¼ä',"
|
+ " `RestTime_one` int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é1)',"
|
+ " `WorkState_one` int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é1)',"
|
+ " `VGroupVol_one` double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é1)',"
|
+ " `VpeakVol_one` double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é1)',"
|
+ " `RestTime_two` int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é2)',"
|
+ " `WorkState_two` int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é2)',"
|
+ " `VGroupVol_two` double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é2)',"
|
+ " `VpeakVol_two` double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é2)',"
|
+ " `RestTime_three` int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é3)',"
|
+ " `WorkState_three` int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é3)',"
|
+ " `VGroupVol_three` double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é3)',"
|
+ " `VpeakVol_three` double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é3)',"
|
+ " `RestTime_four` int(11) NOT NULL DEFAULT '0' COMMENT 'Ê£ÓàÌìÊý(×é4)',"
|
+ " `WorkState_four` int(11) NOT NULL DEFAULT '0' COMMENT '¹¤×÷ģʽ(×é4)',"
|
+ " `VGroupVol_four` double NOT NULL DEFAULT '0' COMMENT '×é¶Ëµçѹ(×é4)',"
|
+ " `VpeakVol_four` double NOT NULL DEFAULT '0' COMMENT '·åÖµµçѹ(×é4)',"
|
+ " PRIMARY KEY (`num`),"
|
+ " UNIQUE KEY `unique_dev_id` (`dev_id`)"
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//sql.sqlMysqlExecute(str1);
|
//System.out.println(str2);
|
sql.sqlMysqlExecute(str2);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/*
|
* ¸üÐÂÖ¸¶¨É豸³ýÁòÄ£¿éµÄ¹¤×÷״̬
|
*/
|
public static void inseartOrUpdateFBS9100SFODState(MysqlConnPool con_pool,FBS9100S_FOD_Data fodstate,int dev_id){
|
String sql_str_base = Sql_Mysql.FBS9100SFODState_Table
|
+ " SET "
|
+ "dev_id=" + dev_id + ", "
|
+ "record_time='" + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms) + "', "
|
+ "RestTime_one=" + fodstate.foddata[0].RestTime + ", "
|
+ "WorkState_one=" + fodstate.foddata[0].WorkState + ", "
|
+ "VGroupVol_one=" + fodstate.foddata[0].VGroupVol + ", "
|
+ "VpeakVol_one=" + fodstate.foddata[0].VpeakVol + ","
|
+ "RestTime_two=" + fodstate.foddata[1].RestTime + ", "
|
+ "WorkState_two=" + fodstate.foddata[1].WorkState + ", "
|
+ "VGroupVol_two=" + fodstate.foddata[1].VGroupVol + ", "
|
+ "VpeakVol_two=" + fodstate.foddata[1].VpeakVol + ","
|
+ "RestTime_three=" + fodstate.foddata[2].RestTime + ", "
|
+ "WorkState_three=" + fodstate.foddata[2].WorkState + ", "
|
+ "VGroupVol_three=" + fodstate.foddata[2].VGroupVol + ", "
|
+ "VpeakVol_three=" + fodstate.foddata[2].VpeakVol + ","
|
+ "RestTime_four=" + fodstate.foddata[3].RestTime + ", "
|
+ "WorkState_four=" + fodstate.foddata[3].WorkState + ", "
|
+ "VGroupVol_four=" + fodstate.foddata[3].VGroupVol + ", "
|
+ "VpeakVol_four=" + fodstate.foddata[3].VpeakVol;
|
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_replace);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/************************************************************************************************/
|
/**
|
* ´´½¨ tb_fbs9100s_fod_param ±í
|
* @param con_pool
|
* @param al_param
|
*/
|
public static void createFBS9100SFODParamOnRam(MysqlConnPool con_pool)
|
{
|
String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SFODParam_Table;
|
String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SFODParam_Table
|
+ "( `num` int(11) NOT NULL AUTO_INCREMENT,"
|
+ " `dev_id` int(11) NOT NULL DEFAULT '0' COMMENT 'É豸id',"
|
+ " `op_cmd` int(11) NOT NULL DEFAULT '0',"
|
+ " `test_cmd` int(11) NOT NULL DEFAULT '0',"
|
+ " `GroupNum` int(11) NOT NULL DEFAULT '1' COMMENT 'µç³Ø×éºÅ',"
|
+ " `STDCap_one` int(11) NOT NULL DEFAULT '0' COMMENT '×é1±ê³ÆÈÝÁ¿',"
|
+ " `FloatVol_one` double NOT NULL DEFAULT '0' COMMENT '×é1¸¡³äµçѹ',"
|
+ " `Strength_one` double NOT NULL DEFAULT '0' COMMENT '×é1³ýÁòÇ¿¶È',"
|
+ " `YHStrength_one` double NOT NULL DEFAULT '0' COMMENT '×é1Ñø»¤Ç¿¶È',"
|
+ " `TimeLong_one` int(11) NOT NULL DEFAULT '0' COMMENT '×é1³ýÁòÌìÊý',"
|
+ " `STDCap_two` int(11) NOT NULL DEFAULT '0' COMMENT '×é2±ê³ÆÈÝÁ¿',"
|
+ " `FloatVol_two` double NOT NULL DEFAULT '0' COMMENT '×é2¸¡³äµçѹ',"
|
+ " `Strength_two` double NOT NULL DEFAULT '0' COMMENT '×é2³ýÁòÇ¿¶È',"
|
+ " `YHStrength_two` double NOT NULL DEFAULT '0' COMMENT '×é2Ñø»¤Ç¿¶È',"
|
+ " `TimeLong_two` int(11) NOT NULL DEFAULT '0' COMMENT '×é2³ýÁòÌìÊý',"
|
+ " `STDCap_three` int(11) NOT NULL DEFAULT '0' COMMENT '×é3±ê³ÆÈÝÁ¿',"
|
+ " `FloatVol_three` double NOT NULL DEFAULT '0' COMMENT '×é3¸¡³äµçѹ',"
|
+ " `Strength_three` double NOT NULL DEFAULT '0' COMMENT '×é3³ýÁòÇ¿¶È',"
|
+ " `YHStrength_three` double NOT NULL DEFAULT '0' COMMENT '×é3Ñø»¤Ç¿¶È',"
|
+ " `TimeLong_three` int(11) NOT NULL DEFAULT '0' COMMENT '×é3³ýÁòÌìÊý',"
|
+ " `STDCap_four` int(11) NOT NULL DEFAULT '0' COMMENT '×é4±ê³ÆÈÝÁ¿',"
|
+ " `FloatVol_four` double NOT NULL DEFAULT '0' COMMENT '×é4¸¡³äµçѹ',"
|
+ " `Strength_four` double NOT NULL DEFAULT '0' COMMENT '×é4³ýÁòÇ¿¶È',"
|
+ " `YHStrength_four` double NOT NULL DEFAULT '0' COMMENT '×é4Ñø»¤Ç¿¶È',"
|
+ " `TimeLong_four` int(11) NOT NULL DEFAULT '0' COMMENT '×é4³ýÁòÌìÊý',"
|
+ " PRIMARY KEY (`num`),"
|
+ " UNIQUE KEY `unique_dev_id` (`dev_id`)"
|
+ ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
sql.sqlMysqlExecute(str2); //´´½¨Êý¾Ý¿â±í£¬Èô±í´æÔÚÔò²»´´½¨
|
/***************************** ɾ³ý·ÏÆú×Ö¶Î ***************************************************/
|
String sql_str1 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'db_ram_db' "
|
+ " AND table_name='tb_fbs9100s_fod_param' "
|
+ " AND column_name='STDCap'";
|
//System.out.println(sql_str3);
|
ResultSet rs = sql.sqlMysqlQuery(sql_str1);
|
if(true == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table + " drop column STDCap");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table + " drop column FloatVol");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table + " drop column Strength");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table + " drop column YHStrength");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table + " drop column TimeLong");
|
}
|
|
sql_str1 = " SELECT * FROM information_schema.columns "
|
+ " WHERE table_schema= 'db_ram_db' "
|
+ " AND table_name='tb_fbs9100s_fod_param' "
|
+ " AND column_name='STDCap_one'";
|
//System.out.println(sql_str3);
|
rs = sql.sqlMysqlQuery(sql_str1);
|
if(false == rs.next()) {
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `STDCap_one` int(11) NOT NULL DEFAULT '0' COMMENT '×é1±ê³ÆÈÝÁ¿'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `FloatVol_one` double NOT NULL DEFAULT '0' COMMENT '×é1¸¡³äµçѹ'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `Strength_one` double NOT NULL DEFAULT '0' COMMENT '×é1³ýÁòÇ¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `YHStrength_one` double NOT NULL DEFAULT '0' COMMENT '×é1Ñø»¤Ç¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `TimeLong_one` int(11) NOT NULL DEFAULT '0' COMMENT '×é1³ýÁòÌìÊý'");
|
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `STDCap_two` int(11) NOT NULL DEFAULT '0' COMMENT '×é2±ê³ÆÈÝÁ¿'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `FloatVol_two` double NOT NULL DEFAULT '0' COMMENT '×é2¸¡³äµçѹ'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `Strength_two` double NOT NULL DEFAULT '0' COMMENT '×é2³ýÁòÇ¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `YHStrength_two` double NOT NULL DEFAULT '0' COMMENT '×é2Ñø»¤Ç¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `TimeLong_two` int(11) NOT NULL DEFAULT '0' COMMENT '×é2³ýÁòÌìÊý'");
|
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `STDCap_three` int(11) NOT NULL DEFAULT '0' COMMENT '×é3±ê³ÆÈÝÁ¿'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `FloatVol_three` double NOT NULL DEFAULT '0' COMMENT '×é3¸¡³äµçѹ'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `Strength_three` double NOT NULL DEFAULT '0' COMMENT '×é3³ýÁòÇ¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `YHStrength_three` double NOT NULL DEFAULT '0' COMMENT '×é3Ñø»¤Ç¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `TimeLong_three` int(11) NOT NULL DEFAULT '0' COMMENT '×é3³ýÁòÌìÊý'");
|
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `STDCap_four` int(11) NOT NULL DEFAULT '0' COMMENT '×é4±ê³ÆÈÝÁ¿'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `FloatVol_four` double NOT NULL DEFAULT '0' COMMENT '×é4¸¡³äµçѹ'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `Strength_four` double NOT NULL DEFAULT '0' COMMENT '×é4³ýÁòÇ¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `YHStrength_four` double NOT NULL DEFAULT '0' COMMENT '×é4Ñø»¤Ç¿¶È'");
|
sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SFODParam_Table
|
+ " ADD COLUMN `TimeLong_four` int(11) NOT NULL DEFAULT '0' COMMENT '×é4³ýÁòÌìÊý'");
|
}
|
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/*
|
* ²åÈë»ò¸üÐÂÖ¸¶¨É豸³ýÁòÄ£¿éµÄ²ÎÊý
|
*/
|
public static void inseartOrUpdateFBS9100SFODParam(MysqlConnPool con_pool,FBS9100S_FOD_Param fodparam,int dev_id){
|
String sql_str_base = Sql_Mysql.FBS9100SFODParam_Table
|
+ " SET "
|
+ "dev_id=" + dev_id + ", "
|
+ "op_cmd=" + fodparam.op_cmd + ", "
|
+ "GroupNum=" + fodparam.GroupNum + ", "
|
+ "STDCap_one=" + fodparam.fodParam[0].STDCap + ", "
|
+ "FloatVol_one=" + fodparam.fodParam[0].FloatVol + ", "
|
+ "Strength_one=" + fodparam.fodParam[0].Strength + ", "
|
+ "YHStrength_one=" + fodparam.fodParam[0].YHStrength + ", "
|
+ "TimeLong_one=" + fodparam.fodParam[0].TimeLong + ", "
|
+ "STDCap_two=" + fodparam.fodParam[1].STDCap + ", "
|
+ "FloatVol_two=" + fodparam.fodParam[1].FloatVol + ", "
|
+ "Strength_two=" + fodparam.fodParam[1].Strength + ", "
|
+ "YHStrength_two=" + fodparam.fodParam[1].YHStrength + ", "
|
+ "TimeLong_two=" + fodparam.fodParam[1].TimeLong + ","
|
+ "STDCap_three=" + fodparam.fodParam[2].STDCap + ", "
|
+ "FloatVol_three=" + fodparam.fodParam[2].FloatVol + ", "
|
+ "Strength_three=" + fodparam.fodParam[2].Strength + ", "
|
+ "YHStrength_three=" + fodparam.fodParam[2].YHStrength + ", "
|
+ "TimeLong_three=" + fodparam.fodParam[2].TimeLong + ","
|
+ "STDCap_four=" + fodparam.fodParam[3].STDCap + ", "
|
+ "FloatVol_four=" + fodparam.fodParam[3].FloatVol + ", "
|
+ "Strength_four=" + fodparam.fodParam[3].Strength + ", "
|
+ "YHStrength_four=" + fodparam.fodParam[3].YHStrength + ", "
|
+ "TimeLong_four=" + fodparam.fodParam[3].TimeLong;
|
|
String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str);
|
sql.sqlMysqlExecute(sql_str_replace);
|
} catch (SQLException e) {
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ²éѯÊý¾Ý¿âÖеijýÁòÄ£¿éµÄ²ÎÊý
|
*/
|
public static void queryFBS9100SFODParam(MysqlConnPool con_pool,FBS9100S_FOD_Param fodparam,int dev_id){
|
String sql_str = "SELECT * FROM " + Sql_Mysql.FBS9100SFODParam_Table + " where dev_id = " + dev_id;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
ResultSet res = sql.sqlMysqlQuery(sql_str);
|
try {
|
if(res.next())
|
{
|
if(null != fodparam) {
|
fodparam.op_cmd = res.getInt("op_cmd");
|
fodparam.test_cmd = res.getInt("test_cmd");
|
fodparam.dev_id = res.getInt("dev_id");
|
fodparam.GroupNum = res.getInt("GroupNum");
|
fodparam.fodParam[0].STDCap = res.getInt("STDCap_one");
|
fodparam.fodParam[0].FloatVol = res.getDouble("FloatVol_one");
|
fodparam.fodParam[0].Strength = res.getDouble("Strength_one");
|
fodparam.fodParam[0].YHStrength = res.getDouble("YHStrength_one");
|
fodparam.fodParam[0].TimeLong = res.getInt("TimeLong_one");
|
|
fodparam.fodParam[1].STDCap = res.getInt("STDCap_two");
|
fodparam.fodParam[1].FloatVol = res.getDouble("FloatVol_two");
|
fodparam.fodParam[1].Strength = res.getDouble("Strength_two");
|
fodparam.fodParam[1].YHStrength = res.getDouble("YHStrength_two");
|
fodparam.fodParam[1].TimeLong = res.getInt("TimeLong_two");
|
|
|
fodparam.fodParam[2].STDCap = res.getInt("STDCap_three");
|
fodparam.fodParam[2].FloatVol = res.getDouble("FloatVol_three");
|
fodparam.fodParam[2].Strength = res.getDouble("Strength_three");
|
fodparam.fodParam[2].YHStrength = res.getDouble("YHStrength_three");
|
fodparam.fodParam[2].TimeLong = res.getInt("TimeLong_three");
|
|
fodparam.fodParam[3].STDCap = res.getInt("STDCap_four");
|
fodparam.fodParam[3].FloatVol = res.getDouble("FloatVol_four");
|
fodparam.fodParam[3].Strength = res.getDouble("Strength_four");
|
fodparam.fodParam[3].YHStrength = res.getDouble("YHStrength_four");
|
fodparam.fodParam[3].TimeLong = res.getInt("TimeLong_four");
|
}
|
}
|
} catch (SQLException e) {
|
e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ¸ù¾ÝÖ¸¶¨µÄÉ豸id Ð޸ıí tb_fbs9100_setparam ÖеÄop_cmdÖµ
|
*/
|
public static void updateFbs9100FODParamCmdBydev_id(MysqlConnPool con_pool, FBS9100S_FOD_Param param,int dev_id)
|
{
|
if((param.op_cmd == FBS9100_ComBase.CMD__ReadFodParamACK)
|
|| (param.op_cmd == FBS9100_ComBase.CMD_Stop_FOD_testACK)
|
|| (param.op_cmd == FBS9100_ComBase.CMD_WriteFodParamACK)
|
|| (param.op_cmd == FBS9100_ComBase.CMD_Start_FODCL_testACK)
|
|| (param.op_cmd == FBS9100_ComBase.CMD_Start_FODYH_testACK))
|
{
|
String sql_str_base = Sql_Mysql.FBS9100SFODParam_Table + " SET "
|
+ "dev_id=" + dev_id + ", "
|
+ "op_cmd=" + param.op_cmd + " "
|
//+ "TestCmd=" + param.m_FBS_DiscParam.test_cmd
|
+ " where dev_id = " + dev_id;
|
String sql_str_update = "UPDATE " + sql_str_base;
|
//String sql_str_replace = "REPLACE INTO " + sql_str_base;
|
Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
|
try {
|
//System.out.println(sql_str_update);
|
sql.sqlMysqlExecute(sql_str_update);
|
} catch (SQLException e) {
|
// TODO Auto-generated catch block
|
//e.printStackTrace();
|
} finally {
|
sql.close_con();
|
}
|
}
|
}
|
|
/**
|
* ´´½¨Ö¸¶¨µÄµç³Ø×éÀúÊ·Êý¾Ý¼Ç¼±í
|
* @param pool
|
* @param BattGroupId
|
*/
|
public static void CreateTb_BattRealDataTable(MysqlConnPool pool,int BattGroupId) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Batt_RealData+BattGroupId + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '1'," +
|
" `recrod_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `group_vol` float NOT NULL DEFAULT '0'," +
|
" `online_vol` float NOT NULL DEFAULT '0'," +
|
" `group_curr` float NOT NULL DEFAULT '0'," +
|
" `group_tmp` float NOT NULL DEFAULT '0'," +
|
" `batt_state` int(11) NOT NULL DEFAULT '0'," +
|
" `batt_test_type` int(11) NOT NULL DEFAULT '0'," +
|
" `batt_test_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `batt_test_tlong` int(11) NOT NULL DEFAULT '0'," +
|
" `batt_test_cap` float NOT NULL DEFAULT '0'," +
|
" `mon_num` int(11) NOT NULL DEFAULT '1'," +
|
" `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'," +
|
" `mon_conn_res` float NOT NULL DEFAULT '0'," +
|
" `mon_cap` float NOT NULL DEFAULT '0'," +
|
" `mon_JH_curr` float NOT NULL DEFAULT '0'," +
|
" `note` varchar(255) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`),"
|
+ "KEY `index_battgroupid` (`BattGroupId`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
//sql.logger.error("FBS9100_Task_Thread_SQL.CreateTb_BattRealDataTable():" + e.toString(), e);
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
|
/**
|
* ´´½¨Ö¸¶¨µÄµç³Ø×éÀúÊ·Êý¾Ý¼Ç¼±í
|
* @param pool
|
* @param BattGroupId µç³Ø×éid
|
* @param time ¼Ç¼ʱ¼ä
|
*/
|
public static void CreateTb_BattRealDataTable(MysqlConnPool pool,int BattGroupId,Date time) {
|
String sql_str = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.Tb_Batt_RealData+BattGroupId+"_"+Com.getDateTimeFormat(time, Com.DTF_YM) + " (" +
|
" `num` bigint(20) NOT NULL AUTO_INCREMENT," +
|
" `BattGroupId` int(11) NOT NULL DEFAULT '1'," +
|
" `recrod_time` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `group_vol` float NOT NULL DEFAULT '0'," +
|
" `online_vol` float NOT NULL DEFAULT '0'," +
|
" `group_curr` float NOT NULL DEFAULT '0'," +
|
" `group_tmp` float NOT NULL DEFAULT '0'," +
|
" `batt_state` int(11) NOT NULL DEFAULT '0'," +
|
" `batt_test_type` int(11) NOT NULL DEFAULT '0'," +
|
" `batt_test_starttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," +
|
" `batt_test_tlong` int(11) NOT NULL DEFAULT '0'," +
|
" `batt_test_cap` float NOT NULL DEFAULT '0'," +
|
" `mon_num` int(11) NOT NULL DEFAULT '1'," +
|
" `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'," +
|
" `mon_conn_res` float NOT NULL DEFAULT '0'," +
|
" `mon_cap` float NOT NULL DEFAULT '0'," +
|
" `mon_JH_curr` float NOT NULL DEFAULT '0'," +
|
" `note` varchar(255) NOT NULL DEFAULT ''," +
|
" PRIMARY KEY (`num`)," +
|
" KEY `index_battgroupid` (`BattGroupId`) USING BTREE," +
|
" KEY `index_record_time` (`recrod_time`) USING BTREE" +
|
") ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
|
Sql_Mysql sql = new Sql_Mysql(pool.getConn());
|
try {
|
sql.sqlMysqlExecute(sql_str);
|
} catch (SQLException e) {
|
//sql.logger.error("CreateTb_BattRealDataTable():" + e.toString(), e);
|
} finally {
|
sql.close_con();
|
}
|
}
|
|
/**
|
* ɾ³ýÐÞ¸Äʱ¼ä³¬Ê±µÄÀúÊ·Êý¾Ý±í[ûÓÐÐÞ¸Äʱ¼äµÄ±í²»»áÓÐÓ¦Ó°Ïì]
|
*/
|
public static void deleteHistoryData(MysqlConnPool conn_pool,Date deldate) {
|
String sql_select_strs = " select TABLE_NAME,UPDATE_TIME " +
|
" from information_schema.tables " +
|
" where table_schema='db_batt_history' " +
|
" AND TABLE_NAME like 'tb_batt_realdata_%' " +
|
" AND CREATE_TIME <= '"+Com.getDateTimeFormat(deldate, Com.DTF_YMDhms)+"';" ;
|
String sql_delete_strs = " DROP TABLE IF EXISTS ";
|
Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
|
ResultSet res = null;
|
int count = 0;
|
res = sql.sqlMysqlQuery(sql_select_strs);
|
try {
|
while(res.next()) {
|
if(count > 0) {
|
sql_delete_strs += ",";
|
}
|
|
sql_delete_strs += "db_batt_history." + res.getString("TABLE_NAME");
|
System.out.println("ɾ³ý£º"+res.getString("TABLE_NAME")+"\t at "+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
|
count++;
|
}
|
if(count >0) {
|
sql.sqlMysqlExecute(sql_delete_strs);
|
}
|
res.close();
|
} catch (SQLException e) {
|
System.err.println("deleteHistoryData():"+ e);
|
} finally {
|
sql.close_con();
|
}
|
}
|
}
|