wangxinhui
2025-08-30 cd78554c3da306ed8c866d971bee94457665f80c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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
    {
        /// <summary>
        /// 配置构造函数,用来创建关系映射
        /// </summary>
        public CustomProfile()
        {
            CreateMap<Sys_Menu, MenuDTO>();
            CreateMap<Dt_Task, WMSTaskDTO>();
            //物料实体BST转换
            CreateMap<BSTMaterialDTO, Dt_MaterielInfo>().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.State)).ForMember(x => x.IsCheck, b => b.MapFrom(b => WhetherEnum.True.ObjToInt())).ForMember(x => x.MaterielSpec, b => b.MapFrom(b => b.Spec)).ForMember(x => x.MaterielWeight, b => b.MapFrom(b => b.Weight));
            //物料实体转换
            CreateMap<BSTSupplierDTO, Dt_SupplierInfo>().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<BSTPurchaseOrderDTO, Dt_PurchaseBSTOrder>().ForMember(x => x.ReceiptDate, b => b.MapFrom(b => DateTimeOffset.FromUnixTimeMilliseconds(b.ReceiptDate).DateTime));
        }
    }
}