Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/RealTimeBulletinBoardWorkloadHelper.java =================================================================== diff -u -r38787 -r38790 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/RealTimeBulletinBoardWorkloadHelper.java (.../RealTimeBulletinBoardWorkloadHelper.java) (revision 38787) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/RealTimeBulletinBoardWorkloadHelper.java (.../RealTimeBulletinBoardWorkloadHelper.java) (revision 38790) @@ -1581,13 +1581,22 @@ String handleDepartCoding = supplyRoomConfigManager.getFirstSupplyRoomConfig().getOrgUnitCoding(); String invocieUrgentAmountSql = "select ti.tousseName,sum(ti.urgentAmount) tiUrgentAmount" - + ", sum(case when ti.recyclingAmount is null then ti.urgentAmount " + //不回收的物品 需扣除装配数量 + + ", sum(case when t.amount>0 and ti.urgentAmount<=t.amount then 0 " + + "when t.amount>0 and ti.urgentAmount>t.amount then ti.urgentAmount-t.amount " + + "when ti.recyclingAmount is null then ti.urgentAmount " + "when ti.urgentAmount<=ti.recyclingAmount then 0 else ti.urgentAmount - ti.recyclingAmount end) notRecycledUrgentAmount " + ",sum(ti.sendOutAmount) invoiceAmount from " + TousseItem.class.getSimpleName() +" ti join " + + TousseDefinition.class.getSimpleName() + +" td on td.id=ti.tousseDefinitionId join " + InvoicePlan.class.getSimpleName() - +" ip on ip.id=ti.recyclingApplication_ID where ip.urgent='是' and ip.applicationTime " + +" ip on ip.id=ti.recyclingApplication_ID " + +" left join (select tic.invoicePlanId,tic.tousseDefinition_id,count(*) amount from " + + TousseInstance.class.getSimpleName() + + " tic group by tic.invoicePlanId,tic.tousseDefinition_id) t on td.isRecycling='否' and t.invoicePlanId=ip.id and t.tousseDefinition_id=td.id " + + " where ip.urgent='是' and ip.applicationTime " + betweenSql + "and ip.handleDepartCoding = '" + handleDepartCoding @@ -1628,10 +1637,10 @@ + " rr on rr.id=ri.recyclingRecord_id join " + InvoicePlan.class.getSimpleName() + " ip on ip.id=rr.recyclingApplication_id " - + " left join (select ti.sourceRecyclingItemId,count(*) amount from " - + TousseInstance.class.getSimpleName() - +" ti where ti.operationTime is not null " - + "group by ti.sourceRecyclingItemId) t on t.sourceRecyclingItemId=ri.id " + + " left join (select ti.tousseDefinition_id,ti.recyclingRecordId, count(*) amount from " + +TousseInstance.class.getSimpleName() + +" ti where ti.operationTime is not null group by ti.tousseDefinition_id,ti.recyclingRecordId) t " + + " on t.tousseDefinition_id=ri.tousseDefinitionId and t.recyclingRecordId=rr.id " + "where rr.recyclingTimes is null and ri.urgentAmount>0 and (ri.urgentAmount>t.amount or t.amount is null) " + "and ip.applicationTime " + betweenSql