Index: ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js =================================================================== diff -u -r30341 -r30378 --- ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 30341) +++ ssts-web/src/main/webapp/disinfectsystem/invoice/invoicePlanExtractedForm.js (.../invoicePlanExtractedForm.js) (revision 30378) @@ -1234,7 +1234,7 @@ } //发货单明细修改 -function updateAmount2(record, amount) { +function updateAmount2(name, amount) { if (name != null && name.length > 0) { for ( var i = 0; i < recyclingapplicationStore1.getCount(); i++) { var record = recyclingapplicationStore1.getAt(i); @@ -1490,6 +1490,7 @@ {name : 'count'}, {name : 'middlePackageAmount'}, {name : 'diposable'}, + {name : 'disposableGoodsId'}, {name : 'goodsType'}, {name : 'price'}, {name : 'urgentAmount'}, @@ -1614,6 +1615,22 @@ if(top.Ext.getCmp("sendOutGoodsDetail")){ top.Ext.getCmp("sendOutGoodsDetail").getEl().unmask(); } + //是否存在待发的一次性物品 + var existsDisposableGoodsWaitDelivery = false; + //如果待发物品中有一次性物品,则设置"一键扫描一次性物品"按钮显示 + for(var i = 0;i < recyclingapplicationStore1.getCount();i++){ + var record = recyclingapplicationStore1.getAt(i); + if(record.data.goodsType == '一次性物品'){ + existsDisposableGoodsWaitDelivery = true; + break; + } + } + if(sstsConfig.oneKeyScanDisposableGoodsForPC && sstsConfig.isInitiateDisposableGoodsFixedBarcode && existsDisposableGoodsWaitDelivery){ + top.Ext.getCmp('btnBatchScanDisposableGoods').setVisible(true); + top.Ext.getCmp('btnBatchScanDisposableGoods').enable(); + }else{ + top.Ext.getCmp('btnBatchScanDisposableGoods').setVisible(false); + } }); recyclingapplicationStore1.load(); @@ -2313,59 +2330,161 @@ }); } } + },{ + id:'btnBatchScanDisposableGoods', + xtype:'button', + text:'一键扫描一次性物品', + //hidden:!(sstsConfig.oneKeyScanDisposableGoodsForPC && sstsConfig.isInitiateDisposableGoodsFixedBarcode && existsDisposableGoodsWaitDelivery),//显示此按钮的3个条件:PC端是否开启一键扫描一次性物品功能、开启固定条码功能、待发货的物品中有一次性物品 + hidden:true, + handler:function(){ + this.disable(); + var sourceWarehouseId = top.Ext.getCmp("sourceWarehouseId").getValue(); + if(isUndefinedOrNullOrEmpty(sourceWarehouseId)){ + showResult('请先选择仓库!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + return false; + } + var amountAndIdArray = []; + var dataLength = recyclingapplicationStore1.getCount(); + if(dataLength > 0){ + for(var i = 0;i < dataLength;i++){ + var dataRecord = recyclingapplicationStore1.getAt(i); + var disposableGoodsId = dataRecord.data.disposableGoodsId; + var errorAmount = dataRecord.data.errorAmount; + if(disposableGoodsId && errorAmount > 0){ + var amountAndIdObject = {disposableGoodsId:disposableGoodsId,amount:errorAmount}; + amountAndIdArray.push(amountAndIdObject); + } + } + } + if(amountAndIdArray.length > 0){ + Ext.Ajax.request({ + url : WWWROOT + '/disinfectSystem/invoiceAction!getDisposableGoodInfoByMapAndWareHouseId.do', + params : {amountAndIdArray : JSON.stringify(amountAndIdArray),wareHouseId : sourceWarehouseId}, + success : function(response, options) { + var responseResultJson = top.Ext.decode(response.responseText); + if(responseResultJson.data && responseResultJson.data.length > 0){ + for(var index = 0;index < responseResultJson.data.length;index++){ + var goods = responseResultJson.data[index]; + //如果左边已扫描窗口中没有此条码时,添加至左边页面. + var storeCount = sendOutGoodsStore1.getCount(); + if(storeCount == 0){ + var newRecord = new addGridItem({ + id:0, + barcode : goods.barcode, + name : goods.name, + ttsName : goods.ttsName, + showTousseName : goods.name, + count : goods.amount, + storage : goods.stockAmount, + diposable : '是', + price : goods.referencePrice, + fluctuationPrice : goods.referencePrice, + tousseType : '一次性物品', + typeInfoOnScanned : goods.typeInfoOnScanned + }); + sendOutGoodsStore1.insert(0,newRecord); + updateAmount2(goods.name,goods.amount); + }else{ + var foundBarcode = false; + var goodsBarcode = goods.barcode; + for ( var i = 0; i < storeCount; i++) { + var record = sendOutGoodsStore1.getAt(i); + var existsGoods = record.data; + if(goodsBarcode == existsGoods.barcode){ + foundBarcode = true; + break; + } + } + if(!foundBarcode){ + var newRecord = new addGridItem({ + id:0, + barcode : goods.barcode, + name : goods.name, + ttsName : goods.ttsName, + showTousseName : goods.name, + count : goods.amount, + storage : goods.stockAmount, + diposable : '是', + price : goods.referencePrice, + fluctuationPrice : goods.referencePrice, + tousseType : '一次性物品', + typeInfoOnScanned : goods.typeInfoOnScanned + }); + sendOutGoodsStore1.insert(0,newRecord); + updateAmount2(goods.name,goods.amount); + } + } + } + } + }, + failure : function(form, action) { + + } + }); + } + } }], listeners : { beforeedit : function(grid){// 只有一次性物品和固定条码才能编辑数量 - var record = grid.record; - var goods = record.data; - if(record.data.diposable == '是') { - return true; + var record = grid.record; + var goods = record.data; + if(record.data.diposable == '是') { + return true; + } + //不追溯的包改为都可以修改发货数量(之前不追溯的包只有器械包和敷料包才可以改数量) + if(/*(goods.tousseType == '器械包' || goods.tousseType == '敷料包') && */goods.tousseFixedBarcode){ + return true; + } + return false; + }, + afteredit :function(grid){ + var id = grid.record.data['id']; + var name = grid.record.data['name']; + var count = grid.record.data['count']; + var countInt = parseInt(count); + var storage = grid.record.data['storage']; + var storageInt = parseInt(storage); + //待发货数量改为从右边待发货物品明细中取.从已扫条码明细中从取不合理 + //var waitDeliveryCount = grid.record.data['waitDeliveryCount']; + var waitDeliveryCount; + for(var i = 0;i < recyclingapplicationStore1.getCount();i++){ + var record = recyclingapplicationStore1.getAt(i); + if(name == record.data.name){ + waitDeliveryCount = record.data.count; + break; } - //不追溯的包改为都可以修改发货数量(之前不追溯的包只有器械包和敷料包才可以改数量) - if(/*(goods.tousseType == '器械包' || goods.tousseType == '敷料包') && */goods.tousseFixedBarcode){ - return true; + } + var waitDeliveryCountInt = parseInt(waitDeliveryCount); + if(id==0){ + var maxAmountCanSend = Math.min(storageInt,waitDeliveryCountInt); + if(countInt > storageInt){ + showResult('库存量为:' + storage + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); } - return false; - }, - afteredit :function(grid){ - var id = grid.record.data['id']; - var name = grid.record.data['name']; - var count = grid.record.data['count']; - var countInt = parseInt(count); - var storage = grid.record.data['storage']; - var storageInt = parseInt(storage); - var waitDeliveryCount = grid.record.data['waitDeliveryCount']; - var waitDeliveryCountInt = parseInt(waitDeliveryCount); - if(id==0){ - var maxAmountCanSend = Math.min(storageInt,waitDeliveryCountInt); - if(countInt > storageInt){ - showResult('库存量为:' + storage + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - } - if(countInt > waitDeliveryCountInt){ - showResult('申请数量为:' + waitDeliveryCountInt + ',已超过申请数量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - } - - if(countInt <= maxAmountCanSend){ - updateAmount2(name,countInt); - } else { - updateAmount2(name,maxAmountCanSend); -// showResult('库存量为:' + storage + ',已超过库存量!'); -// var index = recyclingapplicationStore1.find("name",name); -// var tempAmount = recyclingapplicationStore1.getAt(index).data['tempAmount']; - grid.record.set('count',maxAmountCanSend); - } - } else { - var record = getRecord(recyclingapplicationStore1, "name", name, 0); - if(record != null) { - var tempAmount = record.data['tempAmount']; - if(parseInt(count) <= (storageInt + parseInt(tempAmount))){ - updateAmount2(name,count); - } else { - showResult('库存量为:' + storage + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); - grid.record.set('count',tempAmount); - } - } - } + if(countInt > waitDeliveryCountInt){ + showResult('申请数量为:' + waitDeliveryCountInt + ',已超过申请数量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + } + + if(countInt <= maxAmountCanSend){ + updateAmount2(name,countInt); + } else { + updateAmount2(name,maxAmountCanSend); +// showResult('库存量为:' + storage + ',已超过库存量!'); +// var index = recyclingapplicationStore1.find("name",name); +// var tempAmount = recyclingapplicationStore1.getAt(index).data['tempAmount']; + grid.record.set('count',maxAmountCanSend); + } + } else { + var record = getRecord(recyclingapplicationStore1, "name", name, 0); + if(record != null) { + var tempAmount = record.data['tempAmount']; + if(parseInt(count) <= (storageInt + parseInt(tempAmount))){ + updateAmount2(name,count); + } else { + showResult('库存量为:' + storage + ',已超过库存量!' , null , sstsConfig.messagePauseTimeOnInvoiceplanPage); + grid.record.set('count',tempAmount); + } + } + } } } } Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/action/InvoiceAction.java =================================================================== diff -u -r29577 -r30378 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/action/InvoiceAction.java (.../InvoiceAction.java) (revision 29577) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/action/InvoiceAction.java (.../InvoiceAction.java) (revision 30378) @@ -2261,7 +2261,29 @@ result.add("data", gson.toJsonTree(Collections.singleton(vo), gsonType)); return result; } + } + + /** + * 根据map<一次性物品名称[规格],待发数量>、仓库id获取一次性物品id、物品简称ttsName、满足待发数量、条码、参考价、名称、带规格名称 + * 参数格式 {wareHouseId : 100,amountAndIdArray :[{amount : 110,disposableGoodsId:"1111"},{amount : 110,disposableGoodsId:10243},{amount : 110,disposableGoodsId:"2132"}]} + * @param params + * @return + */ + public void getDisposableGoodInfoByMapAndWareHouseId() { + String amountAndIdArray = StrutsParamUtils.getPraramValue("amountAndIdArray", null); + Long wareHouseId = StrutsParamUtils.getPraramLongValue("wareHouseId", null); + Map amountAndIdMap = new HashMap(); + JSONArray objArray = JSONArray.fromObject(amountAndIdArray); + for (int i = 0; i < objArray.size(); i++) { + JSONObject obj = objArray.optJSONObject(i); + Long amount = obj.optLong("amount"); + Long disposableGoodsId = obj.optLong("disposableGoodsId"); + amountAndIdMap.put(disposableGoodsId, amount); + } + String result = diposableGoodsManager.getDisposableGoodsInfoByAmountAndIdsMap(amountAndIdMap,wareHouseId).toString(); + StrutsResponseUtils.output(result); + } private JsonElement convertTousse(final JsonObject src, Gson gson, Type gsonType, JsonObject result, String tips) { @@ -2347,7 +2369,9 @@ /** * 保存发货单(合并发货单保存) + * 该方法目前已经没有地方调用了,都是调用的saveInvoiceByDepartOrInvoicePlanId方法 */ + @Deprecated public void saveDepartInvoice() { String loginUser = AcegiHelper.getLoginUser().getUserFullName(); Index: ssts-web/src/main/webapp/disinfectsystem/config/klmysrmyy/config.js =================================================================== diff -u -r30239 -r30378 --- ssts-web/src/main/webapp/disinfectsystem/config/klmysrmyy/config.js (.../config.js) (revision 30239) +++ ssts-web/src/main/webapp/disinfectsystem/config/klmysrmyy/config.js (.../config.js) (revision 30378) @@ -1,4 +1,4 @@ -var sstsConfig = { +var sstsConfig = { // 回收时科室显示结算科室 showSettleAccountsDepartInRecycling : false, // 审核器械包必须入篮筐(一级供应室) @@ -158,5 +158,7 @@ //自定义装配界面是否显示选择申请科室 selectDepartInCustomPacking:true, //是否在系统首页的桌面上显示设备维护的快捷图标 - showDeviceMaintenanceDesktopIcon:true + showDeviceMaintenanceDesktopIcon:true, + //PC端是否开启一键扫描一次性物品功能 + oneKeyScanDisposableGoodsForPC:true } \ No newline at end of file Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/DiposableGoodsManagerImpl.java =================================================================== diff -u -r29761 -r30378 --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/DiposableGoodsManagerImpl.java (.../DiposableGoodsManagerImpl.java) (revision 29761) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/service/DiposableGoodsManagerImpl.java (.../DiposableGoodsManagerImpl.java) (revision 30378) @@ -3305,6 +3305,7 @@ obj.put("ttsName", ttsName); obj.put("barcode", barcode); obj.put("referencePrice", referencePrice); + obj.put("stockAmount", stockAmount); obj.put("name", DisposableGoodsUtils.getDisposableGoodsFullName(showTousseName, specification, applicationSpecification)); obj.put("showTousseName", showTousseName); Long amount = amountAndIdsMap.get(disposableGoodsId);//待发货数量