zs
2025-05-05 25750ab29ce4e243f4e4e17a796167f3a0f0697b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsAreas;
using CMS.Plugin.HIAWms.Domain.Shared.WmsAreas;
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<WmsArea> IncludeDetails(this IQueryable<WmsArea> queryable, bool include = true)
    {
        if (!include)
        {
            return queryable;
        }
 
        return queryable;
    }
 
    /// <summary>
    /// Configures the wmsarea.
    /// </summary>
    /// <param name="builder">The builder.</param>
    public static void ConfigureWmsArea(this ModelBuilder builder)
    {
        Check.NotNull(builder, nameof(builder));
 
        builder.Entity<WmsArea>(b =>
        {
            // Configure table & schema name
            b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsAreas").ToLower(), CMSPluginDbProperties.DbSchema).HasComment("库区表");
 
            b.ConfigureByConvention();
 
            // Properties
            b.Property(x => x.AreaNo).HasMaxLength(WmsAreaConsts.MaxNameLength).IsRequired().HasComment("库区编号");
            b.Property(x => x.AreaName).HasMaxLength(WmsAreaConsts.MaxAreaNameLength).IsRequired().HasComment("库区名称");
            b.Property(x => x.AreaDesc).HasMaxLength(WmsAreaConsts.MaxAreaDescLength).IsRequired(false).HasComment("描述");
            b.Property(x => x.AreaStatus).HasComment("库区状态");
            b.Property(x => x.AreaType).HasComment("库区类型");
            b.Property(x => x.RedundantField1).HasMaxLength(WmsAreaConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段1 - 预留扩展用途");
            b.Property(x => x.RedundantField2).HasMaxLength(WmsAreaConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段2 - 预留扩展用途");
            b.Property(x => x.RedundantField3).HasMaxLength(WmsAreaConsts.MaxRedundantFieldLength).IsRequired(false).HasComment("冗余字段3 - 预留扩展用途");
            b.Property(x => x.StoreCode).HasMaxLength(WmsAreaConsts.MaxStoreCodeLength).IsRequired(false).HasComment("仓库代码");
            b.Property(x => x.StoreName).HasMaxLength(WmsAreaConsts.MaxStoreNameLength).IsRequired(false).HasComment("仓库名称");
            b.Property(x => x.Sort).HasComment("排序");
            b.Property(x => x.Remark).HasMaxLength(WmsAreaConsts.MaxRemarkLength).IsRequired(false).HasComment("备注");
            b.Property(x => x.IsDisabled).IsRequired(false).HasComment("是否禁用");
 
            // Indexes
            b.HasIndex(u => u.AreaName);
 
            // Apply object extension mappings
            b.ApplyObjectExtensionMappings();
        });
    }
}