using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using iWare.Wms.Core.Enum;
namespace iWare.Wms.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("物料批次")]
[Required]
[MaxLength(50)]
public string MaterialBatch { get; set; }
///
/// 描述
///
[Comment("描述")]
[MaxLength(500)]
public string Description { get; set; }
///
/// 检验方式;数据字典
///
[Comment("检验方式")]
[Required]
public MaterialInspection InspectionMethod { get; set; }
///
/// 物料类别;数据字典
///
[Comment("物料类别")]
[Required]
public MaterialType MaterialType { get; set; }
///
/// 物料规格
///
[Comment("物料规格")]
[Required]
[MaxLength(50)]
public string MaterialSpec { get; set; }
///
/// 单位类别;数据字典
///
[Comment("单位类别")]
[Required]
public UnitType UnitType { get; set; }
///
/// 单位编号;数据字典
///
[Comment("单位编号")]
[Required]
public UnitnoType UnitNo { get; set; }
///
/// 安全存量
///
[Comment("安全存量")]
public decimal Safeqty { get; set; }
///
/// 是否关键物料;数据字典
///
[Comment("是否关键物料")]
public YesOrNot Keymaterials { get; set; }
///
/// Erp单号
///
[Comment("Erp单号")]
[MaxLength(50)]
public string ErpNo { get; set; }
///
/// 图号
///
[Comment("图号")]
[MaxLength(50)]
public string GraphNo { get; set; }
///
/// 品管类别
///
[Comment("品管类别")]
[MaxLength(50)]
public string Qccategory { get; set; }
///
/// 保质期
///
[Comment("保质期")]
public decimal Warranty { get; set; }
///
/// 最大存量
///
[Comment("最大存量")]
public decimal MaxImumqty { get; set; }
///
/// 最小库龄
///
[Comment("最小库龄")]
public decimal MinstorageAge { get; set; }
///
/// 最大库龄
///
[Comment("最大库龄")]
public decimal MaxstorageAge { get; set; }
public ICollection WmsMaterialContainers { get; set; }
///
/// 构建一对多的关系
///
///
///
///
public void Configure(EntityTypeBuilder entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasMany(x => x.WmsMaterialContainers)
.WithOne(x => x.WmsMaterial)
.HasForeignKey(x => x.MaterialId).IsRequired(false);
}
}
}