|
|
@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
using Castle.Components.DictionaryAdapter; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
@ -87,6 +87,45 @@ public class DeliverRequestFisAppService : |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost("get-list-by-container")] |
|
|
|
public async Task<List<DeliverRequestByContainerDTO>> GetListByContainerAsync() |
|
|
|
{ |
|
|
|
var list = await _repository.GetListAsync(p => p.RequestStatus != EnumRequestStatus.Completed && p.DeliverRequestType == EnumDeliverRequestType.FIS,"",true).ConfigureAwait(false); |
|
|
|
|
|
|
|
var listDetail = new List<DeliverRequestDetailDTO>(); |
|
|
|
|
|
|
|
foreach (var deliverRequest in list) |
|
|
|
{ |
|
|
|
var detailDto = ObjectMapper.Map<List<DeliverRequestDetail>, List<DeliverRequestDetailDTO>>(deliverRequest.Details); |
|
|
|
|
|
|
|
listDetail.AddRange(detailDto); |
|
|
|
} |
|
|
|
|
|
|
|
var groupBy = listDetail.GroupBy(p => p.MesDeliveryContainer); |
|
|
|
|
|
|
|
var resultDto = new List<DeliverRequestByContainerDTO>(); |
|
|
|
|
|
|
|
foreach (var groupKey in groupBy) |
|
|
|
{ |
|
|
|
var dto = new DeliverRequestByContainerDTO(); |
|
|
|
dto.RequestDetailDtos = new EditableList<DeliverRequestDetailDTO>(); |
|
|
|
|
|
|
|
dto.MesDeliveryContainer = groupKey.Key; |
|
|
|
dto.MaxDateTime = groupKey.Max(p => p.CreationTime); |
|
|
|
dto.MinDateTime = groupKey.Min(p => p.CreationTime); |
|
|
|
|
|
|
|
foreach (var groupList in groupKey) |
|
|
|
{ |
|
|
|
dto.RequestDetailDtos.Add(groupList); |
|
|
|
} |
|
|
|
|
|
|
|
resultDto.Add(dto); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDto; |
|
|
|
} |
|
|
|
|
|
|
|
#region 东阳
|
|
|
|
|
|
|
|
private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) |
|
|
|