package inbasis.ui.opticket; 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.DateUtil; import inbasis.util.Util; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; import java.util.Map; public class OpticketRptWindow 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<Windfarm> list = IBSServer.getIBSServer().getBaseDao().findWithQuery(Windfarm.class,"wfname!='��������'"); for(Windfarm l:list){ windfarm.appendItem(l.getWfname()); if(this.getLaborInfo().getDeptnum().equals(l.getWfname())){ windfarm.setValue(l.getWfname()); } } /*String str[] = {"�������Ʊ","������һ�ֹ���Ʊ","�����ڶ��ֹ���Ʊ","������Ʊ"}; for(int i=0;i<str.length;i++){ type.appendItem(str[i]); }*/ } @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(); } }