BarPrint.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.scm.reserve.BarPrint', {
  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. 'core.form.Panel','scm.reserve.BarPrint','core.grid.Panel2','core.toolbar.Toolbar',
  9. 'core.button.Save','core.button.Add','core.button.Close','core.button.Update','core.button.DeleteDetail',
  10. 'core.button.PrintBar','core.button.ClearSubpackage','core.button.Subpackage','core.button.Scan',
  11. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField'
  12. ],
  13. init:function(){
  14. var me = this;
  15. this.control({
  16. 'erpGridPanel2': {
  17. itemclick: this.onGridItemClick
  18. },
  19. 'erpSaveButton': {
  20. click: function(btn){
  21. var me = this;
  22. var form = me.getForm(btn);
  23. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  24. me.BaseUtil.getRandomNumber();//自动添加编号
  25. }
  26. this.FormUtil.beforeSave(this);
  27. }
  28. },
  29. 'erpUpdateButton': {
  30. click: function(btn){
  31. this.FormUtil.onUpdate(this);
  32. }
  33. },
  34. 'erpAddButton': {
  35. click: function(){
  36. me.FormUtil.onAdd('addBarPrint', '新增条码打印', 'jsps/scm/reserve/barPrint.jsp');
  37. }
  38. },
  39. 'erpCloseButton': {
  40. click: function(btn){
  41. me.FormUtil.beforeClose(me);
  42. }
  43. },
  44. 'erpSubpackageButton':{
  45. click: function(btn){
  46. warnMsg("确定分装?", function(btn){
  47. if(btn == 'yes'){
  48. me.FormUtil.setLoading(true);//loading...
  49. Ext.Ajax.request({
  50. url : basePath + 'scm/reserve/BarPrint/Subpackage.action',
  51. params: {
  52. id: Ext.getCmp('bp_id').value,
  53. tqty: Ext.getCmp('bp_unitpackage').value
  54. },
  55. method : 'post',
  56. callback: function(opt, s, r) {
  57. me.FormUtil.setLoading(false);
  58. var rs = Ext.decode(r.responseText);
  59. if(rs.exceptionInfo) {
  60. showError(rs.exceptionInfo);
  61. } else {
  62. if(rs.log)
  63. showMessage('提示', rs.log);
  64. }
  65. window.location.reload();
  66. }
  67. });
  68. }
  69. });
  70. }
  71. },
  72. 'erpClearSubpackageButton':{
  73. click: function(btn){
  74. warnMsg("确定清除分装?", function(btn){
  75. if(btn == 'yes'){
  76. me.FormUtil.setLoading(true);//loading...
  77. Ext.Ajax.request({
  78. url : basePath + 'scm/reserve/BarPrint/ClearSubpackage.action',
  79. params: {
  80. id: Ext.getCmp('bp_id').value
  81. },
  82. method : 'post',
  83. callback: function(opt, s, r) {
  84. me.FormUtil.setLoading(false);
  85. var rs = Ext.decode(r.responseText);
  86. if(rs.exceptionInfo) {
  87. showError(rs.exceptionInfo);
  88. } else {
  89. if(rs.log)
  90. showMessage('提示', rs.log);
  91. }
  92. window.location.reload();
  93. }
  94. });
  95. }
  96. });
  97. }
  98. },
  99. 'erpPrintBarButton':{
  100. click: function(btn){
  101. var reportName = "bar_52_2";
  102. var id = Ext.getCmp('bp_id').value;
  103. var condition = '{BarPrint.bp_id}=' + id;
  104. me.FormUtil.onwindowsPrint(id, reportName, condition);
  105. }
  106. }
  107. });
  108. },
  109. onGridItemClick: function(selModel, record){//grid行选择
  110. this.GridUtil.onGridItemClick(selModel, record);
  111. },
  112. getForm: function(btn){
  113. return btn.ownerCt.ownerCt;
  114. }
  115. });