diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs index 9c1bc1d62..ef33dc6dd 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/AgentModule.cs @@ -149,7 +149,7 @@ public class AgentModule : AbpModule public override void OnApplicationInitialization( ApplicationInitializationContext context) { - //context.AddBackgroundWorkerAsync(); + context.AddBackgroundWorkerAsync(); context.AddBackgroundWorkerAsync(); } } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Properties/PublishProfiles/ClickOnceProfile.pubxml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Properties/PublishProfiles/ClickOnceProfile.pubxml new file mode 100644 index 000000000..c00cda636 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Properties/PublishProfiles/ClickOnceProfile.pubxml @@ -0,0 +1,42 @@ + + + + + 2 + 1.0.0.* + True + Release + False + true + True + Disk + True + False + True + False + Any CPU + bin\Release\net6.0\app.publish\ + bin\publish\ + ClickOnce + False + False + False + (无) + False + false + net6.0 + False + Foreground + False + Publish.html + True|2024-12-06T15:16:15.2109813Z; + + + + True + .NET 运行时 6.0.27 (x64) + + + \ No newline at end of file diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Properties/PublishProfiles/FolderProfile.pubxml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 000000000..154e03532 --- /dev/null +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,13 @@ + + + + + Release + Any CPU + bin\Release\net6.0\publish\ + FileSystem + <_TargetId>Folder + + \ No newline at end of file diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs index d1d5c3dd4..d7a5e1ace 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/TransferNotes/TransferNoteAppService.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Entities; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -54,6 +55,21 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase Dictionary dictionary) { var addList = dictionary.Where(p => p.Value == EntityState.Added).Select(p => p.Key); + foreach (var addTransferNote in addList) + { + foreach (var detail in addTransferNote.Details) + { + var balanceDto = await _balanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + if (balanceDto.Qty < detail.Qty || balanceDto.Qty < 0) + { + throw new UserFriendlyException($"您申请的【ERP料号】{detail.ItemCode}【库位】{detail.FromLocationCode}【箱码】{detail.FromPackingCode}【状态】{detail.FromStatus}【数量】{detail.Qty}的库存," + + $"在实际库存中查询到【ERP料号】{balanceDto.ItemCode}【库位】{balanceDto.LocationCode}【箱码】{balanceDto.PackingCode}【状态】{balanceDto.Status}【数量】{balanceDto.Qty}" + + $"【库存不足】"); + } + } + } foreach (var transferNote in addList) { @@ -312,7 +328,20 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase { var entity = ObjectMapper.Map(input); - entity=await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); + foreach (var detail in entity.Details) + { + var balanceDto = await _balanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + if (balanceDto.Qty < detail.Qty || balanceDto.Qty < 0) + { + throw new UserFriendlyException($"您申请的【ERP料号】{detail.ItemCode}【库位】{detail.FromLocationCode}【箱码】{detail.FromPackingCode}【状态】{detail.FromStatus}【数量】{detail.Qty}的库存," + + $"在实际库存中查询到【ERP料号】{balanceDto.ItemCode}【库位】{balanceDto.LocationCode}【箱码】{balanceDto.PackingCode}【状态】{balanceDto.Status}【数量】{balanceDto.Qty}" + + $"【库存不足】"); + } + } + + entity =await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false); var dto = ObjectMapper.Map(entity); @@ -333,6 +362,19 @@ public class TransferNoteAppService : SfsStoreWithDetailsAppServiceBase foreach (var entity in entitys) { + foreach (var detail in entity.Details) + { + var balanceDto = await _balanceAppService.GetByItemLocationPackingAndStatusAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); + + if (balanceDto.Qty < detail.Qty || balanceDto.Qty < 0) + { + throw new UserFriendlyException($"您申请的【ERP料号】{detail.ItemCode}【库位】{detail.FromLocationCode}【箱码】{detail.FromPackingCode}【状态】{detail.FromStatus}【数量】{detail.Qty}的库存," + + $"在实际库存中查询到【ERP料号】{balanceDto.ItemCode}【库位】{balanceDto.LocationCode}【箱码】{balanceDto.PackingCode}【状态】{balanceDto.Status}【数量】{balanceDto.Qty}" + + $"【库存不足】"); + } + } + resultEntity.Add(await _transferNoteManager.CreateAsync(entity).ConfigureAwait(false)); _ = ObjectMapper.Map(entity); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs index 988f11b7c..112ddd33e 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs @@ -35,17 +35,6 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges { var entity = eventData.Entity; - foreach (var detail in entity.Details) - { - var balanceDto = await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.FromPackingCode, - detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); - - if (balanceDto.Qty < detail.Qty&& balanceDto.Qty <= 0) - { - throw new UserFriendlyException($"{balanceDto.ItemCode}在库位{balanceDto.LocationCode}中库存不足"); - } - } - switch (entity.Type) { case "Transfer_Inside": diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs index 7ca884bdb..13d067bdd 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Transactions/TransferNoteEventHandler.cs @@ -42,17 +42,6 @@ public class TransferNoteEventHandler { var entity = eventData.Entity; - foreach (var detail in entity.Details) - { - var balanceDto=await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.FromPackingCode, - detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); - - if (balanceDto.Qty < detail.Qty) - { - throw new UserFriendlyException($"{balanceDto.ItemCode}在库位{balanceDto.LocationCode}中库存不足"); - } - } - var route = entity.UseOnTheWayLocation ? EnumTransferRoute.SourceToOnTheWay : EnumTransferRoute.SourceToDestination; @@ -72,17 +61,6 @@ public class TransferNoteEventHandler { foreach (var entity in eventData.Entity) { - foreach (var detail in entity.Details) - { - var balanceDto = await _balanceAppService.GetRealQtyByPackingCodeAndItemCodeAndLocationCodeAndStatusAsync(detail.FromPackingCode, - detail.ItemCode, detail.FromLocationCode, detail.FromStatus).ConfigureAwait(false); - - if (balanceDto.Qty < detail.Qty&&balanceDto.Qty <= 0) - { - throw new UserFriendlyException($"{balanceDto.ItemCode}在库位{balanceDto.LocationCode}中库存不足"); - } - } - var route = entity.UseOnTheWayLocation ? EnumTransferRoute.SourceToOnTheWay : EnumTransferRoute.SourceToDestination;