完善仓储客户上下文解析(未传客户查全部),并补充库位与确认收货权限种子。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
c36bdb237c
commit
7e90112cbf
@ -1,5 +1,5 @@
|
||||
-- 仓储模块 + 店铺授权/订单 RBAC 权限(幂等)
|
||||
-- RBAC 库执行;执行后用户需重新登录或刷新权限缓存
|
||||
-- ???? + ????/?? RBAC ??????
|
||||
-- RBAC ?????????????????????
|
||||
|
||||
SET @ADMIN_USER_ID = (
|
||||
SELECT `Id` FROM `user`
|
||||
@ -20,11 +20,14 @@ CROSS JOIN (
|
||||
SELECT 'Warehouse.Sku.Delete' UNION ALL
|
||||
SELECT 'Warehouse.Inventory.Query' 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.Save' UNION ALL
|
||||
SELECT 'Warehouse.Parcel.Delete' UNION ALL
|
||||
SELECT 'Warehouse.InboundNotice.Query' UNION ALL
|
||||
SELECT 'Warehouse.InboundNotice.Save' UNION ALL
|
||||
SELECT 'Warehouse.InboundNotice.ConfirmReceive' UNION ALL
|
||||
SELECT 'Warehouse.InboundNotice.Delete' UNION ALL
|
||||
SELECT 'Order.PlatformStore.Query' UNION ALL
|
||||
SELECT 'Order.PlatformStore.Save' UNION ALL
|
||||
|
||||
@ -10,16 +10,22 @@ namespace Oms.Application.Shared;
|
||||
public static class WarehouseCustomerHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传 customerId 时返回 null(查询全部)。
|
||||
/// 列表/汇总查询用的客户 ID:客户登录强制为自身;管理员未传或传入 ≤0 时返回 null(查询全部)。
|
||||
/// </summary>
|
||||
public static Task<int?> ResolveListCustomerIdAsync(
|
||||
public static async Task<int?> ResolveListCustomerIdAsync(
|
||||
ICustomerRepository customerRepository,
|
||||
ICurrentUser currentUser,
|
||||
int? requestedCustomerId = null) =>
|
||||
OmsSessionHelper.ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId);
|
||||
int? requestedCustomerId = null)
|
||||
{
|
||||
var normalizedRequest = requestedCustomerId is > 0 ? requestedCustomerId : null;
|
||||
return await OmsSessionHelper.ResolveListCustomerIdAsync(
|
||||
customerRepository,
|
||||
currentUser,
|
||||
normalizedRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传 customerId。
|
||||
/// 写入/删除等必须明确客户归属的操作:客户登录强制为自身;管理员须传有效 customerId(>0)。
|
||||
/// </summary>
|
||||
public static async Task<int> ResolveRequiredCustomerIdAsync(
|
||||
ICustomerRepository customerRepository,
|
||||
@ -27,7 +33,7 @@ public static class WarehouseCustomerHelper
|
||||
int? requestedCustomerId = null)
|
||||
{
|
||||
var customerId = await ResolveListCustomerIdAsync(customerRepository, currentUser, requestedCustomerId);
|
||||
if (!customerId.HasValue)
|
||||
if (!customerId.HasValue || customerId.Value <= 0)
|
||||
{
|
||||
throw new BusinessException("客户ID不能为空");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user