OpticketRptWindow.java.r17752 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package inbasis.ui.opticket;
  2. import inbasis.domain.windfarm.Windfarm;
  3. import inbasis.system.IBSServer;
  4. import inbasis.system.ui.SearchWindow;
  5. import inbasis.system.ui.common.SCombobox;
  6. import inbasis.system.ui.common.SEDatebox;
  7. import inbasis.system.ui.common.SSDatebox;
  8. import inbasis.util.DateUtil;
  9. import inbasis.util.Util;
  10. import java.text.SimpleDateFormat;
  11. import java.util.Calendar;
  12. import java.util.Date;
  13. import java.util.List;
  14. import java.util.Map;
  15. public class OpticketRptWindow extends SearchWindow {
  16. private static final long serialVersionUID = -6720100007092979186L;
  17. @SuppressWarnings("static-access")
  18. @Override
  19. public void onCreate() throws Exception {
  20. super.onCreate();
  21. SCombobox windfarm = (SCombobox)this.getFellow("windfarm");
  22. List<Windfarm> list = IBSServer.getIBSServer().getBaseDao().findWithQuery(Windfarm.class,"wfname!='集控中心'");
  23. for(Windfarm l:list){
  24. windfarm.appendItem(l.getWfname());
  25. if(this.getLaborInfo().getDeptnum().equals(l.getWfname())){
  26. windfarm.setValue(l.getWfname());
  27. }
  28. }
  29. /*String str[] = {"风机工作票","电气第一种工作票","电气第二种工作票","动火工作票"};
  30. for(int i=0;i<str.length;i++){
  31. type.appendItem(str[i]);
  32. }*/
  33. }
  34. @Override
  35. public void search() throws Exception {
  36. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  37. SCombobox smon = (SCombobox) this.getFellow("windfarm");
  38. String somon = smon.getValue();
  39. if(Util.isNull(somon))
  40. {
  41. ((Map) this.getSearchList().get("windfarm")).put("value", "");
  42. }else{
  43. ((Map) this.getSearchList().get("windfarm")).put("value", somon);
  44. }
  45. SSDatebox beginBox = (SSDatebox) this.getFellow("s_begin");
  46. Date begin = beginBox.getValue();
  47. if(begin == null){
  48. throw new Exception("报表条件'操作开始时间'不能为空,请确认!");
  49. }else{
  50. ((Map) this.getSearchList().get("s_begin")).put("value", sdf.format(begin)+" 00:00:00");
  51. }
  52. SEDatebox endBox = (SEDatebox) this.getFellow("e_end");
  53. Date end = endBox.getValue();
  54. if(end == null){
  55. throw new Exception("报表条件'操作结束时间'不能为空,请确认!");
  56. }else{
  57. ((Map) this.getSearchList().get("e_end")).put("value", sdf.format(end)+" 23:59:59");
  58. }
  59. if(begin.getTime()> end.getTime()){
  60. throw new Exception("报表条件开始时间不能在结束时间之后,请确认!");
  61. }
  62. super.search();
  63. }
  64. }