Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanOptimizeManagerImpl.java =================================================================== diff -u -r31698 -r31705 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanOptimizeManagerImpl.java (.../InvoicePlanOptimizeManagerImpl.java) (revision 31698) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanOptimizeManagerImpl.java (.../InvoicePlanOptimizeManagerImpl.java) (revision 31705) @@ -412,8 +412,6 @@ }if(StringUtils.equals(SupplyRoomConfig.TOUSSEDELIVEROCCASION_AFTERRECYCLING, config.getTousseDeliverOccasion()) ){ tousseItemWaitSendAmountSumSql = "(recyclingAmount - sendOutAmount)"; } - - //先查未装配生成包实例的申请单 String queryTousseItemSql = String.format( "select "+ invoicePlanTableAlias +".id invoicePlanId," + invoicePlanTableAlias +".departCoding," @@ -427,8 +425,24 @@ + "join %s "+ invoicePlanTableAlias +" on "+ tousseItemTableAlias +".recyclingApplication_ID="+ invoicePlanTableAlias +".id " + "where %s and %s and " + tousseItemWaitSendAmountSumSql +" > 0 ", TousseItem.class.getSimpleName() , InvoicePlan.class.getSimpleName(), + tousseItemCondition,invoicePlanForeignTousseCondition); + + //先查未装配生成包实例的申请单(先不管包实例装没装配了,注释掉下面的内容) + /*String queryTousseItemSql = String.format( + "select "+ invoicePlanTableAlias +".id invoicePlanId," + + invoicePlanTableAlias +".departCoding," + + tousseItemTableAlias +".id tousseItemId," + + tousseItemTableAlias +".tousseName," + + tousseItemTableAlias +".tousseType," + + tousseItemTableAlias +".diposable," + + invoicePlanTableAlias +".applicationTime," + + tousseItemWaitSendAmountSumSql +" amount " + + "from %s "+ tousseItemTableAlias +" " + + "join %s "+ invoicePlanTableAlias +" on "+ tousseItemTableAlias +".recyclingApplication_ID="+ invoicePlanTableAlias +".id " + + "where %s and %s and " + tousseItemWaitSendAmountSumSql +" > 0 ", + TousseItem.class.getSimpleName() , InvoicePlan.class.getSimpleName(), tousseItemCondition,String.format("%s and %s", invoicePlanForeignTousseCondition, - String.format(invoicePlanTableAlias +".id not in (select foreignTousseApp_id from %s where foreignTousseApp_id is not null)",TousseInstance.class.getSimpleName()))); + String.format(invoicePlanTableAlias +".id not in (select foreignTousseApp_id from %s where foreignTousseApp_id is not null)",TousseInstance.class.getSimpleName())));*/ //再查已经装配生成包实例的申请单。由于后面括号里这个问题要求不再把包实例的状态列进条件里,所以不再使用此条件(SZSDSRMYY-46 添加外来器械申请单后,要根据科室供应室设置里的器械包发货时间来决定该发货计划的显示) /*queryTousseItemSql += String.format(" union all " @@ -467,7 +481,7 @@ CssdUtils.buildTousseItemShouldDeliverAmountSql(invoicePlanTableAlias, tousseItemTableAlias, invoiceOrigin, tousseDeliverOccasion); - //先查未装配生成包实例的申请单 + //查询申请项 String queryTousseItemSql = String.format("select "+ invoicePlanTableAlias +".id invoicePlanId," + invoicePlanTableAlias +".departCoding," + invoicePlanTableAlias +".type invoicePlanType," @@ -1441,7 +1455,6 @@ tousseItemWaitSendAmountSumSql = "(recyclingAmount - sendOutAmount)"; } - //先查未装配生成包实例的申请单 String queryTousseItemSql = String.format( "select "+ invoicePlanTableAlias +".id invoicePlanId," + tousseItemTableAlias +".id tousseItemId," @@ -1456,8 +1469,24 @@ + "left join %s ul on "+ tousseItemTableAlias +".urgentLevel_id=ul.id " + "where %s and %s and " + tousseItemWaitSendAmountSumSql +" > 0 ", TousseItem.class.getSimpleName() , InvoicePlan.class.getSimpleName(), UrgentLevel.class.getSimpleName() , + tousseItemCondition,invoicePlanForeignTousseCondition); + //先查未装配生成包实例的申请单(先不管包实例装没装配了,注释掉下面的内容) + /*String queryTousseItemSql = String.format( + "select "+ invoicePlanTableAlias +".id invoicePlanId," + + tousseItemTableAlias +".id tousseItemId," + + tousseItemTableAlias +".tousseName," + + tousseItemTableAlias +".tousseType," + + tousseItemTableAlias +".diposable,ul.grade," + + invoicePlanTableAlias +".applicationTime," + + tousseItemWaitSendAmountSumSql +" amount," + + "(case when ("+ tousseItemTableAlias +".urgentAmount is null or "+ tousseItemTableAlias +".urgentAmount <= "+ tousseItemTableAlias +".sendoutAmount) then 0 else ("+ tousseItemTableAlias +".urgentAmount - "+ tousseItemTableAlias +".sendoutAmount) end) urgentAmount " + + "from %s "+ tousseItemTableAlias +" " + + "join %s "+ invoicePlanTableAlias +" on "+ tousseItemTableAlias +".recyclingApplication_ID="+ invoicePlanTableAlias +".id " + + "left join %s ul on "+ tousseItemTableAlias +".urgentLevel_id=ul.id " + + "where %s and %s and " + tousseItemWaitSendAmountSumSql +" > 0 ", + TousseItem.class.getSimpleName() , InvoicePlan.class.getSimpleName(), UrgentLevel.class.getSimpleName() , tousseItemCondition,String.format("%s and %s", invoicePlanForeignTousseCondition, - String.format(invoicePlanTableAlias +".id not in (select foreignTousseApp_id from %s where foreignTousseApp_id is not null)",TousseInstance.class.getSimpleName()))); + String.format(invoicePlanTableAlias +".id not in (select foreignTousseApp_id from %s where foreignTousseApp_id is not null)",TousseInstance.class.getSimpleName())));*/ //再查已经装配生成包实例的申请单。由于后面括号里这个问题要求不再把包实例的状态列进条件里,所以不再使用此条件(SZSDSRMYY-46 添加外来器械申请单后,要根据科室供应室设置里的器械包发货时间来决定该发货计划的显示) /*queryTousseItemSql += String.format(" union all " @@ -1503,7 +1532,7 @@ CssdUtils.buildTousseItemShouldDeliverAmountSql(invoicePlanTableAlias, tousseItemTableAlias, invoiceOrigin, tousseDeliverOccasion); - //先查未装配生成包实例的申请单 + //查询申请项 String queryTousseItemSql = String.format("select "+ invoicePlanTableAlias +".id invoicePlanId," + invoicePlanTableAlias +".type invoicePlanType," + tousseItemTableAlias +".tousseName,"