using Autofac.Builder;
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.MaterielEnum;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.ERP;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.System;
using WIDESEA_DTO.Task;
using WIDESEA_Model.Models;
namespace WIDESEA_WMSServer.Filter
{
public class CustomProfile : Profile
{
///
/// 配置构造函数,用来创建关系映射
///
public CustomProfile()
{
CreateMap();
CreateMap();
//物料实体BST转换
CreateMap().ForMember(x => x.MaterialSourceId, b => b.MapFrom(b => b.MaterialId)).ForMember(x => x.WarehouseId, b => b.MapFrom(b => WarehouseEnum.LLDYL.ObjToInt())).ForMember(x => x.MaterielCode, b => b.MapFrom(b => b.MaterialNo)).ForMember(x => x.MaterielName, b => b.MapFrom(b => b.Name)).ForMember(x => x.MaterielSourceType, b => b.MapFrom(b => b.MaterielType)).ForMember(x => x.MaterielInvOrgId, b => b.MapFrom(b => b.InvOrgId)).ForMember(x => x.MaterielUnit, b => b.MapFrom(b => b.Unit)).ForMember(x => x.MaterielUnit, b => b.MapFrom(b => b.Unit)).ForMember(x => x.MaterielState, b => b.MapFrom(b => b.Status)).ForMember(x => x.IsCheck, b => b.MapFrom(b => WhetherEnum.False.ObjToInt())).ForMember(x => x.MaterielSpec, b => b.MapFrom(b => b.Spec)).ForMember(x => x.MaterielWeight, b => b.MapFrom(b => b.Weight));
//物料实体转换
CreateMap().ForMember(x => x.SupplierSourceId, b => b.MapFrom(b => b.VendId)).ForMember(x => x.SupplierCode, b => b.MapFrom(b => b.VendNo)).ForMember(x => x.SupplierName, b => b.MapFrom(b => b.ShortName)).ForMember(x => x.SupplierShortName, b => b.MapFrom(b => b.ShortName)).ForMember(x => x.Contacts, b => b.MapFrom(b => b.BusinessContact)).ForMember(x => x.ContactNumber, b => b.MapFrom(b => b.Tel)).ForMember(x => x.ContactAddress, b => b.MapFrom(b => b.Address)).ForMember(x => x.InvOrgId, b => b.MapFrom(b => MaterielInvOrgEnum.老厂.ObjToInt()));
//采购实体转换
CreateMap().ForMember(x => x.ReceiptDate, b => b.MapFrom(b => DateTimeOffset.FromUnixTimeMilliseconds(b.ReceiptDate).DateTime));
CreateMap().ForMember(x => x.MaterialWide, b => b.MapFrom(b => b.W)).ForMember(x => x.MaterialThick, b => b.MapFrom(b => b.Thick)).ForMember(x => x.PurchaseBSTOrderDetailStatus, b => b.MapFrom(b => InOrderStatusEnum.未开始.ObjToInt()));
//BST出库排程实体转换
CreateMap().ForMember(x => x.OutBSTOrderStatus, b => b.MapFrom(b => OutOrderStatusEnum.未开始.ObjToInt())).ForMember(x => x.ProductionDate, b => b.MapFrom(b => DateTimeOffset.FromUnixTimeMilliseconds(b.ProductionDate).DateTime)).ForMember(x => x.WarehouseId, b => b.MapFrom(b => WarehouseEnum.LLDYL.ObjToInt()));
CreateMap().ForMember(x => x.OutBSTOrderDetailStatus, b => b.MapFrom(b => OutOrderStatusEnum.未开始.ObjToInt()));
}
}
}