Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManager.java =================================================================== diff -u -r18343 -r19463 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManager.java (.../InvoiceManager.java) (revision 18343) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManager.java (.../InvoiceManager.java) (revision 19463) @@ -12,6 +12,7 @@ import com.forgon.disinfectsystem.entity.invoicemanager.Invoice; import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan; import com.forgon.disinfectsystem.entity.invoicemanager.TimeQuantum; +import com.forgon.disinfectsystem.invoice.service.SubmitInvoiceContext; import com.forgon.disinfectsystem.invoicemanager.vo.InvoicePrintVo; import com.forgon.disinfectsystem.invoicemanager.vo.InvoiceStaticsVo; import com.forgon.disinfectsystem.invoicemanager.vo.WaitSignGoodsSummary; @@ -90,7 +91,7 @@ * 做了并发控制的发货 TODO ,还需要优化处理的流程 * @param params */ - public void submitInvoice(JSONObject params); + public SubmitInvoiceContext submitInvoice(JSONObject params); public JsonObject getInfoByBarcodeForInvoiceScan(JsonObject params);// 发货扫描时的扫条码处理 Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.js =================================================================== diff -u -r19439 -r19463 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.js (.../invoiceView.js) (revision 19439) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.js (.../invoiceView.js) (revision 19463) @@ -1358,27 +1358,6 @@ }); } -function batchPrintInvoices_result(result, printType){ - var typeofFunction = typeof(batchPrintInvoices_CurrentProject) - if(typeofFunction != undefined && typeofFunction != 'undefined'){ - batchPrintInvoices_CurrentProject(result, printType); - return; - } - batchPrintInvoices_result_default(result, printType); -} -function batchPrintInvoices_result_default(result, printType) { - result.serialNumber = ''; -// result.applicant = ''; - //result.applicationTime = ''; - result.printUser = curUserName; - result.printTime = Ext.util.Format.date(new Date(), 'Y-m-d H:i'); - result.remark = ''; - // 发料人默认改为当前用户 - if (isUndefinedOrNullOrEmpty(result.sender)) { - result.sender = curUserName; - } - printInvoices2(result, printType); -} var loadFormData = function(grid) { var records = grid.getSelectionModel().getSelections(); if (records.length == 0) { @@ -1705,12 +1684,11 @@ // path : WWWROOT + '/disinfectsystem/invoice/', // expires : new Date(new Date().getTime() + 2592000000) // })); - var departGroupStore = new Ext.data.SimpleStore({ fields : ['id', 'shift','departCode' ], url : WWWROOT + '/disinfectSystem/invoiceDepartmentAction!loadDepartGroup.do' }); - + var invoicePrintModule; departGroupStore.on('load', function(){ ShiftDef = Ext.data.Record.create([ @@ -1798,114 +1776,8 @@ ] }); - /** - * 显示和选择打印发货单的配置 - */ - function showSelectUser(){ - return openModalWindow(WWWROOT+"/disinfectsystem/invoice/selectInvoiceConfig.jsp?","选择打印分组", "760", "400"); - } - var mask = null; - function getMask(){ - if(!mask){ - mask = new Ext.LoadMask(Ext.getBody(), { - msg : '正在处理打印请求,请稍候...' - }); - } - return mask; - } - function batchPrintInvoiceWithType(ids,type){ - getMask(); - mask.msg = '正在处理打印请求,请稍候...'; - mask.show(); - -// var mask = new Ext4.LoadMask({ -// msg : '正在处理打印请求,请稍候...', -// renderTo : document.body -// }); -// mask.show(); - - Ext.Ajax.timeout=300*000; - Ext.Ajax.request({ - timeout: 300*000, - url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintData.do', - params : {ids : ids,type:type}, - success : function(response){ - var result = Ext.decode(response.responseText); - 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){ - batchPrintInvoices_result(result.batches[i], 0); - } - grid.dwrReload(); - } - - //updatePrintStatus(ids); - } - mask.hide(); -// mask.destroy(); - }, - failure: function(response){ - showResult("打印失败!"); - mask.hide(); -// mask.destroy(); - } - }); - } - function batchPrint(){ - var selectResult = showSelectUser(); - if(selectResult == null && selectResult == undefined){ - return; - } - var id = selectResult.split("&#;")[0]; - if(id == '' || id == null){ - showResult('请选择对应的班次!'); - return; - } -// var mask = new Ext.LoadMask(Ext.getBody(), { -// msg : '正在处理批量打印请求,请稍候...' -// }); - getMask(); - mask.msg='正在处理批量打印请求,请稍候...'; - mask.show(); - - Ext.Ajax.timeout=300*000; - Ext.Ajax.request({ - timeout: 300*000, - url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintDataByConfig.do', - params : {id : id}, - success : function(response){ - var result = Ext.decode(response.responseText); - 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){ - batchPrintInvoices_result(result.batches[i], 0); - } - grid.dwrReload(); - } - - //updatePrintStatus(ids); - } - mask.hide(); - }, - failure: function(response){ - showResult("打印失败!"); - mask.hide(); - } - }); - } + var tbar = [{ text : '查看', hidden : SSTS_Invoice_Update, @@ -2006,15 +1878,18 @@ iconCls : 'icon_print', menu: new Ext.menu.Menu({ items: [ - {text: '批量打印' + entityName, hidden: !validateIsSupplyRoomUser,handler: batchPrint}, + {text: '批量打印' + entityName, hidden: !validateIsSupplyRoomUser,handler: function (){ + invoicePrintModule.batchPrint(); + } + }, {text: '打印一次性物品', handler:function(){ checkPrintStatus(function(){ var ids = getSelectedIds(); if (ids != null && ids != false){ top.Ext.MessageBox.confirm("请确认", "要打印所选的发货单的一次性物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'一次性物品'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'一次性物品'); } }); } @@ -2030,7 +1905,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选的发货单的器械包吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'器械包'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'器械包'); } }); } @@ -2047,7 +1922,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选的发货单的消毒物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'消毒物品'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'消毒物品'); } }); } @@ -2064,7 +1939,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选发货单的器械包及消毒物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'器械包及消毒物品'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'器械包及消毒物品'); } }); } @@ -2077,7 +1952,7 @@ top.Ext.MessageBox.confirm("请确认", "要打印所选发货单的全部物品吗?", function(btn) { if (btn == 'yes') { - batchPrintInvoiceWithType(ids,'全部'); + invoicePrintModule.batchPrintInvoiceWithType(ids,'全部'); } }); } @@ -2339,4 +2214,5 @@ } } }); + invoicePrintModule = new InvoicePrintModule(grid,curUserName); }); \ No newline at end of file Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java =================================================================== diff -u -r19154 -r19463 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java (.../InvoiceManagerImpl.java) (revision 19154) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceManagerImpl.java (.../InvoiceManagerImpl.java) (revision 19463) @@ -2023,7 +2023,7 @@ invoicePlanManager.terminateTousseItemByIds(tousseItemsIdSet, "发货终止"); } } - public void submitInvoiceForOperationReservation(JSONObject params) { + public SubmitInvoiceContext submitInvoiceForOperationReservation(JSONObject params) { SubmitInvoiceContext submitInvoiceContext = new SubmitInvoiceContext(); setAndValidateParams(params, submitInvoiceContext); // 终止申请单的处理 @@ -2098,6 +2098,7 @@ //省医回写接口调用 writebackForGDSY(invoiceList); // throw new RuntimeException("发货速度测试!"); + return submitInvoiceContext; } /** @@ -2261,7 +2262,7 @@ } } } - public void submitInvoiceForCustom(JSONObject params) { + public SubmitInvoiceContext submitInvoiceForCustom(JSONObject params) { SubmitInvoiceContext submitInvoiceContext = new SubmitInvoiceContext(); setAndValidateParams(params, submitInvoiceContext); @@ -2317,6 +2318,7 @@ //省医回写接口调用 writebackForGDSY(invoiceList); // throw new RuntimeException("发货速度测试!"); + return submitInvoiceContext; } //省医回写接口调用 @@ -2366,19 +2368,16 @@ } } @Override - public void submitInvoice(JSONObject params) { + public SubmitInvoiceContext submitInvoice(JSONObject params) { String invoiceType = JSONUtil.optString(params, "invoiceType", Invoice.TYPE_APPLICATION); switch (invoiceType) { case Invoice.TYPE_OPERATION_RESERVATION: - submitInvoiceForOperationReservation(params); - return; + return submitInvoiceForOperationReservation(params); case Invoice.TYPE_OPERATION_RESERVATION_MERGE: - submitInvoiceForOperationReservation(params); - return; + return submitInvoiceForOperationReservation(params); case Invoice.TYPE_CUSTOM: - submitInvoiceForCustom(params); - return; + return submitInvoiceForCustom(params); } SubmitInvoiceContext submitInvoiceContext = new SubmitInvoiceContext(); @@ -2460,6 +2459,7 @@ writebackForGDSY(invoiceList); // throw new RuntimeException("发货速度测试!"); + return submitInvoiceContext; } /** Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrintModule.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrintModule.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePrintModule.js (revision 19463) @@ -0,0 +1,140 @@ + +function InvoicePrintModule(grid,curUserName){ + function refresh(){ + if(grid){ + if(grid.dwrReload){ + grid.dwrReload(); + }else if(grid.getStore){ + grid.getStore().reload(); + } + } + } + /** + * 显示和选择打印发货单的配置 + */ + function showSelectUser(){ + return openModalWindow(WWWROOT+"/disinfectsystem/invoice/selectInvoiceConfig.jsp?","选择打印分组", "760", "400"); + } + var mask = null; + function getMask(){ + if(!mask){ + mask = new Ext.LoadMask(Ext.getBody(), { + msg : '正在处理打印请求,请稍候...' + }); + } + return mask; + } + this.batchPrintInvoiceWithType = function(ids,type){ + getMask(); + mask.msg = '正在处理打印请求,请稍候...'; + mask.show(); + +// var mask = new Ext4.LoadMask({ +// msg : '正在处理打印请求,请稍候...', +// renderTo : document.body +// }); +// mask.show(); + + Ext.Ajax.timeout=300*000; + Ext.Ajax.request({ + timeout: 300*000, + url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintData.do', + params : {ids : ids,type:type}, + success : function(response){ + var result = Ext.decode(response.responseText); + 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){ + batchPrintInvoices_result(result.batches[i], 0); + } + refresh(); + } + + //updatePrintStatus(ids); + } + mask.hide(); +// mask.destroy(); + }, + failure: function(response){ + showResult("打印失败!"); + mask.hide(); +// mask.destroy(); + } + }); + } + this.batchPrint = function(){ + var selectResult = showSelectUser(); + if(selectResult == null && selectResult == undefined){ + return; + } + var id = selectResult.split("&#;")[0]; + if(id == '' || id == null){ + showResult('请选择对应的班次!'); + return; + } +// var mask = new Ext.LoadMask(Ext.getBody(), { +// msg : '正在处理批量打印请求,请稍候...' +// }); + getMask(); + mask.msg='正在处理批量打印请求,请稍候...'; + mask.show(); + + Ext.Ajax.timeout=300*000; + Ext.Ajax.request({ + timeout: 300*000, + url : WWWROOT + '/disinfectSystem/invoiceAction!mergeLoadPrintDataByConfig.do', + params : {id : id}, + success : function(response){ + var result = Ext.decode(response.responseText); + 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){ + batchPrintInvoices_result(result.batches[i], 0); + } + refresh(); + } + + //updatePrintStatus(ids); + } + mask.hide(); + }, + failure: function(response){ + showResult("打印失败!"); + mask.hide(); + } + }); + } + function batchPrintInvoices_result(result, printType){ + var typeofFunction = typeof(batchPrintInvoices_CurrentProject) + if(typeofFunction != undefined && typeofFunction != 'undefined'){ + batchPrintInvoices_CurrentProject(result, printType); + return; + } + batchPrintInvoices_result_default(result, printType); + } + function batchPrintInvoices_result_default(result, printType) { + result.serialNumber = ''; +// result.applicant = ''; + //result.applicationTime = ''; + result.printUser = curUserName; + result.printTime = Ext.util.Format.date(new Date(), 'Y-m-d H:i'); + result.remark = ''; + // 发料人默认改为当前用户 + if (isUndefinedOrNullOrEmpty(result.sender)) { + result.sender = curUserName; + } + printInvoices2(result, printType); + } +} Index: ssts-web/src/main/webapp/disinfectsystem/config/cdlqyq1yy/config.js =================================================================== diff -u -r19036 -r19463 --- ssts-web/src/main/webapp/disinfectsystem/config/cdlqyq1yy/config.js (.../config.js) (revision 19036) +++ ssts-web/src/main/webapp/disinfectsystem/config/cdlqyq1yy/config.js (.../config.js) (revision 19463) @@ -71,5 +71,7 @@ //是否启用器械包规格大小统计报表(true为启用,false或者不配置都不启用) enableTousseSpecificationSizeStatistics : true, //外来器械申请单"医生"是否不能为空,默认可以为空,true表示不能为空,false表示可以为空 - doctorOfForeignTousseApplicationNotBlank:true + doctorOfForeignTousseApplicationNotBlank:true, + //发货界面,是否启用保存并打印按钮。默认为false,true表示启用,false表示不启用 + enableSaveAndPrintWhenInvoice:true } \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedView.jsp =================================================================== diff -u -r18320 -r19463 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedView.jsp (.../invoicePlanExtractedView.jsp) (revision 18320) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedView.jsp (.../invoicePlanExtractedView.jsp) (revision 19463) @@ -71,6 +71,14 @@ + + + + + + + + - + + + Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js =================================================================== diff -u -r18548 -r19463 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 18548) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 19463) @@ -1253,7 +1253,7 @@ }, dataIndex:'button' }]); - function doSaveAction(){ + function doSaveAction(printInvoiceCallback){ if (!form.getForm().isValid()) { showResult('请正确填写表单各值'); return false; @@ -1283,6 +1283,9 @@ // 一定要事务提交成功才返回发货计划列表界面 showResult(action.result.message); if(action.result.success){ + if(printInvoiceCallback != null){ + printInvoiceCallback(action.result.invoiceIds); + } invoiceFormWindow.close(); // 返回退货界面 if(openMode == INVOICE_FORM_OPEN_MODE_CLICKRETURNRECORD){ @@ -1308,6 +1311,14 @@ } }); } + /** + * 发货并打印发货单 + * @param invoiceIds + */ + function printInvoiceAfterInvoice(invoiceIds){ + var invoicePrintModule = new InvoicePrintModule(grid,$Id('userName').value); + invoicePrintModule.batchPrintInvoiceWithType(invoiceIds,'全部'); + } var barcodeBtn = new BarcodeBtn(function(){doSaveAction();},function(){invoiceFormWindow.close();}); var form = new top.Ext.FormPanel({ id : 'recyclingApplicationForm', @@ -1840,7 +1851,12 @@ text : '保存', id:'saveButton', handler : function(){doSaveAction();} - }, { + },{ + text : '保存并打印', + id:'saveAndPrintButton', + hidden:!sstsConfig.enableSaveAndPrintWhenInvoice, + handler : function(){doSaveAction(printInvoiceAfterInvoice);} + },{ text : '取消', handler : function() { //切记注意:按取消关闭window后,一定要把已选择的申请单号变量清空 Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.jsp =================================================================== diff -u -r18448 -r19463 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.jsp (.../invoiceView.jsp) (revision 18448) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoiceView.jsp (.../invoiceView.jsp) (revision 19463) @@ -41,6 +41,7 @@ + Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/action/InvoiceAction.java =================================================================== diff -u -r18645 -r19463 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/action/InvoiceAction.java (.../InvoiceAction.java) (revision 18645) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/action/InvoiceAction.java (.../InvoiceAction.java) (revision 19463) @@ -19,6 +19,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -81,6 +82,7 @@ import com.forgon.disinfectsystem.entity.toussetransition.WashTransitionRecord; import com.forgon.disinfectsystem.entity.useRecord.UseRecord; import com.forgon.disinfectsystem.entity.washanddisinfectmanager.washanddisinfectrecord.WashAndDisinfectRecord; +import com.forgon.disinfectsystem.invoice.service.SubmitInvoiceContext; import com.forgon.disinfectsystem.invoicemanager.service.InvoiceManager; import com.forgon.disinfectsystem.invoicemanager.service.MaterialInvoiceManager; import com.forgon.disinfectsystem.invoicemanager.vo.InvoicePrintVo; @@ -1342,7 +1344,7 @@ String[] idStrs = StringUtils.split(idsStr, ','); if(idStrs.length == 1){ //如果是单张单,获取住院号 - Invoice invoice = invoiceManager.getInvoiceById(idStrs[0]); + Invoice invoice = invoiceManager.get(idStrs[0]); map.put("hospitalNumber", StringTools.defaultString(invoice.getHospitalNumber())); map.put("sourceWarehouseName", StringTools.defaultString(invoice.getSourceWarehouseName())); // map.put("assistantSender", StringTools.defaultString(invoice.getAssistantSender())); @@ -1830,8 +1832,10 @@ } try{ - invoiceManager.submitInvoice(params); - StrutsResponseUtils.output(true, "保存成功!"); + SubmitInvoiceContext invoiceContext = invoiceManager.submitInvoice(params); + JSONObject json = JSONUtil.buildJsonObject(true, "保存成功!"); + json.put("invoiceIds", invoiceContext.getInvoiceList().stream().map(p->p.getId()).collect(Collectors.toSet())); + StrutsResponseUtils.output(json); } catch (Exception ex){ ex.printStackTrace(); StrutsResponseUtils.output(false, ex.getMessage());