OpticketRptWindow.java.mine 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. SSDatebox begin = (SSDatebox) this.getFellow("s_begin");
  22. SEDatebox end = (SEDatebox) this.getFellow("e_end");
  23. end.setValue(new Date());
  24. Calendar c = Calendar.getInstance();
  25. c.setTime(new Date());
  26. c.add(Calendar.MONTH,-1);
  27. begin.setValue(c.getTime());
  28. SCombobox windfarm = (SCombobox)this.getFellow("windfarm");
  29. List<Windfarm> list = IBSServer.getIBSServer().getBaseDao().findWithQuery(Windfarm.class,"wfname!='集控中心'");
  30. for(Windfarm l:list){
  31. windfarm.appendItem(l.getWfname());
  32. if(this.getLaborInfo().getDeptnum().equals(l.getWfname())){
  33. windfarm.setValue(l.getWfname());
  34. }
  35. }
  36. /*String str[] = {"风机工作票","电气第一种工作票","电气第二种工作票","动火工作票"};
  37. for(int i=0;i<str.length;i++){
  38. type.appendItem(str[i]);
  39. }*/
  40. }
  41. @Override
  42. public void search() throws Exception {
  43. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  44. SCombobox smon = (SCombobox) this.getFellow("windfarm");
  45. String somon = smon.getValue();
  46. if(Util.isNull(somon))
  47. {
  48. ((Map) this.getSearchList().get("windfarm")).put("value", "");
  49. }else{
  50. ((Map) this.getSearchList().get("windfarm")).put("value", somon);
  51. }
  52. SSDatebox beginBox = (SSDatebox) this.getFellow("s_begin");
  53. Date begin = beginBox.getValue();
  54. if(begin == null){
  55. throw new Exception("报表条件'操作开始时间'不能为空,请确认!");
  56. }else{
  57. ((Map) this.getSearchList().get("s_begin")).put("value", sdf.format(begin)+" 00:00:00");
  58. }
  59. SEDatebox endBox = (SEDatebox) this.getFellow("e_end");
  60. Date end = endBox.getValue();
  61. if(end == null){
  62. throw new Exception("报表条件'操作结束时间'不能为空,请确认!");
  63. }else{
  64. ((Map) this.getSearchList().get("e_end")).put("value", sdf.format(end)+" 23:59:59");
  65. }
  66. if(begin.getTime()> end.getTime()){
  67. throw new Exception("报表条件开始时间不能在结束时间之后,请确认!");
  68. }
  69. super.search();
  70. }
  71. }