zs
2025-05-12 7baa0d978e41f395891753b208d805bc02edee38
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsInOutStockRecord;
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<WmsInOutStockRecord> IncludeDetails(this IQueryable<WmsInOutStockRecord> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }
 
            return queryable;
        }
 
        /// <summary>
        /// Configures the wmsmaterial.
        /// </summary>
        /// <param name="builder"></param>
        public static void ConfigureWmsInOutStockRecord(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));
 
            builder.Entity<WmsInOutStockRecord>(b =>
            {
                b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsInOutStockRecords").ToLower(), CMSPluginDbProperties.DbSchema)
                    .HasComment("出入库记录表");
 
                b.ConfigureByConvention();
                // 主键配置
                b.HasKey(x => x.Id);
                // Properties
                b.Property(x => x.OrderNo)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .HasComment("单据编号");
 
                b.Property(x => x.MaterialName)
                    .HasMaxLength(100)
                    .IsRequired(false)
                    .HasComment("物料名称");
 
                b.Property(x => x.MaterialNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("物料件号");
 
                b.Property(x => x.StockType)
                    .IsRequired()
                    .HasComment("操作类型");
 
                b.Property(x => x.ContainerNo)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .HasComment("容器编号");
 
                b.Property(x => x.MaterialModel)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .HasComment("机型");
 
                b.Property(x => x.MaterialBatch)
                    .HasMaxLength(64)
                    .HasComment("物料批次");
 
                b.Property(x => x.OperateTime)
                    .IsRequired(false)
                    .HasComment("操作时间");
 
                b.Property(x => x.Remark)
                    .HasMaxLength(500)
                    .IsRequired(false)
                    .HasComment("备注");
 
                b.Property(x => x.MaterialId)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("物料ID");
 
                b.Property(x => x.TaskNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("任务号");
 
                b.Property(x => x.SourcePlace)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .HasComment("起始库位");
 
                b.Property(x => x.ToPlace)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .HasComment("目标库位");
 
                b.Property(x => x.Sort).HasComment("排序");
                b.Property(x => x.IsDisabled).IsRequired(false).HasComment("是否禁用");
 
                // Indexes
                b.HasIndex(x => x.OrderNo);
                b.HasIndex(x => x.MaterialNo);
                b.HasIndex(x => x.MaterialId);
                b.HasIndex(x => x.TaskNo);
                b.HasIndex(x => x.StockType);
                b.HasIndex(x => x.ContainerNo);
                b.HasIndex(x => x.OperateTime);
 
                b.ApplyObjectExtensionMappings();
            });
        }
    }
}