payne
2024-04-25 46af5a3a488e06c2eb4844a2dd72ad9ddcd7cdbd
iWare_RawMaterialWarehouse_Wms/Admin.NET.Core/Entity/WmsBase/WmsMaterial.cs
@@ -1,9 +1,12 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
/*
 * @author : 刘文奇
 * @date : 2024/4/23下午1:36:22
 * @desc : 物料信息表
 */
namespace Admin.NET.Core
{
    /// <summary>
@@ -11,8 +14,10 @@
    /// </summary>
    [Table("wms_material")]
    [Comment("物料信息表")]
    public class WmsMaterial : DEntityBase, IEntityTypeBuilder<WmsMaterial>
    public class WmsMaterial : DEntityBase
    {
        /// <summary>
        /// 物料名称
        /// </summary>
@@ -21,154 +26,181 @@
        [MaxLength(50)]
        public string MaterialName { get; set; }
        /// <summary>
        /// 物料编号
        /// </summary>
        [Comment("物料编号")]
        [Required]
        [MaxLength(50)]
        public string MaterialNo { get; set; }
        public string MaterialCode { get; set; }
        /// <summary>
        /// 物料批次
        /// ERP编号
        /// </summary>
        [Comment("物料批次")]
        [Comment("ERP编号")]
        [MaxLength(255)]
        public string ErpCode { get; set; }
        /// <summary>
        /// 物料类型名称
        /// </summary>
        [Comment("物料类型名称")]
        [Required]
        [MaxLength(50)]
        public string MaterialBatch { get; set; }
        public string MaterialTypeName { get; set; }
        /// <summary>
        /// 物料类别;数据字典
        /// 物料类型描述
        /// </summary>
        [Comment("物料类别")]
        public MaterialType MaterialType { get; set; }
        [Comment("物料类型描述")]
        [MaxLength(255)]
        public string MaterialTypeDescr { get; set; }
        /// <summary>
        /// 物料检验
        /// 物料类型
        /// </summary>
        [Comment("物料检验")]
        public MaterialInspection InspectionMethod { get; set; }
        [Comment("物料类型")]
        [Required]
        public int MaterialType { get; set; }
        /// <summary>
        /// 物料组
        /// </summary>
        [Comment("物料组")]
        [MaxLength(50)]
        public string MaterialGroup { get; set; }
        /// <summary>
        /// ABC分类名称
        /// </summary>
        [Comment("ABC分类名称")]
        [MaxLength(50)]
        public string ABCClassName { get; set; }
        /// <summary>
        /// ABC分类
        /// </summary>
        [Comment("ABC分类")]
        public ABCClassEnum? ABCClass { get; set; }
        /// <summary>
        /// 物料规格
        /// </summary>
        [Comment("物料规格")]
        [MaxLength(50)]
        [MaxLength(255)]
        public string MaterialSpec { get; set; }
        /// <summary>
        /// 物料密度
        /// </summary>
        [Comment("物料密度")]
        [MaxLength(50)]
        public string MaterialDensity { get; set; }
        /// <summary>
        /// 物料单位
        /// 默认入库库位
        /// </summary>
        [Comment("物料单位")]
        [Comment("默认入库库位")]
        [MaxLength(50)]
        public string InPlaceCode { get; set; }
        /// <summary>
        /// 库存单位
        /// </summary>
        [Comment("库存单位")]
        [Required]
        [MaxLength(50)]
        public string MaterialUnit { get; set; }
        /// <summary>
        /// 库区Ids
        /// </summary>
        [Comment("库区Ids")]
        public string AreaIds { get; set; }
        /// <summary>
        /// 库区参数
        /// 采购单位
        /// </summary>
        [Comment("库区参数")]
        public string AreaNameParameter { get; set; }
        [Comment("采购单位")]
        [Required]
        [MaxLength(50)]
        public string POUnit { get; set; }
        /// <summary>
        /// 工作区Ids
        /// 颜色
        /// </summary>
        [Comment("工作区Ids")]
        public string StationIds { get; set; }
        [Comment("颜色")]
        [MaxLength(50)]
        public string Color { get; set; }
        /// <summary>
        /// 工作区参数
        /// 重量
        /// </summary>
        [Comment("工作区参数")]
        public string StationNameParameter { get; set; }
        [Comment("重量")]
        [MaxLength(50)]
        public string Weight { get; set; }
        /// <summary>
        /// 工段
        /// 标包数量
        /// </summary>
        //[Comment("工段")]
        //[Required]
        //public LesWorkshopSection LesWorkshopSection { get; set; }
        [Comment("标包数量")]
        //1215
        [Column("SNP", TypeName = "decimal(10,3)")]
        public decimal? SNP { get; set; }
        /// <summary>
        /// 换算率
        /// </summary>
        [Comment("换算率")]
        [Column("TranslateRate", TypeName = "decimal(10,3)")]
        public decimal? TranslateRate { get; set; }
        /// <summary>
        /// 批次属性规则
        /// </summary>
        [Comment("批次属性规则")]
        public long? BatchRuleId { get; set; }
        /// <summary>
        /// 控制属性规则
        /// </summary>
        [Comment("控制属性规则")]
        public long? ControlRuleId { get; set; }
        /// <summary>
        /// 是否禁用
        /// </summary>
        [Comment("是否禁用")]
        [Required]
        public bool IsDisabled { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [Comment("描述")]
        [MaxLength(500)]
        public string Description { get; set; }
        /// <summary>
        /// 安全存量
        /// </summary>
        [Comment("安全存量")]
        public decimal Safeqty { get; set; }
        /// <summary>
        /// 最大存量
        /// </summary>
        [Comment("最大存量")]
        public decimal MaxImumqty { get; set; }
        /// <summary>
        /// 最小库龄
        /// </summary>
        [Comment("最小库龄")]
        public decimal MinstorageAge { get; set; }
        /// <summary>
        /// 最大库龄
        /// </summary>
        [Comment("最大库龄")]
        public decimal MaxstorageAge { get; set; }
        [MaxLength(255)]
        public string MaterialDesc { get; set; }
        /// <summary>
        /// 物料托盘关系表
        /// </summary>
        public ICollection<WmsMaterialContainer> WmsFoamingMaterialContainer { get; set; }
        /// <summary>
        /// 物料托盘历史表
        /// </summary>
        public ICollection<WmsHistoryMaterialContainer> WmsFoamingHistoryMaterialContainer { get; set; }
        /// <summary>
        /// 构建一对多的关系
        /// </summary>
        /// <param name="entityBuilder"></param>
        /// <param name="dbContext"></param>
        /// <param name="dbContextLocator"></param>
        public void Configure(EntityTypeBuilder<WmsMaterial> 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);
        }
    }
}
}