zs
2025-05-15 edba4ede85a3d82a7f0a0a7dccddbc8281862888
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
69
70
71
72
73
74
75
76
using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsContainers;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using CMS.Plugin.MyExtension;
using Volo.Abp.EntityFrameworkCore.Modeling;
using CMS.Plugin.MyExtension.Domain;
using CMS.Plugin.HIAWms.Domain.WmsContainerPlace;
 
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<WmsContainerPlace> IncludeDetails(this IQueryable<WmsContainerPlace> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }
 
            return queryable;
        }
        /// <summary>
        /// Configures the WMS container place relationship.
        /// </summary>
        /// <param name="builder">The builder.</param>
        public static void ConfigureWmsContainerPlace(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));
 
            builder.Entity<WmsContainerPlace>(b =>
            {
                b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsContainerPlaces").ToLower(), CMSPluginDbProperties.DbSchema)
                    .HasComment("容器库位关系表");
 
                b.ConfigureByConvention();
                // 主键配置
                b.HasKey(x => x.Id);
                // Properties
                b.Property(x => x.PlaceNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("库位编码");
 
                b.Property(x => x.ContainerNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("托盘编号");
                b.ConfigureMyCmsEntity();
 
                // Composite primary key
                b.HasKey(x => new { x.PlaceNo, x.ContainerNo });
 
                // Indexes
                b.HasIndex(x => x.PlaceNo);
                b.HasIndex(x => x.ContainerNo);
 
                b.ApplyObjectExtensionMappings();
            });
        }
    }
}