库存展示修改 主数据层级联动

This commit is contained in:
zhougf committed 2026-06-01 23:49:07 +08:00
1 parent 7f621dd553
commit 3c6dfda5e5
13 files changed
+488 -42

No files matched your search

+24 -5
View File
@@ -574,6 +574,7 @@ public class OutboundOrderService : OrderServiceBase, IOutboundOrderService
private readonly IOutboundPickTaskRepository _pickTaskRepository;
private readonly ILocationRepository _locationRepository;
private readonly IInventoryAllocationService _allocationService;
private readonly IOrderNumberGenerator _orderNumberGenerator;
private readonly ICurrentUserContext _userContext;
public OutboundOrderService(
@@ -583,6 +584,7 @@ public class OutboundOrderService : OrderServiceBase, IOutboundOrderService
IOutboundPickTaskRepository pickTaskRepository,
ILocationRepository locationRepository,
IInventoryAllocationService allocationService,
IOrderNumberGenerator orderNumberGenerator,
IInventoryRepository inventoryRepository,
IInventoryMovementService inventoryMovementService,
ICurrentUserContext userContext) : base(inventoryRepository, inventoryMovementService)
@@ -593,6 +595,7 @@ public class OutboundOrderService : OrderServiceBase, IOutboundOrderService
_pickTaskRepository = pickTaskRepository;
_locationRepository = locationRepository;
_allocationService = allocationService;
_orderNumberGenerator = orderNumberGenerator;
_userContext = userContext;
}
@@ -638,16 +641,22 @@ public class OutboundOrderService : OrderServiceBase, IOutboundOrderService
{
return await _tx.ExecuteAsync(async () =>
{
if (await _orderRepository.GetByOrderNoAsync(_userContext.TenantId.Trim(), _userContext.OwnerCode.Trim(), request.OrderNo) is not null)
var tenantId = _userContext.TenantId.Trim();
var ownerCode = _userContext.OwnerCode.Trim();
var orderNo = string.IsNullOrWhiteSpace(request.OrderNo)
? await _orderNumberGenerator.NextOutboundOrderNoAsync(tenantId, ownerCode)
: request.OrderNo.Trim();
if (await _orderRepository.GetByOrderNoAsync(tenantId, ownerCode, orderNo) is not null)
{
throw new BusinessException($"Outbound order '{request.OrderNo}' already exists.");
throw new BusinessException($"Outbound order '{orderNo}' already exists.");
}
var order = new OutboundOrder
{
TenantId = _userContext.TenantId.Trim(),
OwnerCode = _userContext.OwnerCode.Trim(),
OrderNo = request.OrderNo.Trim(),
TenantId = tenantId,
OwnerCode = ownerCode,
OrderNo = orderNo,
BizType = request.BizType?.Trim(),
Remark = request.Remark?.Trim(),
Attrs = request.Attrs,
@@ -891,6 +900,11 @@ public class TransferOrderService : OrderServiceBase, ITransferOrderService
{
return await _tx.ExecuteAsync(async () =>
{
if (string.IsNullOrWhiteSpace(request.OrderNo))
{
throw new BusinessException("OrderNo is required.");
}
if (await _orderRepository.GetByOrderNoAsync(_userContext.TenantId.Trim(), _userContext.OwnerCode.Trim(), request.OrderNo) is not null)
{
throw new BusinessException($"Transfer order '{request.OrderNo}' already exists.");
@@ -1066,6 +1080,11 @@ public class StocktakeOrderService : OrderServiceBase, IStocktakeOrderService
{
return await _tx.ExecuteAsync(async () =>
{
if (string.IsNullOrWhiteSpace(request.OrderNo))
{
throw new BusinessException("OrderNo is required.");
}
if (await _orderRepository.GetByOrderNoAsync(_userContext.TenantId.Trim(), _userContext.OwnerCode.Trim(), request.OrderNo) is not null)
{
throw new BusinessException($"Stocktake order '{request.OrderNo}' already exists.");