schangxiang@126.com
2025-05-20 3a61cb05bd4339b89127b15c489ae76370905404
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
using CMS.Plugin.MyExtension.Domain;
using CMS.Plugin.PipeLineLems.Domain;
using CMS.Plugin.PipeLineLems.Domain.Shared.MyTestEntityNames;
using CMS.Plugin.PipeLineLems.Domain.WorkTask;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
 
namespace CMS.Plugin.PipeLineLems.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<WorkTask> IncludeDetails(this IQueryable<WorkTask> queryable, bool include = true)
    {
        if (!include)
        {
            return queryable;
        }
 
        return queryable;
    }
 
    /// <summary>
    /// Configures the mytestentityname.
    /// </summary>
    /// <param name="builder">The builder.</param>
    public static void ConfigureWorkTask(this ModelBuilder builder)
    {
        Check.NotNull(builder, nameof(builder));
 
        builder.Entity<WorkTask>(b =>
        {
            //Configure table & schema name
            b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WorkTasks").ToLower(), CMSPluginDbProperties.DbSchema).HasComment("作业任务表");
 
            b.ConfigureByConvention();
 
            b.Property(x => x.Son_TaskCode).HasMaxLength(256).IsRequired().HasComment("子任务编码");
 
            // Configure properties
            b.Property(x => x.TaskCode).HasMaxLength(256).IsRequired().HasComment("任务编码");
            b.Property(x => x.WorkPlanStatus).IsRequired().HasComment("计划状态");
            b.Property(x => x.CallMaterialStatus).IsRequired().HasComment("叫料状态");
            b.Property(x => x.DataIdentifier).HasMaxLength(256).HasComment("原料标识");
            b.Property(x => x.MaterialMode).HasMaxLength(256).HasComment("原料型号");
            b.Property(x => x.Length).HasColumnType("decimal(18,2)").HasComment("长度(mm)");
            b.Property(x => x.MarkingContent).HasMaxLength(1024).HasComment("打码内容");
 
            b.Property(x => x.Quantity).HasComment("管段数量");
            b.Property(x => x.FlangeThickness).HasColumnType("decimal(18,2)").HasComment("法兰厚度(mm)");
            b.Property(x => x.FlangeInnerDiameter).HasColumnType("decimal(18,2)").HasComment("法兰直径(mm)");
            b.Property(x => x.WeldingHeatInput).HasMaxLength(256).HasComment("法兰公称压力");
            b.Property(x => x.PipeAllowableStress).HasMaxLength(256).HasComment("法兰冲码内容");
            b.Property(x => x.PipeDiameter).HasColumnType("decimal(18,2)").HasComment("套管长度(mm)");
            b.Property(x => x.PipeWallThickness).HasColumnType("decimal(18,2)").HasComment("套管直径(mm)");
            b.Property(x => x.FactoryCode).HasMaxLength(256).HasComment("工厂代码");
            b.Property(x => x.ProductCode).HasMaxLength(256).HasComment("产品代码");
            b.Property(x => x.WorkstationCode).HasMaxLength(256).HasComment("工位代码");
            b.Property(x => x.EquipmentCode).HasMaxLength(256).HasComment("设备代码");
            b.Property(x => x.ProdLineCode).HasMaxLength(256).HasComment("产线编码");
            b.Property(x => x.ShipNumber).HasMaxLength(256).HasComment("船号");
            b.Property(x => x.ProjectNumber).HasMaxLength(256).HasComment("项目号");
 
            b.Property(x => x.ProcessName).HasMaxLength(256).HasComment("工序名称");
            b.Property(x => x.PipeFittingCode).HasMaxLength(256).HasComment("管件编码");
            b.Property(x => x.PreSerialNumber).HasMaxLength(256).HasComment("顺序号");
            b.Property(x => x.PipeSpecCode).HasMaxLength(256).HasComment("管段编码");
            b.Property(x => x.PipeSectionName).HasMaxLength(256).HasComment("管段名称");
            b.Property(x => x.OuterDiameter).HasColumnType("decimal(18,2)").HasComment("外径(mm)");
            b.Property(x => x.Thickness).HasColumnType("decimal(18,2)").HasComment("壁厚(mm)");
            b.Property(x => x.Material).HasMaxLength(256).HasComment("材质");
 
 
            b.Property(x => x.MarkingPosition).HasColumnType("decimal(18,2)").HasComment("打码位置");
            b.Property(x => x.CuttingPosition).HasColumnType("decimal(18,2)").HasComment("切割位置");
 
            b.Property(x => x.ProcessRouteNumber).HasMaxLength(256).HasComment("工艺流向编号");
            b.Property(x => x.PlannedStartTime).HasComment("计划开始时间");
            b.Property(x => x.PlannedEndTime).HasComment("计划完成时间");
            b.Property(x => x.TeamInfo).HasMaxLength(256).HasComment("班组信息");
            b.Property(x => x.Timestamp).HasMaxLength(256).HasComment("时间戳");
 
            b.ConfigureMyCmsEntity();
 
            // Configure indexes
            b.HasIndex(u => u.Son_TaskCode).IsUnique();
            b.HasIndex(u => u.DataIdentifier);
            b.HasIndex(u => u.PlannedStartTime);
            b.HasIndex(u => u.PlannedEndTime);
 
            b.ApplyObjectExtensionMappings();
        });
    }
}