Index: ssts-web/src/main/webapp/jasperRtp/stocktakereport.jasper =================================================================== diff -u -r13124 -r13130 Binary files differ Index: ssts-web/src/test/java/test/forgon/disinfectsystem/AbstractCSSDTest.java =================================================================== diff -u -r13057 -r13130 --- ssts-web/src/test/java/test/forgon/disinfectsystem/AbstractCSSDTest.java (.../AbstractCSSDTest.java) (revision 13057) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/AbstractCSSDTest.java (.../AbstractCSSDTest.java) (revision 13130) @@ -84,7 +84,6 @@ import com.forgon.disinfectsystem.sterilizationmanager.proxydisinfection.service.ProxyDisinfectionManager; import com.forgon.disinfectsystem.stockmanage.cssdstock.service.TousseStockManager; import com.forgon.disinfectsystem.stockmanage.departmentstock.service.DepartmentStockManager; -import com.forgon.disinfectsystem.stocktakerecordmanager.service.StockTakeRecordManager; import com.forgon.disinfectsystem.tousse.materialdefinition.service.MaterialDefinitionManager; import com.forgon.disinfectsystem.tousse.materialinstance.service.MaterialInstanceManager; import com.forgon.disinfectsystem.tousse.toussedefinition.service.TousseDefinitionManager; @@ -181,8 +180,6 @@ @Autowired protected ContainerManager containerManager; @Autowired - protected StockTakeRecordManager stockTakeRecordManager; - @Autowired protected SterilizerManager sterilizerManager; @Autowired protected MaintainManager maintainManager; Index: ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryMaterialForm.js =================================================================== diff -u -r13124 -r13130 --- ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryMaterialForm.js (.../inventoryMaterialForm.js) (revision 13124) +++ ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryMaterialForm.js (.../inventoryMaterialForm.js) (revision 13130) @@ -143,11 +143,13 @@ buttons : [{ text : '暂存', hidden:status=="已更新"?true:false, + id:'button1', handler : function() { saveInventoryItem(); } },{ text : '更新库存并结算', + id:'button2', hidden:status=="已更新"?true:false, handler : function() { updateStock(); @@ -197,6 +199,7 @@ }); function saveInventoryItem(){ + top.Ext.getCmp('button1').disable(); var array = new Array(); for ( var i = 0; i < itemsStore.getCount(); i++) { var record = itemsStore.getAt(i); @@ -233,6 +236,7 @@ } function updateStock(){ + top.Ext.getCmp('button2').disable(); var array = new Array(); var isNullAmount = false; var goodsName = ""; Index: ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryDisposableGoodsForm.js =================================================================== diff -u -r13124 -r13130 --- ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryDisposableGoodsForm.js (.../inventoryDisposableGoodsForm.js) (revision 13124) +++ ssts-web/src/main/webapp/disinfectsystem/stocktakerecordmanager/inventoryDisposableGoodsForm.js (.../inventoryDisposableGoodsForm.js) (revision 13130) @@ -145,12 +145,14 @@ })], buttons : [{ text : '暂存', + id:'button1', hidden:status=="已更新"?true:false, handler : function() { saveInventoryItem(); } },{ text : '更新库存并结算', + id:'button2', hidden:status=="已更新"?true:false, handler : function() { updateStock(); @@ -183,23 +185,19 @@ }); window.show(); - function showMask(msg){ + /*function showMask(msg){ myMask = new top.Ext.LoadMask(top.Ext.getBody(), { - msg: msg, - removeMask: true + msg: msg }); myMask.show(); - } + }*/ - showMask("正在加载,请稍候!"); + //showMask("正在加载,请稍候!"); - itemsStore.load({ - callback: function(records, options, success){ - myMask.hide(); // 加载完成,关闭提示框 - } - }); + itemsStore.load(); function saveInventoryItem(){ + top.Ext.getCmp('button1').disable(); var array = new Array(); for ( var i = 0; i < itemsStore.getCount(); i++) { var record = itemsStore.getAt(i); @@ -214,20 +212,18 @@ }; array.push(obj); } - showMask("正在保存,请稍候!"); + Ext.Ajax.request({ url : WWWROOT + '/disinfectSystem/inventoryRecordAction!saveInventoryRecord.do', params : { items : JSON.stringify(array) }, success : function(response, options) { - myMask.hide(); var jsonObj = Ext.decode(response.responseText); showResult(jsonObj.msg); window.close(); }, failure : function(response, options) { - myMask.hide(); var jsonObj = Ext.decode(response.responseText); showResult(jsonObj.msg); window.close(); @@ -236,6 +232,7 @@ } function updateStock(){ + top.Ext.getCmp('button2').disable(); var array = new Array(); var isNullAmount = false; var goodsName = ""; @@ -259,8 +256,6 @@ return; } - showMask("正在保存,请稍候!"); - Ext.Ajax.request({ timeout: 300*000, url : WWWROOT + '/disinfectSystem/inventoryRecordAction!updateGoodsStock.do', @@ -270,14 +265,12 @@ type : 'disposableGoods' }, success : function(response, options) { - myMask.hide(); var jsonObj = Ext.decode(response.responseText); showResult(jsonObj.msg); grid.dwrReload(); window.close(); }, failure : function(response, options) { - myMask.hide(); var jsonObj = Ext.decode(response.responseText); showResult(jsonObj.msg); grid.dwrReload(); Index: ssts-web/src/main/webapp/jasperRtp/stocktakereport.jrxml =================================================================== diff -u -r13124 -r13130 --- ssts-web/src/main/webapp/jasperRtp/stocktakereport.jrxml (.../stocktakereport.jrxml) (revision 13124) +++ ssts-web/src/main/webapp/jasperRtp/stocktakereport.jrxml (.../stocktakereport.jrxml) (revision 13130) @@ -257,7 +257,7 @@ - + Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r13127 -r13130 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13127) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13130) @@ -7601,6 +7601,38 @@ @SuppressWarnings("unchecked") List goodsList = objectDao.findBySql(StockDiposableGoods.class.getSimpleName(), orderBySql); List voList = new ArrayList(); + + + //本期入库 + String startDate = ""; + if(lastMonthRecord == null){ + startDate = ""; + }else{ + startDate = dateQueryAdapter.dateAdapter(lastMonthRecord.getStockTakeDate()); + } + String endDate = dateQueryAdapter.dateAdapter(currentRecord.getStockTakeDate()); + + + //入库sql + String insql = " where po.godownEntry.type ='"+GodownEntry.TYPE_IN+"' and po.godownEntry.warehouseID = " + + currentRecord.getWarehouseId(); + if(StringUtils.isBlank(startDate)){ + insql += " and po.godownEntry.time < " + endDate + ""; + }else{ + insql += " and po.godownEntry.time between " + startDate + " and " + endDate + " "; + } + Map> inMap = getGodownEntryItemBySql(insql); + + //退库sql + String outsql = " where po.godownEntry.type ='"+GodownEntry.TYPE_OUT+"' and po.godownEntry.warehouseID = " + + currentRecord.getWarehouseId(); + if(StringUtils.isBlank(startDate)){ + outsql += " and po.godownEntry.time < " + endDate + ""; + }else{ + outsql += " and po.godownEntry.time between " + startDate + " and " + endDate + " "; + } + Map> outMap = getGodownEntryItemBySql(outsql); + for (StockDiposableGoods goods : goodsList) { MonthGoodsDetailVo vo = new MonthGoodsDetailVo(); vo.setExternalCode(goods.getExternalCode()); @@ -7650,67 +7682,34 @@ } } - //本期入库 - String startDate = ""; - if(lastMonthRecord == null){ - startDate = ""; - }else{ - startDate = dateQueryAdapter.dateAdapter(lastMonthRecord.getStockTakeDate()); + String key = goods.getName(); + if(StringUtils.isNotBlank(goods.getSpecification())){ + key = "[" + goods.getSpecification() + "]"; } - - String endDate = dateQueryAdapter.dateAdapter(currentRecord.getStockTakeDate()); - - String godownEntrySql = " where po.diposableGoods.name = '"+goods.getName() - +"' and po.godownEntry.type ='"+GodownEntry.TYPE_IN+"' and po.godownEntry.warehouseID = " - + currentRecord.getWarehouseId(); - - if(StringUtils.isBlank(goods.getSpecification())){ - godownEntrySql += " and po.diposableGoods.specification is null "; - }else{ - godownEntrySql += " and po.diposableGoods.specification = '"+goods.getSpecification()+"'"; - } - - if(StringUtils.isBlank(startDate)){ - godownEntrySql += " and po.godownEntry.time < " + endDate + ""; - }else{ - godownEntrySql += " and po.godownEntry.time between " + startDate + " and " + endDate + " "; - } - - List entryItems = getGodownEntryItemBySql(godownEntrySql); + List entryItems = inMap.get(key); Long amount = 0L; double totalPrice = 0.00; - for (GodownEntryItem godownEntryItem : entryItems) { - Long tempAmount = godownEntryItem.getAmount(); - double cost = godownEntryItem.getCost(); - double itemTotalPrice = new BigDecimal(tempAmount).multiply(new BigDecimal(cost)).doubleValue(); - totalPrice += itemTotalPrice; - amount += tempAmount; + if(entryItems != null){ + for (GodownEntryItem godownEntryItem : entryItems) { + Long tempAmount = godownEntryItem.getAmount(); + double cost = godownEntryItem.getCost(); + double itemTotalPrice = new BigDecimal(tempAmount).multiply(new BigDecimal(cost)).doubleValue(); + totalPrice += itemTotalPrice; + amount += tempAmount; + } } - //供应室退库到物资仓库 - String godownEntryOutSql = " where po.diposableGoods.name = '"+goods.getName() - +"' and po.godownEntry.type ='"+GodownEntry.TYPE_OUT+"' and po.godownEntry.warehouseID = " - + currentRecord.getWarehouseId(); - if(StringUtils.isBlank(goods.getSpecification())){ - godownEntryOutSql += " and po.diposableGoods.specification is null "; - }else{ - godownEntryOutSql += " and po.diposableGoods.specification = '"+goods.getSpecification()+"' "; + //供应室退库到物资仓库 + List entryOutItems = outMap.get(key); + if(entryOutItems != null){ + for (GodownEntryItem godownEntryItem : entryOutItems) { + Long tempAmount = godownEntryItem.getAmount(); + double cost = godownEntryItem.getCost(); + double itemTotalPrice = new BigDecimal(tempAmount).multiply(new BigDecimal(cost)).doubleValue(); + totalPrice -= itemTotalPrice; + amount -= tempAmount; + } } - - if(StringUtils.isBlank(startDate)){ - godownEntryOutSql += " and po.godownEntry.time < " + endDate + ""; - }else{ - godownEntryOutSql += " and po.godownEntry.time between " + startDate + " and " + endDate + " "; - } - - List entryOutItems = getGodownEntryItemBySql(godownEntryOutSql); - for (GodownEntryItem godownEntryItem : entryOutItems) { - Long tempAmount = godownEntryItem.getAmount(); - double cost = godownEntryItem.getCost(); - double itemTotalPrice = new BigDecimal(tempAmount).multiply(new BigDecimal(cost)).doubleValue(); - totalPrice -= itemTotalPrice; - amount -= tempAmount; - } vo.setInStorageAmount(amount); vo.setInStoragePrice(totalPrice); @@ -7726,8 +7725,25 @@ return null; } - public List getGodownEntryItemBySql(String sql){ - return objectDao.findBySql(GodownEntryItem.class.getSimpleName(), sql); + @SuppressWarnings("unchecked") + public Map> getGodownEntryItemBySql(String sql){ + List list = objectDao.findBySql(GodownEntryItem.class.getSimpleName(), sql); + Map> map = new HashMap>(); + if(list != null){ + for (GodownEntryItem item : list) { + DisposableGoodsStock stock = item.getDiposableGoods(); + String key = stock.getName(); + if(StringUtils.isNotBlank(stock.getSpecification())){ + key = "[" + stock.getSpecification() + "]"; + } + List items = map.get(key); + if(items == null){ + items = new ArrayList(); + } + items.add(item); + } + } + return map; } public List getGoodsBySql(String sql){