diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs index 34a5aee52..de58a3987 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.Domain.Fawtyg.Mes/MesOut/MesOut.cs @@ -11,6 +11,10 @@ public class MesOut : Entity [Key] public string Mesout_ref_nbr { get; set; } /// + /// 条码号(20240430添加) + /// + public string Mesout_barcode { get; set; } + /// /// 调出储位 /// public string Mesout_id { get; set; } @@ -19,6 +23,10 @@ public class MesOut : Entity /// public string Mesout_part { get; set; } /// + /// 质量补标识(20240430添加) + /// + public string Mesout_quality { get; set; } + /// /// 日期 /// public string Mesout_date { get; set; } diff --git a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs index 61d77b269..0b8bdd2ff 100644 --- a/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs +++ b/be/DataExchange/Fawtyg/Win_in.Sfs.Wms.DataExchange.EntityFrameworkCore.Fawtyg.Mes/MesOut/MesOutDbContextModelCreatingExtensions.cs @@ -17,8 +17,10 @@ public static class MesOutDbContextModelCreatingExtensions //Properties b.Property(q => q.Mesout_ref_nbr).HasMaxLength(36); + b.Property(q => q.Mesout_barcode).HasMaxLength(20); b.Property(q => q.Mesout_id).HasMaxLength(1); b.Property(q => q.Mesout_part).HasMaxLength(20); + b.Property(q => q.Mesout_quality).HasMaxLength(20); b.Property(q => q.Mesout_date).HasMaxLength(8); b.Property(q => q.Mesout_move).HasPrecision(18, 2); b.Property(q => q.Mesout_unable).HasPrecision(18, 2); diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs index 4120b94f6..6a6071789 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Agent/IncomingToWmsWorker.cs @@ -169,7 +169,7 @@ public class IncomingToWmsWorker : AsyncPeriodicBackgroundWorkerBase await incomingToWms.HandleAsnsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.ProductReceipt: - await SendProductReceipt(workerContext, incomingToWms).ConfigureAwait(false); + await incomingToWms.HandleProductReceiptsAsync(workerContext).ConfigureAwait(false); break; case EnumIncomingDataType.MaterialRequest: await incomingToWms.HandleMaterialRequestsAsync(workerContext).ConfigureAwait(false); diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductReceiptNote/ProductReceiptNoteDetailExchangeDto.cs b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductReceiptNote/ProductReceiptNoteDetailExchangeDto.cs index 1ee7279d5..fe2722182 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductReceiptNote/ProductReceiptNoteDetailExchangeDto.cs +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/WMS/ProductReceiptNote/ProductReceiptNoteDetailExchangeDto.cs @@ -61,4 +61,15 @@ public class ProductReceiptNoteDetailExchangeDto /// 仓库 /// public string WarehouseCode { get; set; } + + /// + /// Mes条码号 + /// + [Display(Name = "Mes条码号")] + public string MesBarCode { get; set; } + /// + /// Mes质量补标识 + /// + [Display(Name = "Mes质量补标识")] + public string MesQuality { get; set; } } diff --git a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml index a9660cc25..e614f4317 100644 --- a/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml +++ b/be/DataExchange/src/Win_in.Sfs.Wms.DataExchange.Application.Contracts/Win_in.Sfs.Wms.DataExchange.Application.Contracts.xml @@ -861,6 +861,16 @@ 仓库 + + + Mes条码号 + + + + + Mes质量补标识 + + 完工时间 diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs index da616e239..59739fcba 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/ItemBasics/IItemBasicAppService.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Win_in.Sfs.Basedata.tests; using Win_in.Sfs.Shared.Application.Contracts; using Win_in.Sfs.Shared.Domain.Shared; @@ -26,4 +27,5 @@ public interface IItemBasicAppService Task UpsertAsyncByInterface(ItemBasicEditInput input); Task UpsertStdPackQtyAsync(string itemCode, decimal stdpackqty); + Task GetErpCodeByMesBarCode(string BarCode); } diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/ErpCodeRequest.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/ErpCodeRequest.cs new file mode 100644 index 000000000..ebd3c4da9 --- /dev/null +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/tests/ErpCodeRequest.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; + +namespace Win_in.Sfs.Basedata.tests; +[Serializable] +public class ErpCodeRequest +{ + public string ErpCode { set; get; } + public string ProductType { set; get; } + + + public string ProductColor { set; get; } + + public string ProductState { set; get; } + + public string ProductProperty { set; get; } + + public string From { set; get; } +} diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs index fc7d9b96d..b5a28e7d7 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Items/ItemBasicAppService.cs @@ -14,6 +14,7 @@ using Volo.Abp.Validation; using Win_in.Sfs.Basedata.Application.Contracts; using Win_in.Sfs.Basedata.Domain; using Win_in.Sfs.Basedata.Domain.Shared; +using Win_in.Sfs.Basedata.tests; using Win_in.Sfs.Shared.Domain; using Win_in.Sfs.Shared.Domain.Shared; @@ -231,4 +232,19 @@ public class ItemBasicAppService } #endregion + [HttpPost("get-erp-code-by-mes-barcode")] + public virtual async Task GetErpCodeByMesBarCode(string BarCode) + { + var itemBasic = await _repository.GetAsync(p => p.Code == BarCode).ConfigureAwait(false); + + ErpCodeRequest rest = new ErpCodeRequest(); + rest.ErpCode = itemBasic.Code; + rest.ProductType = itemBasic.Type; + rest.ProductColor = itemBasic.Color; + rest.ProductState = itemBasic.Status.ToString(); + rest.ProductProperty = "油漆件"; + rest.From = "WIPT"; + return rest; + } + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/DTOs/ProductReceiptNoteDetailDTO.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/DTOs/ProductReceiptNoteDetailDTO.cs index 9003ca7c8..361859c3f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/DTOs/ProductReceiptNoteDetailDTO.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/DTOs/ProductReceiptNoteDetailDTO.cs @@ -39,5 +39,14 @@ public class ProductReceiptNoteDetailDTO : SfsStoreRecommendToDetailWithLotPacki /// [Display(Name = "返线数量")] public decimal ReturnQty { get; set; } - + /// + /// Mes条码号 + /// + [Display(Name = "Mes条码号")] + public string MesBarCode { get; set; } + /// + /// Mes质量补标识 + /// + [Display(Name = "Mes质量补标识")] + public string MesQuality { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/Inputs/ProductReceiptNoteDetailInput.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/Inputs/ProductReceiptNoteDetailInput.cs index 3077c723f..292379dfc 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/Inputs/ProductReceiptNoteDetailInput.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application.Contracts/Notes/ProductReceiptNotes/Inputs/ProductReceiptNoteDetailInput.cs @@ -45,4 +45,14 @@ public class ProductReceiptNoteDetailInput : SfsStoreRecommendToDetailWithLotPac /// [Display(Name = "返线数量")] public decimal ReturnQty { get; set; } + /// + /// Mes条码号 + /// + [Display(Name = "Mes条码号")] + public string MesBarCode { get; set; } + /// + /// Mes质量补标识 + /// + [Display(Name = "Mes质量补标识")] + public string MesQuality { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/GaoTongs/GaoTongAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/GaoTongs/GaoTongAppService.cs new file mode 100644 index 000000000..f7f61320f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/GaoTongs/GaoTongAppService.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Win_in.Sfs.Wms.Store.GaoTongs; +internal class GaoTongAppService +{ +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/GaoTongs/GaoTongAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/GaoTongs/GaoTongAutoMapperProfile.cs new file mode 100644 index 000000000..5de41e865 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/GaoTongs/GaoTongAutoMapperProfile.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using AutoMapper; + +namespace Win_in.Sfs.Wms.Store.Application; + +public partial class StoreApplicationAutoMapperProfile : Profile +{ + private void GaoTongAutoMapperProfile() + { + } +} + 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 b22c253d6..e1aee60b2 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 @@ -32,5 +32,14 @@ public enum EnumExchangeDataType //回收料调整 Item_Transform = 28, //半成品上架 - SemiPutaway = 29 + SemiPutaway = 29, + /// + /// 注塑发料 + /// + InjectionIssue=30, + /// + /// 涂装发料 + /// + CoatingIssue=31, + } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteDetail.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteDetail.cs index a6cf2c8a2..36379e3cf 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteDetail.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Domain/Notes/ProductReceiptNotes/ProductReceiptNoteDetail.cs @@ -26,4 +26,13 @@ public class ProductReceiptNoteDetail : SfsStoreRecommendToDetailWithLotPackingQ /// 返线数量 /// public decimal ReturnQty { get; set; } + + /// + /// Mes条码号 + /// + public string MesBarCode { get; set; } + /// + /// Mes质量补标识 + /// + public string MesQuality { get; set; } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDbContextModelCreatingExtensions.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDbContextModelCreatingExtensions.cs index 48cb6c311..d127a8e5f 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDbContextModelCreatingExtensions.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.EntityFrameworkCore/Notes/ProductReceiptNotes/ProductReceiptNoteDbContextModelCreatingExtensions.cs @@ -54,7 +54,8 @@ public static class ProductReceiptNoteDbContextModelCreatingExtensions b.Property(q => q.LocationCode).HasMaxLength(SfsPropertyConst.CodeLength); b.Property(q => q.ReturnQty).HasDefaultValue(0); b.Property(q => q.Remark).HasMaxLength(SfsPropertyConst.RemarkLength); - + b.Property(q => q.MesBarCode).HasMaxLength(SfsPropertyConst.CodeLength); + b.Property(q => q.MesQuality).HasMaxLength(SfsPropertyConst.CodeLength); //Relations //Indexes diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductReceiveJobAutoMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductReceiveJobAutoMapperProfile.cs index 1057b5a5c..306212009 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductReceiveJobAutoMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Jobs/ProductReceiveJobAutoMapperProfile.cs @@ -45,6 +45,8 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.Shift) .Ignore(x => x.Remark) .Ignore(x => x.ArriveDate) + .Ignore(x => x.MesBarCode) + .Ignore(x => x.MesQuality) ; CreateMap() diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ProductReceiptRequestMapperProfile.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ProductReceiptRequestMapperProfile.cs index 865415fd1..f966e48c8 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ProductReceiptRequestMapperProfile.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/AutoMapperProfiles/Requests/ProductReceiptRequestMapperProfile.cs @@ -28,6 +28,8 @@ public partial class StoreEventAutoMapperProfile : Profile .Ignore(x => x.RawLocationCode).Ignore(x => x.Shift).Ignore(x => x.ProdLine) .Ignore(x => x.Status) .Ignore(x => x.ContainerCode) + .Ignore(x => x.MesBarCode) + .Ignore(x => x.MesQuality) .IgnoreIHasRecommendAndHandledTo(); } } diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs new file mode 100644 index 000000000..de0a95320 --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/CoatingIssueNoteEventHandler.cs @@ -0,0 +1,107 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain; +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.Notes.IssueNotes; + +namespace Win_in.Sfs.Wms.Store.Event.DataExchanges; + +/// +/// 涂装发料记录传给TYRP(线边领料单) +/// +public class CoatingIssueNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.CoatingIssue; + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + if (string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledFromLocationErpCode = location.ErpLocationCode; + detail.HandledFromLocationGroup = location.LocationGroupCode; + detail.HandledFromLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + { + detail.HandledFromWarehouseCode = location.WarehouseCode; + } + } + } + + if (string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledToLocationErpCode = location.ErpLocationCode; + detail.HandledToLocationGroup = location.LocationGroupCode; + detail.HandledToLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + { + detail.HandledToWarehouseCode = location.WarehouseCode; + } + } + } + + } + + var toErpDto = new List(); + foreach (var item in dtos) + { + if (item.Details != null && item.Details.Count != 0) + { + toErpDto.Add(item); + } + } + + //2023-12-6要求同储位不传入接口 按历史规则 + var result = new List(); + foreach (var injectionIssueNoteDto in toErpDto) + { + injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + if (injectionIssueNoteDto.Details.Count > 0) + { + result.Add(injectionIssueNoteDto); + } + } + + if (result.Count > 0) + { + var exchangeDataerp = + await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) + .ConfigureAwait(false); + await AddManyAsync(exchangeDataerp).ConfigureAwait(false); + } + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs new file mode 100644 index 000000000..f5e09482f --- /dev/null +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/InjectionIssueNoteEventHandler.cs @@ -0,0 +1,106 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.EventBus; +using Volo.Abp.Uow; +using Win_in.Sfs.Shared.Domain; +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; + +/// +/// 注塑发料记录传给TYRP(线边领料单) +/// +public class InjectionIssueNoteEventHandler + : StoreDataExchangeEventHandlerBase + , ILocalEventHandler> + , ILocalEventHandler>> +{ + + private const EnumExchangeDataType ExchangeDataType = EnumExchangeDataType.InjectionIssue; + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData eventData) + { + var entity = eventData.Entity; + await AddExchangeDataAsync(entity).ConfigureAwait(false); + } + + [UnitOfWork] + public virtual async Task HandleEventAsync(SfsCreatedEntityEventData> eventData) + { + var entities = eventData.Entity; + await AddExchangeDataAsync(entities).ConfigureAwait(false); + } + + protected override async Task AddExchangeDataAsync(List entities) + { + var dtos = ObjectMapper.Map, List>(entities); + foreach (var detail in dtos.SelectMany(dto => dto.Details)) + { + if(string.IsNullOrEmpty(detail.HandledFromLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledFromLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledFromLocationErpCode = location.ErpLocationCode; + detail.HandledFromLocationGroup = location.LocationGroupCode; + detail.HandledFromLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledFromWarehouseCode)) + { + detail.HandledFromWarehouseCode = location.WarehouseCode; + } + } + } + + if(string.IsNullOrEmpty(detail.HandledToLocationErpCode)) + { + var location = await LocationAclService.GetByCodeAsync(detail.HandledToLocationCode).ConfigureAwait(false); + if (location != null) + { + detail.HandledToLocationErpCode = location.ErpLocationCode; + detail.HandledToLocationGroup = location.LocationGroupCode; + detail.HandledToLocationArea = location.AreaCode; + + if (string.IsNullOrEmpty(detail.HandledToWarehouseCode)) + { + detail.HandledToWarehouseCode = location.WarehouseCode; + } + } + } + + } + + var toErpDto = new List(); + foreach (var item in dtos) + { + if (item.Details != null && item.Details.Count != 0) + { + toErpDto.Add(item); + } + } + + //2023-12-6要求同储位不传入接口 按历史规则 + var result = new List(); + foreach (var injectionIssueNoteDto in toErpDto) + { + injectionIssueNoteDto.Details.RemoveAll(p => p.HandledFromLocationErpCode == p.HandledToLocationErpCode); + if (injectionIssueNoteDto.Details.Count > 0) + { + result.Add(injectionIssueNoteDto); + } + } + + if (result.Count > 0) + { + var exchangeDataerp = + await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, ExchangeDataType, result) + .ConfigureAwait(false); + await AddManyAsync(exchangeDataerp).ConfigureAwait(false); + } + } + +} diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs index abd58f12a..7adb5dde4 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Event/DataExchanges/ThirdLocationNoteEventHandler.cs @@ -32,10 +32,9 @@ namespace Win_in.Sfs.Wms.Store.Event.DataExchanges await AddExchangeDataAsync(entity).ConfigureAwait(false); } - protected override async Task AddExchangeDataAsync(List entities) { - var dtos = ObjectMapper.Map, List>(entities); + var dtos = ObjectMapper.Map, List>(entities); var exchangeData = await BuildExchangeDataAsync(StoreEventConsts.WMS, StoreEventConsts.ERP, EnumExchangeDataType.Transfer, dtos).ConfigureAwait(false); await AddManyAsync(exchangeData).ConfigureAwait(false);