using CMS.Plugin.HIAWms.Domain;
using CMS.Plugin.HIAWms.Domain.WmsContainerPlaces;
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
{
///
/// EfCore扩展
///
public static partial class CMSPluginEfCoreExtensions
{
///
/// Includes the details.
///
/// The queryable.
/// if set to true [include].
///
public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable;
}
///
/// Configures the WMS task entity.
///
/// The builder.
public static void ConfigureWmsTask(this ModelBuilder builder)
{
Check.NotNull(builder, nameof(builder));
builder.Entity(b =>
{
b.ToTable((CMSPluginDbProperties.DbTablePrefix + "_WmsTasks").ToLower(), CMSPluginDbProperties.DbSchema)
.HasComment("任务表");
b.ConfigureByConvention();
// Primary key configuration (inherited from FullAuditedAggregateRoot)
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();
});
}
}
}