ProdInOutPost.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.reserve.ProdInOutPost', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'scm.reserve.ProdInOutPost',
  8. 'core.button.Confirm','core.button.Close',
  9. 'core.form.MonthDateField','core.form.ConDateField','core.trigger.DbfindTrigger'
  10. ] ,
  11. init:function(){
  12. var me = this;
  13. this.control({
  14. 'erpCloseButton': {
  15. click: function(btn){
  16. me.FormUtil.onClose();
  17. }
  18. },
  19. 'erpConfirmButton': {
  20. click: function(btn){
  21. var datef = Ext.getCmp('date'),
  22. from = datef ? (datef.firstVal ? Ext.Date.toString(datef.firstVal) : null ): null,
  23. to = datef ? (datef.secondVal ? Ext.Date.toString(datef.secondVal) : null ): null;
  24. var pclass = Ext.getCmp('pclass').value;
  25. if(Ext.isEmpty(pclass)){
  26. alert('请先选择单据类型.');
  27. }
  28. if (!Ext.isEmpty(from) && !Ext.isEmpty(to) ) {
  29. this.confirmPost(from, to, pclass);
  30. } else {
  31. alert('请先选择制日期范围.');
  32. }
  33. }
  34. }
  35. });
  36. },
  37. getForm: function(btn){
  38. return btn.ownerCt.ownerCt;
  39. },
  40. confirmPost: function(from, to, pclass){
  41. var me = this;
  42. var mb = new Ext.window.MessageBox();
  43. mb.wait('正在过账','请稍后...',{
  44. interval: 10000,
  45. duration: 1000000,
  46. increment: 20,
  47. scope: this
  48. });
  49. Ext.Ajax.request({
  50. url : basePath + "scm/prodInOutPost.action",
  51. params:{
  52. caller : caller,
  53. from : from,
  54. to : to,
  55. pclass : pclass
  56. },
  57. timeout: 120000,
  58. method:'post',
  59. callback:function(options,success,r){
  60. mb.close();
  61. var rs = Ext.decode(r.responseText);
  62. if(rs.exceptionInfo) {
  63. showError(rs.exceptionInfo);
  64. } else {
  65. Ext.Msg.alert("提示","过账成功!");
  66. window.location.reload();
  67. }
  68. }
  69. });
  70. }
  71. });