stepio.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.pm.make.stepio', {
  3. extend: 'Ext.app.Controller',
  4. FormUtil: Ext.create('erp.util.FormUtil'),
  5. BaseUtil: Ext.create('erp.util.BaseUtil'),
  6. views:[
  7. 'core.form.Panel','pm.make.Stepio','core.toolbar.Toolbar','core.trigger.MultiDbfindTrigger',
  8. 'core.button.Save','core.button.Add','core.button.Submit','core.button.Print','core.button.ResAudit','core.form.MultiField',
  9. 'core.button.Audit','core.button.Close','core.button.Delete','core.button.Update','core.button.ResSubmit',
  10. 'core.trigger.DbfindTrigger','core.trigger.TextAreaTrigger','core.form.YnField',
  11. ],
  12. init:function(){
  13. var me = this;
  14. this.control({
  15. 'erpSaveButton': {
  16. click: function(btn){
  17. if(Ext.getCmp('si_qty').value==null||Ext.getCmp('si_qty').value==0){
  18. showError("转移数量不能为0!");
  19. return;
  20. }
  21. var st_inqty = Number(Ext.getCmp('st_inqty').value);
  22. var si_qty = Number(Ext.getCmp('si_qty').value);
  23. var st_ngoutqty = Number(Ext.getCmp('st_ngoutqty').value);
  24. if(si_qty+st_ngoutqty>st_inqty){
  25. showError("转移数量+不良数量不能大于投入数量!");
  26. return;
  27. }
  28. var form = me.getForm(btn);
  29. if(Ext.getCmp(form.codeField).value == null || Ext.getCmp(form.codeField).value == ''){
  30. me.BaseUtil.getRandomNumber();//自动添加编号
  31. }
  32. this.FormUtil.beforeSave(this);
  33. }
  34. },
  35. 'erpDeleteButton' : {
  36. click: function(btn){
  37. me.FormUtil.onDelete(Ext.getCmp('si_id').value);
  38. }
  39. },
  40. 'erpUpdateButton': {
  41. click: function(btn){
  42. this.FormUtil.onUpdate(this);
  43. }
  44. },
  45. 'erpAddButton': {
  46. click: function(){
  47. me.FormUtil.onAdd('Stepio', '新增工序单', 'jsps/pm/make/Stepio.jsp?whoami=Stepio');
  48. }
  49. },
  50. 'erpCloseButton': {
  51. click: function(btn){
  52. me.FormUtil.beforeClose(me);
  53. }
  54. },
  55. 'erpSubmitButton': {
  56. afterrender: function(btn){
  57. var status = Ext.getCmp('si_statuscode');
  58. if(status && status.value != 'ENTERING'){
  59. btn.hide();
  60. }
  61. },
  62. click: function(btn){
  63. me.FormUtil.onSubmit(Ext.getCmp('si_id').value);
  64. }
  65. },
  66. 'erpResSubmitButton': {
  67. afterrender: function(btn){
  68. var status = Ext.getCmp('si_statuscode');
  69. if(status && status.value != 'COMMITED'){
  70. btn.hide();
  71. }
  72. },
  73. click: function(btn){
  74. me.FormUtil.onResSubmit(Ext.getCmp('si_id').value);
  75. }
  76. },
  77. 'erpAuditButton': {
  78. afterrender: function(btn){
  79. var status = Ext.getCmp('si_statuscode');
  80. if(status && status.value != 'COMMITED'){
  81. btn.hide();
  82. }
  83. },
  84. click: function(btn){
  85. me.FormUtil.onAudit(Ext.getCmp('si_id').value);
  86. }
  87. },
  88. 'erpResAuditButton': {
  89. afterrender: function(btn){
  90. var status = Ext.getCmp('si_statuscode');
  91. if(status && status.value != 'AUDITED'){
  92. btn.hide();
  93. }
  94. },
  95. click: function(btn){
  96. me.FormUtil.onResAudit(Ext.getCmp('si_id').value);
  97. }
  98. },
  99. 'erpPrintButton': {
  100. click: function(btn){
  101. me.FormUtil.onPrint(Ext.getCmp('si_id').value);
  102. }
  103. },
  104. 'dbfindtrigger[name=si_mmdetno]': {
  105. afterrender:function(trigger){
  106. trigger.dbKey='si_makecode';
  107. trigger.mappingKey='ma_code';
  108. trigger.dbMessage='请先选择关联订单号!';
  109. }
  110. },
  111. });
  112. },
  113. getForm: function(btn){
  114. return btn.ownerCt.ownerCt;
  115. }
  116. });