diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/IDeliverRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/IDeliverRequestAppService.cs index 82231c58d..c5d3e0e85 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/IDeliverRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/DeliverRequests/IDeliverRequestAppService.cs @@ -10,5 +10,6 @@ public interface IDeliverRequestAppService { + Task DeleteByIdAsync(Guid id); Task> HandleListAsync(List ids, string truckNumber); } 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 79afa8653..124ba207e 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 @@ -214,6 +214,27 @@ IItemBasicAppService itemBasicAppService) var dto = ObjectMapper.Map(entity); return dto; } + /// + /// 删除 + /// + /// + /// + [HttpPost("delete-by-id")] + public new async Task DeleteByIdAsync(Guid id) + { + bool result; + try + { + await base.DeleteAsync(id).ConfigureAwait(false); + result = true; + } + catch (Exception) + { + + result = false; + } + return result; + } private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) { //普通件 diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs index 30d437190..bffe6693f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/DeliverRequests/DeliverRequestFisAppService.cs @@ -56,7 +56,27 @@ public class DeliverRequestFisAppService : _balanceAppService = balanceAppService; _itemBasicAppService = itemBasicAppService; } + /// + /// 删除 + /// + /// + /// + [HttpPost("delete-by-id")] + public new async Task DeleteByIdAsync(Guid id) + { + bool result; + try + { + await base.DeleteAsync(id).ConfigureAwait(false); + result = true; + } + catch (Exception) + { + result = false; + } + return result; + } #region 东阳 private async Task SetRequestAutoPropertiesAsync(DeliverRequest entity) 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 5b0d1e0d6..1a255c10c 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 @@ -59,14 +59,30 @@ public class DeliverNoteEventHandler public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventDatas) { var entitys = eventDatas.Entity; - var transferLogs = new List(); - foreach (var entity in entitys) + if (await SettingManager.IsTrueAsync(StoreSettings.Common.EnableCustomerLocation).ConfigureAwait(false)) { - transferLogs.AddRange(BuildTransferLogs(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); + } + else + { + var transactions = new List(); + foreach (var entity in entitys) + { + transactions.AddRange(BuildTransactions(entity)); + + await SetRequestStatusAsync(entity).ConfigureAwait(false); + } + await TransactionAppService.AddManyAsync(transactions).ConfigureAwait(false); - await SetRequestStatusAsync(entity).ConfigureAwait(false); } - await TransferLogAppService.AddManyAsync(transferLogs).ConfigureAwait(false); + } #region 私有