MachineNoScan.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. Ext.define('erp.view.scm.sale.MachineNoScan',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. me.FormUtil = Ext.create('erp.util.FormUtil');
  8. Ext.apply(me, {
  9. items: [{
  10. xtype: 'erpFormPanel',
  11. anchor: '100% 20%'
  12. },{
  13. xtype: 'grid',
  14. anchor: '100% 80%',
  15. columnLines : true,
  16. id : 'grid',
  17. columns : [ {
  18. text : '产品编号',
  19. cls : 'x-grid-header-1',
  20. dataIndex: 'PRCODE',
  21. flex: 1.5
  22. }, {
  23. text : '产品名称',
  24. cls : 'x-grid-header-1',
  25. dataIndex: 'PRNAME',
  26. flex: 1.2
  27. }, {
  28. text : '产品规格',
  29. cls : 'x-grid-header-1',
  30. dataIndex: 'PRSPEC',
  31. flex: 1
  32. }, {
  33. text : '数量',
  34. cls : 'x-grid-header-1',
  35. dataIndex: 'QTY',
  36. flex: 0.7
  37. }, {
  38. text : '已采集数',
  39. cls : 'x-grid-header-1',
  40. dataIndex: 'YQTY',
  41. flex: 1
  42. }, {
  43. text : '待采集数',
  44. cls : 'x-grid-header-1',
  45. dataIndex: 'DCJQTY',
  46. flex: 1
  47. }, {
  48. text : '操作',
  49. cls : 'x-grid-header-1',
  50. flex: 1,
  51. xtype: 'buttoncolumn',
  52. buttons: [{
  53. text: '采集',
  54. handler: function(view, cell, recordIndex, cellIndex, e) {
  55. var record = view.getStore().getAt(recordIndex);
  56. me.gather(record);
  57. }
  58. }, {
  59. text: '清除采集结果',
  60. handler: function(view, cell, recordIndex, cellIndex, e) {
  61. var record = view.getStore().getAt(recordIndex);
  62. me.clear(record);
  63. }
  64. }]
  65. }],
  66. store : new Ext.data.Store({
  67. fields : [ 'PRCODE', 'PRNAME', 'PRSPEC',
  68. 'QTY', 'YQTY', 'DCJQTY', 'PIID', 'INOUTNO'],
  69. proxy : {
  70. type : 'ajax',
  71. url : basePath + 'scm/sale/getProdioMachine.action',
  72. reader : {
  73. type : 'json',
  74. root : 'data'
  75. }
  76. }
  77. })
  78. }]
  79. });
  80. me.callParent(arguments);
  81. },
  82. gather:function(record){
  83. var me = this;
  84. var win=Ext.create('Ext.window.Window', {
  85. width: 400,
  86. height: 300,
  87. modal: true,
  88. closeAction: 'destroy',
  89. title: '<h1>机器号采集</h1>',
  90. layout: {
  91. type: 'vbox'
  92. },
  93. id: 'gather',
  94. items:[{
  95. margin: '5 0 0 5',
  96. xtype:'textfield',
  97. fieldLabel:'产品编号',
  98. value: record.data.PRCODE,
  99. id:'prcode',
  100. readOnly : true
  101. },{
  102. margin: '5 0 0 5',
  103. xtype:'textfield',
  104. fieldLabel:'数量',
  105. value: record.data.QTY,
  106. id:'qty',
  107. readOnly : true
  108. },{
  109. margin: '5 0 0 5',
  110. xtype:'textfield',
  111. fieldLabel:'已采集数',
  112. value: record.data.YQTY,
  113. id:'yqty',
  114. readOnly : true
  115. },{
  116. margin: '5 0 0 5',
  117. xtype: 'textfield',
  118. fieldLabel: '出入库ID',
  119. value: record.data.PIID,
  120. id:'piid',
  121. readOnly: true,
  122. hidden: true
  123. },{
  124. margin: '5 0 0 5',
  125. xtype: 'textfield',
  126. fieldLabel: '出入库单号',
  127. value: record.data.INOUTNO,
  128. id:'inoutno',
  129. readOnly: true,
  130. hidden: true
  131. },{
  132. margin: '5 0 0 5',
  133. xtype: 'textfield',
  134. fieldLabel: '机器号',
  135. readOnly: false,
  136. emptyText: '请采集机器号',
  137. value: record.data.PIM_MAC,
  138. id:'machineno',
  139. allowBlank: false,
  140. plugins: [Ext.create("Ext.ux.form.field.ClearButton")]
  141. },{
  142. margin: '5 0 0 5',
  143. xtype: 'radiogroup',
  144. id: 'operator',
  145. width: 300,
  146. fieldLabel: '操作',
  147. columns: 2,
  148. vertical: false,
  149. items: [{
  150. boxLabel: '采集', name: 'operator', inputValue: 'get', checked: true
  151. },{
  152. boxLabel: '取消', name: 'operator', inputValue: 'back'
  153. }]
  154. }],
  155. buttonAlign:'center',
  156. buttons:[{
  157. xtype: 'button',
  158. id : 'confirm',
  159. text: $I18N.common.button.erpConfirmButton,
  160. cls: 'x-btn-gray',
  161. style: {
  162. marginLeft: '10px'
  163. },
  164. width: 60
  165. },{
  166. xtype: 'button',
  167. id : 'blankAll',
  168. text: $I18N.common.button.erpCloseButton,
  169. cls: 'x-btn-gray',
  170. width: 80,
  171. style: {
  172. marginLeft: '10px'
  173. },
  174. handler:function(btn){
  175. btn.up('window').close();
  176. }
  177. }]
  178. });
  179. win.show();
  180. win.down('#machineno').focus(false, 200);
  181. },
  182. clear:function(record){
  183. var me = this;
  184. var piid = Ext.getCmp('pi_id').value, iswcj = Ext.getCmp("iswcj").value;
  185. Ext.Ajax.request({
  186. url : basePath + 'scm/sale/clearProdioMac.action',
  187. params: {
  188. piid : record.data.PIID,
  189. prcode : record.data.PRCODE
  190. },
  191. method : 'post',
  192. callback : function(options,success,response){
  193. me.FormUtil.getActiveTab().setLoading(false);
  194. var r = new Ext.decode(response.responseText);
  195. if(r.exceptionInfo){
  196. showError(r.exceptionInfo);
  197. }
  198. if(r.success){
  199. if(!Ext.isEmpty(piid)) {
  200. Ext.getCmp('grid').getStore().load({
  201. params: {
  202. piid: piid,
  203. iswcj:iswcj
  204. }
  205. });
  206. }
  207. showMessage('提示', '清除采集结果成功!', 1000);
  208. }
  209. }
  210. });
  211. }
  212. });