diff --git a/InterFaceContorl/Dy_Exchange/.vs/Dy_Exchange/FileContentIndex/6504a1ad-d5e9-4a09-8b41-a36867df4c91.vsidx b/InterFaceContorl/Dy_Exchange/.vs/Dy_Exchange/FileContentIndex/6504a1ad-d5e9-4a09-8b41-a36867df4c91.vsidx new file mode 100644 index 000000000..8a78dc1fe Binary files /dev/null and b/InterFaceContorl/Dy_Exchange/.vs/Dy_Exchange/FileContentIndex/6504a1ad-d5e9-4a09-8b41-a36867df4c91.vsidx differ diff --git a/InterFaceContorl/Dy_Exchange/.vs/Dy_Exchange/FileContentIndex/7ae11430-69da-4cbb-a5d6-711683136f00.vsidx b/InterFaceContorl/Dy_Exchange/.vs/Dy_Exchange/FileContentIndex/7ae11430-69da-4cbb-a5d6-711683136f00.vsidx new file mode 100644 index 000000000..5d765b3fe Binary files /dev/null and b/InterFaceContorl/Dy_Exchange/.vs/Dy_Exchange/FileContentIndex/7ae11430-69da-4cbb-a5d6-711683136f00.vsidx differ diff --git a/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.Development.json b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.Development.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.Development.json @@ -0,0 +1,2 @@ +{ +} diff --git a/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.json b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.json new file mode 100644 index 000000000..a83ccf263 --- /dev/null +++ b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.json @@ -0,0 +1,38 @@ +{ + "App": { + "CorsOrigins": "http://192.168.0.146:20033", + "Audit": { + "IsEnabled": false // 禁用审计功能 + // 其他审计相关设置项 + } + }, + "ConnectionStrings": { + "Default": "Server=.;Database=Dy_FasterZ_Exchange;uid=sa;pwd=sasa;timeout=6000;Encrypt=False;", + "Dy_Exchange": "Server=dev.ccwin-in.com,13319;Database=WMS_DongYang_DataExchange_CC;uid=ccwin-in;pwd=Microsoft@2022;timeout=60000;Encrypt=False;" + }, + "Redis": { + "Configuration": "127.0.0.1" + }, + + + + "AuthServer": { + "Authority": "http://192.168.1.75:60080", + "RequireHttpsMetadata": "false", + "SwaggerClientId": "Dy_Exchange_Swagger" + }, + "StringEncryption": { + "DefaultPassPhrase": "ybgU8NieQZNjguXe" + }, + "AlwaysAllowAuthorization": "true", + "urls": "http://192.168.1.75:60081", + "DataExchangeInterfaceOptions": { + "WmsCode": "WMS", + "CmdStartPath": "D:\\Proc_DyNevWms\\publish\\start.cmd", + "CmdClosePath1": "D:\\Proc_DyNevWms\\publish\\stop.cmd", + "CmdClosePath2": "D:\\Proc_DyNevWms\\publish\\TaskKill.exe", + "WmsUrl": "http://10.164.233.5:60085/swagger/AbpTenant/swagger.json" + + } +} + diff --git a/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.secrets.json b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.secrets.json new file mode 100644 index 000000000..7a73a41bf --- /dev/null +++ b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/appsettings.secrets.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/web.config b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/web.config new file mode 100644 index 000000000..5c90c7be6 --- /dev/null +++ b/InterFaceContorl/Dy_Exchange/src/Dy_Exchange.HttpApi.Host/bin/Release/net7.0/publish/web.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs index d103e423a..71ab4eef9 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/TransferRequests/TransferRequestAppService.cs @@ -39,16 +39,18 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase private readonly ITransferRequestManager _transferRequestManager; private readonly IBalanceAppService _balanceAppService; private readonly ILocationAppService _locationAppService; + private readonly ITransactionTypeAppService _transactionTypeAppService; public TransferRequestAppService( ITransferRequestRepository repository, ITransferRequestManager transferRequestManager, IBalanceAppService balanceAppService, - ILocationAppService locationAppService) : base(repository, transferRequestManager) + ILocationAppService locationAppService, ITransactionTypeAppService transactionTypeAppService) : base(repository, transferRequestManager) { _transferRequestManager = transferRequestManager; _balanceAppService = balanceAppService; _locationAppService = locationAppService; + _transactionTypeAppService = transactionTypeAppService; } #region 东阳使用 @@ -176,8 +178,11 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase private async Task SetEntityPropertiesAsync(TransferRequest entity, EnumTransSubType subType) { - var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType) - .ConfigureAwait(false); + //var tranType = await TransactionTypeAclService.GetByTransTypeAsync(EnumTransType.Transfer, subType) + // .ConfigureAwait(false); + + var tranType = await _transactionTypeAppService.GetByTransTypeAsync(EnumTransType.Transfer, subType).ConfigureAwait(false); + Check.NotNull(tranType, "事务类型", "事务类型不存在"); entity.Worker = CurrentUser.GetUserName(); 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 00a95d95a..988f11b7c 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 @@ -3,10 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Shared.Event; +using Win_in.Sfs.Wms.Inventory.Application.Contracts; using Win_in.Sfs.Wms.Inventory.Domain.Acl.Location; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; @@ -20,16 +22,30 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges , ILocalEventHandler> { private readonly Domain.Acl.Location.ILocationAclService _locationAclService; + private readonly IBalanceAppService _balanceAppService; - public TransferNoteEventHandler(ILocationAclService locationAclService) + public TransferNoteEventHandler(ILocationAclService locationAclService, IBalanceAppService balanceAppService) { _locationAclService = locationAclService; + _balanceAppService = balanceAppService; } [UnitOfWork] public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) { 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": @@ -39,13 +55,8 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges case "Transfer_Warehouse": case "Transfer_Customer": case "Transfer_WIP": - // entity.Handle(); - break; } - - - //await AddExchangeDataAsync(entity).ConfigureAwait(false); } public async Task HandleEventAsync(SfsConfirmedEntityEventData eventData) 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 0bea53dd2..7ca884bdb 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 @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.EventBus; using Volo.Abp.Uow; using Win_in.Sfs.Basedata.Application.Contracts; @@ -22,11 +23,13 @@ public class TransferNoteEventHandler private const EnumTransType TransType = EnumTransType.Transfer; private readonly ILocationAppService _locationAppService; private readonly ITransferLogAppService _transferLogAppService; + private readonly IBalanceAppService _balanceAppService; - public TransferNoteEventHandler(ITransferRequestAppService transferRequestApp, ILocationAppService locationAppService, ITransferLogAppService transferLogAppService) + public TransferNoteEventHandler(ITransferRequestAppService transferRequestApp, ILocationAppService locationAppService, ITransferLogAppService transferLogAppService, IBalanceAppService balanceAppService) { _locationAppService = locationAppService; _transferLogAppService = transferLogAppService; + _balanceAppService = balanceAppService; } /// @@ -39,29 +42,24 @@ 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; var inputList = await BuildTransferLogsAsync(entity, route).ConfigureAwait(false); - //switch (entity.Type) - //{ - // case "Transfer_Inside": - // case "Transfer_Area": - await AddTransferLogsAsync(inputList).ConfigureAwait(false); - // break; - // case "Transfer_Warehouse": - // case "Transfer_Customer": - // case "Transfer_WIP": - // // entity.Handle(); - - // break; - //} - - - - + await AddTransferLogsAsync(inputList).ConfigureAwait(false); } /// @@ -74,29 +72,26 @@ 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; var inputList = await BuildTransferLogsAsync(entity, route).ConfigureAwait(false); - //switch (entity.Type) - //{ - // case "Transfer_Inside": - // case "Transfer_Area": - await AddTransferLogsAsync(inputList).ConfigureAwait(false); - // break; - // case "Transfer_Warehouse": - // case "Transfer_Customer": - // case "Transfer_WIP": - // // entity.Handle(); - - // break; - //} - - + await AddTransferLogsAsync(inputList).ConfigureAwait(false); - + throw new UserFriendlyException("1"); } } @@ -176,7 +171,7 @@ public class TransferNoteEventHandler transferLog.ToLocationArea = toLocation.AreaCode; transferLog.ToLocationErpCode = toLocation.ErpLocationCode; transferLog.ToLocationGroup = toLocation.LocationGroupCode; - break;; + break; ; default: throw new ArgumentOutOfRangeException(nameof(route), route, null); } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Win_in.Sfs.Wms.Store.Event.csproj b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Win_in.Sfs.Wms.Store.Event.csproj index 9d0208cc2..d3cabb332 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Win_in.Sfs.Wms.Store.Event.csproj +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/Win_in.Sfs.Wms.Store.Event.csproj @@ -16,6 +16,7 @@ +