From 5563293e54259b6baeb98ec9785f747aa3fbdc6a Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq,com> Date: 星期四, 27 八月 2020 14:32:53 +0800 Subject: [PATCH] 负载部分修改提交 --- src/com/data/PowerArk_Task_SQL.java | 510 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 451 insertions(+), 59 deletions(-) diff --git a/src/com/data/PowerArk_Task_SQL.java b/src/com/data/PowerArk_Task_SQL.java index 8c3a57c..bd514a7 100644 --- a/src/com/data/PowerArk_Task_SQL.java +++ b/src/com/data/PowerArk_Task_SQL.java @@ -1,59 +1,451 @@ -package com.data; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import com.dev.base.data.Dynamicload_button; -import com.dev.base.data.Dynamicload_control; -import com.dev.base.data.Dynamicload_inf; -import com.dev.base.data.Dynamicload_state; -import com.sql.MysqlConnPool; -import com.sql.Sql_Mysql; - -public class PowerArk_Task_SQL { - - /** - * 查询所有的设备信息 - * @param conn_pool - * @return - */ - public static List<Dynamicload_inf> queryAllPowerArk(MysqlConnPool conn_pool){ - List<Dynamicload_inf> dys = new ArrayList<Dynamicload_inf>(); - String sql_str = " SELECT * FROM db_dynamicsystem.tb_dynamicload_inf "; - ResultSet res = null; - Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn()); - try { - res = sql.sqlMysqlQuery(sql_str); - Dynamicload_inf dyna = null; - while(res.next()) { - dyna = new Dynamicload_inf(); - dyna.setDev_id(res.getInt("dev_id")); - dyna.setDev_ip(res.getString("dev_ip")); - dyna.setDev_name(res.getString("dev_name")); - dyna.setDev_type(res.getInt("dev_type")); - dyna.setFZ_button_num(res.getInt("fZ_button_num")); - dyna.setNote(res.getString("note")); - - dyna.button = new Dynamicload_button(dyna.dev_id); - dyna.control = new Dynamicload_control(dyna.dev_id); - dyna.state = new Dynamicload_state(dyna.dev_id); - dys.add(dyna); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - if(res != null) { - try { - res.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - sql.close_con(); - } - } - return dys; - } - -} +package com.data; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.base.Com; +import com.dev.base.data.Dynamicload_button; +import com.dev.base.data.Dynamicload_control; +import com.dev.base.data.Dynamicload_inf; +import com.dev.base.data.Dynamicload_state; +import com.sql.MysqlConnPool; +import com.sql.Sql_Mysql; + +public class PowerArk_Task_SQL { + + + /** + * 初始化数据库表 + * @param pool + */ + public static void init(MysqlConnPool pool) { + + createDB_ElectricSystem(pool); + + createTb_Dynamicload_inf(pool); + + createTb_Dynamicload_Button_Rt(pool); + + createTb_Dynamicload_State_rt(pool); + + createTb_Dynamicload_Control(pool); + + } + /** + * 创建负载数据库 + * @param pool + */ + public static void createDB_ElectricSystem(MysqlConnPool pool) { + Sql_Mysql sql = new Sql_Mysql(pool.getConn()); + try { + sql.sqlMysqlExecute("CREATE DATABASE IF NOT EXISTS " + Sql_Mysql.DB_DynamicSystem); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } + /** + * 创建负载信息表 + * @param pool + */ + public static void createTb_Dynamicload_inf(MysqlConnPool pool) { + String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Dynamicload_inf+" (" + + " num bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键'," + + " dev_id int(11) NOT NULL DEFAULT '1' COMMENT '设备id'," + + " dev_name varchar(126) NOT NULL DEFAULT '' COMMENT '设备名称'," + + " dev_type int(11) NOT NULL DEFAULT '0' COMMENT '设备类型 1:负载.....'," + + " FZ_button_num int(11) NOT NULL DEFAULT '10' COMMENT '负载柜上按钮个数',"+ + " dev_ip varchar(126) NOT NULL DEFAULT '' COMMENT '设备ip'," + + " note varchar(255) NOT NULL DEFAULT ''," + + " PRIMARY KEY (num)," + + " KEY dev_id_key (dev_id)" + + ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"; + Sql_Mysql sql = new Sql_Mysql(pool.getConn()); + try { + sql.sqlMysqlExecute(sql_str); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } + /** + * 创建按钮实时信息 + * @param pool + */ + public static void createTb_Dynamicload_Button_Rt(MysqlConnPool pool) { + String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Dynamicload_Button_Rt+" (" + + " num bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键'," + + " dev_id int(11) NOT NULL DEFAULT '1' COMMENT '设备id'," + + " FZ_b1 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮1'," + + " FZ_b2 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮2'," + + " FZ_b3 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮3'," + + " FZ_b4 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮4'," + + " FZ_b5 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮5'," + + " FZ_b6 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮6'," + + " FZ_b7 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮7'," + + " FZ_b8 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮8'," + + " FZ_b9 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮9'," + + " FZ_b10 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮10'," + + " FZ_b11 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮11'," + + " FZ_b1_power float NOT NULL DEFAULT '37.5' COMMENT 'FZ按钮1额定功率'," + + " FZ_b2_power float NOT NULL DEFAULT '37.5' COMMENT 'FZ按钮2额定功率'," + + " FZ_b3_power float NOT NULL DEFAULT '75' COMMENT 'FZ按钮3额定功率'," + + " FZ_b4_power float NOT NULL DEFAULT '75' COMMENT 'FZ按钮4额定功率'," + + " FZ_b5_power float NOT NULL DEFAULT '75' COMMENT 'FZ按钮5额定功率'," + + " FZ_b6_power float NOT NULL DEFAULT '75' COMMENT 'FZ按钮6额定功率'," + + " FZ_b7_power float NOT NULL DEFAULT '75' COMMENT 'FZ按钮7额定功率'," + + " FZ_b8_power float NOT NULL DEFAULT '75' COMMENT 'FZ按钮8额定功率'," + + " FZ_b9_power float NOT NULL DEFAULT '112.5' COMMENT 'FZ按钮9额定功率'," + + " FZ_b10_power float NOT NULL DEFAULT '112.5' COMMENT 'FZ按钮10额定功率'," + + " FZ_b11_power float NOT NULL DEFAULT '200' COMMENT 'FZ按钮11额定功率'," + + " FZ_fw1 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮1'," + + " FZ_fw2 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮2'," + + " FZ_fw3 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮3'," + + " FZ_fw4 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮4'," + + " FZ_fw5 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮5'," + + " FZ_fw6 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮6'," + + " FZ_fw7 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮7'," + + " FZ_fw8 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮8'," + + " FZ_fw9 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮9'," + + " FZ_fw10 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮10'," + + " FZ_fw11 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ反馈按钮11'," + + " FZ_ex1 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮1'," + + " FZ_ex2 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮2'," + + " FZ_ex3 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮3'," + + " FZ_ex4 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮4'," + + " FZ_ex5 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮5'," + + " FZ_ex6 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮6'," + + " FZ_ex7 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮7'," + + " FZ_ex8 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮8'," + + " FZ_ex9 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮9'," + + " FZ_ex10 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮10'," + + " FZ_ex11 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ输出按钮11'," + + " note varchar(255) NOT NULL DEFAULT ''," + + " PRIMARY KEY (num)," + + " KEY dev_id_key (dev_id)" + + ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"; + Sql_Mysql sql = new Sql_Mysql(pool.getConn()); + try { + sql.sqlMysqlExecute(sql_str); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } + /** + * 创建负载信息表 + * @param pool + */ + public static void createTb_Dynamicload_State_rt(MysqlConnPool pool) { + String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Dynamicload_State_rt+" (" + + " num int(11) NOT NULL AUTO_INCREMENT COMMENT '主键'," + + " dev_id int(11) NOT NULL DEFAULT '1001' COMMENT '设备id'," + + " record_time datetime NOT NULL DEFAULT '2000-01-01 00:00:00' COMMENT '记录时间'," + + " start_auto int(11) NOT NULL DEFAULT '0' COMMENT '启动自动加载'," + + " stop_auto int(11) NOT NULL DEFAULT '0' COMMENT '停止自动加载'," + + " sudden_crease int(11) NOT NULL DEFAULT '0' COMMENT '突加突卸'," + + " all_open int(11) NOT NULL DEFAULT '0' COMMENT '全部分闸'," + + " actual_set_power float NOT NULL DEFAULT '0' COMMENT '实际设定功率'," + + " output_power float NOT NULL DEFAULT '0' COMMENT '已输出功率'," + + " set_power float NOT NULL DEFAULT '0' COMMENT '设定功率'," + + " interval_time float NOT NULL DEFAULT '0' COMMENT '间隔时间s'," + + " actual_curr float NOT NULL DEFAULT '0' COMMENT '实际电流'," + + " actual_mov float NOT NULL DEFAULT '0' COMMENT '实际电压'," + + " switch_on int(11) NOT NULL DEFAULT '0' COMMENT '是否合闸'," + + " FZ_autostate1 int(11) NOT NULL DEFAULT '0' COMMENT 'FZ自动状态1'," + + " FZ_autostate2 int(11) NOT NULL DEFAULT '0' COMMENT 'FZ自动状态2'," + + " FZ_autostate3 int(11) NOT NULL DEFAULT '0' COMMENT 'FZ自动状态3'," + + " FZ_autostate4 int(11) NOT NULL DEFAULT '0' COMMENT 'FZ自动状态4'," + + " FZ_autostate5 int(11) NOT NULL DEFAULT '0' COMMENT 'FZ自动状态5'," + + " react_overtem int(11) NOT NULL DEFAULT '0' COMMENT '电抗超温'," + + " water_overtem int(11) NOT NULL DEFAULT '0' COMMENT '冷却水超温'," + + " water_level_low int(11) NOT NULL DEFAULT '0' COMMENT '冷却水液位低'," + + " water_pressure_high int(11) NOT NULL DEFAULT '0' COMMENT '冷却水压高'," + + " local_control int(11) NOT NULL DEFAULT '0' COMMENT '就地控制'," + + " back_control int(11) NOT NULL DEFAULT '0' COMMENT '后台控制'," + + " central_control int(11) NOT NULL DEFAULT '0' COMMENT '中控控制'," + + " switch_state int(11) NOT NULL DEFAULT '0' COMMENT '开关柜状态'," + + " inter_volume_M200 int(11) NOT NULL DEFAULT '0' COMMENT '中间量M200'," + + " fan_button int(11) NOT NULL DEFAULT '0' COMMENT '风机按钮'," + + " fan_output int(11) NOT NULL DEFAULT '0' COMMENT '风机输出'," + + " allow_close int(11) NOT NULL DEFAULT '0' COMMENT '是否允许合闸'," + + " note varchar(255) NOT NULL DEFAULT ''," + + " PRIMARY KEY (num)," + + " KEY dev_id_key (dev_id)" + + ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"; + Sql_Mysql sql = new Sql_Mysql(pool.getConn()); + try { + sql.sqlMysqlExecute(sql_str); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } + /** + * 创建控制表 + * @param pool + */ + public static void createTb_Dynamicload_Control(MysqlConnPool pool) { + String sql_str = "CREATE TABLE IF NOT EXISTS "+Sql_Mysql.Tb_Dynamicload_Control+" (" + + " num int(11) NOT NULL AUTO_INCREMENT COMMENT '主键'," + + " dev_id int(11) NOT NULL DEFAULT '1' COMMENT '设备id'," + + " FZ_b1 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮1'," + + " FZ_b2 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮2'," + + " FZ_b3 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮3'," + + " FZ_b4 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮4'," + + " FZ_b5 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮5'," + + " FZ_b6 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮6'," + + " FZ_b7 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮7'," + + " FZ_b8 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮8'," + + " FZ_b9 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮9'," + + " FZ_b10 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮10'," + + " FZ_b11 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ按钮11'," + + " start_auto int(11) NOT NULL DEFAULT '1' COMMENT '启动自动加载'," + + " stop_auto int(11) NOT NULL DEFAULT '1' COMMENT '停止自动加载'," + + " sudden_crease int(11) NOT NULL DEFAULT '1' COMMENT '突加突卸'," + + " all_open int(11) NOT NULL DEFAULT '1' COMMENT '全部分闸'," + + " FZ_autostate1 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ自动状态1'," + + " FZ_autostate2 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ自动状态2'," + + " FZ_autostate3 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ自动状态3'," + + " FZ_autostate4 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ自动状态4'," + + " FZ_autostate5 int(11) NOT NULL DEFAULT '1' COMMENT 'FZ自动状态5'," + + " local_control int(11) NOT NULL DEFAULT '1' COMMENT '就地控制'," + + " back_control int(11) NOT NULL DEFAULT '1' COMMENT '后台控制'," + + " central_control int(11) NOT NULL DEFAULT '1' COMMENT '中控控制'," + + " inter_volume_M200 int(11) NOT NULL DEFAULT '1' COMMENT '中间量M200'," + + " fan_button int(11) NOT NULL DEFAULT '1' COMMENT '风机按钮'," + + " set_power float NOT NULL DEFAULT '0' COMMENT '设定功率'," + + " note varchar(255) NOT NULL DEFAULT ''," + + " interval_time int(11) NOT NULL DEFAULT '0'," + + " PRIMARY KEY (num)," + + " KEY dev_id_key (dev_id)" + + ") ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;"; + Sql_Mysql sql = new Sql_Mysql(pool.getConn()); + try { + sql.sqlMysqlExecute(sql_str); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } + /** + * 插入或更新负载按钮信息表 + * @param conn_pool + * @param dev_id + */ + public static void insertOrUpdateDynamicload_ButtonTable(MysqlConnPool conn_pool,Dynamicload_button dbutton,int button_num) { + String sql_str_sel = " SELECT * FROM " +Sql_Mysql.Tb_Dynamicload_Button_Rt+ " WHERE dev_id = " + dbutton.getDev_id(); + String sql_str_ins10 = " INSERT INTO " + Sql_Mysql.Tb_Dynamicload_Button_Rt + "(dev_id,FZ_b1_power,FZ_b2_power,FZ_b3_power,FZ_b4_power,FZ_b5_power,FZ_b6_power,FZ_b7_power,FZ_b8_power,FZ_b9_power,FZ_b10_power,FZ_b11_power) VALUES("+dbutton.dev_id+",37.5,37.5,75,75,75,75,75,75,112.5,112.5,0)"; + String sql_str_ins11 = " INSERT INTO " + Sql_Mysql.Tb_Dynamicload_Button_Rt + "(dev_id,FZ_b1_power,FZ_b2_power,FZ_b3_power,FZ_b4_power,FZ_b5_power,FZ_b6_power,FZ_b7_power,FZ_b8_power,FZ_b9_power,FZ_b10_power,FZ_b11_power) VALUES("+dbutton.dev_id+",5,5,10,10,20,50,50,100,100,200,200)"; + Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn()); + ResultSet res = null; + try { + res = sql.sqlMysqlQuery(sql_str_sel); + if(res.next()) { + //更新当前状态 + updateDynamicload_ButtonTable(conn_pool, new Dynamicload_button(dbutton.dev_id)); + }else { + //插入默认状态 + if(button_num==11) { + sql.sqlMysqlExecute(sql_str_ins11); + }else { + sql.sqlMysqlExecute(sql_str_ins10); + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if(res != null) { + try { + res.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + sql.close_con(); + } + } + /** + * 插入或更新负载状态信息表 + * @param conn_pool + * @param dev_id + */ + public static void insertOrUpdateDynamicload_StateTable(MysqlConnPool conn_pool,Dynamicload_state dstate) { + String sql_str_sel = " SELECT * FROM " +Sql_Mysql.Tb_Dynamicload_State_rt+ " WHERE dev_id = " + dstate.dev_id; + String sql_str_ins = " INSERT INTO " + Sql_Mysql.Tb_Dynamicload_State_rt + "(dev_id,record_time) VALUES("+dstate.dev_id+",'"+Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)+"')"; + Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn()); + ResultSet res = null; + try { + res = sql.sqlMysqlQuery(sql_str_sel); + if(res.next()) { + //更新当前状态 + updateDynamicload_StateTable(conn_pool, new Dynamicload_state(dstate.dev_id,0)); + }else { + //插入默认状态 + sql.sqlMysqlExecute(sql_str_ins); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if(res != null) { + try { + res.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + sql.close_con(); + } + } + + /** + * 查询所有的设备信息 + * @param conn_pool + * @return + */ + public static List<Dynamicload_inf> queryAllPowerArk(MysqlConnPool conn_pool){ + List<Dynamicload_inf> dys = new ArrayList<Dynamicload_inf>(); + String sql_str = " SELECT * FROM db_dynamicsystem.tb_dynamicload_inf "; + ResultSet res = null; + Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn()); + try { + res = sql.sqlMysqlQuery(sql_str); + Dynamicload_inf dyna = null; + while(res.next()) { + dyna = new Dynamicload_inf(); + dyna.setDev_id(res.getInt("dev_id")); + dyna.setDev_ip(res.getString("dev_ip")); + dyna.setDev_name(res.getString("dev_name")); + dyna.setDev_type(res.getInt("dev_type")); + dyna.setFZ_button_num(res.getInt("fZ_button_num")); + dyna.setNote(res.getString("note")); + + dyna.button = new Dynamicload_button(dyna.dev_id); + dyna.control = new Dynamicload_control(dyna.dev_id); + dyna.state = new Dynamicload_state(dyna.dev_id,0); + dys.add(dyna); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if(res != null) { + try { + res.close(); + } catch (SQLException e) { + e.printStackTrace(); + } + sql.close_con(); + } + } + return dys; + } + + /** + * 更新设备按钮信息 + * @param conn_pool + * @param control + */ + public static void updateDynamicload_ButtonTable(MysqlConnPool conn_pool,Dynamicload_button button) { + String sql_str = " UPDATE " + Sql_Mysql.Tb_Dynamicload_Button_Rt + +" SET " + +" FZ_b1=" + button.FZ_b1 + +",FZ_b2=" + button.FZ_b2 + +",FZ_b3=" + button.FZ_b3 + +",FZ_b4=" + button.FZ_b4 + +",FZ_b5=" + button.FZ_b5 + +",FZ_b6=" + button.FZ_b6 + +",FZ_b7=" + button.FZ_b7 + +",FZ_b8=" + button.FZ_b8 + +",FZ_b9=" + button.FZ_b9 + +",FZ_b10=" + button.FZ_b10 + +",FZ_b11=" + button.FZ_b11 + +",FZ_fw1=" + button.FZ_fw1 + +",FZ_fw2=" + button.FZ_fw2 + +",FZ_fw3=" + button.FZ_fw3 + +",FZ_fw4=" + button.FZ_fw4 + +",FZ_fw5=" + button.FZ_fw5 + +",FZ_fw6=" + button.FZ_fw6 + +",FZ_fw7=" + button.FZ_fw7 + +",FZ_fw8=" + button.FZ_fw8 + +",FZ_fw9=" + button.FZ_fw9 + +",FZ_fw10=" + button.FZ_fw10 + +",FZ_fw11=" + button.FZ_fw11 + +",FZ_ex1=" + button.FZ_ex1 + +",FZ_ex2=" + button.FZ_ex2 + +",FZ_ex3=" + button.FZ_ex3 + +",FZ_ex4=" + button.FZ_ex4 + +",FZ_ex5=" + button.FZ_ex5 + +",FZ_ex6=" + button.FZ_ex6 + +",FZ_ex7=" + button.FZ_ex7 + +",FZ_ex8=" + button.FZ_ex8 + +",FZ_ex9=" + button.FZ_ex9 + +",FZ_ex10=" + button.FZ_ex10 + +",FZ_ex11=" + button.FZ_ex11 + +" WHERE dev_id = " + button.dev_id; + Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn()); + try { + sql.sqlMysqlExecute(sql_str); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } + + + /** + * 更新设备状态信息 + * @param conn_pool + * @param control + */ + public static void updateDynamicload_StateTable(MysqlConnPool conn_pool,Dynamicload_state state) { + String sql_str = " UPDATE " + Sql_Mysql.Tb_Dynamicload_State_rt + + " SET " + +" start_auto=" + state.getStart_auto() + +",stop_auto=" + state.getStop_auto() + +",sudden_crease=" + state.getSudden_crease() + +",all_open=" + state.getAll_open() + +",actual_set_power=" + state.getActual_set_power() + +",output_power=" + state.getOutput_power() + +",set_power=" + state.getSet_power() + +",interval_time=" + state.getInterval_time() + +",actual_curr=" + state.getActual_curr() + +",actual_mov=" + state.getActual_mov() + +",switch_on=" + state.getSwitch_on() + +",FZ_autostate1=" + state.getFZ_autostate1() + +",FZ_autostate2=" + state.getFZ_autostate2() + +",FZ_autostate3=" + state.getFZ_autostate3() + +",FZ_autostate4=" + state.getFZ_autostate4() + +",FZ_autostate5=" + state.getFZ_autostate5() + +",react_overtem=" + state.getReact_overtem() + +",water_overtem=" + state.getWater_overtem() + +",water_level_low=" + state.getWater_level_low() + +",water_pressure_high=" + state.getWater_pressure_high() + +",local_control=" + state.getLocal_control() + +",back_control=" + state.getBack_control() + +",central_control=" + state.getCentral_control() + +",switch_state=" + state.getSwitch_state() + +",inter_volume_M200=" + state.getInter_volume_M200() + +",fan_button=" + state.getFan_button() + +",fan_output=" + state.getFan_output() + +",allow_close=" + state.allow_close + + " WHERE dev_id = " + state.dev_id; + Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn()); + try { + //System.out.println(sql_str); + sql.sqlMysqlExecute(sql_str); + } catch (SQLException e) { + e.printStackTrace(); + } finally { + sql.close_con(); + } + } +} -- Gitblit v1.9.1