Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/DataIndex.java =================================================================== diff -u -r35154 -r35182 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/DataIndex.java (.../DataIndex.java) (revision 35154) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/dataindex/DataIndex.java (.../DataIndex.java) (revision 35182) @@ -1538,12 +1538,14 @@ case "清洗数量": String groupSql = ""; String groupSql2 = ""; + String sum = ""; if(StringUtils.isBlank(obj.groupBySql)){ groupSql = " group by ci.tousseDefinitionID,ci.recyclingRecordId "; groupSql2 = ""; }else{ groupSql = obj.groupBySql + ",ci.tousseDefinitionID,ci.recyclingRecordId"; - groupSql2 = obj.groupBySql + ",numOfUnwashedStops,amount "; + groupSql2 = obj.groupBySql; + sum = "sum"; } amountSql = String.format( "select min(ci.tousseAmountForMaterial) amount %s %s %s %s %s " @@ -1570,10 +1572,11 @@ groupSql); amountSql += " union all "; - amountSql += String.format("select (ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end) amount %s %s %s %s %s " + amountSql += String.format("select %s(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end) amount %s %s %s %s %s " + "from WashAndDisinfectRecord wdr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td,TousseDefinition tdc " + "where cw.WashAndDisinfectRecord_ID = wdr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID and tdc.id=td.ancestorID " + "and wdr.endDate %s %s %s and %s %s %s and ci.itemtype != '材料' and wdr.washMaterialAmount <> 0 %s %s %s %s %s %s ", + sum, obj.queryIntegral?",(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end)*tdc.integral integral":"", obj.selectUserName?",case when (cb.personInCharge is null or cb.personInCharge = '') then wdr.operator else cb.personInCharge end userName":"", obj.selectTousseType ? ",ci.itemType tousseType" : "",