|
@ -119,36 +119,32 @@ public class DeliverRequestEventHandler |
|
|
//东阳特殊逻辑
|
|
|
//东阳特殊逻辑
|
|
|
if (entitys.First().DirectCreateNote) |
|
|
if (entitys.First().DirectCreateNote) |
|
|
{ |
|
|
{ |
|
|
var noteCreateInput = await BuildDeliverNoteAsync(entitys).ConfigureAwait(false); |
|
|
var noteCreateInputs = await BuildDeliverNotesAsync(entitys).ConfigureAwait(false); |
|
|
await _deliverNoteApp.CreateAsync(noteCreateInput).ConfigureAwait(false); |
|
|
await _deliverNoteApp.CreateManyAsync(noteCreateInputs).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#region 私有
|
|
|
#region 私有
|
|
|
private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(List<DeliverRequest> requests) |
|
|
private async Task<List<DeliverNoteEditInput>> BuildDeliverNotesAsync(List<DeliverRequest> requests) |
|
|
{ |
|
|
{ |
|
|
var transactionType = await TransactionTypeAclService |
|
|
List<DeliverNoteEditInput> createInputs = new List<DeliverNoteEditInput>(); |
|
|
.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); |
|
|
var transactionType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Deliver, EnumTransSubType.None).ConfigureAwait(false); |
|
|
|
|
|
foreach (var request in requests) |
|
|
if (requests.First().DeliverRequestType == EnumDeliverRequestType.Normal) |
|
|
{ |
|
|
|
|
|
if (request.DeliverRequestType == EnumDeliverRequestType.Normal) |
|
|
{ |
|
|
{ |
|
|
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( |
|
|
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( |
|
|
EnumTransType.Deliver, |
|
|
EnumTransType.Deliver, |
|
|
EnumTransSubType.Deliver_Standard).ConfigureAwait(false); |
|
|
EnumTransSubType.Deliver_Standard).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
else if (requests.First().DeliverRequestType == EnumDeliverRequestType.FIS) |
|
|
else if (request.DeliverRequestType == EnumDeliverRequestType.FIS) |
|
|
{ |
|
|
{ |
|
|
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( |
|
|
transactionType = await TransactionTypeAclService.GetByTransTypeAsync( |
|
|
EnumTransType.Deliver, |
|
|
EnumTransType.Deliver, |
|
|
EnumTransSubType.Deliver_FIS).ConfigureAwait(false); |
|
|
EnumTransSubType.Deliver_FIS).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
|
|
|
var createInput = ObjectMapper.Map<DeliverRequest, DeliverNoteEditInput>(request); |
|
|
var createInput = ObjectMapper.Map<DeliverRequest, DeliverNoteEditInput>(requests.First()); |
|
|
var customerAddress = (await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false)).FirstOrDefault(); |
|
|
|
|
|
|
|
|
var customerAddress = |
|
|
|
|
|
(await _customerAddressApp.GetByCustomerCodeAsync(createInput.CustomerCode).ConfigureAwait(false)) |
|
|
|
|
|
.FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
LocationDTO toLocation = null; |
|
|
LocationDTO toLocation = null; |
|
|
if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) |
|
|
if (customerAddress != null && !string.IsNullOrEmpty(customerAddress.LocationCode)) |
|
|
{ |
|
|
{ |
|
@ -156,10 +152,9 @@ public class DeliverRequestEventHandler |
|
|
|
|
|
|
|
|
Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在"); |
|
|
Check.NotNull(toLocation, $"客户库位 {customerAddress.LocationCode} 不存在"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createInput.Details = new List<DeliverNoteDetailInput>(); |
|
|
createInput.Details = new List<DeliverNoteDetailInput>(); |
|
|
List<BalanceDTO> oldBalances = new List<BalanceDTO>(); |
|
|
List<BalanceDTO> oldBalances = new List<BalanceDTO>(); |
|
|
foreach (var detail in requests.SelectMany(r=>r.Details)) |
|
|
foreach (var detail in request.Details) |
|
|
{ |
|
|
{ |
|
|
var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); |
|
|
var locations = await _locationAppService.GetListByTypesAndErpCodeAsync(transactionType.OutLocationTypes, detail.AreaCode).ConfigureAwait(false); |
|
|
if (locations.Count <= 0) |
|
|
if (locations.Count <= 0) |
|
@ -209,7 +204,10 @@ public class DeliverRequestEventHandler |
|
|
createInput.Details.Add(inputDetail); |
|
|
createInput.Details.Add(inputDetail); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return createInput; |
|
|
|
|
|
|
|
|
createInputs.Add(createInput); |
|
|
|
|
|
} |
|
|
|
|
|
return createInputs; |
|
|
} |
|
|
} |
|
|
private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(DeliverRequest request) |
|
|
private async Task<DeliverNoteEditInput> BuildDeliverNoteAsync(DeliverRequest request) |
|
|
{ |
|
|
{ |
|
|