using CMS.Plugin.HIAWms.Domain;
|
using CMS.Plugin.HIAWms.Domain.WmsPlaces;
|
using CMS.Plugin.HIAWms.Domain.Shared.WmsPlaces;
|
using Microsoft.EntityFrameworkCore;
|
using Volo.Abp;
|
using Volo.Abp.EntityFrameworkCore.Modeling;
|
|
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<WmsPlace> IncludeDetails(this IQueryable<WmsPlace> queryable, bool include = true)
|
{
|
if (!include)
|
{
|
return queryable;
|
}
|
|
return queryable;
|
}
|
|
/// <summary>
|
/// Configures the wmsplace.
|
/// </summary>
|
/// <param name="builder">The builder.</param>
|
public static void ConfigureWmsPlace(this ModelBuilder builder)
|
{
|
Check.NotNull(builder, nameof(builder));
|
|
builder.Entity<WmsPlace>(b =>
|
{
|
// Configure table & schema name
|
b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsPlaces").ToLower(), CMSPluginDbProperties.DbSchema).HasComment("Wms_Place");
|
|
b.ConfigureByConvention();
|
|
// Properties
|
b.Property(x => x.PlaceNo).HasMaxLength(WmsPlaceConsts.MaxPlaceNoLength).IsRequired().HasComment("编号");
|
b.Property(x => x.StorageTypeNo).HasComment("货位类型");
|
b.Property(x => x.PlaceStatus).HasComment("货位状态");
|
b.Property(x => x.AreaCode).HasMaxLength(WmsPlaceConsts.MaxAreaCodeLength).IsRequired().HasComment("所在库区");
|
b.Property(x => x.Aisle).HasComment("巷道");
|
b.Property(x => x.RowNo).HasComment("排");
|
b.Property(x => x.ColumnNo).HasComment("列");
|
b.Property(x => x.LayerNo).HasComment("层");
|
b.Property(x => x.Islock).HasComment("是否锁定");
|
b.Property(x => x.EmptyContainer).HasComment("是否空托");
|
b.Property(x => x.RedundantField1).HasMaxLength(WmsPlaceConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段1 - 预留扩展用途");
|
b.Property(x => x.RedundantField2).HasMaxLength(WmsPlaceConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段2 - 预留扩展用途");
|
b.Property(x => x.RedundantField3).HasMaxLength(WmsPlaceConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段3 - 预留扩展用途");
|
b.Property(x => x.Sort).HasComment("排序");
|
b.Property(x => x.Remark).HasMaxLength(WmsPlaceConsts.MaxRemarkLength).IsRequired(false).HasComment("备注");
|
b.Property(x => x.IsDisabled).IsRequired(false).HasComment("是否禁用");
|
|
// Indexes
|
b.HasIndex(u => u.PlaceNo).IsUnique(); // 编号字段添加唯一索引
|
b.HasIndex(u => u.AreaCode); // 所在库区字段添加普通索引
|
b.HasIndex(u => u.StorageTypeNo); // 货位类型字段添加普通索引
|
b.HasIndex(u => u.PlaceStatus); // 货位类型字段添加普通索引
|
|
// Apply object extension mappings
|
b.ApplyObjectExtensionMappings();
|
});
|
}
|
}
|