fix(wms): 解决库存批量更新问题
- 将 updateBatchById 方法替换为单个 updateById 的循环调用 - 添加更新失败时的业务异常处理 - 确保每次更新失败都能抛出 "库存更新失败" 错误信息 - 提高了库存更新操作的可靠性和错误处理能力
This commit is contained in:
parent
94594abdf1
commit
7b31d1cf77
|
|
@ -86,7 +86,9 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
|||
if (CollectionUtil.isNotEmpty(forDelete)) {
|
||||
removeBatchByIds(forDelete);
|
||||
}
|
||||
updateBatchById(dbInventories);
|
||||
dbInventories.forEach(inventory -> {
|
||||
VUtil.trueThrowBusinessError(!updateById(inventory)).throwMessage("库存更新失败");
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
@ -130,7 +132,9 @@ public class WmsInventoryServiceImpl extends ServiceImpl<WmsInventoryMapper, Wms
|
|||
saveBatch(forAdd);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(forUpdate)) {
|
||||
updateBatchById(forUpdate);
|
||||
forUpdate.forEach(inventory -> {
|
||||
VUtil.trueThrowBusinessError(!updateById(inventory)).throwMessage("库存更新失败");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue