package inbasis.ui.shiftoperation; import inbasis.domain.windfarm.Windfarm; import inbasis.system.IBSServer; import inbasis.system.ui.SearchWindow; import inbasis.system.ui.common.SCombobox; import inbasis.system.ui.common.SEDatebox; import inbasis.system.ui.common.SSDatebox; import inbasis.util.Util; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; public class SbdqsyqhjlRptWindow extends SearchWindow { private static final long serialVersionUID = -6720100007092979186L; @SuppressWarnings("static-access") @Override public void onCreate() throws Exception { super.onCreate(); SCombobox windfarm = (SCombobox)this.getFellow("windfarm"); List list = IBSServer.getIBSServer().getBaseDao().findAll(Windfarm.class); for(Windfarm l:list){ windfarm.appendItem(l.getWfname()); if(this.getLaborInfo().getDeptnum().equals(l.getWfname())){ windfarm.setValue(l.getWfname()); } } } @Override public void search() throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SCombobox smon = (SCombobox) this.getFellow("windfarm"); String somon = smon.getValue(); if(Util.isNull(somon)) { ((Map) this.getSearchList().get("windfarm")).put("value", ""); }else{ ((Map) this.getSearchList().get("windfarm")).put("value", somon); } SSDatebox beginBox = (SSDatebox) this.getFellow("s_begin"); Date begin = beginBox.getValue(); if(begin == null){ throw new Exception("报表条件'试验开始时间'不能为空,请确认!"); }else{ ((Map) this.getSearchList().get("s_begin")).put("value", sdf.format(begin)+" 00:00:00"); } SEDatebox endBox = (SEDatebox) this.getFellow("e_end"); Date end = endBox.getValue(); if(end == null){ throw new Exception("报表条件'试验结束时间'不能为空,请确认!"); }else{ ((Map) this.getSearchList().get("e_end")).put("value", sdf.format(end)+" 23:59:59"); } if(begin.getTime()> end.getTime()){ throw new Exception("报表条件开始时间不能在结束时间之后,请确认!"); } super.search(); } }