Index: ssts-receiverecord/src/main/java/com/forgon/disinfectsystem/receiverecord/service/ReceiveRecordManagerImpl.java =================================================================== diff -u -r13124 -r13140 --- ssts-receiverecord/src/main/java/com/forgon/disinfectsystem/receiverecord/service/ReceiveRecordManagerImpl.java (.../ReceiveRecordManagerImpl.java) (revision 13124) +++ ssts-receiverecord/src/main/java/com/forgon/disinfectsystem/receiverecord/service/ReceiveRecordManagerImpl.java (.../ReceiveRecordManagerImpl.java) (revision 13140) @@ -515,13 +515,20 @@ if (StringUtils.isBlank(diposableGoodsIDsStr)) { return; } - String diposableGoodsIDsSql = String.format(" where po.id in (%s) ", + String diposableGoodsIDsSql = String.format(" where po.disposableGoodsID in (%s) ", diposableGoodsIDsStr); List allDiposableGoods = diposableGoodsManager .getDiposableGoodsBySql_ForUpdate(diposableGoodsIDsSql); - if (allDiposableGoods == null - || allDiposableGoods.size() != diposableGoodsIDsSet.size()) { - throw new RuntimeException("某些物品已被删除!"); + if (CollectionUtils.isNotEmpty(allDiposableGoods)) { + Set stockIdSet = new HashSet(); + for(DisposableGoodsStock stock : allDiposableGoods){ + stockIdSet.add(stock.getDisposableGoodsID()); + } + if(stockIdSet.size() != diposableGoodsIDsSet.size()){ + throw new RuntimeException("某些物品已被删除!"); + } + }else{ + throw new RuntimeException("物品已被删除!"); } for (DisposableGoodsStock diposableGoods : allDiposableGoods) { idToDiposableGoodsMap.put(diposableGoods.getDisposableGoodsID(), diposableGoods); @@ -538,7 +545,15 @@ batchStockSql); } - if (batchStocks == null || batchStocks.size() != batchIdsSet.size()) { + if (CollectionUtils.isNotEmpty(batchStocks)) { + Set stockIdSet = new HashSet(); + for(DisposableGoodsBatchStock stock : batchStocks){ + stockIdSet.add(stock.getDisposableGoodsBatchID()); + } + if(stockIdSet.size() != batchIdsSet.size()){ + throw new RuntimeException("某些批次物品已被删除!"); + } + }else{ throw new RuntimeException("某些批次已被删除!"); } if (batchStocks != null) {