修复:限定幂等键精确业务域

This commit is contained in:
焦龙言
2026-07-27 18:54:50 +08:00
parent 4a321098f8
commit b6f3b1e1f0
18 changed files with 730 additions and 135 deletions
@@ -513,10 +513,17 @@ class InboundService:
) -> CrudResponseModel:
try:
warehouse_ids = await cls._warehouse_scope(query_db, current_user)
current = await OperationDao.get_inbound_by_id(
query_db,
inbound_id,
warehouse_ids=warehouse_ids,
)
if current is None:
cls._raise_inbound_not_accessible(current_user)
recovered = await OperationDao.get_inbound_by_confirm_idempotency_key(
query_db,
idempotency_key,
warehouse_ids=warehouse_ids,
warehouse_ids=[current.warehouse_id],
)
if recovered is None:
raise ServiceException(message='确认入库失败,幂等冲突')
@@ -575,7 +582,7 @@ class InboundService:
existing = await OperationDao.get_inbound_by_confirm_idempotency_key(
query_db,
idempotency_key,
warehouse_ids=warehouse_ids,
warehouse_ids=[inbound.warehouse_id],
)
if existing is not None:
await AccessService.assert_warehouse_access(