using System.Collections.Generic; using System.Linq; using System.Text.Json; using AutoMapper; using Volo.Abp.AutoMapper; using Volo.Abp.Domain.Entities; using Volo.Abp.Timing; using Win_in.Sfs.Scp.WebApi.Asns; namespace Win_in.Sfs.Scp.WebApi { public class WebApiApplicationAutoMapperProfile : Profile { public WebApiApplicationAutoMapperProfile() { /* You can configure your AutoMapper mapping configuration here. * Alternatively, you can split your mapping configurations * into multiple profile classes for a better organization. */ CreateMapPart(); CreateMapSupplier(); CreateMapReceipt(); CreateMapPurchaseOrder(); CreateMapPurchaseOrderDetail(); CreateMapUnplannedReceipt(); CreateMapX12Asn(); } /// /// 零件实体与Dto映射 /// private void CreateMapPart() { CreateMap(); CreateMap() .Ignore(p => p.Id) .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } /// /// 供应商实体与Dto相互映射 /// private void CreateMapSupplier() { CreateMap(); CreateMap() .Ignore(p => p.Id) .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } /// /// 收货单与退货单明细实体与Dto映射 /// private void CreateMapReceipt() { CreateMap(); CreateMap() .Ignore(p => p.Id) .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } /// /// 采购订单主表映射 /// private void CreateMapPurchaseOrder() { CreateMap(); CreateMap() .Ignore(p => p.Id) .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } /// /// 采购订单明细表映射 /// private void CreateMapPurchaseOrderDetail() { CreateMap(); CreateMap() .Ignore(p => p.Id) .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } private void CreateMapUnplannedReceipt() { CreateMap(); CreateMap() .Ignore(p => p.Id) .Ignore(p => p.CreatorId) .Ignore(p => p.CreationTime); } private void CreateMapX12Asn() { CreateMap() .Ignore(p => p.Scpedi) .AfterMap((src, dto) => dto.Scpedi = src.EdiString?.Split("\r\n").ToList()) ; } } }