Index: ssts-userecord/src/main/java/com/forgon/disinfectsystem/useRecord/service/UseRecordManagerImpl.java =================================================================== diff -u -r25307 -r25314 --- ssts-userecord/src/main/java/com/forgon/disinfectsystem/useRecord/service/UseRecordManagerImpl.java (.../UseRecordManagerImpl.java) (revision 25307) +++ ssts-userecord/src/main/java/com/forgon/disinfectsystem/useRecord/service/UseRecordManagerImpl.java (.../UseRecordManagerImpl.java) (revision 25314) @@ -653,8 +653,6 @@ objectDao.excuteSQL(String.format("update %s set useAmount=useAmount - %s where id=%s", DiposableGoodsItem.class.getSimpleName() , useAmount, id)); - // 增加发货时的目标标识库存 - //addTargetWarehouseAmount((DiposableGoodsItem)objectDao.getById(DiposableGoodsItem.class.getSimpleName(), id), useAmount); updateDisposableStockAmount(orgUnitCoding, id , useAmount); } objectDao.excuteSQL(String.format("delete from %s where useDiposableGoodsItemId=%s" , @@ -6839,29 +6837,6 @@ sendOutDiposableGoodsItemAmountMap.put(sendOutDiposableGoodsItem, curAmountCanUse); } - // 一次性物品库存修改 - /*String identificationIDStr = sendOutDiposableGoodsItem.getIdentificationID().toString(); - DisposableGoodsIdentification identification = - (DisposableGoodsIdentification)objectDao.getByProperty(DisposableGoodsIdentification.class.getSimpleName(), "id", Long.valueOf(identificationIDStr)); - if(identification == null){ - throw new RuntimeException("标识号已被删除!"); - } - - Long amountChange = curAmountCanUse; - diposableGoodsManager.adjustAmount(identification, amountChange); - - // 减少发货时的目标标识库存 - addTargetWarehouseAmount(sendOutDiposableGoodsItem, -amountChange); - objectDao.update(identification); - objectDao.update(identification.getBatchStock()); - objectDao.update(identification.getBatchStock().getDiposableGoods()); - - DisposableGoodsStorageAdjustVo vo = new DisposableGoodsStorageAdjustVo(); - vo.setDisposableGoodsIdentificationId(identification.getId()); - vo.setAdjustAmount(amountChange); - result.add(vo);*/ - - amountToUse -= curAmountCanUse; if(amountToUse <= 0){// 待使用数量已经等于0,使用完成 break; @@ -6948,35 +6923,11 @@ Long curAmountCanUse = Math.min(sendOutItemAmountCanUse, amountToUse);// 当前可使用数量 sendOutDiposableGoodsItem.setUseAmount(useAmount + curAmountCanUse);// 设置发货明细的已使用数量 - Long amountChange = curAmountCanUse; - // 一次性物品库存修改 - /*@SuppressWarnings("unchecked") - List identificationList = - objectDao.findBySql(DisposableGoodsIdentification.class.getSimpleName(), - " where warehouseID in (select id from "+ WareHouse.class.getSimpleName() +" where orgUnitCode = '"+ useRecord.getDepartCoding() +"') and amount > 0 order by id desc"); - if(CollectionUtils.isNotEmpty(identificationList)){ - for (DisposableGoodsIdentification identification : identificationList) { - - Long currentAmount = identification.getAmount(); - if(currentAmount >= amountChange){ - - } - // 减少发货时的目标标识库存 - addTargetWarehouseAmount(sendOutDiposableGoodsItem, -amountChange); - objectDao.update(identification); - objectDao.update(identification.getBatchStock()); - objectDao.update(identification.getBatchStock().getDiposableGoods()); - - DisposableGoodsStorageAdjustVo vo = new DisposableGoodsStorageAdjustVo(); - vo.setDisposableGoodsIdentificationId(identification.getId()); - vo.setAdjustAmount(amountChange); - result.add(vo); - } - }else{ - // 减少发货时的目标标识库存 - addTargetWarehouseAmount(sendOutDiposableGoodsItem, -amountChange); - }*/ + objectDao.update(sendOutDiposableGoodsItem); + //录入使用记录后调整库存 + updateDisposableStockAmount(useRecord.getDepartCoding(),sendOutDiposableGoodsItem.getId() , curAmountCanUse * -1); + //可录入使用记录的发货项id Long sendOutDiposableGoodsItemID = sendOutDiposableGoodsItem.getId(); if(sendOutDiposableGoodsItemAmountMap.containsKey(sendOutDiposableGoodsItemID)){ @@ -6985,8 +6936,6 @@ sendOutDiposableGoodsItemAmountMap.put(sendOutDiposableGoodsItem, curAmountCanUse); } - objectDao.update(sendOutDiposableGoodsItem); - amountToUse -= curAmountCanUse; if(amountToUse <= 0){// 待使用数量已经等于0,使用完成 break; @@ -7097,26 +7046,6 @@ sendOutDiposableGoodsItemAmountMap.put(sendOutDiposableGoodsItem, curAmountCanUse); } - // 一次性物品库存修改 - /*String identificationIDStr = sendOutDiposableGoodsItem.getIdentificationID().toString(); - DisposableGoodsIdentification identification = - (DisposableGoodsIdentification)objectDao.getByProperty(DisposableGoodsIdentification.class.getSimpleName(), "id", Long.valueOf(identificationIDStr)); - if(identification == null){ - throw new RuntimeException("标识号已被删除!"); - } - Long amountChange = curAmountCanUse; - diposableGoodsManager.adjustAmount(identification, amountChange); - - // 减少发货时的目标标识库存 - addTargetWarehouseAmount(sendOutDiposableGoodsItem, -amountChange); - objectDao.update(identification); - objectDao.update(identification.getBatchStock()); - objectDao.update(identification.getBatchStock().getDiposableGoods());*/ - - /*DisposableGoodsStorageAdjustVo vo = new DisposableGoodsStorageAdjustVo(); - vo.setDisposableGoodsIdentificationId(identification.getId()); - vo.setAdjustAmount(amountChange); - result.add(vo);*/ //修改临床科室该条标识记录的库存数量 updateDisposableStockAmount(useRecord.getDepartCoding(), sendOutDiposableGoodsItem.getId() , -1 * curAmountCanUse); objectDao.update(sendOutDiposableGoodsItem); @@ -7329,28 +7258,6 @@ //修改临床科室该条标识记录的库存数量 updateDisposableStockAmount(useRecord.getDepartCoding(),sendOutDiposableGoodsItem.getId() , -1 * curAmountCanUse); - - // 一次性物品库存修改 - /*String identificationIDStr = sendOutDiposableGoodsItem.getIdentificationID().toString(); - DisposableGoodsIdentification identification = - (DisposableGoodsIdentification)objectDao.getByProperty(DisposableGoodsIdentification.class.getSimpleName(), "id", Long.valueOf(identificationIDStr)); - if(identification == null){ - throw new RuntimeException("标识号已被删除!"); - } - - Long amountChange = curAmountCanUse; - diposableGoodsManager.adjustAmount(identification, amountChange); - - // 减少发货时的目标标识库存 - addTargetWarehouseAmount(sendOutDiposableGoodsItem, -amountChange); - objectDao.update(identification); - objectDao.update(identification.getBatchStock()); - objectDao.update(identification.getBatchStock().getDiposableGoods()); - - DisposableGoodsStorageAdjustVo vo = new DisposableGoodsStorageAdjustVo(); - vo.setDisposableGoodsIdentificationId(identification.getId()); - vo.setAdjustAmount(amountChange); - result.add(vo);*/ //可录入使用记录的发货项id Long sendOutDiposableGoodsItemID = sendOutDiposableGoodsItem.getId();