|
|
|
using AutoMapper;
|
|
|
|
using Volo.Abp.AutoMapper;
|
|
|
|
using Volo.Abp.Timing;
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 零件实体与Dto映射
|
|
|
|
/// </summary>
|
|
|
|
private void CreateMapPart()
|
|
|
|
|
|
|
|
{
|
|
|
|
CreateMap<Part, PartDTO>();
|
|
|
|
CreateMap<PartCreateDto, Part>()
|
|
|
|
.Ignore(p=>p.Id)
|
|
|
|
.Ignore(p=>p.CreatorId)
|
|
|
|
.Ignore(p=>p.CreationTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 供应商实体与Dto相互映射
|
|
|
|
/// </summary>
|
|
|
|
private void CreateMapSupplier()
|
|
|
|
|
|
|
|
{
|
|
|
|
CreateMap<Supplier, SupplierDTO>();
|
|
|
|
CreateMap<SupplierCreateDTO,Supplier>()
|
|
|
|
.Ignore(p => p.Id)
|
|
|
|
.Ignore(p => p.CreatorId)
|
|
|
|
.Ignore(p => p.CreationTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 收货单与退货单明细实体与Dto映射
|
|
|
|
/// </summary>
|
|
|
|
private void CreateMapReceipt()
|
|
|
|
|
|
|
|
{
|
|
|
|
CreateMap<Receipt, ReceiptDTO>();
|
|
|
|
CreateMap<ReceiptCreateDTO, Receipt>()
|
|
|
|
.Ignore(p => p.Id)
|
|
|
|
.Ignore(p => p.CreatorId)
|
|
|
|
.Ignore(p => p.CreationTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 采购订单主表映射
|
|
|
|
/// </summary>
|
|
|
|
private void CreateMapPurchaseOrder()
|
|
|
|
|
|
|
|
{
|
|
|
|
CreateMap<PurchaseOrder, PurchaseOrderDTO>();
|
|
|
|
CreateMap<PurchaseOrderCreateDTO, PurchaseOrder>()
|
|
|
|
.Ignore(p => p.Id)
|
|
|
|
.Ignore(p => p.CreatorId)
|
|
|
|
.Ignore(p => p.CreationTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 采购订单明细表映射
|
|
|
|
/// </summary>
|
|
|
|
private void CreateMapPurchaseOrderDetail()
|
|
|
|
|
|
|
|
{
|
|
|
|
CreateMap<PurchaseOrderDetail, PurchaseOrderDetailDTO>();
|
|
|
|
CreateMap<PurchaseOrderDetailCreateDTO,PurchaseOrderDetail>()
|
|
|
|
.Ignore(p => p.Id)
|
|
|
|
.Ignore(p => p.CreatorId)
|
|
|
|
.Ignore(p => p.CreationTime);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CreateMapUnplannedReceipt()
|
|
|
|
{
|
|
|
|
CreateMap<UnplannedReceipt, UnplannedReceiptDTO>();
|
|
|
|
CreateMap<UnplannedReceiptCreateDTO, UnplannedReceipt>()
|
|
|
|
.Ignore(p => p.Id)
|
|
|
|
.Ignore(p => p.CreatorId)
|
|
|
|
.Ignore(p => p.CreationTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|