| | |
| | | import com.fgkj.dao.CallBack;
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.dao.FBS9100_ComBase;
|
| | | import com.fgkj.dao.UinfDaoFactory;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.User_log;
|
| | | import com.fgkj.dto.ram.Fbs9100_battparam;
|
| | | import com.fgkj.dto.ram.Fbs9100_sysparam;
|
| | | import com.fgkj.services.User_logService;
|
| | | import com.mysql.fabric.xmlrpc.base.Array;
|
| | |
|
| | | public class Fbs9100_battparamImpl implements BaseDAO,CallBack{
|
| | |
| | | ,bparam.getBattTemp(),bparam.getFloatChargeVol(),bparam.getFloatChargeCurr(),bparam.getOnlineVolLow(),bparam.getGroupConnType()});
|
| | | return bl;
|
| | | }
|
| | |
|
| | | //批量设置参数前往表中加入数据
|
| | | public boolean updatePL(Object obj) {
|
| | | Fbs9100_battparam bparam=(Fbs9100_battparam) obj;
|
| | | /*String sql=" update db_ram_db.tb_fbs9100_battparam set STD_CAP=?,STD_RES=?,BattGroupCount=?,EachGroupBattCount=?,MonomerVol=?,GroupVol=?,BattTemp=?,FloatChargeVol=?,FloatChargeCurr=?,OnlineVolLow=?,GroupConnType=? " +
|
| | | " where dev_id=? ";*/
|
| | | String sql=" replace into db_ram_db.tb_fbs9100_battparam(dev_id,op_cmd,dev_ip,STD_CAP,STD_RES,BattGroupCount,EachGroupBattCount,MonomerVol,GroupVol,BattTemp,FloatChargeVol,FloatChargeCurr,OnlineVolLow,GroupConnType) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{bparam.getDev_id(),bparam.getOp_cmd(),bparam.getDev_ip(),bparam.getSTD_CAP(),bparam.getSTD_RES(),bparam.getBattGroupCount(),bparam.getEachGroupBattCount(),bparam.getMonomerVol(),bparam.getGroupVol()
|
| | | ,bparam.getBattTemp(),bparam.getFloatChargeVol(),bparam.getFloatChargeCurr(),bparam.getOnlineVolLow(),bparam.getGroupConnType()});
|
| | | return bl;
|
| | | }
|
| | | //批量修改电池参数
|
| | | public boolean updatePro(Object obj) {
|
| | | List<Fbs9100_battparam> list=(List<Fbs9100_battparam>) obj;
|
| | | ArrayList sql_str=new ArrayList();
|
| | | List<User_log> listU=new ArrayList<User_log>();//存放user_log
|
| | | if(list!=null&&list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Fbs9100_battparam fs=list.get(i);
|
| | | String sql="replace into db_ram_db.tb_fbs9100_battparam(dev_id,op_cmd,dev_ip,STD_CAP,STD_RES,BattGroupCount,EachGroupBattCount"
|
| | | + ",MonomerVol,GroupVol,BattTemp,FloatChargeVol,FloatChargeCurr,OnlineVolLow,GroupConnType) "
|
| | | + " values("+fs.getDev_id()+","+fs.getOp_cmd()+",'"+fs.getDev_ip()+"',"+fs.getSTD_CAP()+","+fs.getSTD_RES()+","+fs.getBattGroupCount()+","+fs.getEachGroupBattCount()
|
| | | +","+fs.getMonomerVol()+","+fs.getGroupVol()+","+fs.getBattTemp()+","+fs.getFloatChargeVol()+","+fs.getFloatChargeCurr()+","+fs.getOnlineVolLow()+","+fs.getGroupConnType()+")";
|
| | | sql_str.add(sql);
|
| | | {
|
| | | String msg="修改"+fs.getDev_id()+"电池参数";
|
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
|
| | | listU.add(ulog);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | Boolean bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str);
|
| | | (new User_logService()).addPro(listU);//将用户的操作记录下来
|
| | | return bl;
|
| | | }
|
| | | //批量读取电池参数
|
| | | public boolean readPL(Object obj) {
|
| | | List<Fbs9100_battparam> list=(List<Fbs9100_battparam>) obj;
|
| | | ArrayList sql_str=new ArrayList();
|
| | | List<User_log> listU=new ArrayList<User_log>();//存放user_log
|
| | | if(list!=null&&list.size()>0){
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | Fbs9100_battparam fs=list.get(i);
|
| | | String sql="replace into db_ram_db.tb_fbs9100_battparam(dev_id,op_cmd) "
|
| | | + " values("+fs.getDev_id()+","+fs.getOp_cmd()+")";
|
| | | sql_str.add(sql);
|
| | | {
|
| | | String msg="获取"+fs.getDev_id()+"电池参数";
|
| | | User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
|
| | | listU.add(ulog);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | Boolean bl=DAOHelper.makeManualCommit(DBUtil.getConn(), sql_str);
|
| | | (new User_logService()).addPro(listU);//将用户的操作记录下来
|
| | | return bl;
|
| | | }
|
| | | public boolean del(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return false;
|
| | |
| | | }
|
| | | return res_exe;
|
| | | }
|
| | | |
| | | //批量设置电池参数成功后读取命令的ACK
|
| | | public boolean getCmdAck(int cmd,int dev_id) {
|
| | | int m_cmd = cmd;
|
| | | int m_cmd_ack = cmd;
|
| | | switch(m_cmd) {
|
| | | case FBS9100_ComBase.CMD_GetBattParam: m_cmd_ack = FBS9100_ComBase.CMD_GetBattParamACK; break;
|
| | | case FBS9100_ComBase.CMD_SetBattParam: m_cmd_ack = FBS9100_ComBase.CMD_SetBattParamACK; break;
|
| | | default: return false;
|
| | | }
|
| | | String sql = "SELECT op_cmd FROM db_ram_db.tb_fbs9100_battparam "+
|
| | | " WHERE dev_id="+dev_id;
|
| | | Connection conn=DBUtil.getConn();
|
| | | PreparedStatement ps = null;
|
| | | ResultSet rs = null;
|
| | | boolean res_exe=false;
|
| | | try {
|
| | | ps = conn.prepareStatement(sql);
|
| | | rs=ps.executeQuery();
|
| | | if(rs.next())
|
| | | {
|
| | | if(rs.getInt("op_cmd") == m_cmd_ack)
|
| | | {
|
| | | res_exe = true;
|
| | | }
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | DBUtil.close(rs, ps, conn);
|
| | | return res_exe;
|
| | | }
|
| | | public List serchByInfo(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|