using iWareCommon.Common.Entity; using iWareCommon.Utils; using iWareDataCore.ORM; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace iWareDataCore.BASE.Entity { public class MaterialVoidLabelEntity : ICommonEntity { /// /// 1物料主键 /// public int Id { get; set; } /// /// 2库位外键id /// public int MaterialId { get; set; } /// /// 3锁定级别 /// public int Voidlabel { get; set; } /// /// 4数量 /// public int Quantity { get; set; } /// /// 5物料类型 /// public int Type { get; set; } /// /// 6orderid /// public int OrderId { get; set; } /// /// 无参构造 /// public MaterialVoidLabelEntity() { } /// /// 有参构造 /// /// orm映射的类 public MaterialVoidLabelEntity(BASEMaterialVoidLabel material) { EntityPropHelper.CopyProp(material, this, GetColumnMap()); } ///// ///// 转换视图的方法 ///// ///// //public MaterialVoidLabelEntity(MaterialViewEntity material) //{ // var keys = GetColumnMap().Keys.ToList(); // var columnMap = new Dictionary(); // keys.ForEach(x => columnMap.Add(x, x)); // EntityPropHelper.CopyProp(material, this, columnMap); //} /// /// 将对象转换成ORM中的类型 /// /// Orm中的BASEMaterialVoidLabel类型 public BASEMaterialVoidLabel ToOrm() { BASEMaterialVoidLabel material = new BASEMaterialVoidLabel(); EntityPropHelper.CopyProp(this, material, GetColumnMap()); return material; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { { "Id", "id"}, { "MaterialId", "materialid"}, { "Voidlabel", "voidlabel"}, { "Type", "type"}, { "Remark", "remark"}, { "OrderId","orderid"} }; } /// /// 根据MaterialVoidLabelEntity的字段转BASEMaterialVoidLabel的字段 /// /// MaterialVoidLabelEntity的字段 /// BASEMaterialVoidLabel public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取MaterialVoidLabelEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[BASEMaterialVoidLabel]"; } } }