using iWareCommon.Common.Entity; using iWareCommon.Utils; using iWareDataCore.ORM; using System; using System.Collections.Generic; using System.Linq; namespace iWareDataCore.BASE.Entity { public class MaterialViewEntity : ICommonEntity { /// /// 1物料主键 /// public int Id { get; set; } /// /// 2物料名称 /// public string Name { get; set; } /// /// 3物料号 /// public string Code { get; set; } /// /// 3物料规格号 /// public string MaterialNo { get; set; } /// /// 4版本(用于记录SAP的类型号) /// public string Version { get; set; } /// /// 5物料状态(启用、禁用) /// public int Status { get; set; } /// /// 6保质期 /// public string GuaranteePeriod { get; set; } /// /// 7计数单位 /// public string Unit { get; set; } /// /// 8物料备注(用于记录SAP租号) /// public string Remark { get; set; } /// /// 9描述 /// public string Description { get; set; } /// /// 10成本 /// public decimal Cost { get; set; } /// /// 11船级社 /// public string ClassificationSociety { get; set; } /// /// 12分段号 /// public string SerialNo { get; set; } /// /// 13垂直位置 /// public string VerticalPosition { get; set; } /// /// 14重量 /// public string Weight { get; set; } /// /// 15发放工程号 /// public string IssueProjectNo { get; set; } /// /// 16采购工程号 /// public string ProcurementProjectNo { get; set; } /// /// 17切割类型 /// public string CuttingType { get; set; } /// /// 18页码 /// public string PageNo { get; set; } /// /// 19厚 /// public string Thick { get; set; } /// /// 20宽 /// public string Wide { get; set; } /// /// 21长 /// public string Length { get; set; } /// /// 22记号笔 /// public string MarkingPen { get; set; } /// /// 23分道 /// public string Laneseparation { get; set; } /// /// 24类型备注 /// public string TypeRemark { get; set; } /// /// 25类型名称 /// public string TypeName { get; set; } /// /// 26材质类型 /// public int MaterialType { get; set; } /// /// 27数量 /// public int Quantity { get; set; } /// /// 无参构造 /// public MaterialViewEntity() { } /// /// 有参构造 /// /// orm映射的类 public MaterialViewEntity(BASEMaterialView material) { EntityPropHelper.CopyProp(material, this, GetColumnMap()); } /// /// 将对象转换成ORM中的类型 /// /// Orm中的BASEMaterialView类型 public BASEMaterialView ToOrm() { var material = new BASEMaterialView(); EntityPropHelper.CopyProp(this, material, GetColumnMap()); return material; } /// /// 获取自定义角色类中的字段名为键,orm中对象的字段名为值的字段 /// /// public static Dictionary GetColumnMap() { return new Dictionary() { { "Id", "id"}, { "Name", "name"}, { "Code", "code"}, { "MaterialNo", "materialno"}, { "Version", "version"}, { "Status", "status"}, { "GuaranteePeriod", "guaranteeperiod"}, { "Unit", "unit"}, { "Remark", "remark"}, { "Description", "description"}, { "Cost", "cost"}, { "ClassificationSociety", "classificationsociety"}, { "SerialNo", "serialno"}, { "VerticalPosition", "verticalposition"}, { "Weight", "weight"}, { "IssueProjectNo", "issueprojectno"}, { "ProcurementProjectNo", "procurementprojectno"}, { "CuttingType", "cuttingtype"}, { "PageNo", "pageno"}, { "Thick", "thick"}, { "Wide", "wide"}, { "Length", "length"}, { "MarkingPen", "markingpen"}, { "Laneseparation", "laneseparation"}, { "TypeRemark", "typeremark"}, { "TypeName", "typename"}, { "MaterialType", "materialtype"} }; } /// /// 根据MaterialViewEntity的字段转BASEMaterialView的字段 /// /// MaterialViewEntity的字段 /// BASEMaterialView public static string GetColumnName(string name) { var columnMap = GetColumnMap(); return columnMap.ContainsKey(name) ? columnMap[name] : name; } /// /// 获取MaterialViewEntity对应的表名 /// /// 表名 public static string GetTableName() { return "[dbo].[BASEMaterialView]"; } /// /// 添加克隆对象 /// /// public MaterialViewEntity Clone() { var newObj = new MaterialViewEntity(); EntityPropHelper.CopyProp(this, newObj, GetColumnMap().Keys.ToList()); return newObj; } } }