fix(wms-inventory): 修复库存服务中的集合操作问题

- 将 Stream().toList() 替换为 Collectors.toList() 以确保兼容性
- 在批量删除后从数据库库存列表中移除已删除项,避免后续操作出错
- 保证库存更新逻辑的正确执行顺序
This commit is contained in:
曹鹏飞 2026-06-03 17:29:09 +08:00
parent 4c554b0c4b
commit 8ceb832eaf
1 changed files with 2 additions and 1 deletions

View File

@ -88,7 +88,7 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
}
)
.flatMap(list -> list.stream())
.toList();
.collect(Collectors.toList());
VUtil.trueThrowBusinessError(CollectionUtil.isNotEmpty(errorMaterialNos))
.throwMessage("以下物料库存不足:" + StrUtil.join(",", errorMaterialNos));
List<WmsInventory> forDelete = dbInventories.stream()
@ -96,6 +96,7 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
.toList();
if (CollectionUtil.isNotEmpty(forDelete)) {
removeBatchByIds(forDelete);
dbInventories.removeAll(forDelete);
}
dbInventories.forEach(inventory -> {
VUtil.trueThrowBusinessError(!updateById(inventory)).throwMessage("库存更新失败");