Inventory.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.reserve.Inventory', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'scm.reserve.InventoryForm','scm.reserve.Inventory',
  8. 'core.button.Confirm','core.button.Close','core.trigger.DbfindTrigger'
  9. ] ,
  10. init:function(){
  11. var me = this;
  12. this.control({
  13. 'erpCloseButton': {
  14. click: function(btn){
  15. me.FormUtil.onClose();
  16. }
  17. },
  18. 'erpConfirmButton': {
  19. click: function(btn){
  20. this.confirm();
  21. }
  22. }
  23. });
  24. },
  25. getForm: function(btn){
  26. return btn.ownerCt.ownerCt;
  27. },
  28. confirm: function(){
  29. var me = this;
  30. this.BaseUtil.getActiveTab().setLoading(true);
  31. Ext.Ajax.request({
  32. url : basePath + "scm/reserve/inventory.action",
  33. params:{
  34. method: Ext.getCmp('method').value,
  35. whcode: Ext.getCmp('pr_whcode').value
  36. },
  37. method:'post',
  38. timeout: 300000,
  39. callback:function(options,success,response){
  40. me.BaseUtil.getActiveTab().setLoading(false);
  41. var localJson = new Ext.decode(response.responseText);
  42. if(localJson.success){
  43. Ext.Msg.alert("提示", localJson.log);
  44. } else {
  45. if(localJson.exceptionInfo){
  46. var str = localJson.exceptionInfo;
  47. if(str.trim().substr(0, 12) == 'AFTERSUCCESS'){//特殊情况:操作成功,但是出现警告,允许刷新页面
  48. str = str.replace('AFTERSUCCESS', '');
  49. showError(str);
  50. Ext.Msg.alert("提示",localJson.log);
  51. } else {
  52. showError(str);return;
  53. }
  54. }
  55. }
  56. }
  57. });
  58. }
  59. });