From 2c592928efe30b98538befb7f12471a2f95741b5 Mon Sep 17 00:00:00 2001 From: 星伟 <星伟@192.168.10.34> Date: 星期三, 10 十月 2018 10:35:23 +0800 Subject: [PATCH] 电池配组 --- gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java | 14 +++++++ gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 52 ++++++++++++++++++++++---- gx_tieta/src/com/fgkj/dto/Batttestdatastop.java | 14 ++++++ gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java | 21 +++++++--- gx_tieta/src/com/fgkj/services/BattInfServices.java | 19 ++++++++- 5 files changed, 102 insertions(+), 18 deletions(-) diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java index 472b2ad..a3e889b 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java +++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java @@ -25,6 +25,7 @@ import com.fgkj.db.DBUtil; import com.fgkj.db.IDatabaseName; import com.fgkj.dto.BattInf; +import com.fgkj.dto.BattInf_Rebuild; import com.fgkj.dto.BattMap_information; import com.fgkj.dto.Batt_Maint_Dealarm; import com.fgkj.dto.Batt_maint_inf; @@ -3618,10 +3619,15 @@ //鐢垫睜閰嶇粍绠$悊(閲嶈) public List serchMakeGroup(Object obj){ BattInf binf=(BattInf) obj; - String sql="SELECT distinct BattGroupId,battgroupname,stationid,stationname1,stationname2,stationname,stationname3,BattProducer,MonVolStd,MonCapStd,monCount from db_battinf.tb_battinf where stationname2 like ? "; + String sql="SELECT distinct BattGroupId,battgroupname,stationid,stationname1,stationname2,stationname,stationname3,BattProducer,MonVolStd,MonCapStd,monCount " + + " ,battinf_re.old_stationname,old_battgroupname,old_battproducer,old_stationid,old_battgroupid,old_monum,new_stationname,new_battgroupname,new_battproducer,new_stationid,new_battgroupid,new_monum,rebuild_time,rebuild_uid,rebuild_address,rebuild_clear_type " + + " from db_battinf.tb_battinf " + + " left outer join (select * from db_battinf.tb_battinf_rebuild where tb_battinf_rebuild.rebuild_clear_type=1 ) as battinf_re " + + " on BattGroupId=battinf_re.new_battgroupid or BattGroupId=battinf_re.old_battgroupid " + + " where stationname2 like ? "; //閫変腑鍝佺墝涓�鑷� - String producerSqlT=" order by BattProducer,MonCapStd,MonVolStd ";//涓�鑷� - String producerSqlF=" order by MonCapStd,MonVolStd ";//涓嶄竴鑷� + String producerSqlT=" order by BattProducer,MonCapStd,MonVolStd,BattGroupId ";//涓�鑷� + String producerSqlF=" order by MonCapStd,MonVolStd,BattGroupId ";//涓嶄竴鑷� if(binf.getBattProducer().equals("1")){ sql+=producerSqlT; }else{ @@ -3630,7 +3636,8 @@ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+binf.getStationName2()+"%"}, new CallBack() { public List getResults(ResultSet rs) { - List list=new ArrayList(); + List<BattInf> list=new ArrayList(); + int battgroupid=0; try { while(rs.next()){ BattInf binf=new BattInf(); @@ -3645,6 +3652,34 @@ binf.setMonVolStd(rs.getFloat("monVolStd")); binf.setMonCapStd(rs.getFloat("monCapStd")); binf.setMonCount(rs.getInt("monCount")); + + BattInf_Rebuild brinf=new BattInf_Rebuild(); + brinf.setNew_battgroupid(rs.getInt("new_battgroupid")); + brinf.setNew_battgroupname(rs.getString("new_battgroupname")); + brinf.setNew_battproducer(rs.getString("new_battproducer")); + brinf.setNew_monum(rs.getInt("new_monum")); + brinf.setNew_stationid(rs.getString("new_stationid")); + brinf.setNew_stationname(rs.getString("new_stationname")); + brinf.setOld_battgroupid(rs.getInt("old_battgroupid")); + brinf.setOld_battgroupname(rs.getString("old_battgroupname")); + brinf.setOld_battproducer(rs.getString("old_battproducer")); + brinf.setOld_monum(rs.getInt("old_monum")); + brinf.setOld_stationid(rs.getString("old_stationid")); + brinf.setOld_stationname(rs.getString("old_stationname")); + brinf.setRebuild_address(rs.getString("rebuild_address")); + brinf.setRebuild_clear_type(rs.getInt("rebuild_clear_type")); + brinf.setRebuild_time(rs.getTimestamp("rebuild_time")); + brinf.setRebuild_uid(rs.getInt("rebuild_uid")); + + if(binf.getBattGroupId()==battgroupid){ + ((ArrayList)list.get(list.size()-1).getObj()).add(brinf); + continue; + } + List listr=new ArrayList(); + listr.add(brinf); + binf.setObj(listr); + battgroupid=binf.getBattGroupId(); + list.add(binf); } } catch (SQLException e) { @@ -3662,9 +3697,10 @@ BattInfImpl biml = new BattInfImpl(); BattInf binf = new BattInf(); binf.setBattGroupId(1000967); - binf.setStationName("鍐呰挋鍙�"); - binf.setStationName1("鍐呰挋鍙�"); - + binf.setStationName(""); + binf.setStationName1(""); + binf.setStationName2(""); + binf.setBattProducer("1"); User_inf uinf=new User_inf(); uinf.setUId(1002); @@ -3689,7 +3725,7 @@ //List<BattInf> list = biml.serchByConditionNew(bmd); //List<BattInf> list=biml.serchByTestType(bmd); //List<BattInf> list=biml.serchGroupAssess(bmd); - List<BattInf> list=biml.serchByMonNum(binf); + List<BattInf> list=biml.serchMakeGroup(binf); for (BattInf b : list) { System.out.println(b); } diff --git a/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java index 9edaba7..a13256c 100644 --- a/gx_tieta/src/com/fgkj/dao/impl/BatttestdatastopDAOImpl.java +++ b/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; @@ -423,6 +424,7 @@ //鐢垫睜閰嶇粍绠$悊(閲嶈) 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 " + @@ -475,6 +477,18 @@ 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.setMon_num(-1); + break; + } + if(sdata.getMon_num()==brinf.getNew_monum()){ + sdata.setNote(brinf.getOld_battproducer()); + break; + } + } STDAH=binf.getMonCapStd(); MonomerVolType=binf.getMonVolStd(); diff --git a/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java b/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java index f210e6e..68140d5 100644 --- a/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java +++ b/gx_tieta/src/com/fgkj/dto/Batt_Maint_Dealarm.java @@ -5,6 +5,7 @@ public class Batt_Maint_Dealarm implements Serializable{ private BattInf binf; //battinf瀵硅薄淇℃伅 + private BattInf_Rebuild brinf; //BattInf_Rebuild瀵硅薄 private Batt_maintenance_inf minf; //Batt_maintenance_inf瀵硅薄淇℃伅 private Batt_maint_inf mainf; //Batt_maint_inf瀵硅薄淇℃伅 private Batt_maint_process mprocess; //Batt_maint_process瀵硅薄淇℃伅 @@ -127,16 +128,22 @@ public void setAdata_H(Battalarm_data_history adata_H) { this.adata_H = adata_H; } + public BattInf_Rebuild getBrinf() { + return brinf; + } + public void setBrinf(BattInf_Rebuild brinf) { + this.brinf = brinf; + } @Override public String toString() { - return "Batt_Maint_Dealarm [binf=" + binf + ", minf=" + minf - + ", mainf=" + mainf + ", mprocess=" + mprocess + ", uinf=" - + uinf + ", tdata=" + tdata + ", rinf=" + rinf + ", rdata=" - + rdata + ", adata=" + adata + ", sdata=" + sdata + ", page=" - + page + ", bplan=" + bplan + ", binformation=" + binformation - + ", bdmon=" + bdmon + ", adata_H=" + adata_H + "]"; + return "Batt_Maint_Dealarm [binf=" + binf + ", brinf=" + brinf + + ", minf=" + minf + ", mainf=" + mainf + ", mprocess=" + + mprocess + ", uinf=" + uinf + ", tdata=" + tdata + ", rinf=" + + rinf + ", rdata=" + rdata + ", adata=" + adata + ", sdata=" + + sdata + ", page=" + page + ", bplan=" + bplan + + ", binformation=" + binformation + ", bdmon=" + bdmon + + ", adata_H=" + adata_H + "]"; } - diff --git a/gx_tieta/src/com/fgkj/dto/Batttestdatastop.java b/gx_tieta/src/com/fgkj/dto/Batttestdatastop.java index 61a4c52..7d98060 100644 --- a/gx_tieta/src/com/fgkj/dto/Batttestdatastop.java +++ b/gx_tieta/src/com/fgkj/dto/Batttestdatastop.java @@ -25,6 +25,7 @@ private Float mon_min; private Float mon_max; private float percent; + private String note; public Batttestdatastop() { } @@ -198,6 +199,14 @@ this.percent = percent; } + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + @Override public String toString() { return "Batttestdatastop [num=" + num + ", BattGroupId=" + BattGroupId @@ -210,10 +219,13 @@ + ", test_cap=" + test_cap + ", mon_num=" + mon_num + ", mon_vol=" + mon_vol + ", lowC=" + lowC + ", lowV=" + lowV + ", mon_avg=" + mon_avg + ", mon_min=" + mon_min - + ", mon_max=" + mon_max + ", percent=" + percent + "]"; + + ", mon_max=" + mon_max + ", percent=" + percent + ", note=" + + note + "]"; } + + diff --git a/gx_tieta/src/com/fgkj/services/BattInfServices.java b/gx_tieta/src/com/fgkj/services/BattInfServices.java index 6687f85..32fd1b2 100644 --- a/gx_tieta/src/com/fgkj/services/BattInfServices.java +++ b/gx_tieta/src/com/fgkj/services/BattInfServices.java @@ -26,6 +26,7 @@ import com.fgkj.db.DBUtil; import com.fgkj.dto.App_Sys; import com.fgkj.dto.BattInf; +import com.fgkj.dto.BattInf_Rebuild; import com.fgkj.dto.Batt_Maint_Dealarm; import com.fgkj.dto.Batt_param_low; import com.fgkj.dto.Batttestdata_inf; @@ -824,9 +825,23 @@ //姹傚嚭鍗曚綋鐨勫疄闄呭閲� list_sdata=(new BatttestdatastopDAOImpl().serchMakeGroup(binf, tinf)); }else{ + List listr=(List) binf.getObj(); for (int j = 0; j <binf.getMonCount(); j++) { Batttestdatastop sdata=new Batttestdatastop(); + sdata.setBattGroupId(binf.getBattGroupId()); + sdata.setNote(binf.getBattProducer()); sdata.setMon_num(j+1); + for (int z = 0; z < listr.size(); z++) { + BattInf_Rebuild brinf=(BattInf_Rebuild) listr.get(z); + if((j+1)==brinf.getOld_monum()){ + sdata.setMon_num(-1); + break; + } + if((j+1)==brinf.getNew_monum()){ + sdata.setNote(brinf.getOld_battproducer()); + break; + } + } sdata.setTest_cap(binf.getMonCapStd());//娌℃湁鏀剧數榛樿涓烘爣绉� sdata.setPercent(1f); list_sdata.add(sdata); @@ -887,14 +902,14 @@ //bs.searchInform(bmd); //bs.serchByBattGroupName(b); //bs.updateIp(b); - /*ServiceModel model=bs.serchMakeGroup(b); + ServiceModel model=bs.serchMakeGroup(b); List<BattInf> list=(List) model.getData(); for (BattInf binf : list) { List<Batttestdatastop> list_sdata=(List) binf.getObj(); for (Batttestdatastop s : list_sdata) { System.out.println(s); } - }*/ + } //BattTestData.run_cmd(BattTestData.STRCMD); } } -- Gitblit v1.9.1