Browse Source

成品发运修改

dev_DY_CC
lvzb 11 months ago
parent
commit
af5f739091
  1. 2
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs
  2. 14
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs
  3. 8
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs
  4. 36
      be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs

2
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/DeliverNotes/IDeliverNoteAppService.cs

@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
@ -35,4 +36,5 @@ public interface IDeliverNoteAppService :
Task<IActionResult> ExportForRAWAsync(SfsExportRequestInput requestInput);
Task SumPrintAsync(string number);
Task<List<DeliverNoteDTO>> CreateManyAsync(List<DeliverNoteEditInput> inputs);
}

14
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/DeliverNotes/DeliverNoteAppService.cs

@ -13,6 +13,7 @@ using Win_in.Sfs.Wms.Store.Domain.Shared;
namespace Win_in.Sfs.Wms.Store.Application;
using Volo.Abp.ObjectMapping;
using Win_in.Sfs.Shared.Application.Contracts;
using Win_in.Sfs.Shared.Domain;
@ -50,7 +51,20 @@ public class DeliverNoteAppService :
var dto = ObjectMapper.Map<DeliverNote, DeliverNoteDTO>(entity);
return dto;
}
/// <summary>
/// 新增接口
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("create-many")]
public async Task<List<DeliverNoteDTO>> CreateManyAsync(List<DeliverNoteEditInput> inputs)
{
var entitys = ObjectMapper.Map<List<DeliverNoteEditInput>, List<DeliverNote>>(inputs);
await _deliverNoteManager.CreateManyAsync(entitys).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<DeliverNote>, List<DeliverNoteDTO>>(entitys);
return dtos;
}
/// <summary>
/// 新增接口
/// </summary>

8
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs

@ -163,10 +163,10 @@ IItemBasicAppService itemBasicAppService)
public virtual async Task<List<DeliverRequestDTO>> HandleListAsync(List<Guid> ids)
{
var entitys = await _repository.GetListAsync(r=> ids.Contains(r.Id),true).ConfigureAwait(false);
if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1)
{
throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!");
}
//if (entitys.Select(r => r.CustomerCode).Distinct().Count()>1)
//{
// throw new UserFriendlyException($"所选申请涉及多个客户不能创建为一个发货单,请重新选择!");
//}
Check.NotNull(entitys, typeof(DeliverRequest).Name);
var result = await _deliverRequestManager.HandleListAsync(entitys).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<DeliverRequest>, List<DeliverRequestDTO>>(entitys);

36
be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/DeliverRequestEventHandler.cs

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

Loading…
Cancel
Save