Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/MonthGoodsDetailSummaryService.java =================================================================== diff -u -r27669 -r27777 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/MonthGoodsDetailSummaryService.java (.../MonthGoodsDetailSummaryService.java) (revision 27669) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/MonthGoodsDetailSummaryService.java (.../MonthGoodsDetailSummaryService.java) (revision 27777) @@ -170,6 +170,8 @@ String name = item.optString("name"); String spec = item.optString("specification"); MonthGoodsDetailVo vo = findOrAdd(name, spec,true); + //设置最后入库的供应商 + vo.setLastEntrySupplier(item.optString("lastEntrySupplier","")); long amout = item.optLong("amout"); double price = item.optDouble("price"); String externalCode = item.optString("externalCode"); @@ -192,6 +194,8 @@ String name = item.optString("name"); String spec = item.optString("specification"); MonthGoodsDetailVo vo = findOrAdd(name, spec,true); + //设置最后入库的供应商 + vo.setLastEntrySupplier(item.optString("lastEntrySupplier","")); long amout = item.optLong("amout"); double price = item.optDouble("price"); String externalCode = item.optString("externalCode"); Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r27774 -r27777 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 27774) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 27777) @@ -11736,20 +11736,21 @@ MonthGoodsDetailSummaryService service = new MonthGoodsDetailSummaryService(); if(currentRecord != null){ String projectName = CssdUtils.getProjectName(); - - ResultSet rs = null; - //计算期末 - calcStockTakeRecord(currentRecord, type, service,false); - //计算期初 - calcStockTakeRecord(lastMonthRecord, type, service,true); - //入库单及出库单 String startDate = ""; if(lastMonthRecord != null){ startDate = dateQueryAdapter.dateAdapter(lastMonthRecord.getStockTakeDate()); } String endDate = dateQueryAdapter.dateAdapter(currentRecord.getStockTakeDate()); + //查出该时间内各一次性物品最后入库的供应商 + Map disposableGoodsLastEntrySupplierMap = + godownEntryItemManager.getDisposableGoodsLastEntrySupplierMap(startDate,endDate); + //计算期末 + calcStockTakeRecord(currentRecord, type, service,false , disposableGoodsLastEntrySupplierMap); + //计算期初 + calcStockTakeRecord(lastMonthRecord, type, service,true , disposableGoodsLastEntrySupplierMap); + String sql = "select d.name,d.specification,i.amount,i.cost,r.type,r.subType from " + GodownEntry.class.getSimpleName() + " r inner join " + GodownEntryItem.class.getSimpleName() + " i on r.id = i.godownEntry_id" @@ -11835,10 +11836,8 @@ sql += " union all " + packingRecordUsedSql; sql += " union all " + returnGoodsSql; //System.out.println(sql); + ResultSet rs = null; try { - //查出该时间内各一次性物品最后入库的供应商 - Map disposableGoodsLastEntrySupplierMap = - godownEntryItemManager.getDisposableGoodsLastEntrySupplierMap(startDate,endDate); rs = objectDao.executeSql(sql); while(rs.next()){ JSONObject item = new JSONObject(); @@ -11876,7 +11875,7 @@ * @param isStart 计算期初或者是期末 */ private void calcStockTakeRecord(StockTakeRecord stockTakeRecord, - String type, MonthGoodsDetailSummaryService service,boolean isStart) { + String type, MonthGoodsDetailSummaryService service,boolean isStart,Map disposableGoodsLastEntrySupplierMap) { if(stockTakeRecord == null){ return; } @@ -11906,10 +11905,19 @@ while(rs.next()){ JSONObject item = new JSONObject(); item.put("externalCode", rs.getString("externalCode")); - item.put("name", rs.getString("name")); + String name = rs.getString("name"); + String specification = rs.getString("specification"); + item.put("name", name); + item.put("specification", specification); + String fullName = DisposableGoodsUtils.getDisposableGoodsFullName(name, specification); + if(disposableGoodsLastEntrySupplierMap != null){ + String lastEntrySupplier = disposableGoodsLastEntrySupplierMap.get(fullName); + if(StringUtils.isNotBlank(lastEntrySupplier)){ + item.put("lastEntrySupplier", lastEntrySupplier); + } + } item.put("unit",rs.getString("unit")); item.put("type",rs.getString("type")); - item.put("specification", rs.getString("specification")); item.put("amout", rs.getLong("amout")); item.put("price", rs.getDouble("price")); if(isStart){