diff --git a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs index ead6be2c7..b6d428c62 100644 --- a/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs +++ b/be/Hosts/WmsPda.Host/Win_in.Sfs.Wms.Pda.Host/Controllers/Jobs/JobController.cs @@ -71,7 +71,7 @@ public class JobController : AbpController /// /// [HttpGet("")] - public virtual async Task> CountAsync() + public virtual async Task> CountAsync(bool isToday) { var wlgCodes = await _userWorkGroupAppService.GetCodsOfCurrentUserAsync().ConfigureAwait(false); var jsonCodes = JsonSerializer.Serialize(wlgCodes); @@ -146,7 +146,7 @@ public class JobController : AbpController }).ConfigureAwait(false); list.Add(new JobCountDto { JobType = EnumJobType.ProductReceiveJob, Count = productReceiveJobs }); - var purchaseReceiptJobs = await _purchaseReceiptJobAppService.GetCountByFilterAsync(new SfsJobRequestInputBase + var purchaseReceiptJobRequest = new SfsJobRequestInputBase { Condition = new Condition { @@ -156,8 +156,12 @@ public class JobController : AbpController new(nameof(PurchaseReceiptJobDTO.JobStatus),jsonStatus,"In") } } - }).ConfigureAwait(false); - list.Add(new JobCountDto { JobType = EnumJobType.PurchaseReceiptJob, Count = purchaseReceiptJobs }); + }; + if (isToday)//只看当日 + { + purchaseReceiptJobRequest.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), Clock.Now.ToString("yyyy-MM-dd"), ">=", "And")); + purchaseReceiptJobRequest.Condition.Filters.Add(new Filter(nameof(PurchaseReceiptJobDTO.PlanArriveDate), Clock.Now.AddDays(1).ToString("yyyy-MM-dd"), "<=", "And")); + } var purchaseReturnJobs = await _purchaseReturnJobAppService.GetCountByFilterAsync(new SfsJobRequestInputBase { diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs index 37c115932..a7babf41a 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Domain/Balances/BalanceManager.cs @@ -105,6 +105,15 @@ public class BalanceManager : DomainService, IBalanceManager } else { + if (existBalance.IsActive == false) + { + throw new UserFriendlyException($"库位在{existBalance.LocationCode}," + + $"物品编号为{existBalance.ItemCode}," + + $"箱码为{existBalance.PackingCode}," + + $"批次为{existBalance.Lot}," + + $"状态为{existBalance.Status.GetDisplayName()}" + + $"的库存是不可用状态"); + } //如果单件管理的库存已存在,报错 transaction.CheckSingleUnitHasExist(); existBalance.IncreaseQty(transaction.Qty); @@ -202,6 +211,16 @@ public class BalanceManager : DomainService, IBalanceManager } else { + if (existBalance.IsActive == false) + { + throw new UserFriendlyException($"库位在{existBalance.LocationCode}," + + $"物品编号为{existBalance.ItemCode}," + + $"箱码为{existBalance.PackingCode}," + + $"批次为{existBalance.Lot}," + + $"状态为{existBalance.Status}" + + $"的库存是不可用状态"); + } + existBalance.IncreaseQty(transaction.Qty); switch (existBalance.Qty) { diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs index 4c096c02d..ddd82519b 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Requests/TransferRequests/Inputs/TransferRequestImportInput.cs @@ -14,6 +14,8 @@ public class TransferRequestImportInput : SfsStoreImportInputBase [Required(ErrorMessage = "{0}是必填项")] [ImporterHeader(Name = "调拨类型")] [ExporterHeader(DisplayName = "调拨类型")] + [ValueMapping("区域间调拨(储位调拨)", EnumTransSubType.Transfer_Area)] + [ValueMapping("线边调拨(线边仓调拨)", EnumTransSubType.Transfer_WIP)] [ValueMapping("客户库位调拨(客户储位调拨)", EnumTransSubType.Transfer_Customer)] public string Type { get; set; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs index 9407d0b7e..2316a0843 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/ScrapNotes/ScrapNoteAppService.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Application.Dtos; using Volo.Abp.EventBus; +using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Wms.Store.Application.Contracts; using Win_in.Sfs.Wms.Store.Domain; using Win_in.Sfs.Wms.Store.Domain.Shared; @@ -27,9 +28,14 @@ public class ScrapNoteAppService : ScrapNoteDetail, ScrapNoteDetailDTO, SfsStoreRequestInputBase, ScrapNoteImportInput>, IScrapNoteAppService { + private readonly ILocationAppService _locationAppService; + private readonly IItemBasicAppService _itemBasicAppService; + public ScrapNoteAppService( - IScrapNoteRepository repository) : base(repository) + IScrapNoteRepository repository, ILocationAppService locationAppService, IItemBasicAppService itemBasicAppService) : base(repository) { + _locationAppService = locationAppService; + _itemBasicAppService = itemBasicAppService; } [HttpPost("")] @@ -42,7 +48,24 @@ public class ScrapNoteAppService : foreach (var detail in entity.Details) { + var fromLocation=await _locationAppService.GetByCodeAsync(detail.FromLocationCode).ConfigureAwait(false); + var toLocation =await _locationAppService.GetByCodeAsync(detail.ToLocationCode).ConfigureAwait(false); + var itemBasicDto =await _itemBasicAppService.GetByCodeAsync(detail.ItemCode).ConfigureAwait(false); + detail.SetIdAndNumber(GuidGenerator, entity.Id, entity.Number); + detail.FromLocationArea = fromLocation.AreaCode; + detail.FromLocationErpCode = fromLocation.ErpLocationCode; + detail.FromLocationGroup = fromLocation.LocationGroupCode; + detail.FromWarehouseCode = fromLocation.WarehouseCode; + + detail.ToLocationArea = toLocation.AreaCode; + detail.ToLocationErpCode = toLocation.ErpLocationCode; + detail.ToLocationGroup = toLocation.LocationGroupCode; + detail.ToWarehouseCode = toLocation.WarehouseCode; + + detail.ToStatus = detail.FromStatus; + detail.Uom = itemBasicDto.BasicUom; + detail.StdPackQty = itemBasicDto.StdPackQty; } entity = await _repository.InsertAsync(entity).ConfigureAwait(false); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs index be7623764..d23d8c20f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/ScrapRequests/ScrapRequestAppService.cs @@ -70,20 +70,22 @@ public class ScrapRequestAppService : SfsStoreRequestAppServiceBase scrapRequest.Type = scrapRequest.Type; EnumTransSubType enumTransSubType = 0; - if (scrapRequest.Type == "原料报废") { enumTransSubType = EnumTransSubType.Scrap_Manual; + scrapRequest.Type = EnumTransSubType.Scrap_Manual.ToString(); } if (scrapRequest.Type== "线边报废") { enumTransSubType = EnumTransSubType.Scrap_WIP; + scrapRequest.Type = EnumTransSubType.Scrap_WIP.ToString(); } if (scrapRequest.Type == "完工报废") { enumTransSubType = EnumTransSubType.Scrap_Product; + scrapRequest.Type= EnumTransSubType.Scrap_Product.ToString(); } await SetEntityPropertiesAsync(scrapRequest, enumTransSubType).ConfigureAwait(false); 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 409de9b89..c0b214534 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 @@ -64,54 +64,87 @@ public class TransferRequestAppService : SfsStoreRequestAppServiceBase foreach (var transferRequest in addList) { - if (transferRequest.Type == EnumTransSubType.Transfer_Customer.GetDisplayName()) //客户储位调拨 + EnumTransSubType enumTransSubType = EnumTransSubType.None; + + //储位 + if (transferRequest.Type == EnumTransSubType.Transfer_Area.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_Area.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Area; + transferRequest.UseOnTheWayLocation = false; + } + //储位内 + if (transferRequest.Type == EnumTransSubType.Transfer_Inside.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_Inside.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Inside; + transferRequest.UseOnTheWayLocation = false; + } + + //库间 + if (transferRequest.Type == EnumTransSubType.Transfer_Warehouse.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_Warehouse.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Warehouse; + transferRequest.UseOnTheWayLocation = true; + } + //客户储位 + if (transferRequest.Type == EnumTransSubType.Transfer_Customer.GetDisplayName()) { transferRequest.Type = EnumTransSubType.Transfer_Customer.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_Customer; + transferRequest.UseOnTheWayLocation = true; + } + //线边调拨 + if (transferRequest.Type == EnumTransSubType.Transfer_WIP.GetDisplayName()) + { + transferRequest.Type = EnumTransSubType.Transfer_WIP.ToString(); //重点 需要转换 + enumTransSubType = EnumTransSubType.Transfer_WIP; transferRequest.UseOnTheWayLocation = true; + } - foreach (var detail in transferRequest.Details) - { - var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, - detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); - var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) - .ConfigureAwait(false); - - detail.ItemCode = balanceDto.ItemCode; - detail.ArriveDate = balanceDto.ArriveDate; - detail.ItemDesc1 = balanceDto.ItemDesc1; - detail.ItemDesc2 = balanceDto.ItemDesc2; - detail.ItemName = balanceDto.ItemName; - detail.ProduceDate = balanceDto.ProduceDate; - detail.Qty = balanceDto.Qty; - detail.Uom = balanceDto.Uom; - detail.ExpireDate = balanceDto.ExpireDate; - detail.StdPackQty = balanceDto.StdPackQty; - detail.SupplierBatch = balanceDto.SupplierBatch; - - detail.FromLocationArea = balanceDto.LocationArea; - detail.FromContainerCode = balanceDto.ContainerCode; - detail.FromLocationErpCode = balanceDto.LocationErpCode; - detail.FromLocationGroup = balanceDto.LocationGroup; - detail.FromPackingCode = balanceDto.PackingCode; - detail.FromLocationArea = balanceDto.LocationArea; - detail.FromStatus = balanceDto.Status; - detail.FromWarehouseCode = balanceDto.WarehouseCode; - detail.FromLot = balanceDto.Lot; - - detail.ToLocationArea = toLocationDto.AreaCode; - detail.ToLocationErpCode = toLocationDto.LocationGroupCode; - detail.ToLocationGroup = toLocationDto.LocationGroupCode; - detail.ToWarehouseCode = toLocationDto.WarehouseCode; - detail.ToContainerCode = balanceDto.ContainerCode; - detail.ToPackingCode = balanceDto.PackingCode; - detail.ToLocationArea = balanceDto.LocationArea; - detail.ToStatus = balanceDto.Status; - detail.ToLot = balanceDto.Lot; - } - - await SetEntityPropertiesAsync(transferRequest, EnumTransSubType.Transfer_Customer) + foreach (var detail in transferRequest.Details) + { + var balanceDto = await _balanceAppService.GetByItemLocationAndPackingAsync(detail.FromPackingCode, + detail.ItemCode, detail.FromLocationCode).ConfigureAwait(false); + var toLocationDto = await _locationAppService.GetByCodeAsync(detail.ToLocationCode) .ConfigureAwait(false); + + detail.ItemCode = balanceDto.ItemCode; + detail.ArriveDate = balanceDto.ArriveDate; + detail.ItemDesc1 = balanceDto.ItemDesc1; + detail.ItemDesc2 = balanceDto.ItemDesc2; + detail.ItemName = balanceDto.ItemName; + detail.ProduceDate = balanceDto.ProduceDate; + detail.Qty = detail.Qty; + detail.Uom = balanceDto.Uom; + detail.ExpireDate = balanceDto.ExpireDate; + detail.StdPackQty = balanceDto.StdPackQty; + detail.SupplierBatch = balanceDto.SupplierBatch; + + detail.FromLocationArea = balanceDto.LocationArea; + detail.FromContainerCode = balanceDto.ContainerCode; + detail.FromLocationErpCode = balanceDto.LocationErpCode; + detail.FromLocationGroup = balanceDto.LocationGroup; + detail.FromPackingCode = balanceDto.PackingCode; + detail.FromLocationArea = balanceDto.LocationArea; + detail.FromStatus = balanceDto.Status; + detail.FromWarehouseCode = balanceDto.WarehouseCode; + detail.FromLot = balanceDto.Lot; + + detail.ToLocationArea = toLocationDto.AreaCode; + detail.ToLocationErpCode = toLocationDto.LocationGroupCode; + detail.ToLocationGroup = toLocationDto.LocationGroupCode; + detail.ToWarehouseCode = toLocationDto.WarehouseCode; + detail.ToContainerCode = balanceDto.ContainerCode; + detail.ToPackingCode = balanceDto.PackingCode; + detail.ToLocationArea = balanceDto.LocationArea; + detail.ToStatus = balanceDto.Status; + detail.ToLot = balanceDto.Lot; } + + await SetEntityPropertiesAsync(transferRequest, enumTransSubType) + .ConfigureAwait(false); } return dictionary; diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs index 630967205..77e876b6f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/UnplannedIssueRequests/UnplannedIssueRequestForDongyangAppService.cs @@ -107,7 +107,7 @@ public class UnplannedIssueRequestForDongyangAppService : UnplannedIssueRequestA detail.Lot = balance.Lot; detail.ContainerCode = balance.ContainerCode; detail.PackingCode = balance.PackingCode; - detail.Qty = balance.Qty; + detail.Qty = detail.Qty; detail.Status = balance.Status; } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs index 819a11568..5b0d6f098 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Requests/WipWarehouseAdjustRequests/WipWarehouseAdjustRequestAppService.cs @@ -134,6 +134,7 @@ public class WipWarehouseAdjustRequestAppService : SfsStoreRequestAppServiceBase /// 新增实体 /// /// CreateInput + [HttpPost("")] public override async Task CreateAsync(WipWarehouseAdjustRequestEditInput input) { var entity = ObjectMapper.Map(input); diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs index 4dae593bf..70535ce5f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/ExchangeDatas/EnumExchangeDataType.cs @@ -25,4 +25,10 @@ public enum EnumExchangeDataType RecycledMaterialReceipt = 23, ProductRecycle = 24, PurchaseOrder = 25, + //报废 + Scrap = 26, + //线边调整 + WipAdjust = 27, + //回收料调整 + Item_Transform = 28 } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs index bec022137..eb5563c21 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Notes/TransferNoteAutoMapperProfile.cs @@ -29,6 +29,14 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.WarehouseCode) ; + CreateMap() + .Ignore(x => x.ExtraProperties) + .Ignore(x => x.DocNumber) + .Ignore(x => x.JobNumber) + .Ignore(x => x.Worker) + .Ignore(x => x.TransType) + .Ignore(x => x.TransSubType) + ; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ItemTransformNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ItemTransformNoteEventHandler.cs new file mode 100644 index 000000000..7675ee335 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ItemTransformNoteEventHandler.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Basedata.Application.Contracts; +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; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges +{ + public class ItemTransformNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + { + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.Item_Transform; + private const EnumTransSubType TransSubType = EnumTransSubType.Item_Transform; + private readonly ILocationAppService _locationAppService; + + public ItemTransformNoteEventHandler(ILocationAppService locationAppService) + { + _locationAppService = locationAppService; + } + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity); + } + + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + + foreach (var dto in dtos) + { + dto.Type = TransSubType.ToString(); + } + + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos); + await AddManyAsync(exchangeData); + } + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs index 44b1939c4..5dcc31266 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ScrapNoteEventHandler.cs @@ -47,7 +47,7 @@ public class ScrapNoteEventHandler } else { - var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.UnplannedIssue, dtos).ConfigureAwait(false); + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Scrap, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false); } } 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 new file mode 100644 index 000000000..290228ac9 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/TransferNoteEventHandler.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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.Domain.Acl.Location; +using Win_in.Sfs.Wms.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using ILocationAclService = Win_in.Sfs.Wms.Store.Domain.Acl.Location.ILocationAclService; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges +{ + public class TransferNoteEventHandler : + StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + { + private readonly Domain.Acl.Location.ILocationAclService _locationAclService; + + public TransferNoteEventHandler(ILocationAclService locationAclService) + { + _locationAclService = locationAclService; + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); + } + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); + await AddManyAsync(exchangeData).ConfigureAwait(false); + + } + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/WipWarehouseAdjustNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/WipWarehouseAdjustNoteEventHandler.cs new file mode 100644 index 000000000..d007e6653 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/WipWarehouseAdjustNoteEventHandler.cs @@ -0,0 +1,56 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +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.Store.Application.Contracts; +using Win_in.Sfs.Wms.Store.Domain; +using Win_in.Sfs.Wms.Store.Domain.Acl.Location; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges +{ + public class WipWarehouseAdjustNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> + { + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.WipAdjust; + + private ILocationAclService _locationAclService; + + public WipWarehouseAdjustNoteEventHandler(ILocationAclService locationAclService) + { + _locationAclService = locationAclService; + } + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity); + } + + + + [Volo.Abp.Uow.UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + await detail.TrySetLocationAsync(_locationAclService).ConfigureAwait(false); + } + var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, dtos).ConfigureAwait(false); + await AddManyAsync(exchangeData).ConfigureAwait(false); + } + + } +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs index 8bfaac66e..3ddb84994 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/IHasLocationDtoExtensions.cs @@ -16,6 +16,8 @@ public static class IHasLocationExtensions { hasLocation.LocationErpCode = location.ErpLocationCode; hasLocation.WarehouseCode = location.WarehouseCode; + hasLocation.LocationArea = location.AreaCode; + hasLocation.LocationGroup = location.LocationGroupCode; } } } @@ -28,6 +30,9 @@ public static class IHasLocationExtensions if (location != null) { hasFromTolocation.FromLocationErpCode = location.ErpLocationCode; + hasFromTolocation.FromLocationGroup = location.LocationGroupCode; + hasFromTolocation.FromLocationArea = location.AreaCode; + if (string.IsNullOrEmpty(hasFromTolocation.FromWarehouseCode)) { hasFromTolocation.FromWarehouseCode = location.WarehouseCode; @@ -40,6 +45,8 @@ public static class IHasLocationExtensions var location = await locationAclService.GetByCodeAsync(hasFromTolocation.ToLocationCode).ConfigureAwait(false); if (location != null) { + hasFromTolocation.ToLocationArea = location.AreaCode; + hasFromTolocation.ToLocationGroup = location.LocationGroupCode; hasFromTolocation.ToLocationErpCode = location.ErpLocationCode; if (string.IsNullOrEmpty(hasFromTolocation.ToWarehouseCode)) {