Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrintModule.js =================================================================== diff -u -r19547 -r24986 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrintModule.js (.../invoicePrintModule.js) (revision 19547) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrintModule.js (.../invoicePrintModule.js) (revision 24986) @@ -35,9 +35,9 @@ // }); // mask.show(); var thiz = this; - Ext.Ajax.timeout=300*000; + Ext.Ajax.timeout=300*1000; Ext.Ajax.request({ - timeout: 300*000, + timeout: 300*1000, url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintData.do', params : {ids : ids,type:type}, success : function(response){ @@ -68,6 +68,40 @@ } }); } + this.batchPrintInvoiceWithType_dwr = function(ids,type){ + getMask(); + mask.msg = '正在处理打印请求,请稍候...'; + mask.show(); + +// var mask = new Ext4.LoadMask({ +// msg : '正在处理打印请求,请稍候...', +// renderTo : document.body +// }); +// mask.show(); + var thiz = this; + DWREngine.setAsync(false); + InvoiceTableManager.mergeLoadPrintData( + ids,type,function(str) { + var result = Ext.decode(str); + if(!result.success){ + if(result.message){ + showResult(result.message); + } + }else{ + if(result.batches.length <= 0){ + showResult("没有打印数据"); + }else{ + for(var i = 0; i < result.batches.length;++i){ + thiz.batchPrintInvoices_result(result.batches[i], 0); + } + } + + //updatePrintStatus(ids); + } + mask.hide(); + }); + DWREngine.setAsync(true); + } this.batchPrint = function(){ var selectResult = showSelectUser(); if(selectResult == null && selectResult == undefined){ Index: ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.js =================================================================== diff -u -r24814 -r24986 --- ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.js (.../customInvoiceForm.js) (revision 24814) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.js (.../customInvoiceForm.js) (revision 24986) @@ -608,7 +608,13 @@ }, dataIndex:'button' }]); - + function callback_yes(){ + doSaveAction(); + } + function callback_no(){ + doCancelAction(); + } + var barcodeBtn = new BarcodeBtn(function(){callback_yes();},function(){callback_no();}); var form = new top.Ext.FormPanel({ id : 'recyclingApplicationForm', frame : true, @@ -714,7 +720,14 @@ } top.Ext.getCmp("depart").setValue(result.name); top.Ext.getCmp("orgUnitCoding").setValue(result.orgUnitCoding); - top.Ext.getCmp('assistantSenderBarcode').focus(); + if(top.Ext.getCmp('assistantSenderBarcode_parent').isVisible()){ + top.Ext.getCmp('assistantSenderBarcode').focus(); + }else if(top.Ext.getCmp('personInChargeBarcode_parent').isVisible()){ + top.Ext.getCmp('personInChargeBarcode').focus(); + }else{ + top.Ext.getCmp('scanText').focus(); + } + } }); @@ -775,6 +788,8 @@ layout : 'form', labelWidth :70, columnWidth :.33, + id : 'assistantSenderBarcode_parent', + name : 'assistantSenderBarcode_parent', hidden: !getSystemSetConfig('showInvoiceAssistantSender',true), items : [{ xtype : 'textfield', @@ -800,7 +815,12 @@ } } top.Ext.getCmp('assistantSenderBarcode').setValue(""); - top.Ext.getCmp('personInChargeBarcode').focus(); +// top.Ext.getCmp('personInChargeBarcode').focus(); + if(top.Ext.getCmp('personInChargeBarcode_parent').isVisible()){ + top.Ext.getCmp('personInChargeBarcode').focus(); + }else{ + top.Ext.getCmp('scanText').focus(); + } }); } }); @@ -828,6 +848,8 @@ layout : 'form', labelWidth :90, columnWidth :.33, + id : 'personInChargeBarcode_parent', + name : 'personInChargeBarcode_parent', hidden: !getSystemSetConfig('showInvoicePersonInCharge',true), items : [{ xtype : 'textfield', @@ -1012,6 +1034,9 @@ c.getEl().on('keypress',function(e) { if (e.getKey() == 13) {// 输入;号键,grid重新加载 if(top.Ext.getCmp("scanText").getValue() != ''){ + if(barcodeBtn.processBarcode(top.Ext.getCmp("scanText").getValue())){ + return; + } loadGoodsByBarcode(orgUnitCoding); }else{ showResult("请扫描输入器械包/篮筐(首)条码!"); @@ -1038,6 +1063,9 @@ c.getEl().on('keypress',function(e) { if (e.getKey() == 13) {// 输入;号键,grid重新加载 if(top.Ext.getCmp("scanTextEnd").getValue() != ''){ + if(barcodeBtn.processBarcode(top.Ext.getCmp("scanTextEnd").getValue())){ + return; + } loadGoodsByBarcode(orgUnitCoding); }else{ showResult("请扫描输入器械包/篮筐(尾)条码!"); @@ -1137,58 +1165,83 @@ text : '保存', id:'saveButton', handler : function() { - if (!form.getForm().isValid()) { - showResult('请正确填写表单各值'); - return false; - } - //验证发货物品表格 - if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ - showResult('发货物品不能为空!'); - return false; - } - - var bool = validGridAmount(); - if(!bool){ - return false; - } - - getTousseGridData(); - form.form.submit( { - //url : WWWROOT + '/disinfectSystem/invoiceAction!saveDepartInvoice.do', - url : WWWROOT + '/disinfectSystem/invoiceAction!saveInvoiceByDepartOrInvoicePlanId.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { - // 一定要事务提交成功才返回发货计划列表界面 - showResult(action.result.message); - if(action.result.success){ - window.close(); - reloadSelf(); - } - }, - failure : function(form, action) { - if(!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)){ - showResult(action.result.message); - }else{ - showResult("发货超时,请稍后查看发货单以确定发货是否成功,避免重复发货!"); - window.close(); - } - } - }); + doSaveAction(); } + },{ + text : '保存并打印', + id:'saveAndPrintButton', +// hidden:!sstsConfig.enableSaveAndPrintWhenInvoice, + handler : function(){doSaveAction(printInvoiceAfterInvoice);} }, { text : '取消', + id:'cancelButton', handler : function() { - //切记注意:按取消关闭window后,一定要把已选择的申请单号变量清空 - selectedInvoicePlanId = ""; - window.close(); -// reloadSelf(); + doCancelAction(); } }] }); + + function doSaveAction(printInvoiceCallback){ + if (!form.getForm().isValid()) { + showResult('请正确填写表单各值'); + return false; + } + //验证发货物品表格 + if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + } + + var bool = validGridAmount(); + if(!bool){ + return false; + } + + getTousseGridData(); + form.form.submit( { + //url : WWWROOT + '/disinfectSystem/invoiceAction!saveDepartInvoice.do', + url : WWWROOT + '/disinfectSystem/invoiceAction!saveInvoiceByDepartOrInvoicePlanId.do', + method : 'POST', + waitMsg : '正在保存数据,请稍候', + waitTitle : '提交表单', + success : function(form, action) { + // 一定要事务提交成功才返回发货计划列表界面 + showResult(action.result.message); + if(action.result.success){ + if(printInvoiceCallback != null){ + printInvoiceCallback(action.result.invoiceIds); + } + window.close(); + reloadSelf(); + } + }, + failure : function(form, action) { + if(!isUndefinedOrNullOrEmpty(action.result) && !isUndefinedOrNullOrEmpty(action.result.message)){ + showResult(action.result.message); + }else{ + showResult("发货超时,请稍后查看发货单以确定发货是否成功,避免重复发货!"); + window.close(); + } + } + }); + } + function doCancelAction(){ + //切记注意:按取消关闭window后,一定要把已选择的申请单号变量清空 + selectedInvoicePlanId = ""; + window.close(); +// reloadSelf(); + } + + function printInvoiceAfterInvoice(invoiceIds){ + if(!isUndefinedOrNull(invoiceIds)){ + var invoicePrintModule = new InvoicePrintModule(null,$Id('userName').value); + invoicePrintModule.batchPrintInvoiceWithType_dwr(invoiceIds.join(","),'全部'); + } + } + + var cookieAssistantSender = Ext.state.Manager.getProvider().get('cookieAssistantSender'); if(getSystemSetConfig('rememberLastInvoiceAssistantSender',false) && cookieAssistantSender){ top.Ext.getCmp('assistantSender').setValue(cookieAssistantSender); Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/dwr/table/InvoiceTableManager.java =================================================================== diff -u -r23824 -r24986 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/dwr/table/InvoiceTableManager.java (.../InvoiceTableManager.java) (revision 23824) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/dwr/table/InvoiceTableManager.java (.../InvoiceTableManager.java) (revision 24986) @@ -39,6 +39,7 @@ import com.forgon.tools.MathTools; import com.forgon.tools.SqlBuilder; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.json.JSONUtil; import com.forgon.tools.string.StringTools; import com.forgon.tools.util.SqlUtils; @@ -523,4 +524,14 @@ return json; } + public String mergeLoadPrintData(String ids,String type){ + try{ + JSONObject jsonObject = invoiceManager.batchPrintInvoice(ids, type); + return jsonObject.toString(); + }catch(Exception e){ + e.printStackTrace(); + return JSONUtil.buildJsonObject(false,e.getMessage()).toString(); + } + } + } Index: ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.jsp =================================================================== diff -u -r16404 -r24986 --- ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.jsp (.../customInvoiceForm.jsp) (revision 16404) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/customInvoiceForm.jsp (.../customInvoiceForm.jsp) (revision 24986) @@ -52,9 +52,16 @@ + + + + + + + - + + +