using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Admin.NET.Core
{
///
/// 物料信息表
///
[Table("wms_material")]
[Comment("物料信息表")]
public class WmsMaterial : DEntityBase, IEntityTypeBuilder
{
///
/// 物料名称
///
[Comment("物料名称")]
[Required]
[MaxLength(50)]
public string MaterialName { get; set; }
///
/// 物料编号
///
[Comment("物料编号")]
[Required]
[MaxLength(50)]
public string MaterialNo { get; set; }
///
/// 物料批次
///
[Comment("物料批次")]
[MaxLength(50)]
public string MaterialBatch { get; set; }
///
/// 物料类别;数据字典
///
[Comment("物料类别")]
public MaterialType MaterialType { get; set; }
///
/// 物料检验
///
[Comment("物料检验")]
public MaterialInspection InspectionMethod { get; set; }
///
/// 物料规格
///
[Comment("物料规格")]
[MaxLength(50)]
public string MaterialSpec { get; set; }
///
/// 物料密度
///
[Comment("物料密度")]
[MaxLength(50)]
public string MaterialDensity { get; set; }
///
/// 物料单位
///
[Comment("物料单位")]
[MaxLength(50)]
public string MaterialUnit { get; set; }
///
/// 库区Ids
///
[Comment("库区Ids")]
public string AreaIds { get; set; }
///
/// 库区参数
///
[Comment("库区参数")]
public string AreaNameParameter { get; set; }
///
/// 工作区Ids
///
[Comment("工作区Ids")]
public string StationIds { get; set; }
///
/// 工作区参数
///
[Comment("工作区参数")]
public string StationNameParameter { get; set; }
///
/// 工段
///
//[Comment("工段")]
//[Required]
//public LesWorkshopSection LesWorkshopSection { get; set; }
//1215
///
/// 描述
///
[Comment("描述")]
[MaxLength(500)]
public string Description { get; set; }
///
/// 安全存量
///
[Comment("安全存量")]
public decimal Safeqty { get; set; }
///
/// 最大存量
///
[Comment("最大存量")]
public decimal MaxImumqty { get; set; }
///
/// 最小库龄
///
[Comment("最小库龄")]
public decimal MinstorageAge { get; set; }
///
/// 最大库龄
///
[Comment("最大库龄")]
public decimal MaxstorageAge { get; set; }
///
/// 物料托盘关系表
///
public ICollection WmsFoamingMaterialContainer { get; set; }
///
/// 物料托盘历史表
///
public ICollection WmsFoamingHistoryMaterialContainer { get; set; }
///
/// 构建一对多的关系
///
///
///
///
public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasMany(x => x.WmsFoamingMaterialContainer)
.WithOne(x => x.WmsMaterial)
.HasForeignKey(x => x.MaterialId).IsRequired(false);
entityBuilder.HasMany(x => x.WmsFoamingHistoryMaterialContainer)
.WithOne(x => x.WmsMaterial)
.HasForeignKey(x => x.MaterialId).IsRequired(false);
}
}
}