AfterserviceordeCreatewkDataBean.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package afterserviceorder;
  2. import baseclass.DataBeanCust;
  3. import p2.pao.PaoRemote;
  4. import p2.pao.PaoSetRemote;
  5. import p2.util.P2AppException;
  6. import p2.util.P2Exception;
  7. import p2.webclient.system.controller.Utility;
  8. import sysmsg.sysmsg;
  9. public class AfterserviceordeCreatewkDataBean extends DataBeanCust{
  10. public int createworkorder() throws P2Exception {
  11. PaoRemote pao = app.getAppBean().getPao();
  12. String ftype = pao.getString("ftype");// 工单状态
  13. if (ftype==null || ftype.length()==0) {
  14. throw new P2AppException("", "选择的工单状态不能为空");
  15. }
  16. PaoSetRemote paoset=pao.getPaoSet("HYWORKORDER");
  17. if(!paoset.isEmpty()) {
  18. int i=0;
  19. PaoRemote paoRemote =null;
  20. while ((paoRemote=paoset.getPao(i))!=null) {
  21. if(paoRemote.getString("ftype").equals(ftype) && !paoRemote.getString("fstatus").equals("作废")) {
  22. throw new P2AppException("", "已存在"+ftype+"类型的工单,无法继续生成此类型的工单");
  23. }
  24. i++;
  25. }
  26. }
  27. afterserviceorder afterserviceorder = (afterserviceorder) pao;
  28. System.out.println(afterserviceorder.getString("FAGENTNUM"));
  29. if (afterserviceorder != null) {
  30. System.out.println(888);
  31. long l = afterserviceorder.createhyWorkorder(ftype);
  32. app.getAppBean().save();
  33. this.sessionContext.queueRefreshEvent();
  34. Utility.sendEvent(sessionContext, app.getCurrentPageId(),
  35. "dialogclose", null);// 关闭当前对话框
  36. closeApp("AFTERORDER");
  37. openApp("AFTERORDER", pao.getUniqueIDValue());
  38. openApp("HYORDER",l);
  39. byrefresh();
  40. }
  41. return 1;
  42. }
  43. }