SbdqsyqhjlRptWindow.java.r17752 2.3 KB

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