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 InputMaterialEntity : ICommonEntity { /// /// 1物料主键 /// public int Id { get; set; } /// /// 2导入状态 /// public string Status { get; set; } /// /// 3物料号 /// public string Code { get; set; } /// /// 4物料名 /// public string Name { get; set; } /// /// 5物料类型 /// public string TypeName { get; set; } /// /// 6切割类型 /// public string CuttingType { get; set; } /// /// 7出入库单号 /// public string ListNo { get; set; } /// /// 8船级社 /// public string ClassificationSociety { get; set; } /// /// 9分段号 /// public string SerialNo { get; set; } /// /// 10厚(mm) /// public string Thick { get; set; } /// /// 11宽(mm) /// public string Wide { get; set; } /// /// 12长(mm) /// public string Length { get; set; } /// /// 无参构造 /// public InputMaterialEntity() { } /// /// 有参构造 /// /// orm映射的类 public InputMaterialEntity(BASEInputMaterial material) { EntityPropHelper.CopyProp(material, this, GetColumnMap()); } ///// ///// 转换视图的方法 ///// ///// //public InputMaterialEntity(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中的BASEInputMaterial类型 public BASEInputMaterial ToOrm() { BASEInputMaterial material = new BASEInputMaterial(); EntityPropHelper.CopyProp(this, material, GetColumnMap()); return material; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { { "Id", "id"}, { "Status", "status"}, { "Code", "code"}, { "Name", "name"}, { "TypeName", "typename"}, { "CuttingType","cuttingtype"}, { "ListNo","listno"}, { "ClassificationSociety", "classificationsociety"}, { "SerialNo", "serialno"}, { "Thick", "thick"}, { "Wide", "wide"}, { "Length", "length"} }; } /// /// 根据InputMaterialEntity的字段转BASEInputMaterial的字段 /// /// InputMaterialEntity的字段 /// BASEInputMaterial public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取InputMaterialEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[BASEInputMaterial]"; } } }