¶Ô±ÈÐÂÎļþ |
| | |
| | | using CMS.Plugin.HIAWms.Domain; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.Domain.Shared.WmsMaterials; |
| | | 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<WmsMaterial> IncludeDetails(this IQueryable<WmsMaterial> queryable, bool include = true) |
| | | { |
| | | if (!include) |
| | | { |
| | | return queryable; |
| | | } |
| | | |
| | | return queryable; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Configures the wmsmaterial. |
| | | /// </summary> |
| | | /// <param name="builder">The builder.</param> |
| | | public static void ConfigureWmsMaterial(this ModelBuilder builder) |
| | | { |
| | | Check.NotNull(builder, nameof(builder)); |
| | | |
| | | builder.Entity<WmsMaterial>(b => |
| | | { |
| | | // é
置表ååæ³¨é |
| | | b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsMaterials").ToLower(), |
| | | CMSPluginDbProperties.DbSchema) |
| | | .HasComment("ç©æåºç¡ä¿¡æ¯è¡¨"); |
| | | |
| | | b.ConfigureByConvention(); |
| | | |
| | | // 主é®é
ç½®ï¼FullAuditedAggregateRoot<Guid> å·²é»è®¤å
å« Idï¼ |
| | | b.HasKey(x => x.Id); |
| | | |
| | | // åæ®µé
ç½® |
| | | b.Property(x => x.MaterialCode) |
| | | .HasMaxLength(64) |
| | | .IsRequired() |
| | | .HasComment("ç©æç¼ç ï¼å¯ä¸æ è¯ï¼"); |
| | | |
| | | b.Property(x => x.MaterialName) |
| | | .HasMaxLength(128) |
| | | .IsRequired() |
| | | .HasComment("ç©æåç§°"); |
| | | |
| | | b.Property(x => x.PurchaseType) |
| | | .HasComment("éè´ç±»åï¼æä¸¾å¼ï¼"); |
| | | |
| | | b.Property(x => x.MaterialType) |
| | | .HasComment("ç©æç±»åï¼æä¸¾å¼ï¼"); |
| | | |
| | | b.Property(x => x.PrimaryUnit) |
| | | .HasMaxLength(20) |
| | | .HasComment("主åä½ï¼å¦ï¼kgãmã个ï¼"); |
| | | |
| | | b.Property(x => x.Standard) |
| | | .HasMaxLength(128) |
| | | .HasComment("è§æ ¼/æ åï¼å¦ï¼GB/T 8163-2018ï¼"); |
| | | |
| | | b.Property(x => x.OuterDiameter) |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("å¤å¾ï¼åä½ï¼mmï¼"); |
| | | |
| | | b.Property(x => x.WallThickness) |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("å£åï¼åä½ï¼mmï¼"); |
| | | |
| | | b.Property(x => x.MaterialQuality) |
| | | .HasMaxLength(64) |
| | | .HasComment("æè´¨ï¼å¦ï¼304ä¸éé¢ï¼"); |
| | | |
| | | b.Property(x => x.Length) |
| | | .HasColumnType("decimal(18,2)") |
| | | .HasComment("é¿åº¦ï¼åä½ï¼mï¼"); |
| | | |
| | | b.Property(x => x.IsMainBranch) |
| | | .HasDefaultValue(false) |
| | | .HasComment("æ¯å¦ä¸ºä¸»æ¯ç®¡"); |
| | | |
| | | b.Property(x => x.Factory) |
| | | .HasMaxLength(64) |
| | | .HasComment("ç产工å"); |
| | | |
| | | b.Property(x => x.Certification) |
| | | .HasMaxLength(128) |
| | | .HasComment("è¯ä¹¦ç¼å·"); |
| | | |
| | | // åä½å段é
ç½® |
| | | b.Property(x => x.RedundantField1) |
| | | .HasMaxLength(256) |
| | | .IsRequired(false) |
| | | .HasComment("åä½å段1 - é¢çæ©å±ç¨é"); |
| | | |
| | | b.Property(x => x.RedundantField2) |
| | | .HasMaxLength(256) |
| | | .IsRequired(false) |
| | | .HasComment("åä½å段2 - é¢çæ©å±ç¨é"); |
| | | |
| | | b.Property(x => x.RedundantField3) |
| | | .HasMaxLength(256) |
| | | .IsRequired(false) |
| | | .HasComment("åä½å段3 - é¢çæ©å±ç¨é"); |
| | | |
| | | // å
¶ä»éç¨å段 |
| | | b.Property(x => x.Sort) |
| | | .HasDefaultValue(0) |
| | | .HasComment("æåº"); |
| | | |
| | | b.Property(x => x.Remark) |
| | | .HasMaxLength(500) |
| | | .IsRequired(false) |
| | | .HasComment("夿³¨"); |
| | | |
| | | b.Property(x => x.IsDisabled) |
| | | .IsRequired(false) |
| | | .HasDefaultValue(false) |
| | | .HasComment("æ¯å¦ç¦ç¨"); |
| | | |
| | | // ç´¢å¼é
ç½® |
| | | b.HasIndex(x => x.MaterialCode).IsUnique(); // ç©æç¼ç å¯ä¸ç´¢å¼ |
| | | b.HasIndex(x => x.MaterialName); // ç©æåç§°æ®éç´¢å¼ |
| | | b.HasIndex(x => x.PurchaseType); // éè´ç±»åç´¢å¼ï¼å¦éæ¥è¯¢è¿æ»¤ï¼ |
| | | b.HasIndex(x => x.MaterialType); // ç©æç±»åç´¢å¼ï¼å¦éæ¥è¯¢è¿æ»¤ï¼ |
| | | |
| | | b.ApplyObjectExtensionMappings(); |
| | | }); |
| | | } |
| | | } |