using CMS.Plugin.HIAWms.Domain; using CMS.Plugin.HIAWms.Domain.WmsAreas; using CMS.Plugin.HIAWms.Domain.WmsInOutStockOrder; 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 WmsInOutStockOrder. /// /// public static void ConfigureWmsInOutStockOrder(this ModelBuilder builder) { Check.NotNull(builder, nameof(builder)); builder.Entity(b => { b.ToTable((CMSPluginDbProperties.DbTablePrefix + "WmsInOutStockOrder").ToLower(), CMSPluginDbProperties.DbSchema) .HasComment("出入库单据表"); // 主键配置 b.HasKey(x => x.Id); // 字段配置 b.Property(x => x.OrderNo) .HasMaxLength(50) .IsRequired() .HasComment("单据编号"); b.Property(x => x.OrderStatus) .IsRequired() .HasComment("单据状态"); b.Property(x => x.OrderType) .IsRequired() .HasComment("单据类型"); b.Property(x => x.StockType) .IsRequired() .HasComment("操作类型(枚举值)"); b.Property(x => x.MaterialName) .HasMaxLength(100) .HasComment("物料名称"); b.Property(x => x.MaterialNo) .HasMaxLength(50) .IsRequired() .HasComment("物料件号"); b.Property(x => x.MaterialModel) .HasMaxLength(50) .HasComment("型号"); b.Property(x => x.MaterialBatch) .HasMaxLength(50) .IsRequired() .HasComment("批次号"); b.Property(x => x.MaterialNumber) .IsRequired() .HasComment("单据数量"); b.Property(x => x.DistributeNumber) .IsRequired() .HasDefaultValue(0) .HasComment("下发数量"); b.Property(x => x.CompleteNumber) .IsRequired() .HasDefaultValue(0) .HasComment("完成数量"); b.Property(x => x.Priority) .IsRequired() .HasDefaultValue(1) .HasComment("优先级"); b.Property(x => x.PlanNo) .HasMaxLength(50) .HasComment("关联计划编号"); b.Property(x => x.OperateTime) .HasComment("操作时间"); b.Property(x => x.Remark) .HasMaxLength(500) .HasComment("备注"); b.Property(x => x.Sort) .HasDefaultValue(0) .HasComment("排序"); b.Property(x => x.IsDisabled) .HasDefaultValue(false) .HasComment("是否禁用"); // 索引配置 b.HasIndex(x => x.OrderNo).IsUnique(); b.HasIndex(x => x.MaterialNo); b.HasIndex(x => x.MaterialBatch); b.HasIndex(x => x.PlanNo); b.HasIndex(x => x.OperateTime); // 软删除过滤器(ABP框架默认支持) b.ConfigureByConvention(); b.ApplyObjectExtensionMappings(); }); } } }