OdDynamicAnalysis.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /**
  2. * 订单异动分析按钮
  3. */
  4. Ext.define('erp.view.core.button.OdDynamicAnalysis',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpOrderAnalysisButton',
  7. id:'oddynamicanalysis',
  8. text: '订单异动分析',
  9. cls: 'x-btn-gray',
  10. requires:['erp.util.BaseUtil'],
  11. initComponent : function(){
  12. this.callParent(arguments);
  13. },
  14. listeners:{
  15. click:function(btn){
  16. var id=Ext.getCmp('mm_id').getValue();
  17. var OrderWin = new Ext.window.Window({
  18. id : 'OrderWin',
  19. title: "订单异动分析",
  20. height: "70%",
  21. width: "93%",
  22. maximizable : false,
  23. closeAction:'destroy',
  24. buttonAlign : 'center',
  25. autoScroll:true,
  26. layout : 'anchor',
  27. listeners:{
  28. beforeshow: function(win){
  29. var values='';
  30. values+=id+",";
  31. Ext.Ajax.request({
  32. url:basePath+'pm/mps/getMaxCode.action',
  33. params:{
  34. code:id
  35. },
  36. method : 'post',
  37. callback : function(options,success,response){
  38. var res = new Ext.decode(response.responseText);
  39. if(res.data)
  40. { values+=res.data;
  41. Ext.getCmp('oddynamicanalysis').getGridColumnsAndStore(win,values);
  42. }
  43. }
  44. })
  45. }
  46. },
  47. items:[{
  48. xtype: 'grid',
  49. loadMask:'true',
  50. columns: [{
  51. text: '物料编号',
  52. cls: 'x-grid-header-1',
  53. dataIndex:'MD_PRODCODE',
  54. width: 130
  55. },{
  56. text: '物料名称',
  57. cls: 'x-grid-header-1',
  58. dataIndex: 'PR_DETAIL',
  59. width: 110
  60. },{
  61. text: '规格',
  62. cls: 'x-grid-header-1',
  63. dataIndex: 'PR_SPEC',
  64. width: 100
  65. },{
  66. text: '订单编号',
  67. cls: 'x-grid-header-1',
  68. dataIndex: 'MD_ORDERCODE',
  69. width: 100
  70. },{
  71. text: '订单序号',
  72. cls: 'x-grid-header-1',
  73. dataIndex: 'MD_ORDERDETNO',
  74. width: 80
  75. },{
  76. text: '订单类型',
  77. cls: 'x-grid-header-1',
  78. dataIndex: 'MD_ORDERKIND',
  79. width: 90
  80. },{
  81. text: '差异数',
  82. cls: 'x-grid-header-1',
  83. dataIndex: 'DIFFQTY',
  84. width: 100
  85. },{
  86. text: '差异描述',
  87. cls: 'x-grid-header-1',
  88. dataIndex: 'CHANGEKIND',
  89. width: 100
  90. },{
  91. text: '本次计划数',
  92. cls: 'x-grid-header-1',
  93. dataIndex: 'QTY1',
  94. width: 100
  95. },{
  96. text: '上次计划数',
  97. cls: 'x-grid-header-1',
  98. dataIndex: 'QTY2',
  99. width: 100
  100. }],
  101. columnLines: true,
  102. store: new Ext.data.Store({
  103. fields: ['MD_PRODCODE', 'PR_DETAIL', 'PR_SPEC','MD_ORDERCODE','MD_ORDERDETNO','MD_ORDERKIND','DIFFQTY','CHANGEKIND','QTY1','QTY2'],
  104. data: [{},{},{},{},{},{},{},{},{},{},{},{}]
  105. })
  106. }],
  107. bbar: ['->',{
  108. text:'导出',
  109. iconCls: 'x-button-icon-excel',
  110. cls: 'x-btn-gray',
  111. handler: function(btn){
  112. var grid=Ext.getCmp('OrderWin').down('grid');//.getGrid();
  113. var BaseUtil=Ext.create('erp.util.BaseUtil');
  114. BaseUtil.exportGrid(grid,'订单异动分析');
  115. }
  116. },{
  117. text:'关闭',
  118. cls: 'x-btn-gray',
  119. iconCls: 'x-button-icon-close',
  120. listeners: {
  121. click: function(){
  122. OrderWin.close();
  123. }
  124. }
  125. },'->']
  126. });
  127. OrderWin.show();
  128. }
  129. },
  130. getGridColumnsAndStore: function(view,values){
  131. var me = this;
  132. Ext.getCmp('oddynamicanalysis').setLoading(true,view);
  133. Ext.Ajax.request({//拿到grid的columns
  134. url : basePath+"pm/mps/OrderAnalysis.action",
  135. params: {
  136. caller: 'OrderAnalysis',
  137. condition: values
  138. },
  139. method : 'post',
  140. callback : function(options,success,response){
  141. var res = new Ext.decode(response.responseText);
  142. Ext.getCmp('oddynamicanalysis').setLoading(false,view);
  143. if(res.data == null){
  144. showError("异动分析单没有数据!");
  145. Ext.getCmp('OrderWin').close();
  146. }else{
  147. view.down('grid').store.loadData(res.data);
  148. }
  149. if(res.exceptionInfo){
  150. showError(res.exceptionInfo);
  151. return;
  152. }
  153. }
  154. });
  155. },
  156. setLoading : function(b,view) {
  157. var mask = this.mask;
  158. if (this.rendered) {
  159. Ext.destroy(this.mask);
  160. this.mask = null;
  161. }
  162. if(!mask){
  163. this.mask = mask = new Ext.LoadMask(view.down('grid'), {
  164. msg : "处理中,请稍后...",
  165. msgCls : 'z-index:10000;'
  166. });
  167. }
  168. if (b)
  169. mask.show();
  170. else
  171. mask.hide();
  172. }
  173. });