完善仓储客户上下文解析(未传客户查全部),并补充库位与确认收货权限种子。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-07-14 11:12:41 +08:00
parent c36bdb237c
commit 7e90112cbf
2 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,5 @@
-- 仓储模块 + 店铺授权/订单 RBAC 权限(幂等) -- ???? + ????/?? RBAC ??????
-- RBAC 库执行;执行后用户需重新登录或刷新权限缓存 -- RBAC ?????????????????????
SET @ADMIN_USER_ID = ( SET @ADMIN_USER_ID = (
SELECT `Id` FROM `user` SELECT `Id` FROM `user`
@ -20,11 +20,14 @@ CROSS JOIN (
SELECT 'Warehouse.Sku.Delete' UNION ALL SELECT 'Warehouse.Sku.Delete' UNION ALL
SELECT 'Warehouse.Inventory.Query' UNION ALL SELECT 'Warehouse.Inventory.Query' UNION ALL
SELECT 'Warehouse.Inventory.Relocate' UNION ALL SELECT 'Warehouse.Inventory.Relocate' UNION ALL
SELECT 'Warehouse.BinLocation.Query' UNION ALL
SELECT 'Warehouse.BinLocation.Save' UNION ALL
SELECT 'Warehouse.Parcel.Query' UNION ALL SELECT 'Warehouse.Parcel.Query' UNION ALL
SELECT 'Warehouse.Parcel.Save' UNION ALL SELECT 'Warehouse.Parcel.Save' UNION ALL
SELECT 'Warehouse.Parcel.Delete' UNION ALL SELECT 'Warehouse.Parcel.Delete' UNION ALL
SELECT 'Warehouse.InboundNotice.Query' UNION ALL SELECT 'Warehouse.InboundNotice.Query' UNION ALL
SELECT 'Warehouse.InboundNotice.Save' UNION ALL SELECT 'Warehouse.InboundNotice.Save' UNION ALL
SELECT 'Warehouse.InboundNotice.ConfirmReceive' UNION ALL
SELECT 'Warehouse.InboundNotice.Delete' UNION ALL SELECT 'Warehouse.InboundNotice.Delete' UNION ALL
SELECT 'Order.PlatformStore.Query' UNION ALL SELECT 'Order.PlatformStore.Query' UNION ALL
SELECT 'Order.PlatformStore.Save' UNION ALL SELECT 'Order.PlatformStore.Save' UNION ALL

View File

@ -10,16 +10,22 @@ namespace Oms.Application.Shared;
public static class WarehouseCustomerHelper public static class WarehouseCustomerHelper
{ {
/// <summary> /// <summary>
/// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传 customerId 时返回 null(查询全部)。 /// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传或传入 ≤0 时返回 null(查询全部)。
/// </summary> /// </summary>
public static Task<int?> ResolveListCustomerIdAsync( public static async Task<int?> ResolveListCustomerIdAsync(
ICustomerRepository customerRepository, ICustomerRepository customerRepository,
ICurrentUser currentUser, ICurrentUser currentUser,
int? requestedCustomerId = null) => int? requestedCustomerId = null)
OmsSessionHelper.ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId); {
var normalizedRequest = requestedCustomerId is > 0 ? requestedCustomerId : null;
return await OmsSessionHelper.ResolveListCustomerIdAsync(
customerRepository,
currentUser,
normalizedRequest);
}
/// <summary> /// <summary>
/// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传 customerId。 /// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传有效 customerId(>0)。
/// </summary> /// </summary>
public static async Task<int> ResolveRequiredCustomerIdAsync( public static async Task<int> ResolveRequiredCustomerIdAsync(
ICustomerRepository customerRepository, ICustomerRepository customerRepository,
@ -27,7 +33,7 @@ public static class WarehouseCustomerHelper
int? requestedCustomerId = null) int? requestedCustomerId = null)
{ {
var customerId = await ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId); var customerId = await ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId);
if (!customerId.HasValue) if (!customerId.HasValue || customerId.Value <= 0)
{ {
throw new BusinessException("客户ID不能为空"); throw new BusinessException("客户ID不能为空");
} }