Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r15258 -r15292 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 15258) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 15292) @@ -6485,7 +6485,7 @@ } String tousseSql = "select i.settleAccountsDepart," + caseSql + " as name,sum(ii.amount) as amount,sum(ii.settlementPrice) as settlementprice,ii.tousseType as type" - + ",'' from invoice i,InvoiceItem ii " + + ",'' as batchNumber from invoice i,InvoiceItem ii " + " where i.id = ii.invoice_id " + " and ii.diposable = '否' and "+getHandleDeptCodeSql("i.orgUnitCoding")+" " + monthFilterSql @@ -6497,7 +6497,7 @@ String diposableGoodsSql = " "; if(StringUtils.isBlank(typeSearch) || "一次性物品".equals(typeSearch) || "高值耗材".equals(typeSearch)){ diposableGoodsSql = " union all (select i.settleaccountsdepart,d.name as name,sum(d.amount) as amount,sum(d.fluctuationPrice*d.amount) as settlementprice,'一次性物品' as type" - + ",d.batch from invoice i,DiposableGoodsItem d " + + ",d.batch as batchNumber from invoice i,DiposableGoodsItem d " + " where i.id = d.invoice_id and "+getHandleDeptCodeSql("i.orgUnitCoding")+" " +" and "+diposableGoodsItemPredicate + monthFilterSql @@ -6510,7 +6510,7 @@ { if(StringUtils.isBlank(typeSearch) || "一次性物品".equals(typeSearch)){ packingDisposableGoodsSql = " union all (select pr.orgUnitName,dgi.name as name,sum(dgi.amount) as amount,sum(dgi.fluctuationPrice*dgi.amount) as settlementprice,'一次性物品' as type" - + ",dgi.batch from PackingRecord pr inner join DiposableGoodsItem dgi on pr.id = dgi.packingRecordId " + + ",dgi.batch as batchNumber from PackingRecord pr inner join DiposableGoodsItem dgi on pr.id = dgi.packingRecordId " + " where "+getHandleDeptCodeSql("pr.orgUnitCoding")+" " +" and "+packingDisposableGoodsTypeSql + packingDisposableGoodsTimeSql @@ -6524,7 +6524,7 @@ String materialInvoiceSql = " "; if (StringUtils.isBlank(typeSearch) || "器械材料".equals(typeSearch) || "高值耗材".equals(typeSearch)) { // 材料发货 - materialInvoiceSql = " union all (select i.settleAccountsDepart,ii.materialName,sum(ii.amount),sum(ii.settlementPrice),'材料' as type,'' " + materialInvoiceSql = " union all (select i.settleAccountsDepart,ii.materialName,sum(ii.amount),sum(ii.settlementPrice),'材料' as type,'' as batchNumber " + " from MaterialInvoice i," + "MaterialInvoiceItem ii,materialDefinition d where i.id = ii.materialInvoice_id " + " and ii.materialDefinitionId = d.id and "+getHandleDeptCodeSql("i.orgUnitCoding")+" " @@ -6535,7 +6535,7 @@ + " group by i.settleaccountsdepart,ii.materialName) "; } // 材料退货 - String materialReturnSql = " union all (select rr.depart as settleaccountsdepart,ii.materialName,-sum(ii.amount),-sum(ii.settlementPrice),'材料' as type,'' " + String materialReturnSql = " union all (select rr.depart as settleaccountsdepart,ii.materialName,-sum(ii.amount),-sum(ii.settlementPrice),'材料' as type,'' as batchNumber " + " from ReturnMaterialRecord rr,materialDefinition d," + "ReturnMaterialItem ii where rr.id = ii.returnMaterialRecord_ID " + " and ii.materialDefinitionId = d.id and "+getHandleDeptCodeSql("rr.handleDepartCode")+" " @@ -6548,38 +6548,38 @@ //退货 String returnGoodsSql = " union all (select rr.depart as settleaccountsdepart,ri.toussename as name," + "-sum(ri.amount) as amount,-sum(ri.settlementPrice) as settlementprice,"+returnGoodsTousseType+" as type" - + ",ri.batchNumber from " + ReturnGoodsRecord.class.getSimpleName() + " rr inner join " + + ",ri.batchNumber as batchNumber from " + ReturnGoodsRecord.class.getSimpleName() + " rr inner join " + ReturnGoodsItem.class.getSimpleName()+ " ri on rr.id = ri.returngoodsrecord_id " + " left join " + TousseDefinition.class.getSimpleName() + " td on td.id = ri.tousseDefinition_id" + " where " + getHandleDeptCodeSql("rr.handleDepartCode")+" " + returnGoodsFilterSql +" and "+returnGoodsItemPredicate + " group by rr.depart,ri.toussename,"+returnGoodsTousseType+",ri.batchNumber) "; - String lostMaterial = " union all (select r.depart,r.materialName,sum(r.additionalAmount),sum(r.additionalAmount * r.materialCost),'材料' as type,'' " + String lostMaterial = " union all (select r.depart,r.materialName,sum(r.additionalAmount),sum(r.additionalAmount * r.materialCost),'材料' as type,'' as batchNumber " + " from RecyclingError r,materialDefinition m where r.materialDefinitionId = m.id and r.errorType = '缺失' and r.materialName != '器械包标识牌' and r.additionalAmount > 0 and "+getHandleDeptCodeSql("r.handleDepartCode")+" " + lostMaterialFilterSql + "group by r.depart,r.materialName ) "; - String damageMaterial = " union all (select i.depart,i.materialName,sum(i.additionalAmount),sum(i.materialCost*i.additionalAmount),'材料','' " + String damageMaterial = " union all (select i.depart,i.materialName,sum(i.additionalAmount),sum(i.materialCost*i.additionalAmount),'材料' as type,'' as batchNumber " + "from RecyclingDamageItem i,MaterialDefinition m where i.materialDefinitionId = m.id " + "and i.additionalAmount > 0 and "+getHandleDeptCodeSql("i.handleDepartCode")+" " + damageFilterSql + " group by i.departCoding,i.depart,i.materialName ) "; - String supplyRoomDiposableGoodsSql = " union all (select rr.depart as settleaccountsdepart,rri.goodsName,sum(rri.amount),sum(rri.price*rri.amount) as settlementprice,rri.type as type,dbs.batchNumber " + String supplyRoomDiposableGoodsSql = " union all (select rr.depart as settleaccountsdepart,rri.goodsName,sum(rri.amount),sum(rri.price*rri.amount) as settlementprice,rri.type as type,dbs.batchNumber as batchNumber " +" from ReceiveRecord rr,ReceiveRecordItem rri left join " + DisposableGoodsBatchStock.class.getSimpleName() + " dbs " +" on rri.diposableGoodBatchStock_id = dbs.id left join DisposableGoods d on d.id = rri.disposableGoodsId where rr.id = rri.receiveRecord_id and "+getHandleDeptCodeSql("rr.departCoding")+" " +supplyRoomDiposableGoodsFilterSql +" and "+receiveRecordItemPredicate + " group by rr.depart,rri.goodsName,rri.amount,rri.type,dbs.batchNumber) "; // 调拨出库 - String appropriateOutDiposableGoodsSql = " union all (select oge.targetOrgUnitName as settleaccountsdepart,ged.goodsName,sum(ged.amount),sum(ged.price*ged.amount) as settlementprice,'一次性物品' as type,dgb.batchNumber " + String appropriateOutDiposableGoodsSql = " union all (select oge.targetOrgUnitName as settleaccountsdepart,ged.goodsName,sum(ged.amount),sum(ged.price*ged.amount) as settlementprice,'一次性物品' as type,dgb.batchNumber as batchNumber " +" from GodownEntry oge inner join GodownEntryDiposableGoodsItem ged on oge.id = ged.godownEntryID inner join DisposableGoodsBatch dgb on ged.disposableGoodsBatchID=dgb.id " +" where oge.type ='退库单' and oge.subType='调拨出库' and "+getHandleDeptCodeSql("oge.orgUnitCode")+" " +outEntryFilterSql +" and "+outEntryPredicate + " group by oge.targetOrgUnitName, ged.goodsName,dgb.batchNumber) "; // 盘亏出库 - String stocktakeOutDiposableGoodsSql = " union all (select oge.orgUnitName as settleaccountsdepart,ged.goodsName,sum(ged.amount),sum(ged.price*ged.amount) as settlementprice,'一次性物品' as type,dgb.batchNumber " + String stocktakeOutDiposableGoodsSql = " union all (select oge.orgUnitName as settleaccountsdepart,ged.goodsName,sum(ged.amount),sum(ged.price*ged.amount) as settlementprice,'一次性物品' as type,dgb.batchNumber as batchNumber " +" from GodownEntry oge inner join GodownEntryDiposableGoodsItem ged on oge.id = ged.godownEntryID inner join DisposableGoodsBatch dgb on ged.disposableGoodsBatchID=dgb.id " +" where oge.type ='退库单' and oge.subType='盘亏出库' and "+getHandleDeptCodeSql("oge.orgUnitCode")+" " +outEntryFilterSql @@ -6617,8 +6617,7 @@ if (rs != null) { try { while (rs.next()) { - String settleaccountsdepart = rs - .getString("settleaccountsdepart"); + String settleaccountsdepart = rs.getString("settleaccountsdepart"); List itemList = detailMap.get(settleaccountsdepart); if (itemList == null) { itemList = new ArrayList(); @@ -6659,7 +6658,7 @@ mdi.setGoodsName(goodsName); mdi.setType(type); mdi.setSettlementPrice(settlementPrice); - mdi.setBatchNumber(rs.getString(6)); + mdi.setBatchNumber(rs.getString("batchNumber")); if ("一次性物品".equals(type)) { mdi.setManufacturer(manufacturerMap.get(goodsName + "_" + mdi.getBatchNumber())); mdi.setExternalCode(disposableGoodsExternalCodeMap.get(goodsName));