SbdqsyqhjlRptWindow.java.r17810 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package inbasis.ui.shiftoperation;
  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.Util;
  9. import java.text.SimpleDateFormat;
  10. import java.util.Calendar;
  11. import java.util.Date;
  12. import java.util.List;
  13. import java.util.Map;
  14. public class SbdqsyqhjlRptWindow extends SearchWindow {
  15. private static final long serialVersionUID = -6720100007092979186L;
  16. @SuppressWarnings("static-access")
  17. @Override
  18. public void onCreate() throws Exception {
  19. super.onCreate();
  20. SSDatebox begin = (SSDatebox) this.getFellow("s_begin");
  21. SEDatebox end = (SEDatebox) this.getFellow("e_end");
  22. end.setValue(new Date());
  23. Calendar c = Calendar.getInstance();
  24. c.setTime(new Date());
  25. c.add(Calendar.MONTH, -1);
  26. begin.setValue(c.getTime());
  27. SCombobox windfarm = (SCombobox)this.getFellow("windfarm");
  28. List<Windfarm> list = IBSServer.getIBSServer().getBaseDao().findAll(Windfarm.class);
  29. for(Windfarm l:list){
  30. windfarm.appendItem(l.getWfname());
  31. if(this.getLaborInfo().getDeptnum().equals(l.getWfname())){
  32. windfarm.setValue(l.getWfname());
  33. }
  34. }
  35. }
  36. @Override
  37. public void search() throws Exception {
  38. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  39. SCombobox smon = (SCombobox) this.getFellow("windfarm");
  40. String somon = smon.getValue();
  41. if(Util.isNull(somon))
  42. {
  43. ((Map) this.getSearchList().get("windfarm")).put("value", "");
  44. }else{
  45. ((Map) this.getSearchList().get("windfarm")).put("value", somon);
  46. }
  47. SSDatebox beginBox = (SSDatebox) this.getFellow("s_begin");
  48. Date begin = beginBox.getValue();
  49. if(begin == null){
  50. throw new Exception("报表条件'试验开始时间'不能为空,请确认!");
  51. }else{
  52. ((Map) this.getSearchList().get("s_begin")).put("value", sdf.format(begin)+" 00:00:00");
  53. }
  54. SEDatebox endBox = (SEDatebox) this.getFellow("e_end");
  55. Date end = endBox.getValue();
  56. if(end == null){
  57. throw new Exception("报表条件'试验结束时间'不能为空,请确认!");
  58. }else{
  59. ((Map) this.getSearchList().get("e_end")).put("value", sdf.format(end)+" 23:59:59");
  60. }
  61. if(begin.getTime()> end.getTime()){
  62. throw new Exception("报表条件开始时间不能在结束时间之后,请确认!");
  63. }
  64. super.search();
  65. }
  66. }