|
@ -1,14 +1,15 @@ |
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Linq; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Win_in.Sfs.Basedata.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Application.Contracts; |
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
|
using Win_in.Sfs.Wms.Store.Domain; |
|
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|
|
using Win_in.Sfs.Wms.Store.Domain.Shared; |
|
|
|
|
|
|
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
namespace Win_in.Sfs.Wms.Store.Application; |
|
|
|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
|
|
|
|
|
|
|
[Authorize] |
|
|
[Authorize] |
|
|
[Route($"{StoreConsts.RootPath}backFlush-note")] |
|
|
[Route($"{StoreConsts.RootPath}backFlush-note")] |
|
|
public class BackFlushNoteAppService : |
|
|
public class BackFlushNoteAppService : |
|
@ -17,17 +18,22 @@ public class BackFlushNoteAppService : |
|
|
IBackFlushNoteAppService |
|
|
IBackFlushNoteAppService |
|
|
{ |
|
|
{ |
|
|
private readonly IBackFlushNoteManager _backFlushNoteManager; |
|
|
private readonly IBackFlushNoteManager _backFlushNoteManager; |
|
|
|
|
|
private readonly IItemBasicAppService _itemBasicAppService; |
|
|
|
|
|
|
|
|
public BackFlushNoteAppService(IBackFlushNoteRepository repository, IBackFlushNoteManager backFlushNoteManager) : |
|
|
public BackFlushNoteAppService(IBackFlushNoteRepository repository, IBackFlushNoteManager backFlushNoteManager, IItemBasicAppService itemBasicAppService) : |
|
|
base(repository) |
|
|
base(repository) |
|
|
{ |
|
|
{ |
|
|
_backFlushNoteManager = backFlushNoteManager; |
|
|
_backFlushNoteManager = backFlushNoteManager; |
|
|
|
|
|
_itemBasicAppService = itemBasicAppService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
[HttpPost("create-many")] |
|
|
[HttpPost("create-many")] |
|
|
public virtual async Task<List<BackFlushNoteDTO>> CreateManyAsync(List<BackFlushNoteEditInput> inputs) |
|
|
public virtual async Task<List<BackFlushNoteDTO>> CreateManyAsync(List<BackFlushNoteEditInput> inputs) |
|
|
{ |
|
|
{ |
|
|
var entities = ObjectMapper.Map<List<BackFlushNoteEditInput>, List<BackFlushNote>>(inputs); |
|
|
var entities = ObjectMapper.Map<List<BackFlushNoteEditInput>, List<BackFlushNote>>(inputs); |
|
|
|
|
|
|
|
|
|
|
|
entities = await ProcessingBackFlushNoteData(entities).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
entities = await _backFlushNoteManager.CreateManyAsync(entities).ConfigureAwait(false); |
|
|
entities = await _backFlushNoteManager.CreateManyAsync(entities).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
var dtos = ObjectMapper.Map<List<BackFlushNote>, List<BackFlushNoteDTO>>(entities); |
|
|
var dtos = ObjectMapper.Map<List<BackFlushNote>, List<BackFlushNoteDTO>>(entities); |
|
@ -43,4 +49,33 @@ public class BackFlushNoteAppService : |
|
|
|
|
|
|
|
|
return ObjectMapper.Map<List<BackFlushNote>, List<BackFlushNoteDTO>>(entities); |
|
|
return ObjectMapper.Map<List<BackFlushNote>, List<BackFlushNoteDTO>>(entities); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 处理数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private async Task<List<BackFlushNote>> ProcessingBackFlushNoteData(List<BackFlushNote> backFlushNotes) |
|
|
|
|
|
{ |
|
|
|
|
|
if (backFlushNotes != null && backFlushNotes.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
var itemCodes = backFlushNotes.Select(t => t.ItemCode); |
|
|
|
|
|
List<ItemBasicDTO> itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false); |
|
|
|
|
|
|
|
|
|
|
|
backFlushNotes.ForEach(t => |
|
|
|
|
|
{ |
|
|
|
|
|
var itemBasicDto = itemBasicDtos.FirstOrDefault(w => w.Code == t.ItemCode); |
|
|
|
|
|
if (itemBasicDto != null) |
|
|
|
|
|
{ |
|
|
|
|
|
t.ItemDesc1 = itemBasicDto.Desc1; |
|
|
|
|
|
t.ItemDesc2 = itemBasicDto.Desc2; |
|
|
|
|
|
t.Details.ForEach(tDetail => |
|
|
|
|
|
{ |
|
|
|
|
|
tDetail.ItemDesc1 = itemBasicDto.Desc1; |
|
|
|
|
|
tDetail.ItemDesc2 = itemBasicDto.Desc2; |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
return backFlushNotes; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|