Index: ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/inventorymanagement/service/WriteBackInventoryManagerImpl.java =================================================================== diff -u -r13710 -r14396 --- ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/inventorymanagement/service/WriteBackInventoryManagerImpl.java (.../WriteBackInventoryManagerImpl.java) (revision 13710) +++ ssts-datasync-default-impl/src/main/java/com/forgon/disinfectsystem/inventorymanagement/service/WriteBackInventoryManagerImpl.java (.../WriteBackInventoryManagerImpl.java) (revision 14396) @@ -93,6 +93,7 @@ "id", invoiceId); if(invoice == null) return null; + String errMsg = null; try { // 若以前已经回写过,则先删除原先已回写的记录 Long existWriteBackEntryId = invoice @@ -135,17 +136,20 @@ if(writeBackDiposableGoods){ for (DiposableGoodsItem di : invoice.getDiposableGoodsItems()) { BarcodeDevice bd = barcodeManager.getBarcodeByBarcode(di.getBarcode()); - if(bd == null || !(bd instanceof DisposableGoodsBatch)) - continue; + if(bd == null || !(bd instanceof DisposableGoodsBatch)){ + throw new RuntimeException(String.format("未找到条码为%s的批次!", di.getBarcode())); + } + DisposableGoodsBatch disposableGoodsBatch = (DisposableGoodsBatch)bd; DisposableGoods dg = disposableGoodsBatch.getDiposableGoods(); String inventorySerialNumber = dg .getInventorySerialNumber(); if (StringUtils.isEmpty(inventorySerialNumber)) { - logger.error(String.format( + errMsg = String.format( "发货单回写物资系统时找不到匹配物品,名称:%s,规格:%s", - dg.getName(), dg.getSpecification())); - continue; + dg.getName(), dg.getSpecification()); + logger.error(errMsg); + throw new RuntimeException(errMsg); } String key = inventorySerialNumber + "_" +disposableGoodsBatch.getBatchNumber() + "_" + di.getPrice(); WriteBackEntryItem item = itemsMap.get(key);