PackageCollection.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. Ext.define('erp.view.pm.mes.PackageCollection',{
  2. extend: 'Ext.Viewport',
  3. layout: 'anchor',
  4. hideBorders: true,
  5. initComponent : function(){
  6. var me = this;
  7. Ext.apply(me, {
  8. items: [{
  9. id:'form',
  10. title:'包装采集',
  11. xtype: 'form',
  12. anchor: '100% 30%',
  13. bodyStyle: 'background: #f1f1f1;',
  14. bodyPadding:5,
  15. autoScroll: true,
  16. scrollable: true,
  17. items:[{
  18. xtype: 'fieldcontainer',
  19. defaults: {
  20. width: 250,
  21. msgTarget:'side'
  22. },
  23. layout: 'column',
  24. items: [{
  25. xtype: 'dbfindtrigger',
  26. fieldLabel: '资源编号',
  27. allowBlank:false,
  28. id:'sc_code',
  29. name:'sc_code',
  30. fieldStyle : "background:rgb(224, 224, 255);",
  31. labelStyle:"color:red;"
  32. },{
  33. xtype: 'textfield',
  34. fieldLabel: '资源名称',
  35. readOnly:true,
  36. id:'sc_name',
  37. name:'sc_name'
  38. },{
  39. xtype: 'textfield',
  40. fieldLabel: '工序编号',
  41. readOnly:true,
  42. id:'st_code',
  43. name:'st_code'
  44. },{
  45. xtype: 'textfield',
  46. fieldLabel: '工序名称',
  47. readOnly:true,
  48. id:'st_name',
  49. name:'st_name'
  50. },{
  51. xtype: 'dbfindtrigger',
  52. fieldLabel: '作业单号',
  53. id:'mc_code' ,
  54. name:'mc_code',
  55. allowBlank:false,
  56. fieldStyle : "background:rgb(224, 224, 255);",
  57. labelStyle:"color:red;"
  58. },{
  59. xtype: 'textfield',
  60. fieldLabel: '制造单号',
  61. id:'mc_makecode' ,
  62. name:'mc_makecode',
  63. allowBlank:false,
  64. hidden : true,
  65. hideLabel:true
  66. },{
  67. xtype: 'textfield',
  68. fieldLabel: '产品编号',
  69. readOnly:true,
  70. id:'mc_prodcode',
  71. name:'mc_prodcode'
  72. },{
  73. xtype: 'textfield',
  74. fieldLabel: '产品名称',
  75. readOnly:true,
  76. id:'pr_detail',
  77. name:'pr_detail'
  78. },{
  79. xtype: 'textfield',
  80. fieldLabel: '产品ID',
  81. id:'pr_id',
  82. name:'pr_id',
  83. hidden : true,
  84. hideLabel : true
  85. },{
  86. xtype: 'textfield',
  87. fieldLabel: '数量',
  88. readOnly:true,
  89. id:'mc_qty',
  90. name:'mc_qty'
  91. },{
  92. xtype: 'boxcodetrigger',
  93. fieldLabel: '箱号',
  94. allowBlank:false,
  95. id:'pa_code',
  96. name:'pa_code',
  97. fieldStyle : "background:rgb(224, 224, 255);",
  98. labelStyle:"color:red"
  99. },{
  100. xtype: 'textfield',
  101. fieldLabel: '箱内容量',
  102. allowBlank:false,
  103. id:'pa_totalqty',
  104. name:'pa_totalqty',
  105. readOnly : true
  106. },{
  107. xtype: 'textfield',
  108. fieldLabel: '已装数量',
  109. readOnly : true,
  110. id:'pa_inqty'
  111. },{
  112. xtype: 'textfield',
  113. fieldLabel: '剩余可装数',
  114. readOnly : true,
  115. id:'pa_restqty'
  116. }]
  117. }],
  118. buttonAlign: 'center',
  119. buttons: [{
  120. xtype: 'erpQueryButton'
  121. },{
  122. xtype: 'erpCloseButton'
  123. },{
  124. id:'updateQty',
  125. text:'更新箱内容量'
  126. }]
  127. },{
  128. xtype: 'grid',
  129. anchor: '100% 45%',
  130. id:'querygrid',
  131. plugins: [Ext.create('erp.view.core.plugin.CopyPasteMenu')],
  132. columns: [{
  133. text: '箱号',
  134. dataIndex: 'pd_outboxcode',
  135. flex: 1
  136. },{
  137. text: '序列号',
  138. dataIndex: 'pd_barcode',
  139. flex: 1
  140. },{
  141. text: '数量',
  142. dataIndex: 'pd_innerqty',
  143. flex: 1
  144. },{
  145. text : '操作',
  146. cls : 'x-grid-header-1',
  147. flex: 1,
  148. xtype: 'buttoncolumn',
  149. buttons: [{
  150. text: '清除采集结果',
  151. handler: function(view, cell, recordIndex, cellIndex, e) {
  152. var record = view.getStore().getAt(recordIndex);
  153. me.clear(record);
  154. }
  155. }]
  156. }],
  157. columnLines: true,
  158. store: Ext.create('Ext.data.Store',{
  159. fields: ['pd_outboxcode','pd_barcode','pd_innerqty'],
  160. data: [],
  161. autoLoad:true
  162. })
  163. },{
  164. xtype: 'dataview',
  165. anchor: '100% 15%',
  166. id: 't_result',
  167. autoScroll: true,
  168. scrollable: true,
  169. store: new Ext.data.Store({
  170. fields: ['type', 'text']
  171. }),
  172. cls: 'msg-body',
  173. tpl: new Ext.XTemplate(
  174. '<audio id="audio-success" src="' + basePath + 'resource/audio/success.wav"></audio>',
  175. '<audio id="audio-error" src="' + basePath + 'resource/audio/error.wav"></audio>',
  176. '<tpl for=".">',
  177. '<div class="msg-item">',
  178. '<tpl if="type == \'success\'"><span class="text-info">{text}</span></tpl>',
  179. '<tpl if="type == \'error\'"><span class="text-warning">{text}</span></tpl>',
  180. '</div>',
  181. '</tpl>'
  182. ),
  183. itemSelector: 'div.msg-item',
  184. emptyText: '提示信息',
  185. deferEmptyText: false,
  186. autoScroll: true,
  187. append: function(text, type) {
  188. type = type || 'success';
  189. this.getStore().add({text: text, type: type});
  190. this.getEl().scroll("b", this.getEl().getHeight(), true);
  191. var el = Ext.get('audio-' + type).dom;
  192. el.play();
  193. }
  194. },{
  195. xtype: 'form',
  196. anchor: '100% 10%',
  197. bodyStyle: 'background: #f1f1f1;',
  198. bodyPadding:5,
  199. items: [{
  200. xtype: 'fieldcontainer',
  201. autoScroll: true,
  202. scrollable: true,
  203. /*defaults: {
  204. width: 250
  205. },*/
  206. /*layout: {
  207. type: 'table',
  208. columns: 4
  209. },*/
  210. layout:'column',
  211. items: [{
  212. xtype: 'textfield',
  213. fieldLabel: '序列号',
  214. id:'ms_sncode',
  215. columnWidth: 0.23,
  216. labelWidth:60,
  217. //colspan: 1,
  218. allowBlank: false,
  219. fieldStyle : "background:rgb(224, 224, 255);",
  220. labelStyle:"color:red;"
  221. },{
  222. xtype: 'textfield',
  223. fieldLabel: '序列号开头',
  224. id:'ms_codeB',
  225. columnWidth: 0.20
  226. },{
  227. xtype: 'textfield',
  228. fieldLabel: '序列号长度',
  229. id:'ms_codeLength',
  230. columnWidth: 0.20
  231. },/*{
  232. xtype: 'combo',
  233. fieldLabel: '标签模板',
  234. id: 'template',
  235. columnWidth: 0.24,
  236. //autoSelect:true,
  237. queryMode: 'remote',
  238. store: Ext.create('Ext.data.Store', {
  239. autoLoad: true,
  240. fields: ['lps_code','lps_id'],
  241. proxy: {
  242. type: 'ajax',
  243. url : basePath + 'pm/mes/getTemplates.action',
  244. extraParams:{condition:'package'},
  245. reader: {
  246. type: 'json',
  247. root: 'datas'
  248. },
  249. headers: {
  250. 'Content-Type': 'application/json;charset=utf-8'
  251. }
  252. },
  253. listeners:{
  254. load : function (store){
  255. Ext.getCmp('template').select(store.getAt(0));
  256. }
  257. }
  258. }),
  259. displayField: 'lps_code',
  260. valueField: 'lps_id',
  261. allowBlank:false
  262. },*/{
  263. xtype: 'erpPrintButton' ,
  264. width:'80px'
  265. }]
  266. }]
  267. }]
  268. });
  269. me.callParent(arguments);
  270. } ,
  271. clear:function(record){
  272. var me = this;
  273. Ext.Ajax.request({
  274. url : basePath + 'pm/mes/clearPackageDetail.action',
  275. params: {
  276. caller : caller,
  277. outbox : record.data.pd_outboxcode,
  278. sncode : record.data.pd_barcode
  279. },
  280. method : 'post',
  281. callback : function(options,success,response){
  282. var r = new Ext.decode(response.responseText);
  283. if(r.exceptionInfo){
  284. showError(r.exceptionInfo);
  285. }
  286. if(r.success){
  287. Ext.getCmp("querygrid").store.remove(record);
  288. Ext.getCmp('pa_inqty').setValue(Ext.getCmp("querygrid").store.data.length);
  289. Ext.getCmp('t_result').append('清除采集结果:'+record.data.pd_barcode+'成功!');
  290. showMessage('提示', '清除采集结果成功!', 1000);
  291. }
  292. }
  293. });
  294. }
  295. });