zs
2025-05-07 ce86642feb81352ce43701fceda3ec59ce662905
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
using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsContainerPlaces;
using CMS.Plugin.HIAWms.Domain.WmsMaterialContainer;
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
    {
        /// <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<WmsMaterialContainer> IncludeDetails(this IQueryable<WmsMaterialContainer> 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 ConfigureWmsMaterialContainer(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));
 
            builder.Entity<WmsMaterialContainer>(b =>
            {
                b.ToTable((CMSPluginDbProperties.DbTablePrefix + "WmsMaterialContainer").ToLower(), CMSPluginDbProperties.DbSchema)
                    .HasComment("物料容器关系表");
 
                b.ConfigureByConvention();
                // 主键配置
                b.HasKey(x => x.Id);
                // Properties
                b.Property(x => x.MaterialId)
                    .HasMaxLength(64)
                    .IsRequired()
                    .HasComment("物料ID");
 
                b.Property(x => x.ContainerNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("托盘编号");
 
                // Composite primary key
                b.HasKey(x => new { x.MaterialId, x.ContainerNo });
 
                // Indexes
                b.HasIndex(x => x.MaterialId);
                b.HasIndex(x => x.ContainerNo);
 
                b.ApplyObjectExtensionMappings();
            });
        }
    }
}