From f8599dbecb492b176de7a86b19207c76d9396bb0 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Fri, 20 Oct 2023 16:35:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=9D=9E=E7=94=9F=E4=BA=A7=E9=A2=86?= =?UTF-8?q?=E6=96=99=E5=92=8C=E9=80=80=E6=96=99=E8=AE=BE=E7=BD=AE=20create?= =?UTF-8?q?id=20=E7=BB=99=E6=8E=A5=E5=8F=A3=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs | 1 + .../UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs | 1 + .../DataExchanges/UnplannedIssueNoteEventHandler.cs | 1 + 3 files changed, 3 insertions(+) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs index 1ee172a4c..2836dbb67 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs @@ -41,6 +41,7 @@ public class UnplannedIssueNoteAppService : detail.ExtraProperties = inputDetail.ExtraProperties; entity.Details.Add(detail); + entity.CreatorId = CurrentUser.Id; } await _unplannedIssueNoteManager.CreateAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs index 0f0cf5a03..99a231e40 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs @@ -46,6 +46,7 @@ public class UnplannedReceiptNoteAppService : detail.ExtraProperties = inputDetail.ExtraProperties; entity.Details.Add(detail); + entity.CreatorId = CurrentUser.Id; } await _unplannedReceiptNoteManager.CreateAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/UnplannedIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/UnplannedIssueNoteEventHandler.cs index 9eac13e05..eb86fc5a1 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/UnplannedIssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/UnplannedIssueNoteEventHandler.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using Volo.Abp.EventBus; using Volo.Abp.Uow; +using Volo.Abp.Users; using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; From ab369535d29670b111bf7a6c95cff00eb4fa26b6 Mon Sep 17 00:00:00 2001 From: "boxu.zheng" Date: Fri, 20 Oct 2023 17:41:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?//2023-10-20=20=E8=A2=81=E9=9D=99=E9=9B=AF?= =?UTF-8?q?=E8=A6=81=E6=B1=82=E4=BF=AE=E6=94=B9=E8=AE=A1=E5=88=92=E5=A4=96?= =?UTF-8?q?=E5=87=BA=E5=85=A5=E5=BA=93=20=E6=93=8D=E4=BD=9C=E4=BA=BA?= =?UTF-8?q?=E4=B8=BAuserName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Users/ISfsUserAppService.cs | 1 + .../Users/SfsUserAppService.cs | 10 ++++++++++ .../UnplannedIssueNoteAppService.cs | 14 ++++++++++++-- .../UnplannedReceiptNoteAppService.cs | 14 +++++++++----- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application.Contracts/Users/ISfsUserAppService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application.Contracts/Users/ISfsUserAppService.cs index 63c0fbf78..a17a8e118 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application.Contracts/Users/ISfsUserAppService.cs +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application.Contracts/Users/ISfsUserAppService.cs @@ -14,4 +14,5 @@ public interface ISfsUserAppService : IApplicationService Task UpdateIsActiveAsync(Guid id, bool isActive); + Task GetUserNameByUserAsync(string worker); } diff --git a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs index 93c4d501f..1d39e27f0 100644 --- a/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs +++ b/be/Hosts/Auth.Host/src/Win_in.Sfs.Auth.Application/Users/SfsUserAppService.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using IdentityModel; using Microsoft.AspNetCore.Authorization; @@ -94,6 +95,15 @@ public class SfsUserAppService : ApplicationService, ISfsUserAppService return username; } + [HttpPost("get-username-by-user")] + public virtual async Task GetUserNameByUserAsync(string worker) + { + var userList = await _userRepository.GetListAsync().ConfigureAwait(false); + var userEntity = userList.First(p => p.Name == worker); + return userEntity.UserName; + } + + /// /// 修改密码 /// diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs index 2836dbb67..d131d72ef 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedIssuesNotes/UnplannedIssueNoteAppService.cs @@ -1,7 +1,13 @@ using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Identity; +using Volo.Abp.Users; +using Win_in.Sfs.Auth.Users; +using Win_in.Sfs.Shared.Domain; +using Win_in.Sfs.Wms.Inventory.Domain; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -19,11 +25,13 @@ public class UnplannedIssueNoteAppService : IUnplannedIssueNoteAppService { private readonly IUnplannedIssueNoteManager _unplannedIssueNoteManager; + private readonly ISfsUserAppService _userAppService; public UnplannedIssueNoteAppService(IUnplannedIssueNoteRepository repository, - IUnplannedIssueNoteManager unplannedIssueNoteManager) : base(repository) + IUnplannedIssueNoteManager unplannedIssueNoteManager, ISfsUserAppService userAppService) : base(repository) { _unplannedIssueNoteManager = unplannedIssueNoteManager; + _userAppService = userAppService; } [HttpPost("")] @@ -41,7 +49,9 @@ public class UnplannedIssueNoteAppService : detail.ExtraProperties = inputDetail.ExtraProperties; entity.Details.Add(detail); - entity.CreatorId = CurrentUser.Id; + //2023-10-20 袁静雯要求修改计划外出入库 Worker为userName + var userName = await _userAppService.GetUserNameByUserAsync(input.Worker).ConfigureAwait(false); + entity.Worker = userName; } await _unplannedIssueNoteManager.CreateAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs index 99a231e40..4c701cbc2 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/UnplannedReceiptNotes/UnplannedReceiptNoteAppService.cs @@ -1,6 +1,8 @@ +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Win_in.Sfs.Auth.Users; using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -9,6 +11,8 @@ using Win_in.Sfs.Wms.Store.Domain.Shared; namespace Win_in.Sfs.Wms.Store.Application; using System.Collections.Generic; +using Volo.Abp.Identity; +using Volo.Abp.Users; /// /// 计划外入库记录 @@ -21,14 +25,14 @@ public class UnplannedReceiptNoteAppService : IUnplannedReceiptNoteAppService { private readonly IUnplannedReceiptNoteManager _unplannedReceiptNoteManager; - private readonly ILocationCapacityAppService _locationCapacityAppService; + private readonly ISfsUserAppService _userAppService; public UnplannedReceiptNoteAppService(IUnplannedReceiptNoteRepository repository, IUnplannedReceiptNoteManager unplannedReceiptNoteManager, - ILocationCapacityAppService locationCapacityAppService) : base(repository) + ISfsUserAppService userAppService) : base(repository) { _unplannedReceiptNoteManager = unplannedReceiptNoteManager; - _locationCapacityAppService = locationCapacityAppService; + _userAppService = userAppService; } [HttpPost("")] @@ -45,8 +49,8 @@ public class UnplannedReceiptNoteAppService : detail.ExtraProperties = inputDetail.ExtraProperties; - entity.Details.Add(detail); - entity.CreatorId = CurrentUser.Id; + var userName = await _userAppService.GetUserNameByUserAsync(input.Worker).ConfigureAwait(false); + entity.Worker = userName; } await _unplannedReceiptNoteManager.CreateAsync(entity).ConfigureAwait(false);