diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs index 6f80a9d45..d7f3a3545 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/MaterialRequests/MaterialRequestAppService.cs @@ -5,14 +5,19 @@ using System.Linq; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; +using IdentityModel; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.ObjectMapping; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; +using Win_in.Sfs.Shared.Event; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -91,6 +96,13 @@ public class MaterialRequestAppService : SfsStoreRequestAppServiceBase HandleAsync(Guid id) + { + var entity=await _repository.GetAsync(id).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new SfsHandledEntityEventData(entity), false).ConfigureAwait(false); + return ObjectMapper.Map(entity); + } + #endregion [HttpPost("")] diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs index 897d7af99..89d439cfb 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/MaterialRequestEventHandler.cs @@ -68,6 +68,10 @@ public class MaterialRequestEventHandler { await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false); } + if (entity.Type == EnumMaterialRequestType.Issue_WIP.ToString()) + { + await _materialRequestManager.SubmitAsync(entity).ConfigureAwait(false); + } } } @@ -110,6 +114,8 @@ public class MaterialRequestEventHandler await Task.CompletedTask.ConfigureAwait(false); } + #region 私有 + private async Task> BuildIssueJobAsync (MaterialRequest materialRequest) { @@ -119,7 +125,7 @@ public class MaterialRequestEventHandler var toLocationCodes = materialRequest.Details.Select(p => p.ToLocationCode).Distinct().ToList(); var toLocations = await _locationAppService.GetByCodesAsync(toLocationCodes).ConfigureAwait(false); - foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0)) + foreach (var materialRequestDetail in materialRequest.Details.Where(p => p.ToBeIssuedQty > 0))//如果有还有剩余未叫料的数量 则创建新的任务 { var toLocation = toLocations.FirstOrDefault(p => p.Code == materialRequestDetail.ToLocationCode); Check.NotNull(toLocation, "库位代码", $"库位 {materialRequestDetail.ToLocationCode} 不存在"); @@ -240,7 +246,6 @@ public class MaterialRequestEventHandler detail.RecommendFromLocationErpCode= balance.LocationErpCode; detail.RecommendFromLocationGroup= balance.LocationGroup; detail.RecommendFromWarehouseCode= balance.WarehouseCode; - detail.RecommendQty = balance.Qty; detail.Uom = balance.Uom; detail.ToLocationCode = materialRequestDetail.ToLocationCode; @@ -279,5 +284,5 @@ public class MaterialRequestEventHandler } - + #endregion } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs index 8d28b137e..e113d92e4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/Note/IssueNoteEventHandler.cs @@ -24,6 +24,11 @@ public class IssueNoteEventHandler _materialRequestManager = materialRequestManager; } + /// + /// 当叫料记录创建后 修改请求的值 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) { @@ -59,7 +64,11 @@ public class IssueNoteEventHandler } } - + /// + /// 当叫料记录创建后 修改请求的值 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { @@ -70,6 +79,11 @@ public class IssueNoteEventHandler } } + /// + /// 当叫料记录创建后 修改请求的值 + /// + /// + /// [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) {