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 1ee172a4c..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,6 +49,9 @@ public class UnplannedIssueNoteAppService : detail.ExtraProperties = inputDetail.ExtraProperties; entity.Details.Add(detail); + //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 0f0cf5a03..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,7 +49,8 @@ public class UnplannedReceiptNoteAppService : detail.ExtraProperties = inputDetail.ExtraProperties; - entity.Details.Add(detail); + var userName = await _userAppService.GetUserNameByUserAsync(input.Worker).ConfigureAwait(false); + entity.Worker = userName; } 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;