Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r17029 -r17041 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 17029) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 17041) @@ -44,6 +44,7 @@ import com.forgon.directory.service.OrgUnitManager; import com.forgon.directory.vo.LoginUserData; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.basedatamanager.toussedefinition.service.TousseInstanceUtils; import com.forgon.disinfectsystem.common.CssdUtils; import com.forgon.disinfectsystem.diposablegoods.service.DiposableGoodsManager; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods; @@ -1312,94 +1313,12 @@ /*计算发货状态*/ - SupplyRoomConfig config = supplyRoomConfigManager.getSystemParamsObj(); - final String invoiceOrigin = config.getInvoiceOrigin(); - final boolean isBorrowTousse = InvoicePlan.TYPE_BORROWINGSINGLE - .equals(invoicePlan.getType()); - List applicationItems = invoicePlan.getApplicationItems(); - // 需发货的物品,包括已终止的 - Collection needSendTousseItems = CollectionUtils - .select(invoicePlan.getApplicationItems(), - new Predicate() { - @Override - public boolean evaluate(TousseItem tousseItem) { - if(BooleanUtils.isTrue(tousseItem.getIsTerminated())) - return false; - int waitDeliverAmount = CssdUtils - .getWaitDeliverAmountForApply(tousseItem, - invoiceOrigin,isBorrowTousse, objectDao); - return (waitDeliverAmount > 0); - } - }); - // 不需要发货的items - Collection notInvoiceTousseItems = CollectionUtils - .select(invoicePlan.getApplicationItems(), - new Predicate() { - @Override - public boolean evaluate(TousseItem tousseItem) { - if(!TousseItemUtils.IsInvoice(tousseItem)){ - return true; - } - return false; - } - }); - Predicate notSendPred = new Predicate() { - @Override - public boolean evaluate(TousseItem vo) { - return (vo.getSendOutAmount() == null || vo.getSendOutAmount() == 0); - } - }; - - Predicate sendedPred = new Predicate() { - @Override - public boolean evaluate(TousseItem vo) { - int sendOutAmount = (vo.getSendOutAmount() != null ? vo.getSendOutAmount() : 0); - int waitDeliverAmount = CssdUtils.getWaitDeliverAmountForApply( - vo, invoiceOrigin, isBorrowTousse, objectDao); - return (sendOutAmount >= waitDeliverAmount); - } - }; - - if(!InvoicePlan.TYPE_APPLYING_FOR_RETURN_FORM.equals(invoicePlan.getType())){ - if(notTerminateTousseItems.isEmpty()){ - // 所有应发货的物品已终止 - if(!InvoicePlan.DELIVERSTATUS_DELIVERED.equals(invoicePlan.getDeliverStatus())){ - invoicePlan.setDeliverStatus(InvoicePlan.STATUS_END); - } - invoicePlan.setOrderByFiled(InvoicePlan.DELIVER_END); - - } else if(needSendTousseItems.isEmpty()){ - // 不存在应发货的物品 - invoicePlan.setDeliverStatus(InvoicePlan.DELIVERSTATUS_DELIVERED); - invoicePlan.setOrderByFiled(InvoicePlan.DELIVER_DELIVERED); - - } else if(CollectionUtils.matchesAll(needSendTousseItems, notSendPred)){ - // 所有应发货的物品,都未发货 - invoicePlan.setDeliverStatus(InvoicePlan.DELIVERSTATUS_AWAITDELIVER); - invoicePlan.setOrderByFiled(InvoicePlan.DELIVER_AWAITDELIVER); - - } else if (CollectionUtils.matchesAll(needSendTousseItems, sendedPred)){ - // 所有应发货的物品,都已发货 - invoicePlan.setDeliverStatus(InvoicePlan.DELIVERSTATUS_DELIVERED); - invoicePlan.setOrderByFiled(InvoicePlan.DELIVER_DELIVERED); - - } else { - // 其余情况都是部分发货 - invoicePlan.setDeliverStatus(InvoicePlan.DELIVERSTATUS_PARTDELIVERED); - invoicePlan.setOrderByFiled(InvoicePlan.DELIVER_PARTDELIVERED); - } - if(applicationItems != null && applicationItems.size() == notInvoiceTousseItems.size()){ - // 都是不需要发货的 - if(InvoicePlan.DELIVERSTATUS_DELIVERED.equals(invoicePlan.getDeliverStatus()) || InvoicePlan.DELIVERSTATUS_AWAITDELIVER.equals(invoicePlan.getDeliverStatus()) || InvoicePlan.DELIVERSTATUS_PARTDELIVERED.equals(invoicePlan.getDeliverStatus())){ - invoicePlan.setDeliverStatus(null); - } - - } - } + computeAndSetInvoiceStatus(invoicePlan); /*计算发货状态*/ - /*计算归还状态*/ + final boolean isBorrowTousse = InvoicePlan.TYPE_BORROWINGSINGLE + .equals(invoicePlan.getType()); if(isBorrowTousse){ this.calculateReturnStatus(invoicePlan); } @@ -1524,13 +1443,14 @@ new Predicate() { @Override public boolean evaluate(TousseItem tousseItem) { + if(!TousseItemUtils.IsInvoice(tousseItem)){ + return false; + } if(BooleanUtils.isTrue(tousseItem.getIsTerminated())) return false; int waitDeliverAmount = CssdUtils - .getWaitDeliverAmount(tousseItem, - invoiceOrigin, - afterRecyclingTousseDeliver, - invoicePlan, objectDao); + .getWaitDeliverAmountForApply(tousseItem, + invoiceOrigin,isBorrowTousse, objectDao); return (waitDeliverAmount > 0); } }); @@ -1557,9 +1477,8 @@ @Override public boolean evaluate(TousseItem vo) { int sendOutAmount = (vo.getSendOutAmount() != null ? vo.getSendOutAmount() : 0); - int waitDeliverAmount = CssdUtils.getWaitDeliverAmount( - vo, invoiceOrigin, - afterRecyclingTousseDeliver, invoicePlan, objectDao); + int waitDeliverAmount = CssdUtils.getWaitDeliverAmountForApply( + vo, invoiceOrigin, isBorrowTousse, objectDao); return (sendOutAmount >= waitDeliverAmount); } }; Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java =================================================================== diff -u -r17029 -r17041 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 17029) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 17041) @@ -2746,7 +2746,8 @@ boolean needInvoice = isNeedInvoiceForRecyclingApplication(application); if(needInvoice){ - application.setDeliverStatus(InvoicePlan.DELIVERSTATUS_AWAITDELIVER); +// application.setDeliverStatus(InvoicePlan.DELIVERSTATUS_AWAITDELIVER); + invoicePlanManager.computeAndSetInvoiceStatus(application); }else{ application.setDeliverStatus(""); } Index: ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/service/PackingManagerImpl.java =================================================================== diff -u -r17029 -r17041 --- ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/service/PackingManagerImpl.java (.../PackingManagerImpl.java) (revision 17029) +++ ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/service/PackingManagerImpl.java (.../PackingManagerImpl.java) (revision 17041) @@ -946,22 +946,22 @@ //是否打印科室及科室名称 obj.put("printOrgSource", td.getPrintOrgSource()); //根据器械包的申请单编号或回收单编号查询出所属申请部门 - String department = null; - if(tousseInstance.getInvoicePlanID() != null){ - InvoicePlan invoicePlan = - (InvoicePlan)objectDao.getByProperty(InvoicePlan.class.getSimpleName(), "id", tousseInstance.getInvoicePlanID()); - if(invoicePlan != null){ - department = invoicePlan.getDepart(); - } - }else if(tousseInstance.getRecyclingRecordId() != null){ - RecyclingRecord recylingRecord = - (RecyclingRecord)objectDao.getByProperty(RecyclingRecord.class.getSimpleName(), "id", tousseInstance.getRecyclingRecordId()); - if(recylingRecord != null){ - department = recylingRecord.getDepart(); - } - }else{ - department = department1; - } + String department = TousseInstanceUtils.getTousseInstanceDepartForPrint(tousseInstance); +// if(tousseInstance.getInvoicePlanID() != null){ +// InvoicePlan invoicePlan = +// (InvoicePlan)objectDao.getByProperty(InvoicePlan.class.getSimpleName(), "id", tousseInstance.getInvoicePlanID()); +// if(invoicePlan != null){ +// department = invoicePlan.getDepart(); +// } +// }else if(tousseInstance.getRecyclingRecordId() != null){ +// RecyclingRecord recylingRecord = +// (RecyclingRecord)objectDao.getByProperty(RecyclingRecord.class.getSimpleName(), "id", tousseInstance.getRecyclingRecordId()); +// if(recylingRecord != null){ +// department = recylingRecord.getDepart(); +// } +// }else{ +// department = department1; +// } if(StringUtils.isNotBlank(department)){ obj.put("department", department); }