Index: ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationView.js =================================================================== diff -u -r36808 -r36817 --- ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationView.js (.../operationReservationView.js) (revision 36808) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationView.js (.../operationReservationView.js) (revision 36817) @@ -310,6 +310,44 @@ }); } +//取出或存入托盘 +function sendKardexContainerTCPCommand(status){ + var storageLocationId = top.Ext.getCmp("storageLocationId").getValue(); + var storageLocationAddr = top.Ext.getCmp("storageLocationAddr").getValue(); + var kardexContainerHost = top.Ext.getCmp("kardexContainerHost").getValue(); + var kardexContainerPort = top.Ext.getCmp("kardexContainerPort").getValue(); + var params = { + storageLocationId:storageLocationId, + addr:storageLocationAddr, + status:status, + host:kardexContainerHost, + port:kardexContainerPort + } + if(storageLocationAddr == ''){ + showResult('开口不能为空'); + return; + } + if(storageLocationId == ''){ + showResult('托盘不能为空'); + return; + } + showResult('已经发送命令给货柜,托盘调度中,请稍候!'); + Ext.Ajax.timeout=2*60*1000; + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/storageRecordAction!sendKardexContainerTCPCommand.do', + async:false, + params : params, + timeout: 2*60*1000, + success : function(response) { + var result = Ext.decode(response.responseText); + showResult(result.message); + }, + failure : function(response, options) { + showResult(response.responseText); + } + }); +} + function editOperationReservation(id, committedStatus, deliverStatus) { var operationRoomAllowBlank = true; var operationTimeAllowBlank = true; @@ -1083,50 +1121,26 @@ }] }, { layout: 'form', - columnWidth: .33, + columnWidth :'80px', items: [{ xtype: 'button', - text: '取回托盘', + text: '取出托盘', handler: function () { - var storageLocationId = top.Ext.getCmp("storageLocationId").getValue(); - var storageLocationAddr = top.Ext.getCmp("storageLocationAddr").getValue(); - var kardexContainerHost = top.Ext.getCmp("kardexContainerHost").getValue(); - var kardexContainerPort = top.Ext.getCmp("kardexContainerPort").getValue(); - var params = { - storageLocationId: storageLocationId, - addr: storageLocationAddr, - status: '取出', - host: kardexContainerHost, - port: kardexContainerPort - } - if (storageLocationAddr == '') { - showResult('开口不能为空'); - return; - } - if (storageLocationId == '') { - showResult('托盘不能为空'); - return; - } - showResult('已经发送命令给货柜,托盘调度中,请稍候!'); - Ext.Ajax.timeout = 2 * 60 * 1000; - Ext.Ajax.request({ - url: WWWROOT + '/disinfectSystem/baseData/storageRecordAction!sendKardexContainerTCPCommand.do', - async: false, - params: params, - timeout: 2 * 60 * 1000, - success: function (response) { - var result = Ext.decode(response.responseText); - showResult(result.message); - if (result.success) { - sendToSuccess = true; - } - }, - failure: function (response, options) { - showResult(response.responseText); - } - }); + sendKardexContainerTCPCommand('取出'); } }] + },{ + layout : 'form', + columnWidth :'80px', + hidden:!sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer, + style:'margin-left:10px', + items:[{ + xtype : 'button', + text : '存入托盘', + handler : function() { + sendKardexContainerTCPCommand('存入'); + } + }] }] }, { columnWidth: 1, Index: ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js =================================================================== diff -u -r36800 -r36817 --- ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js (.../operationReservationInvoiceView.js) (revision 36800) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/operationReservationInvoiceView.js (.../operationReservationInvoiceView.js) (revision 36817) @@ -909,23 +909,34 @@ function printInvoiceAfterInvoice(invoiceIds){ if(!isUndefinedOrNull(invoiceIds)){ var invoicePrintModule = new InvoicePrintModule(grid,$Id('userName').value); - invoicePrintModule.batchPrintInvoiceWithType(invoiceIds.join(","),'全部'); + if(typeof invoiceIds == 'string'){ + invoicePrintModule.batchPrintInvoiceWithType(invoiceIds,'全部'); + }else { + invoicePrintModule.batchPrintInvoiceWithType(invoiceIds.join(","),'全部'); + } } } + +//BJDXZLYY-42:存储未打印的发货单ID +function getInvoiceIds(invoiceIds){ + var hiddenInvoiceIds = top.Ext.getCmp('hiddenInvoiceIds').getValue(); + if(invoiceIds){ + if(hiddenInvoiceIds == ''){ + hiddenInvoiceIds = invoiceIds; + }else { + hiddenInvoiceIds += ',' + invoiceIds + } + } + return hiddenInvoiceIds; +} + +//BJDXZLYY-42:saveType:save保存,saveAndInvoice保存并继续发货,saveAndPrintPage保存并打印当前页,saveAndPrintAll保存并打印所有 function doSaveAction(form,window,saveType){ if (!form.getForm().isValid()) { showResult('请正确填写表单各值'); return false; } - //验证发货物品表格 - if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ - showResult('发货物品不能为空!'); - return false; - } - /*var b = validTousseGridData(); - if(!b){ - return false; - }*/ + var bool = validGridAmount(); if(!bool){ return false; @@ -945,24 +956,91 @@ // 一定要事务提交成功才返回发货计划列表界面 showResult(action.result.message); if(action.result.success){ - 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(); + 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(); + if(recyclingapplicationStore.getCount() > 0){ + var invoiceIds = getInvoiceIds(action.result.invoiceIds.join(',')); + top.Ext.getCmp('hiddenInvoiceIds').setValue(invoiceIds); + showResult('发货完成,您可以继续扫描物品进行发货'); + sendOutGoodsStore.removeAll(); + grid.getStore().reload(); + }else { + showResult('发货成功'); + window.close(); + grid.getStore().reload(); + } + }else { + window.close(); + grid.getStore().reload(); + } + }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 { - showResult('发货成功'); window.close(); grid.getStore().reload(); } - }else { - window.close(); - grid.getStore().reload(); } } }, @@ -977,6 +1055,45 @@ } }); } + +//取出或存入托盘 +function sendKardexContainerTCPCommand(status){ + var storageLocationId = top.Ext.getCmp("storageLocationId").getValue(); + var storageLocationAddr = top.Ext.getCmp("storageLocationAddr").getValue(); + var kardexContainerHost = top.Ext.getCmp("kardexContainerHost").getValue(); + var kardexContainerPort = top.Ext.getCmp("kardexContainerPort").getValue(); + var params = { + storageLocationId:storageLocationId, + addr:storageLocationAddr, + status:status, + host:kardexContainerHost, + port:kardexContainerPort + } + if(storageLocationAddr == ''){ + showResult('开口不能为空'); + return; + } + if(storageLocationId == ''){ + showResult('托盘不能为空'); + return; + } + showResult('已经发送命令给货柜,托盘调度中,请稍候!'); + Ext.Ajax.timeout=2*60*1000; + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/baseData/storageRecordAction!sendKardexContainerTCPCommand.do', + async:false, + params : params, + timeout: 2*60*1000, + success : function(response) { + var result = Ext.decode(response.responseText); + showResult(result.message); + }, + failure : function(response, options) { + showResult(response.responseText); + } + }); +} + /** * 发货单窗口 * @param orgUnitCoding 科室编码 @@ -1217,6 +1334,10 @@ name : 'warehouseName', id : 'warehouseName' },{ + xtype : 'hidden', + name : 'hiddenInvoiceIds', + id : 'hiddenInvoiceIds' + },{ layout : 'form', labelWidth :70, columnWidth :.33, @@ -1531,55 +1652,40 @@ listeners : { select : function(combo, record, index) { top.Ext.getCmp('storageLocationId').setValue(record.data.id); + }, + blur:function(){ + var storageLocationName = top.Ext.getCmp('storageLocationName').getRawValue(); + if(storageLocationName == ''){ + top.Ext.getCmp('storageLocationId').setValue(''); + } } } }] },{ layout : 'form', - columnWidth :.33, + columnWidth :'80px', hidden:!sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer, items:[{ xtype : 'button', - text : '取回托盘', + text : '取出托盘', handler : function() { - var storageLocationId = top.Ext.getCmp("storageLocationId").getValue(); - var storageLocationAddr = top.Ext.getCmp("storageLocationAddr").getValue(); - var kardexContainerHost = top.Ext.getCmp("kardexContainerHost").getValue(); - var kardexContainerPort = top.Ext.getCmp("kardexContainerPort").getValue(); - var params = { - storageLocationId:storageLocationId, - addr:storageLocationAddr, - status:'取出', - host:kardexContainerHost, - port:kardexContainerPort - } - if(storageLocationAddr == ''){ - showResult('开口不能为空'); - return; - } - if(storageLocationId == ''){ - showResult('托盘不能为空'); - return; - } - showResult('已经发送命令给货柜,托盘调度中,请稍候!'); - Ext.Ajax.timeout=2*60*1000; - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/baseData/storageRecordAction!sendKardexContainerTCPCommand.do', - async:false, - params : params, - timeout: 2*60*1000, - success : function(response) { - var result = Ext.decode(response.responseText); - showResult(result.message); - }, - failure : function(response, options) { - showResult(response.responseText); - } - }); + sendKardexContainerTCPCommand('取出'); } }] },{ layout : 'form', + columnWidth :'80px', + hidden:!sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer, + style:'margin-left:10px', + items:[{ + xtype : 'button', + text : '存入托盘', + handler : function() { + sendKardexContainerTCPCommand('存入'); + } + }] + },{ + layout : 'form', columnWidth : 1, labelWidth :70, items : [{ @@ -1785,22 +1891,124 @@ disabled : committedStatus ? false : true,//未提交则保存按钮置灰 id:'saveButton', handler : function() { - doSaveAction(form,window); + //验证发货物品表格 + if(sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer){ + if((!recyclingapplicationStore || recyclingapplicationStore.getCount() == 0) && (!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0)){ + top.Ext.MessageBox.confirm("请确认","无待发货物品,是否关闭页面?", function(button, text) { + if ("yes" == button){ + window.close(); + } + }); + }else if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + }else { + doSaveAction(form,window,'save'); + } + }else { + if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + }else { + doSaveAction(form,window,'save'); + } + } } },{ text : '保存并继续发货', disabled : committedStatus ? false : true,//未提交则保存按钮置灰 hidden:!sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer, handler : function() { - doSaveAction(form,window,'saveAndInvoice'); + //验证发货物品表格 + if(sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer){ + if((!recyclingapplicationStore || recyclingapplicationStore.getCount() == 0) && (!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0)){ + top.Ext.MessageBox.confirm("请确认","无待发货物品,是否关闭页面?", function(button, text) { + if ("yes" == button){ + window.close(); + } + }); + }else if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + }else { + doSaveAction(form,window,'saveAndInvoice'); + } + }else { + if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + }else { + doSaveAction(form,window,'saveAndInvoice'); + } + } } },{ text : '保存并打印', disabled : committedStatus ? false : true,//未提交则保存按钮置灰 id:'saveAndPrintButton', hidden:!sstsConfig.enableSaveAndPrintWhenInvoice, handler : function() { - doSaveAction(form,window,'saveAndPrint'); + //验证发货物品表格 + if(sstsConfig.enableOperationReservationShippedToTraysOfKardexContainer){ + if((!recyclingapplicationStore || recyclingapplicationStore.getCount() == 0) && (!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0)){ + 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; + }else { + 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.show({ + title:'请确认', + msg: '请确认只打印当前发货的物品发货单,还是需要打印本次所有未打印的发货单?', + buttons: { ok: '打印所有', yes: '打印当前', cancel: '取消' }, + fn: function(btn){ + if(btn == 'ok'){ + doSaveAction(form,window,'saveAndPrintAll'); + }else if(btn == 'yes'){ + doSaveAction(form,window,'saveAndPrintPage'); + } + }, + icon: top.Ext.MessageBox.QUESTION + }); + } + }else { + if(!sendOutGoodsStore || sendOutGoodsStore.getCount() == 0){ + showResult('发货物品不能为空!'); + return false; + }else { + doSaveAction(form,window,'saveAndPrintPage'); + } + } } }, { text : '取消',