UpdateWHCode.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * 修改仓库按钮
  3. */
  4. Ext.define('erp.view.core.button.UpdateWHCode',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.erpUpdateWHCodeButton',
  7. iconCls: 'x-button-icon-submit',
  8. cls: 'x-btn-gray',
  9. text: $I18N.common.button.erpUpdateWHCodeButton,
  10. style: {
  11. marginLeft: '10px'
  12. },
  13. width: 80,
  14. initComponent : function(){
  15. this.callParent(arguments);
  16. },
  17. listeners: {
  18. afterrender: function(btn) {
  19. var status = Ext.getCmp('pi_statuscode');
  20. if(status && status.value == 'POSTED'){
  21. btn.hide();
  22. }
  23. },
  24. click:function(){
  25. var whcode=Ext.getCmp('pi_whcode');
  26. var inwhcode=Ext.getCmp('pi_purpose');
  27. if(whcode && whcode.value){
  28. var codevalue=whcode.value;
  29. var value=Ext.getCmp('pi_whname').getValue();
  30. var inwhname=Ext.getCmp('pi_purposename');
  31. if(caller=='ProdInOut!AppropriationOut' && (!inwhcode || !inwhcode.value)){
  32. Ext.Msg.alert('提示','请选择对应拨出拨入仓库!');
  33. }
  34. Ext.MessageBox.show({
  35. title:'确认修改?',
  36. msg: '将统一更新明细仓库?',
  37. buttons: Ext.Msg.YESNO,
  38. icon: Ext.Msg.WARNING,
  39. fn: function(btn){
  40. if(btn == 'yes'){
  41. //保存
  42. var grid=Ext.getCmp('grid');
  43. var store=grid.getStore();
  44. Ext.Array.each(store.data.items,function(item){
  45. if(item.data.pd_prodcode){
  46. item.set('pd_whcode',codevalue);
  47. item.set('pd_whname',value);
  48. if(caller=='ProdInOut!AppropriationOut' && inwhcode && inwhname){
  49. item.set('pd_inwhcode',inwhcode.value);
  50. item.set('pd_inwhname',inwhname.value);
  51. }
  52. }
  53. });
  54. } else if(btn == 'no'){
  55. //不保存
  56. return;
  57. } else {
  58. return;
  59. }
  60. }
  61. });
  62. }else {
  63. Ext.Msg.alert('提示','请选择仓库!');
  64. }
  65. }}
  66. });