Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java =================================================================== diff -u -r17431 -r17452 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 17431) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/RecyclingApplicationManagerImpl.java (.../RecyclingApplicationManagerImpl.java) (revision 17452) @@ -1015,7 +1015,7 @@ if (remark != null) { recyclingApplication.setRemark(remark); } - createApplicationItems(recyclingApplication, tousseNameAndAmount); + createApplicationItems(recyclingApplication, tousseNameAndAmount , null , 0 , null); setApplicationStatus(recyclingApplication, tousseNameAndAmount); // 备注里面增加普通器械包的数量 RecyclingApplicationUtils.appendTousseAmountRemark(recyclingApplication); @@ -1140,10 +1140,16 @@ * * @param recyclingApplication * @param tousseNameAndAmount + * @param newDiposableGoodMap + * @param dpf + * @param applyUrgentTousseMap */ private void createApplicationItems( RecyclingApplication recyclingApplication, - Map tousseNameAndAmount) { + Map tousseNameAndAmount, + Map newDiposableGoodMap, + double dpf, + Map applyUrgentTousseMap) { List applicationItems = new ArrayList(); for (Entry entry : tousseNameAndAmount.entrySet()) { @@ -1179,6 +1185,41 @@ } applicationItems.add(tousseItem); } + + List items = recyclingApplication.getApplicationItems(); + if(items == null){ + items = new ArrayList(); + } + //调用方法前一定要判空 + if(applyUrgentTousseMap != null && CollectionUtils.isNotEmpty(items)){ + updateUrgentAmount(applyUrgentTousseMap, items); + } + //如果一次性物品map不为空,遍历按处理科室拆分后的一次性物品map + if(newDiposableGoodMap.size()>0){ + for (Entry entry : newDiposableGoodMap.entrySet()) { + TousseItem tousseItem = new TousseItem(); + String dgName = entry.getKey(); + tousseItem.setTousseName(dgName); + tousseItem.setAmount(0); + tousseItem.setEditAmount(entry.getValue()); + tousseItem.setInvoicePlan(recyclingApplication); + tousseItem.setDiposable(TousseItem.DIPOSABLE_YES); + tousseItem.setTousseType(TousseItem.TYPE_DIPOSABLE_GOODS); + String name = CssdUtils.getGoodsNameAndSp(dgName).optString("materialName"); ; + String sp = CssdUtils.getGoodsNameAndSp(dgName).optString("specification"); + DisposableGoods disposableGoods = diposableGoodsManager.getDisposableGoodsByName(name, sp); + if(disposableGoods != null){ + tousseItem.setDisposableGoodsId(disposableGoods.getId()); + Double price = disposableGoods.getReferencePrice(); + price = MathTools.mul(price, dpf).doubleValue(); + Double rowPrice = MathTools.mul(price, + tousseItem.getEditAmount()).doubleValue(); + tousseItem.setPrice(price); + tousseItem.setRowPrice(rowPrice); + } + applicationItems.add(tousseItem); + } + } recyclingApplication.setApplicationItems(applicationItems); } @@ -3595,47 +3636,13 @@ recyclingApplication.setRemark(remark); } //必须先设置申请项,再计算单的状态 - createApplicationItems(recyclingApplication, newTousseNameAndAmountMap); + createApplicationItems(recyclingApplication, newTousseNameAndAmountMap , newDiposableGoodMap , dpf ,applyUrgentTousseMap); //设置申请单状态这一句一定要放在设置申请项之后 setApplicationStatus(recyclingApplication, newTousseNameAndAmountMap); setInstanceCodesToApplication(tousseInstanceMap, recyclingApplication); // 备注里面增加普通器械包的数量 RecyclingApplicationUtils.appendTousseAmountRemark(recyclingApplication); - List items = recyclingApplication.getApplicationItems(); - if(items == null){ - items = new ArrayList(); - recyclingApplication.setApplicationItems(items); - } - //调用方法前一定要判空 - if(applyUrgentTousseMap != null && CollectionUtils.isNotEmpty(items)){ - updateUrgentAmount(applyUrgentTousseMap, items); - } - //遍历按处理科室拆分后的一次性物品map - if(newDiposableGoodMap.size()>0){ - for (Entry entry : newDiposableGoodMap.entrySet()) { - TousseItem tousseItem = new TousseItem(); - String dgName = entry.getKey(); - tousseItem.setTousseName(dgName); - tousseItem.setAmount(0); - tousseItem.setEditAmount(entry.getValue()); - tousseItem.setInvoicePlan(recyclingApplication); - tousseItem.setDiposable(TousseItem.DIPOSABLE_YES); - tousseItem.setTousseType(TousseItem.TYPE_DIPOSABLE_GOODS); - String name = CssdUtils.getGoodsNameAndSp(dgName).optString("materialName"); ; - String sp = CssdUtils.getGoodsNameAndSp(dgName).optString("specification"); - DisposableGoods disposableGoods = diposableGoodsManager.getDisposableGoodsByName(name, sp); - if(disposableGoods != null){ - tousseItem.setDisposableGoodsId(disposableGoods.getId()); - Double price = disposableGoods.getReferencePrice(); - price = MathTools.mul(price, dpf).doubleValue(); - Double rowPrice = MathTools.mul(price, - tousseItem.getEditAmount()).doubleValue(); - tousseItem.setPrice(price); - tousseItem.setRowPrice(rowPrice); - } - items.add(tousseItem); - } - } + saveOrUpdateRecyclingApplication(recyclingApplication,true); list.add(recyclingApplication); }