|
@ -1,20 +1,26 @@ |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
|
|
|
using Volo.Abp; |
|
|
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Domain; |
|
|
namespace Win_in.Sfs.Wms.Store.Domain; |
|
|
|
|
|
|
|
|
public class UnplannedReceiptRequestManager : SfsStoreRequestManagerBase<UnplannedReceiptRequest, UnplannedReceiptRequestDetail>, IUnplannedReceiptRequestManager |
|
|
public class UnplannedReceiptRequestManager : SfsStoreRequestManagerBase<UnplannedReceiptRequest, UnplannedReceiptRequestDetail>, IUnplannedReceiptRequestManager |
|
|
{ |
|
|
{ |
|
|
public readonly IUnplannedReceiptRequestRepository _repository; |
|
|
private readonly IUnplannedReceiptRequestRepository _repository; |
|
|
|
|
|
private readonly IDictAppService _dictAppService; |
|
|
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
|
|
|
|
|
//public readonly _repository;
|
|
|
//public readonly _repository;
|
|
|
//public readonly IUnplannedReceiptRequestRepository _repository;
|
|
|
//public readonly IUnplannedReceiptRequestRepository _repository;
|
|
|
|
|
|
|
|
|
public UnplannedReceiptRequestManager( |
|
|
public UnplannedReceiptRequestManager( |
|
|
IUnplannedReceiptRequestRepository repository |
|
|
IUnplannedReceiptRequestRepository repository, IDictAppService dictAppService, IItemBasicAppService itemBasicAppService) : base(repository) |
|
|
) : base(repository) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_repository = repository; |
|
|
_repository = repository; |
|
|
|
|
|
_dictAppService = dictAppService; |
|
|
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
@ -30,4 +36,25 @@ public class UnplannedReceiptRequestManager : SfsStoreRequestManagerBase<Unplann |
|
|
await CreateManyAsync(mergeEntities).ConfigureAwait(false); |
|
|
await CreateManyAsync(mergeEntities).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override async Task<List<UnplannedReceiptRequest>> CreateManyAsync(List<UnplannedReceiptRequest> entities) |
|
|
|
|
|
{ |
|
|
|
|
|
var dictDto= await _dictAppService.GetByCodeAsync("CaseCode").ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var entity in entities) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var unplannedReceiptRequestDetail in entity.Details) |
|
|
|
|
|
{ |
|
|
|
|
|
var flag= dictDto.Items.ToList().FirstOrDefault(p => p.Value == unplannedReceiptRequestDetail.CaseCode); |
|
|
|
|
|
if (flag == null) |
|
|
|
|
|
{ |
|
|
|
|
|
throw new UserFriendlyException($"【{unplannedReceiptRequestDetail.CaseCode}】专案不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var itemBasicDto = await _itemBasicAppService.GetByCodeAsync(unplannedReceiptRequestDetail.ItemCode).ConfigureAwait(false); |
|
|
|
|
|
unplannedReceiptRequestDetail.Uom = itemBasicDto.BasicUom; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return await base.CreateManyAsync(entities).ConfigureAwait(false); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|