Index: ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js =================================================================== diff -u -r36819 -r36822 --- ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js (.../operationReservationInvoiceView.js) (revision 36819) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js (.../operationReservationInvoiceView.js) (revision 36822) @@ -930,6 +930,60 @@ return hiddenInvoiceIds; } +//发货完成 +function invoiceAfterFun(saveType,invoiceIds,storageLocationName,window){ + if(saveType == 'saveAndPrintPage'){ + printInvoiceAfterInvoice(invoiceIds); + grid.getStore().reload(); + if(storageLocationName == ''){ + window.close(); + }else { + recyclingapplicationStore.load(); + sendOutGoodsStore.removeAll(); + } + }else if(saveType == 'saveAndPrintAll'){ + var newInvoiceIds = getInvoiceIds(invoiceIds.join(',')); + printInvoiceAfterInvoice(newInvoiceIds); + top.Ext.getCmp('hiddenInvoiceIds').setValue(''); + grid.getStore().reload(); + if(storageLocationName == ''){ + window.close(); + }else { + recyclingapplicationStore.load(); + sendOutGoodsStore.removeAll(); + } + }else if(saveType == 'saveAndInvoice'){ + recyclingapplicationStore.load(); + setTimeout(function(){ + if(recyclingapplicationStore.getCount() > 0){ + var newInvoiceIds = getInvoiceIds(invoiceIds.join(',')); + top.Ext.getCmp('hiddenInvoiceIds').setValue(newInvoiceIds); + showResult('发货完成,您可以继续扫描物品进行发货'); + sendOutGoodsStore.removeAll(); + grid.getStore().reload(); + }else { + showResult('发货成功'); + grid.getStore().reload(); + if(storageLocationName == ''){ + window.close(); + }else { + sendOutGoodsStore.removeAll(); + } + } + }, 500); + }else { + grid.getStore().reload(); + if(storageLocationName == ''){ + window.close(); + }else { + var newInvoiceIds = getInvoiceIds(invoiceIds.join(',')); + top.Ext.getCmp('hiddenInvoiceIds').setValue(newInvoiceIds); + recyclingapplicationStore.load(); + sendOutGoodsStore.removeAll(); + } + } +} + //BJDXZLYY-42:saveType:save保存,saveAndInvoice保存并继续发货,saveAndPrintPage保存并打印当前页,saveAndPrintAll保存并打印所有 function doSaveAction(form,window,saveType){ if (!form.getForm().isValid()) { @@ -958,23 +1012,16 @@ if(action.result.success){ if(sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer){ var storageLocationName = top.Ext.getCmp('storageLocationName').getRawValue(); - - if(storageLocationName == ''){ - if(saveType == 'saveAndPrintPage'){ - printInvoiceAfterInvoice(invoiceIds); - window.close(); - grid.getStore().reload(); - }else if(saveType == 'saveAndPrintAll'){ - var invoiceIds = getInvoiceIds(action.result.invoiceIds.join(',')); - printInvoiceAfterInvoice(invoiceIds); - top.Ext.getCmp('hiddenInvoiceIds').setValue(''); - window.close(); - grid.getStore().reload(); - }else if(saveType == 'saveAndInvoice'){ - recyclingapplicationStore.load(); + invoiceAfterFun(saveType,action.result.invoiceIds,storageLocationName,window); + }else { + if(saveType == 'saveAndPrint'){ + printInvoiceAfterInvoice(action.result.invoiceIds); + window.close(); + grid.getStore().reload(); + }else if(saveType == 'saveAndInvoice'){ + recyclingapplicationStore.load(); + setTimeout(function(){ if(recyclingapplicationStore.getCount() > 0){ - var invoiceIds = getInvoiceIds(action.result.invoiceIds.join(',')); - top.Ext.getCmp('hiddenInvoiceIds').setValue(invoiceIds); showResult('发货完成,您可以继续扫描物品进行发货'); sendOutGoodsStore.removeAll(); grid.getStore().reload(); @@ -983,63 +1030,10 @@ window.close(); grid.getStore().reload(); } - }else { - window.close(); - grid.getStore().reload(); - } + }, 500); }else { - if(saveType == 'saveAndPrintPage'){ - printInvoiceAfterInvoice(action.result.invoiceIds); - recyclingapplicationStore.load(); - sendOutGoodsStore.removeAll(); - grid.getStore().reload(); - }else if(saveType == 'saveAndPrintAll'){ - var invoiceIds = getInvoiceIds(action.result.invoiceIds.join(',')); - printInvoiceAfterInvoice(invoiceIds); - top.Ext.getCmp('hiddenInvoiceIds').setValue(''); - recyclingapplicationStore.load(); - sendOutGoodsStore.removeAll(); - grid.getStore().reload(); - }else if(saveType == 'saveAndInvoice'){ - recyclingapplicationStore.load(); - var invoiceIds = getInvoiceIds(action.result.invoiceIds.join(',')); - top.Ext.getCmp('hiddenInvoiceIds').setValue(invoiceIds); - if(recyclingapplicationStore.getCount() > 0){ - showResult('发货完成,您可以继续扫描物品进行发货'); - sendOutGoodsStore.removeAll(); - grid.getStore().reload(); - }else { - showResult('发货成功'); - sendOutGoodsStore.removeAll(); - grid.getStore().reload(); - } - }else { - var invoiceIds = getInvoiceIds(action.result.invoiceIds.join(',')); - top.Ext.getCmp('hiddenInvoiceIds').setValue(invoiceIds); - recyclingapplicationStore.load(); - sendOutGoodsStore.removeAll(); - grid.getStore().reload(); - } - } - }else { - if(saveType == 'saveAndPrint'){ - printInvoiceAfterInvoice(action.result.invoiceIds); window.close(); grid.getStore().reload(); - }else if(saveType == 'saveAndInvoice'){ - recyclingapplicationStore.load(); - if(recyclingapplicationStore.getCount() > 0){ - showResult('发货完成,您可以继续扫描物品进行发货'); - sendOutGoodsStore.removeAll(); - grid.getStore().reload(); - }else { - showResult('发货成功'); - window.close(); - grid.getStore().reload(); - } - }else { - window.close(); - grid.getStore().reload(); } } } @@ -1949,14 +1943,40 @@ handler : function() { //验证发货物品表格 if(sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer){ + var hiddenInvoiceIds = top.Ext.getCmp('hiddenInvoiceIds').getValue(); if((!recyclingapplicationStore || recyclingapplicationStore.getCount() == 0) && (!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0)){ - top.Ext.MessageBox.confirm("请确认","无待发货物品,是否关闭页面?", function(button, text) { - if ("yes" == button){ - window.close(); - } - }); + if(hiddenInvoiceIds !== ''){ + top.Ext.MessageBox.show({ + title:'请确认', + msg: '无待发货物品,是要打印所有本次未打印的发货单?', + buttons: { ok: '打印所有', cancel: '取消' }, + fn: function(btn){ + if(btn == 'ok'){ + var storageLocationName = top.Ext.getCmp('storageLocationName').getRawValue(); + if(storageLocationName == ''){ + printInvoiceAfterInvoice(hiddenInvoiceIds); + top.Ext.getCmp('hiddenInvoiceIds').setValue(''); + window.close(); + grid.getStore().reload(); + }else { + printInvoiceAfterInvoice(hiddenInvoiceIds); + top.Ext.getCmp('hiddenInvoiceIds').setValue(''); + recyclingapplicationStore.load(); + sendOutGoodsStore.removeAll(); + grid.getStore().reload(); + } + } + }, + icon: top.Ext.MessageBox.QUESTION + }); + }else { + top.Ext.MessageBox.confirm("请确认","无待发货物品,是否关闭页面?", function(button, text) { + if ("yes" == button){ + window.close(); + } + }); + } }else if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ - var hiddenInvoiceIds = top.Ext.getCmp('hiddenInvoiceIds').getValue(); if(hiddenInvoiceIds == ''){ showResult('发货物品不能为空!'); return false;