From 14277172c01a64493d9159001eca1818b1f89684 Mon Sep 17 00:00:00 2001 From: liuyunfeng Date: Fri, 5 Jan 2024 15:51:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E8=BE=B9=E9=80=80=E6=96=99=E7=8A=B6?= =?UTF-8?q?=E6=80=81=3D=20=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nnedReceiptRequestForDongyangAppService.cs | 2 +- .../Bases/ISfsStoreManager.cs | 5 +++++ .../Bases/SfsStoreManagerBase.cs | 19 +++++++++++++++++++ .../UnplannedReceiptRequestEventHandler.cs | 4 ++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs index a553d4dee..31f50bae5 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedReceiptRequests/UnplannedReceiptRequestForDongyangAppService.cs @@ -73,7 +73,7 @@ public class UnplannedReceiptRequestForDongyangAppService : UnplannedReceiptRequ { entity.DirectCreateNote = false; //原料先生成任务、再生成记录 } - await _unplannedReceiptRequestManager.CreateAsync(entity).ConfigureAwait(false); + var res = await _unplannedReceiptRequestManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); return dto; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/ISfsStoreManager.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/ISfsStoreManager.cs index 5fe33708f..aecf52f43 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/ISfsStoreManager.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/ISfsStoreManager.cs @@ -17,4 +17,9 @@ where TDetailEntity : SfsDetailEntityBase public Task CreateAsync(TEntity entity); Task> CreateManyAsync(List entities); + + Task InsertOrUpdateAsync(TEntity entity); + + Task UpdateAsync(TEntity entity); + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreManagerBase.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreManagerBase.cs index 69d0a8a46..1ec3e4ba9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreManagerBase.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Bases/SfsStoreManagerBase.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Volo.Abp; using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; using Volo.Abp.EventBus.Distributed; using Volo.Abp.EventBus.Local; @@ -145,4 +146,22 @@ public abstract class SfsStoreManagerBase throw; } } + + public virtual async Task InsertOrUpdateAsync(TEntity entity) + { + var isExist = await Repository.AnyAsync(p => p.Id == entity.Id).ConfigureAwait(false); + if (!isExist) + { + return await Repository.InsertAsync(entity).ConfigureAwait(false); + } + else + { + return await Repository.UpdateAsync(entity).ConfigureAwait(false); + } + } + + public virtual async Task UpdateAsync(TEntity entity) + { + return await Repository.UpdateAsync(entity).ConfigureAwait(false); + } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedReceiptRequestEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedReceiptRequestEventHandler.cs index 59707e40c..d37846ca6 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedReceiptRequestEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Requests/UnplannedReceiptRequestEventHandler.cs @@ -66,6 +66,10 @@ public class UnplannedReceiptRequestEventHandler { var entity = eventData.Entity; + if (entity.UnplannedReceiptType == Shared.Domain.Shared.Enums.Store.EnumUnplannedReceiptType.Wip) + { + entity.RequestStatus = EnumRequestStatus.Completed; + } if (entity.DirectCreateNote) { var note = await BuildUnplannedReceiptNoteCreateInputAsync(entity).ConfigureAwait(false);