山东雷驰
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

138 lines
7.6 KiB

using AutoMapper;
using Kean.Domain.Task.Commands;
using Kean.Domain.Task.Events;
using Kean.Domain.Task.Models;
namespace Kean.Domain.Task
{
/// <summary>
/// 模型映射配置
/// </summary>
public class AutoMapper : Profile
{
/// <summary>
/// 初始化 Kean.Domain.Task.AutoMapper 类的新实例
/// </summary>
public AutoMapper()
{
AllowNullCollections = true;
ShouldMapProperty = property => property.GetMethod.IsPublic || property.GetMethod.IsAssembly;
CreateMap<Spec, int?>()
.ConvertUsing(type => (int?)type);
CreateMap<InfeedCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<InfeedCommand, InfeedExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<InfeedCommand, InfeedSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<OutfeedCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<OutfeedCommand, OutfeedExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<OutfeedCommand, OutfeedSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<TransferCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<TransferCommand, TransferExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<TransferCommand, TransferSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<BypassCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<BypassCommand, BypassExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<BypassCommand, BypassSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<Models.Task, InfeedCommand>();
CreateMap<Models.Task, OutfeedCommand>();
CreateMap<Models.Task, TransferCommand>();
CreateMap<Models.Task, BypassCommand>();
CreateMap<Models.Task, CancelSuccessEvent>()
.ForMember(@event => @event.Created, options => options.MapFrom(model => model.Timestamp));
CreateMap<Models.Task, CompleteSuccessEvent>()
.ForMember(@event => @event.Created, options => options.MapFrom(model => model.Timestamp));
/////////////////////////////////////////////////////////////////
CreateMap<ApplyOutCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<ApplyOutCommand, ApplyOutExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<ApplyOutCommand, ApplyOutSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<Models.Task, ApplyOutCommand>();
CreateMap<PalletOutCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<PalletOutCommand, PalletOutExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<PalletOutCommand, PalletOutSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<Models.Task, PalletOutCommand>();
CreateMap<DirectOutboundCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<DirectOutboundCommand, DirectOutboundExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<DirectOutboundCommand, DirectOutboundSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<Models.Task, DirectOutboundCommand>();
CreateMap<BypassHithumCommand, Models.Task>();
CreateMap<BypassHithumCommand, BypassHithumExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<BypassHithumCommand, BypassHithumSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<BypassEmptyCommand, Models.Task>();
CreateMap<BypassEmptyCommand, BypassEmptyExecutingEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<BypassEmptyCommand, BypassEmptySuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
CreateMap<InfeedCheckCommand, Models.Task>()
.ForMember(model => model.Original, options => options.Ignore())
.ForMember(model => model.Destination, options => options.Ignore());
CreateMap<InfeedCheckCommand, InfeedCheckSuccessEvent>()
.ForMember(@event => @event.Original, options => options.Ignore())
.ForMember(@event => @event.Destination, options => options.Ignore());
}
}
}