Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r16316 -r16332 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 16316) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 16332) @@ -951,16 +951,25 @@ break; } } + String amountSql; + SupplyRoomConfig supplyRoomConfig = supplyRoomConfigManager.getSystemParamsObj(); + if(supplyRoomConfig.invoiceOriginRecycling()){ + //发货数量依据回收单 + amountSql = "(recyclingAmount - sendOutAmount) > 0"; + }else{ + amountSql = "(amount - sendOutAmount) > 0"; + } + if(!tousseTypeSet.isEmpty()){ // 新的传参方式 - where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and ((po.type = '"+InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION+"' and (recyclingAmount - sendOutAmount) > 0) or (po.type <> '"+InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION+"' and (amount - sendOutAmount) > 0)) and %s)",SqlUtils.getStringFieldInCollectionsPredicate("tousseType", tousseTypeSet)); + where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and (%s) and %s)",amountSql,SqlUtils.getStringFieldInCollectionsPredicate("tousseType", tousseTypeSet)); }else if(TousseItem.DIPOSABLE_YES.equals(tousseType) || TousseItem.TYPE_DIPOSABLE_GOODS.equals(tousseType)){ where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and (amount - sendOutAmount > 0) and tousseType = '%s')",TousseItem.TYPE_DIPOSABLE_GOODS); }else if(TousseItem.DIPOSABLE_NO.equals(tousseType)){ - where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and ((po.type = '"+InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION+"' and (recyclingAmount - sendOutAmount) > 0) or (po.type <> '"+InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION+"' and (amount - sendOutAmount) > 0)) and tousseType != '%s')",TousseItem.TYPE_DIPOSABLE_GOODS); + where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and (%s) and tousseType != '%s')",amountSql,TousseItem.TYPE_DIPOSABLE_GOODS); }else{ //具体的器械包类型 - where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and ((po.type = '"+InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION+"' and (recyclingAmount - sendOutAmount) > 0) or (po.type <> '"+InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION+"' and (amount - sendOutAmount) > 0)) and tousseType = '%s')",tousseType); + where8 = String.format("po.id in (select invoicePlan.id from TousseItem where (isTerminated is null or isTerminated <> true) and (%s) and tousseType = '%s')",amountSql,tousseType); } }