BOMCost.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.pm.bom.BOMCost', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'pm.bom.BOMCost','core.form.Panel', 'core.trigger.DbfindTrigger',
  8. 'core.button.Print','core.button.Close','core.button.BOMCost','core.button.Gather'
  9. ],
  10. init:function(){
  11. this.control({
  12. 'erpCloseButton': {
  13. click: function(btn){
  14. this.FormUtil.beforeClose(this);
  15. }
  16. },
  17. 'erpBOMCostButton': {
  18. click: function(btn) {
  19. var form = btn.ownerCt.ownerCt,
  20. bo_id = Ext.getCmp('bo_id').value,
  21. pr_code = Ext.getCmp('bo_mothercode').value;
  22. if(bo_id==""){bo_id=0;}
  23. //if(bo_id > 0) {
  24. console.log(bo_id);
  25. form.setLoading(true);
  26. Ext.Ajax.request({
  27. url: basePath + 'pm/bom/cost.action',
  28. params: {
  29. bo_id: bo_id,
  30. pr_code: pr_code
  31. },
  32. timeout: 60000,
  33. callback: function(opt, s, r) {
  34. form.setLoading(false);
  35. var rs = Ext.decode(r.responseText);
  36. Ext.getCmp('bo_id').setValue(rs.data.boid);
  37. if(rs.success) {
  38. alert('计算完成!');
  39. }
  40. }
  41. });
  42. //}
  43. }
  44. },
  45. 'erpPrintButton': {
  46. click:function(btn){
  47. var reportName = "BOMCostView",
  48. id = Ext.getCmp('bo_id').value,
  49. prodcode=Ext.getCmp('bo_mothercode').value,
  50. condition = '{BOM.bo_id}=' + id+' and {BomStruct.bs_topmothercode}='+"'"+Ext.getCmp('bo_mothercode').value+"'";
  51. console.log(condition);
  52. this.FormUtil.onwindowsPrintBom(id, reportName, condition,prodcode);
  53. }
  54. },
  55. 'erpGatherButton': {
  56. click:function(btn){
  57. var reportName = "BOMCostView",
  58. id = Ext.getCmp('bo_id').value,
  59. condition = '{BOM.bo_id}=' + id+' and '+'{BOMSTRUCT.bs_sonbomid}>'+"0";
  60. this.FormUtil.onwindowsPrint(id, reportName, condition);
  61. }
  62. }
  63. });
  64. }
  65. });