From d7d5450ce1f69115e8deb8a97896859a3e278db6 Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Tue, 28 May 2024 11:57:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=A9=BA=E5=99=A8=E5=85=B7?= =?UTF-8?q?=E5=91=BC=E5=8F=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContainerRequestAppService.cs | 31 ++++++--- .../Requests/ContainerRequestEventHandler.cs | 63 +++++-------------- 2 files changed, 40 insertions(+), 54 deletions(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs index 79f901e1f..a57e2b4a0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ContainerRequests/ContainerRequestAppService.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Win_in.Sfs.Basedata.Application; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain; @@ -32,12 +33,14 @@ public class ContainerRequestAppService : private readonly IAreaAppService _areaApp; private readonly ICustomerAppService _customerApp; private readonly ICustomerAddressAppService _customerAddressApp; + private readonly ITransactionTypeAppService _transactionTypeAppService; public ContainerRequestAppService( IContainerRequestRepository repository , IContainerRequestManager containerRequestManager , IAreaAppService areaApp , ICustomerAppService customerApp + , ITransactionTypeAppService transactionTypeAppService , ICustomerAddressAppService customerAddressApp) : base(repository, containerRequestManager) { @@ -45,6 +48,7 @@ public class ContainerRequestAppService : _areaApp = areaApp; _customerApp = customerApp; _customerAddressApp = customerAddressApp; + _transactionTypeAppService= transactionTypeAppService; } @@ -56,12 +60,8 @@ public class ContainerRequestAppService : [HttpPost("")] public override async Task CreateAsync(ContainerRequestEditInput input) { - - input.AutoAgree = true; - input.AutoHandle = true; - input.AutoSubmit = true; - input.AutoCompleteJob = false; - input.DirectCreateNote = false; + + await SetRequestAutoPropertiesAsync(input).ConfigureAwait(false); var entity = ObjectMapper.Map(input); @@ -71,5 +71,22 @@ public class ContainerRequestAppService : return dto; } - + /// + /// 赋值Request业务属性 + /// + /// + /// + private async Task SetRequestAutoPropertiesAsync(ContainerRequestEditInput entity) + { + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Issue, EnumTransSubType.None).ConfigureAwait(false); + + Check.NotNull(tranType, "事务类型", "事务类型不存在"); + + entity.AutoSubmit = tranType.AutoSubmitRequest; + entity.AutoAgree = tranType.AutoAgreeRequest; + entity.AutoHandle = tranType.AutoHandleRequest; + entity.AutoCompleteJob = tranType.AutoCompleteJob; + entity.DirectCreateNote = tranType.DirectCreateNote; + } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs index d190cae40..4d6b3e577 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/ContainerRequestEventHandler.cs @@ -28,7 +28,7 @@ public class ContainerRequestEventHandler private readonly IContainerNoteAppService _containerNoteApp; private readonly IContainerJobAppService _containerJobApp; private readonly IEquipmentLocAppService _equipmentLocApp; - + private readonly ILocationAppService _locationAppService; private readonly IContainerRequestManager _containerRequestManager; @@ -36,12 +36,15 @@ public class ContainerRequestEventHandler IContainerNoteAppService containerNoteApp, IContainerJobAppService containerJobApp, IEquipmentLocAppService equipmentLocApp, + ILocationAppService locationAppService, IContainerRequestManager containerRequestManager) { _containerNoteApp = containerNoteApp; _containerJobApp = containerJobApp; _equipmentLocApp= equipmentLocApp; _containerRequestManager = containerRequestManager; + _locationAppService = locationAppService; + } @@ -127,59 +130,25 @@ public class ContainerRequestEventHandler var createInput = ObjectMapper.Map(request); ContainerNoteDetailInput detail=new ContainerNoteDetailInput(); - //createInput.Details = new List(); - //detail.ToLocationCode = request.RequestLocationCode; - - //detail.FromLocationCode = "123"; - //detail.FromPackingCode = "123"; - //detail.ToPackingCode = "123"; - //detail.FromLot = "123"; - //detail.ToLot = "123"; - //detail.FromLocationErpCode = "123"; - //detail.FromWarehouseCode = "123"; - //detail.ToLocationErpCode = "123"; - //detail.ToWarehouseCode = "123"; - //detail.Uom = "123"; - //detail.ItemCode = "123"; - //detail.ItemName = "123"; - - ////var container = await _equipmentLocApp.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); - - ////if (container != null) - ////{ - //// detail.ItemCode = container.Code; - ////} - - //createInput.Details.Add(detail); - + return createInput; } - - private async Task BuildContainerJobsAsync(ContainerRequest request) { var createInput = ObjectMapper.Map(request); - - createInput.WarehouseCode = "T8"; - - //ContainerJobDetailInput detail=new ContainerJobDetailInput(); - - //detail.FromLocationCode = "123"; - //detail.ToLocationCode = "123"; - - //detail.ItemCode = "123"; - //detail.ItemName = "123"; - //detail.RecommendPackingCode = "123"; - //detail.RecommendLot = "123"; - //detail.RecommendFromLocationCode = "123"; - //detail.RecommendFromLocationErpCode = "123"; - //detail.Uom = "123"; - - - //createInput.Details.Add(detail); - + var toLocationDto = await _locationAppService.GetByCodeAsync(createInput.RequestLocationCode).ConfigureAwait(false); + if(toLocationDto!=null) + { + createInput.WarehouseCode = toLocationDto.WarehouseCode; + } + else + { + createInput.WarehouseCode = ""; + } + + return createInput ; }