OverStationGet.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.pm.mes.OverStationGet', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. GridUtil: Ext.create('erp.util.GridUtil'),
  6. BaseUtil: Ext.create('erp.util.BaseUtil'),
  7. views:[
  8. 'pm.mes.OverStationGet','core.trigger.DbfindTrigger',
  9. 'core.button.Close'
  10. ],
  11. init:function(){
  12. var me = this;
  13. this.control({
  14. '#form':{
  15. beforerender:function(){
  16. me.createWin();
  17. }
  18. },
  19. '#sn_code': {
  20. specialkey: function(f, e){//按ENTER执行确认
  21. if (e.getKey() == e.ENTER) {//序列号采集
  22. if(f.value != null && f.value != '' ){
  23. me.confirmSnCodeGet(f.value);
  24. }
  25. }
  26. }
  27. }
  28. });
  29. },
  30. createWin :function(){
  31. var me = this;
  32. var win = new Ext.window.Window({
  33. modal : true,
  34. id : 'win',
  35. height : '35%',
  36. width : '30%',
  37. layout : 'anchor',
  38. bodyStyle: 'background: #f1f1f1;',
  39. bodyPadding:5,
  40. items : [{
  41. anchor: '100% 100%',
  42. xtype: 'form',
  43. bodyStyle: 'background: #f1f1f1;',
  44. defaults:{
  45. fieldStyle : "background:rgb(224, 224, 255);",
  46. labelStyle:"color:red;"
  47. },
  48. items:[{
  49. xtype:'dbfindtrigger',
  50. name:'scCode',
  51. fieldLabel:'资源编号',
  52. id:'scCode',
  53. allowBlank:false
  54. },{
  55. xtype:'dbfindtrigger',
  56. name:'mcCode',
  57. fieldLabel:'作业单号',
  58. id:'mcCode',
  59. allowBlank:false
  60. }],
  61. buttonAlign : 'center',
  62. buttons: [{
  63. text: '确定' ,
  64. cls: 'x-btn-gray',
  65. iconCls: 'x-button-icon-save',
  66. id:'confirmBtn',
  67. formBind: true, //only enabled once the form is valid
  68. handler: function(btn) {
  69. me.getFormStore({scCode:Ext.getCmp("scCode").value,mcCode:Ext.getCmp("mcCode").value});
  70. }
  71. }]
  72. }]
  73. });
  74. win.show();
  75. },
  76. getFormStore : function(a){
  77. Ext.Ajax.request({
  78. url : basePath + 'pm/mes/getOverStationStore.action',
  79. params: a,
  80. method : 'post',
  81. callback : function(opt, s, res) {
  82. var r = Ext.decode(res.responseText);
  83. if (r.exceptionInfo) {
  84. showError(r.exceptionInfo);
  85. return;
  86. }
  87. if (r.datas) {
  88. Ext.getCmp("form").getForm().setValues(r.datas);
  89. Ext.getCmp("win").close();
  90. }
  91. }
  92. });
  93. },
  94. confirmSnCodeGet:function(f){//确认过站采集
  95. var sn_code = Ext.getCmp("sn_code").value, mc_code = Ext.getCmp("mc_code").value,
  96. sc_code = Ext.getCmp("sc_code").value,st_code = Ext.getCmp("st_code").value,
  97. result = Ext.getCmp("t_result"),combineChecked = Ext.getCmp('getCombine').value;
  98. if(Ext.isEmpty(sc_code)){
  99. showError("请先选择资源编号!");
  100. return;
  101. }
  102. if(Ext.isEmpty(sn_code)){
  103. showError("请录入资源编号!");
  104. return;
  105. }
  106. Ext.Ajax.request({
  107. url : basePath + 'pm/mes/confirmSnCodeGet.action',
  108. params: {sc_code:sc_code, mc_code:mc_code,sn_code:sn_code,st_code:st_code,combineChecked:combineChecked},
  109. method : 'post',
  110. callback : function(opt, s, res) {
  111. var r = Ext.decode(res.responseText);
  112. if (r.exceptionInfo) {
  113. result.append(r.exceptionInfo, 'error');
  114. showError(res.exceptionInfo);
  115. Ext.getCmp("sn_code").setValue('');
  116. return;
  117. }
  118. if (r.success) {
  119. if(combineChecked){
  120. result.append('过站采集,拼板采集,序列号:' + sn_code + '成功!');
  121. }else {
  122. result.append('过站采集,序列号:' + sn_code + '成功!');
  123. }
  124. Ext.getCmp("form").getForm().setValues(r.datas);
  125. Ext.getCmp("sn_code").setValue('');
  126. }
  127. }
  128. });
  129. }
  130. });