taftersalesmagAppBean.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. package taftersalesmag;
  2. import baseclass.AppBeanCust;
  3. import baseclass.PaoCust;
  4. import openapi.base.parameter.parameter;
  5. import p2.pao.PaoSet;
  6. import p2.util.P2AppException;
  7. import p2.util.P2Exception;
  8. import p2.webclient.system.beans.DataBean;
  9. import service.UploadDataToERP;
  10. public class taftersalesmagAppBean extends AppBeanCust {
  11. // 在应用加载时过滤
  12. @Override
  13. public void initializeApp() throws P2Exception {
  14. if (!(this.app.inAppLinkMode())) {
  15. DataBean databean = this.app.getGridBean();
  16. if (getPao() == null) {
  17. super.initializeApp();
  18. } else {
  19. if (getPao().getThisPaoSet().getApp() == null) {
  20. super.initializeApp();
  21. } else {
  22. String appname = getPao().getThisPaoSet().getApp();
  23. String agentnum = ((PaoCust) getPao())
  24. .getAgentnumByHrid(getPao().getUserName());
  25. if ("AFTERSALES".equalsIgnoreCase(appname)) {
  26. //反退申请单管理
  27. databean.setAppWhere("fistool =0");
  28. } else if ("AFTERSALE".equalsIgnoreCase(appname)) {
  29. // 反退申请单
  30. databean.setAppWhere("FAGENTNUM ='" + agentnum + "'");
  31. } else if ("TOOLSBACK".equalsIgnoreCase(appname)) {
  32. // 工具归还单
  33. databean.setAppWhere("fistool =1");
  34. }
  35. databean.reset();
  36. super.initializeApp();
  37. }
  38. }
  39. }
  40. }
  41. @Override
  42. public int SUBMIT() throws P2Exception {
  43. this.SAVE();
  44. taftersalesmag taftersalesmag = (taftersalesmag) getPao();
  45. taftersalesmag.submitvalidate(true);
  46. taftersalesmag.submit(true);
  47. this.SAVE();
  48. byrefresh();
  49. return super.SUBMIT();
  50. }
  51. @Override
  52. public int UNSUBMIT() throws P2Exception {
  53. this.SAVE();
  54. taftersalesmag taftersalesmag = (taftersalesmag) getPao();
  55. taftersalesmag.submitvalidate(false);
  56. taftersalesmag.submit(false);
  57. this.SAVE();
  58. byrefresh();
  59. return super.UNSUBMIT();
  60. }
  61. @Override
  62. public int CHECK() throws P2Exception {
  63. this.SAVE();
  64. taftersalesmag taftersalesmag = (taftersalesmag) getPao();
  65. taftersalesmag.checkvalidate(true);
  66. taftersalesmag.check(true);
  67. this.SAVE();
  68. byrefresh();
  69. return super.CHECK();
  70. }
  71. @Override
  72. public int UNCHECK() throws P2Exception {
  73. this.SAVE();
  74. taftersalesmag taftersalesmag = (taftersalesmag) getPao();
  75. taftersalesmag.checkvalidate(false);
  76. taftersalesmag.check(false);
  77. this.SAVE();
  78. byrefresh();
  79. return super.UNCHECK();
  80. }
  81. @Override
  82. public int RECHECK() throws P2Exception {
  83. this.SAVE();
  84. if (msgDialogIsNotOpen()) {
  85. msgDialogOpen("复核后退款金额将返还至订单账户中,该操作不可逆,是否继续");
  86. }
  87. if (msgDialogIsCheckOk()) {
  88. taftersalesmag taftersalesmag = (taftersalesmag) getPao();
  89. taftersalesmag.recheckvalidate(true);
  90. taftersalesmag.recheck(true);
  91. this.SAVE();
  92. if (!parameter.isdebug) {
  93. boolean issuccess = new UploadDataToERP(taftersalesmag, getPaoSet().getUserInfo()).upload();
  94. // if (!issuccess) {
  95. // ((PaoSet) getPaoSet()).addWarning(new P2AppException("", "上传ERP失败,当前单据将自动反复核,请检查!"));
  96. // UNRECHECK();
  97. // }
  98. }
  99. }
  100. byrefresh();
  101. return super.RECHECK();
  102. }
  103. @Override
  104. public int UNRECHECK() throws P2Exception {
  105. this.SAVE();
  106. if (msgDialogIsNotOpen()) {
  107. msgDialogOpen("复核后退款金额将返还至订单账户中,该操作不可逆,是否继续");
  108. }
  109. if (msgDialogIsCheckOk()) {
  110. taftersalesmag taftersalesmag = (taftersalesmag) getPao();
  111. taftersalesmag.recheckvalidate(false);
  112. taftersalesmag.recheck(false);
  113. this.SAVE();
  114. }
  115. byrefresh();
  116. return super.UNRECHECK();
  117. }
  118. }