From d074e29f7fcb436825422aa5cbecec7b9d538b5b Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Wed, 5 Jun 2024 13:06:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E5=93=81=E5=8F=91=E8=BF=90=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgentModule.cs | 2 +- .../SfsCrudWithDetailsAppServiceBase.cs | 2 +- .../Inputs/DeliverRequestImportInput.cs | 7 +++++++ .../DeliverRequestAppService.cs | 5 +++++ .../DeliverRequestAutoMapperProfile.cs | 4 ++-- .../Transactions/DeliverNoteEventHandler.cs | 18 ++++++++++++++++++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs index 900b4cf8d..59cf323ef 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs @@ -149,7 +149,7 @@ public class AgentModule : AbpModule public override void OnApplicationInitialization( ApplicationInitializationContext context) { - //context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); // context.AddBackgroundWorkerAsync(); } } diff --git a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs index 7c9416a5d..29c506d6b 100644 --- a/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs +++ b/be/Modules/Shared/src/Win_in.Sfs.Shared.Application/SfsCrudWithDetailsAppServiceBase.cs @@ -739,7 +739,7 @@ public abstract class SfsCrudWithDetailsAppServiceBase /// /// - /// + /// protected virtual async Task ValidateImportEntityAsync(TImportInput model, TEntity entity, List validationRresult) { await Task.CompletedTask.ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs index 37b4c29bb..917c5b910 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/Inputs/DeliverRequestImportInput.cs @@ -7,6 +7,13 @@ namespace Win_in.Sfs.Wms.Store.Application.Contracts; [Display(Name = "发货申请")] public class DeliverRequestImportInput : SfsStoreImportInputBase { + /// + /// 单据号 + /// + [Display(Name = "单据号")] + [Required] + [Key] + public string Number { get; set; } /// /// 发货类型 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs index 10ad367a6..8d712414e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAppService.cs @@ -89,6 +89,11 @@ IItemBasicAppService itemBasicAppService) protected override async Task SaveImportAsync(Dictionary dict) { var addList = dict.Where(p => p.Value == EntityState.Added).Select(p => p.Key).ToList(); + foreach (var item in addList) + { + await SetRequestAutoPropertiesAsync(item).ConfigureAwait(false); + } + await _deliverRequestManager.CreateManyAsync(addList).ConfigureAwait(false); } private static void CheckItemBasic(ItemBasicDTO itemcBasicDto, string itemCode) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs index 30ac4f81e..da3b0fcf0 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestAutoMapperProfile.cs @@ -29,7 +29,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile CreateMap() - .ForMember(x => x.DeliverRequestType, y => y.MapFrom(t => EnumDeliverRequestType.Normal)) + // .ForMember(x => x.DeliverRequestType, y => y.MapFrom(t => EnumDeliverRequestType.Normal)) .Ignore(x => x.CustomerAddressCode) .Ignore(x => x.DeliverPlanNumber) .Ignore(x => x.ActiveDate) @@ -62,7 +62,7 @@ public partial class StoreApplicationAutoMapperProfile : Profile .Ignore(x => x.Remark); CreateMap() - .ForMember(x => x.DeliverRequestType, y => y.MapFrom(t => EnumDeliverRequestType.FIS)) + // .ForMember(x => x.DeliverRequestType, y => y.MapFrom(t => EnumDeliverRequestType.FIS)) .Ignore(x => x.CustomerAddressCode) .Ignore(x => x.DeliverPlanNumber) .Ignore(x => x.ActiveDate) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/DeliverNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/DeliverNoteEventHandler.cs index d08b6cd95..5b0d1e0d6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/DeliverNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/DeliverNoteEventHandler.cs @@ -20,6 +20,7 @@ namespace Win_in.Sfs.Wms.Store.Event.Transactions; public class DeliverNoteEventHandler : StoreInventoryEventHandlerBase , ILocalEventHandler> + , ILocalEventHandler>> { private const EnumTransType TransType = EnumTransType.Deliver; private readonly IDeliverRequestAppService _deliverRequestApp; @@ -49,7 +50,24 @@ public class DeliverNoteEventHandler await SetRequestStatusAsync(entity).ConfigureAwait(false); } + /// + /// 创建后 + /// + /// + /// + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventDatas) + { + var entitys = eventDatas.Entity; + var transferLogs = new List(); + foreach (var entity in entitys) + { + transferLogs.AddRange(BuildTransferLogs(entity)); + await SetRequestStatusAsync(entity).ConfigureAwait(false); + } + await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } #region 私有 private async Task AddTransactionsAsync(DeliverNote deliverNote)