Index: ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java =================================================================== diff -u -r27845 -r27850 --- ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java (.../InvoiceOptimizeManagerImpl.java) (revision 27845) +++ ssts-invoice/src/main/java/com/forgon/disinfectsystem/invoicemanager/service/InvoiceOptimizeManagerImpl.java (.../InvoiceOptimizeManagerImpl.java) (revision 27850) @@ -1250,6 +1250,7 @@ List disposableGoodsBatchIdList = expensiveDisposablegoodsToDisposableGoodsBatchIdMap.values().stream().distinct().collect(Collectors.toList()); if(CollectionUtils.isNotEmpty(disposableGoodsBatchIdList)){ + @SuppressWarnings("unchecked") List batchList = (List)objectDao.getCollection_ForUpdate(DisposableGoodsBatch.class.getSimpleName(), "id", disposableGoodsBatchIdList); @@ -1413,7 +1414,7 @@ dateQueryAdapter.dateAdapter(now) )); if(CollectionUtils.isEmpty(batchList)){ - throw new SystemException("所有一次性物品的未失效的批次都找没找到"); + throw new SystemException("所有一次性物品的未失效的批次都未找到"); } //判断一次性物品批次的标识表数量是否够发货数量(然后用内存排序方式对标识号按其批次的失效期先后排序) @@ -3086,7 +3087,7 @@ Integer sendAmount = tdIdToSendAmountMap.get(tdId); tdIdToSendAmountMapFromTousseItem.put(tdId , MathTools.add(tdIdToSendAmountMapFromTousseItem.get(tdId), sendAmount).intValue()); - int tiSize = CollectionUtils.size(tiList);int a = Integer.MAX_VALUE; + int tiSize = CollectionUtils.size(tiList); if(tiSize < sendAmount.intValue()){ throw new SystemException( String.format("%s发货数量为%s,符合发货条件的包数量为%s,库存不足(可能部分包实例被其它用户发货或废弃),发货失败", @@ -3446,7 +3447,7 @@ Integer matchAmount = allMatchTdIdToAmountMap.get(key); if(matchAmount == null || matchAmount.intValue() < value.intValue()){ throw new SystemException(String.format("条码为%s的%s应发数量为%s,实际可发数据为%s,小于应发数量.可能有申请单被其它用户发货或终止,请调小其发货数量", - tdIdToSendBarcodeParam.get(key),tdIdToTdMapParam.get(key), + tdIdToSendBarcodeParam.get(key),tdIdToTdMapParam.get(key).getName(), value,matchAmount)); } } @@ -4039,14 +4040,19 @@ * 1.2终止状态不为已终止(固定写上,不受任何参数控制) * 1.3申请单类型:受invoiceTypeList参数控制 * 1.4发货状态为"待发货"或"部分发货"(固定写上,不受任何参数控制) - * 1.5回收状态:受invoiceOrigin,afterRecyclingTousseDeliver,existsNeedRecycleTousse参数控制 + * 1.5回收状态:受invoiceOrigin,afterRecyclingTousseDeliver,existsNeedRecycleTousse参数控制,暂时不用了 * 1.6打印状态:受hideUnprintedDisposableGoodsInvoicePlan参数影响,如果单类型是一次性物品申请,则打印状态不为已打印的不显示 + * 1.7.借物单审核状态(只能为null或不为未审核,前提是有包含借物单的话) */ String departCodingCondition = String.format("invoicePlan.%s='%s'",InvoiceUtils.getInvoiceGroupByConfig(),departCoding); //单类型过滤条件 String typeCondition = "1=1"; //打印状态过滤条件(仅适合一次性物品申请单) String printedCondition = "1=1"; + //发货状态过滤条件(仅适合一次性物品申请单) + String deliverStatusCondition = + SqlUtils.getStringFieldInLargeCollectionsPredicate("invoicePlan.deliverStatus", + Arrays.asList(InvoicePlan.DELIVERSTATUS_AWAITDELIVER,InvoicePlan.DELIVERSTATUS_PARTDELIVERED)); //回收状态过滤条件 String recyclingStatusCondition = "1=1"; //如果发货数量依据为回收单且为回收后发货且都为要回收的物品时 @@ -4101,10 +4107,19 @@ } } - + /* + * 条件如下: + * 1.过滤的科室编码:(申请或结算科室编码,默认为申请科室编码,以配置为准)为该科室,受invoiceGroupByConfig和departCoding参数控制 + * 2.终止状态不为已终止(固定写上,不受任何参数控制) + * 3.申请单类型:受invoiceTypeList参数控制 + * 4.发货状态为"待发货"或"部分发货"(固定写上,不受任何参数控制) + * 5.回收状态:受invoiceOrigin,afterRecyclingTousseDeliver,existsNeedRecycleTousse参数控制,暂不用了 + * 6.打印状态:受hideUnprintedDisposableGoodsInvoicePlan参数影响,如果单类型是一次性物品申请,则打印状态不为已打印的不显示 + * 7.借物单审核状态(只能为null或不为未审核) + */ String invoicePlanCondition = String.format(" %s and (invoicePlan.endStatus is null or invoicePlan.endStatus <> '%s') " - + "and %s and %s and %s and %s", departCodingCondition,InvoicePlan.STATUS_END, - typeCondition,recyclingStatusCondition,printedCondition,borrowConfirmStatusCondition + + "and %s and %s and %s and %s and %s", departCodingCondition,InvoicePlan.STATUS_END, + typeCondition,deliverStatusCondition,recyclingStatusCondition,printedCondition,borrowConfirmStatusCondition ); if(DatabaseUtil.isPoIdValid(invoicePlanId)){ invoicePlanCondition = String.format("invoicePlan.id=%s",invoicePlanId);