zs
2025-05-09 14f9c8378bde7d9a8d8f1fcc393e0e8d49eced82
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
126
127
128
129
130
131
132
133
134
135
136
137
using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsAreas;
using CMS.Plugin.HIAWms.Domain.WmsInOutStockOrder;
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<WmsInOutStockOrder> IncludeDetails(this IQueryable<WmsInOutStockOrder> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }
 
            return queryable;
        }
 
        /// <summary>
        ///  Configures the WmsInOutStockOrder.
        /// </summary>
        /// <param name="builder"></param>
        public static void ConfigureWmsInOutStockOrder(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));
 
            builder.Entity<WmsInOutStockOrder>(b =>
            {
                b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsInOutStockOrder").ToLower(),
                         CMSPluginDbProperties.DbSchema)
                 .HasComment("出入库单据表");
 
                // 主键配置
                b.HasKey(x => x.Id);
 
                // 字段配置
                b.Property(x => x.OrderNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("单据编号");
 
                b.Property(x => x.OrderStatus)
                    .IsRequired()
                    .HasComment("单据状态");
 
                b.Property(x => x.OrderType)
                    .IsRequired()
                    .HasComment("单据类型");
 
                b.Property(x => x.StockType)
                    .IsRequired()
                    .HasComment("操作类型(枚举值)");
 
                b.Property(x => x.MaterialName)
                    .HasMaxLength(100)
                    .HasComment("物料名称");
 
                b.Property(x => x.MaterialNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("物料件号");
 
                b.Property(x => x.MaterialModel)
                    .HasMaxLength(50)
                    .HasComment("型号");
 
                b.Property(x => x.MaterialBatch)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("批次号");
 
                b.Property(x => x.MaterialNumber)
                    .IsRequired()
                    .HasComment("单据数量");
 
                b.Property(x => x.DistributeNumber)
                    .IsRequired()
                    .HasDefaultValue(0)
                    .HasComment("下发数量");
 
                b.Property(x => x.CompleteNumber)
                    .IsRequired()
                    .HasDefaultValue(0)
                    .HasComment("完成数量");
 
                b.Property(x => x.Priority)
                    .IsRequired()
                    .HasDefaultValue(1)
                    .HasComment("优先级");
 
                b.Property(x => x.PlanNo)
                    .HasMaxLength(50)
                    .HasComment("关联计划编号");
 
                b.Property(x => x.OperateTime)
                    .HasComment("操作时间");
 
                b.Property(x => x.Remark)
                    .HasMaxLength(500)
                    .HasComment("备注");
 
                b.Property(x => x.Sort)
                    .HasDefaultValue(0)
                    .HasComment("排序");
 
                b.Property(x => x.IsDisabled)
                    .HasDefaultValue(false)
                    .HasComment("是否禁用");
 
                // 索引配置
                b.HasIndex(x => x.OrderNo).IsUnique();
                b.HasIndex(x => x.MaterialNo);
                b.HasIndex(x => x.MaterialBatch);
                b.HasIndex(x => x.PlanNo);
                b.HasIndex(x => x.OperateTime);
 
                // 软删除过滤器(ABP框架默认支持)
                b.ConfigureByConvention();
                b.ApplyObjectExtensionMappings();
            });
        }
    }
}