using CMS.Plugin.HIAWms.Domain; using CMS.Plugin.HIAWms.Domain.WmsContainerPlace; using CMS.Plugin.HIAWms.Domain.WmsMaterialContainer; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions { public static partial class CMSPluginEfCoreExtensions { /// /// Includes the details. /// /// The queryable. /// if set to true [include]. /// public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) { if (!include) { return queryable; } return queryable; } /// /// Configures the WMS container place relationship. /// /// The builder. public static void ConfigureWmsMaterialContainer(this ModelBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Entity(b => { b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsMaterialContainer").ToLower(), CMSPluginDbProperties.DbSchema) .HasComment("物料容器关系表"); b.ConfigureByConvention(); // 主键配置 b.HasKey(x => x.Id); // Properties b.Property(x => x.MaterialId) .HasMaxLength(64) .IsRequired() .HasComment("物料ID"); b.Property(x => x.ContainerNo) .HasMaxLength(50) .IsRequired() .HasComment("托盘编号"); // Composite primary key b.HasKey(x => new { x.MaterialId, x.ContainerNo }); // Indexes b.HasIndex(x => x.MaterialId); b.HasIndex(x => x.ContainerNo); b.ApplyObjectExtensionMappings(); }); } } }