schangxiang@126.com
2025-05-12 3aedad63dd01f1fc5154cb520af32edab967d6e0
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsContainerPlace;
using CMS.Plugin.HIAWms.Domain.WmsTask;
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
{
    /// <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<WmsTask> IncludeDetails(this IQueryable<WmsTask> queryable, bool include = true)
        {
            if (!include)
            {
                return queryable;
            }
 
            return queryable;
        }
        /// <summary>
        /// Configures the WMS task entity.
        /// </summary>
        /// <param name="builder">The builder.</param>
        public static void ConfigureWmsTask(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));
 
            builder.Entity<WmsTask>(b =>
            {
                b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsTasks").ToLower(), CMSPluginDbProperties.DbSchema)
                    .HasComment("任务表");
 
                b.ConfigureByConvention();
 
                // Primary key configuration (inherited from FullAuditedAggregateRoot<Guid>)
                b.HasKey(x => x.Id);
 
                // Properties configuration
                b.Property(x => x.TaskNo)
                    .HasMaxLength(50)
                    .IsRequired()
                    .HasComment("任务号");
 
                b.Property(x => x.TaskType)
                    .IsRequired()
                    .HasComment("任务类型");
 
                b.Property(x => x.TaskLevel)
                    .IsRequired()
                    .HasComment("任务等级");
 
                b.Property(x => x.TaskStatus)
                    .IsRequired()
                    .HasComment("任务状态");
 
                b.Property(x => x.ContainerNo)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .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.Aisle)
                    .IsRequired(false)
                    .HasComment("巷道");
 
                b.Property(x => x.DodeviceId)
                    .IsRequired(false)
                    .HasComment("堆垛机ID");
 
                b.Property(x => x.Dodevicetype)
                    .IsRequired()
                    .HasComment("设备类型");
 
                b.Property(x => x.TaskDodeviceStatus)
                    .IsRequired()
                    .HasComment("设备任务状态");
 
                b.Property(x => x.IsRead)
                    .IsRequired()
                    .HasComment("WCS是否可以读取");
 
                b.Property(x => x.SonTaskType)
                    .IsRequired(false)
                    .HasComment("子任务类型");
 
                b.Property(x => x.SourceOrderNo)
                    .HasMaxLength(50)
                    .IsRequired(false)
                    .HasComment("来源单据号");
 
                b.Property(x => x.IsNextTask)
                    .IsRequired(false)
                    .HasComment("下个任务是否生成成功");
 
                b.Property(x => x.MutableParam1)
                    .HasMaxLength(200)
                    .IsRequired(false)
                    .HasComment("可变变量1");
 
                b.Property(x => x.MutableParam2)
                    .HasMaxLength(200)
                    .IsRequired(false)
                    .HasComment("可变变量2");
 
                b.Property(x => x.MutableParam3)
                    .HasMaxLength(200)
                    .IsRequired(false)
                    .HasComment("可变变量3");
 
                b.Property(x => x.Sort)
                    .IsRequired()
                    .HasComment("排序");
 
                b.Property(x => x.IsDisabled)
                    .IsRequired(false)
                    .HasComment("是否禁用");
 
                // Indexes configuration
                b.HasIndex(x => x.TaskNo).IsUnique();
                b.HasIndex(x => x.TaskType);
                b.HasIndex(x => x.TaskStatus);
                b.HasIndex(x => x.ContainerNo);
                b.HasIndex(x => x.SourcePlace);
                b.HasIndex(x => x.ToPlace);
                b.HasIndex(x => x.DodeviceId);
                b.HasIndex(x => x.IsRead);
                b.HasIndex(x => x.SourceOrderNo);
                b.HasIndex(x => x.Sort);
 
                b.ApplyObjectExtensionMappings();
            });
        }
    }
    
}