81041
2019-01-18 cf4efde9b2ec3d661269c0346596aaf789eb54ad
gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java
@@ -17,6 +17,7 @@
import com.fgkj.db.IDatabaseName;
import com.fgkj.dto.Alarm_param;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.BattInf_Rebuild;
import com.fgkj.dto.Batt_Maint_Dealarm;
import com.fgkj.dto.Batttestdata;
import com.fgkj.dto.Batttestdata_inf;
@@ -420,6 +421,94 @@
         }
          return listB;
       }
    //电池配组管理(重要)
    public List serchMakeGroup(Object obj1,Object obj2){
           BattInf binf=(BattInf) obj1;
           List listr=(List) binf.getObj();
          Batttestdata_inf tinf=(Batttestdata_inf) obj2;
          String sql="select num,BattGroupId,test_record_count,test_type,data_new,data_available,record_num,test_starttime,record_time,test_timelong,group_vol," +
               " test_curr,test_cap,mon_num,mon_vol " +
                " from db_batt_testdata.tb_batttestdatastop_"+tinf.getBattGroupId()+" " +
               " where " +
               "test_record_count=?  and record_time=?  " +
               " and db_batt_testdata.tb_batttestdatastop_"+tinf.getBattGroupId()+".data_available=1 ";//tb_batttestdatastop_id表中筛选出实际电压>标存电压*0.9的时的那笔数据,new Object[]{tdata.getTest_record_count(),tdata.getRecord_time()}
         List<Batttestdatastop> list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{tinf.getTest_record_count(),tinf.getRecord_time()}, new CallBack() {
            public List getResults(ResultSet rs) {
               List<Batttestdatastop> list=new ArrayList<Batttestdatastop>();
               try {
                  while(rs.next()){
                     Batttestdatastop sdata=new Batttestdatastop();
                     sdata.setNum(rs.getInt("num"));
                     sdata.setBattGroupId(rs.getInt("BattGroupId"));
                     sdata.setTest_record_count(rs.getInt("test_record_count"));
                     sdata.setTest_type(rs.getInt("test_type"));
                     sdata.setData_new(rs.getInt("data_new"));
                     sdata.setData_available(rs.getInt("data_available"));
                     sdata.setRecord_num(rs.getInt("record_num"));
                     sdata.setTest_starttime(rs.getTimestamp("test_starttime"));
                     sdata.setRecord_time(rs.getTimestamp("record_time"));
                     sdata.setTest_timelong(rs.getInt("test_timelong"));
                     sdata.setGroup_vol(rs.getFloat("group_vol"));
                     sdata.setTest_curr(rs.getFloat("test_curr"));
                     sdata.setTest_cap(rs.getFloat("test_cap"));
                     sdata.setMon_num(rs.getInt("mon_num"));
                     sdata.setMon_vol(rs.getFloat("mon_vol"));
                     list.add(sdata);
                  }
               } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
               }
               return list;
            }
         });
          double realCap=0;//实际容量
          double STDAH=0;//标存容量
          int hourRate=0;//小时率
          double current=0;//当前电流
          double SumAH=0;//测试容量
          double MaxMonomerVol=0;//最大电压
         double MonomerVol=0; //最小电压
         double MonomerVolType=0;//电池电压类型
         int flag=1;//电池单体告警标识
         if(list!=null&&list.size()>0){
             for(int i=0;i<list.size();i++){
                Batttestdatastop sdata=list.get(i);
                sdata.setNote(binf.getBattProducer());
                for (int j = 0; j < listr.size(); j++) {
                   BattInf_Rebuild brinf=(BattInf_Rebuild) listr.get(j);
                  if(sdata.getMon_num()==brinf.getOld_monum()&&sdata.getBattGroupId()==brinf.getOld_battgroupid()){
                     sdata.setMon_num(-1);
                     break;
                  }
                  if(sdata.getMon_num()==brinf.getNew_monum()&&sdata.getBattGroupId()==brinf.getNew_battgroupid()){
                     sdata.setNote(brinf.getOld_battproducer());
                     break;
                  }
               }
                STDAH=binf.getMonCapStd();
                MonomerVolType=binf.getMonVolStd();
                current=sdata.getTest_curr();
                SumAH=sdata.getTest_cap();
                MaxMonomerVol=tinf.getMax_monvol();
                MonomerVol=sdata.getMon_vol();
                hourRate=BattCapFactory.GetHourRate(STDAH, current);
                if(sdata.getMon_vol()>binf.getMonVolStd()*BattTestData.test_stop){
                    realCap=BattCapFactory.GetMonomerCap(STDAH, hourRate, SumAH, MaxMonomerVol, MonomerVol, MonomerVolType, BattCapFactory.CapType_Real);
                }else{
                   sdata.setMon_vol(binf.getMonVolStd()*BattTestData.test_stop);
                   realCap=(new BatttestdataDAOImpl()).serchRealCap(sdata);
                }
                sdata.setTest_cap((float)realCap);
                sdata.setPercent((float)(realCap/STDAH));
             }
         }
          return list;
       }
     //查询指定电池组指定单体的实际容量
   public double serchRealCapByMon_num(Object obj) {
       BattInf binf=(BattInf) obj;