using CMS.Plugin.HIAWms.Domain; using CMS.Plugin.HIAWms.Domain.WmsInOutStockRecord; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; namespace CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions { /// /// EfCore扩展 /// 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 wmsmaterial. /// /// public static void ConfigureWmsInOutStockRecord(this ModelBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Entity(b => { b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsInOutStockRecords").ToLower(), CMSPluginDbProperties.DbSchema) .HasComment("出入库记录表"); b.ConfigureByConvention(); // 主键配置 b.HasKey(x => x.Id); // Properties b.Property(x => x.OrderNo) .HasMaxLength(50) .IsRequired() .HasComment("单据编号"); b.Property(x => x.MaterialName) .HasMaxLength(100) .IsRequired(false) .HasComment("物料名称"); b.Property(x => x.MaterialNo) .HasMaxLength(50) .IsRequired() .HasComment("物料件号"); b.Property(x => x.StockType) .IsRequired() .HasComment("操作类型"); b.Property(x => x.ContainerNo) .HasMaxLength(50) .IsRequired(false) .HasComment("容器编号"); b.Property(x => x.MaterialModel) .HasMaxLength(50) .IsRequired(false) .HasComment("机型"); b.Property(x => x.OperateTime) .IsRequired(false) .HasComment("操作时间"); b.Property(x => x.Remark) .HasMaxLength(500) .IsRequired(false) .HasComment("备注"); b.Property(x => x.MaterialId) .HasMaxLength(50) .IsRequired() .HasComment("物料ID"); b.Property(x => x.TaskNo) .HasMaxLength(50) .IsRequired() .HasComment("任务号"); b.Property(x => x.SourcePlace) .HasMaxLength(50) .IsRequired(false) .HasComment("起始库位"); b.Property(x => x.ToPlace) .HasMaxLength(50) .IsRequired(false) .HasComment("目标库位"); b.Property(x => x.Sort).HasComment("排序"); b.Property(x => x.IsDisabled).IsRequired(false).HasComment("是否禁用"); // Indexes b.HasIndex(x => x.OrderNo); b.HasIndex(x => x.MaterialNo); b.HasIndex(x => x.MaterialId); b.HasIndex(x => x.TaskNo); b.HasIndex(x => x.StockType); b.HasIndex(x => x.ContainerNo); b.HasIndex(x => x.OperateTime); b.ApplyObjectExtensionMappings(); }); } } }