using CMS.Plugin.HIAWms.Domain;
|
using CMS.Plugin.HIAWms.Domain.WmsContainers;
|
using Microsoft.EntityFrameworkCore;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Volo.Abp;
|
using CMS.Plugin.MyExtension;
|
using Volo.Abp.EntityFrameworkCore.Modeling;
|
using CMS.Plugin.MyExtension.Domain;
|
using CMS.Plugin.HIAWms.Domain.WmsContainerPlace;
|
|
namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions
|
{
|
/// <summary>
|
/// EfCore扩展
|
/// </summary>
|
public static partial class CMSPluginEfCoreExtensions
|
{
|
/// <summary>
|
/// Includes the details.
|
/// </summary>
|
/// <param name="queryable">The queryable.</param>
|
/// <param name="include">if set to <c>true</c> [include].</param>
|
/// <returns></returns>
|
public static IQueryable<WmsContainerPlace> IncludeDetails(this IQueryable<WmsContainerPlace> queryable, bool include = true)
|
{
|
if (!include)
|
{
|
return queryable;
|
}
|
|
return queryable;
|
}
|
/// <summary>
|
/// Configures the WMS container place relationship.
|
/// </summary>
|
/// <param name="builder">The builder.</param>
|
public static void ConfigureWmsContainerPlace(this ModelBuilder builder)
|
{
|
Check.NotNull(builder, nameof(builder));
|
|
builder.Entity<WmsContainerPlace>(b =>
|
{
|
b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsContainerPlaces").ToLower(), CMSPluginDbProperties.DbSchema)
|
.HasComment("容器库位关系表");
|
|
b.ConfigureByConvention();
|
// 主键配置
|
b.HasKey(x => x.Id);
|
// Properties
|
b.Property(x => x.PlaceNo)
|
.HasMaxLength(50)
|
.IsRequired()
|
.HasComment("库位编码");
|
|
b.Property(x => x.ContainerNo)
|
.HasMaxLength(50)
|
.IsRequired()
|
.HasComment("托盘编号");
|
b.ConfigureMyCmsEntity();
|
|
// Composite primary key
|
b.HasKey(x => new { x.PlaceNo, x.ContainerNo });
|
|
// Indexes
|
b.HasIndex(x => x.PlaceNo);
|
b.HasIndex(x => x.ContainerNo);
|
|
b.ApplyObjectExtensionMappings();
|
});
|
}
|
}
|
}
|