using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Net.NetworkInformation; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace DS.Module.Core.Enums { public class EnumsHelper { ///// ///// 根据枚举值获取枚举Description ///// ///// ///// ///// //public static string GetEnumDescriptionFromValue(T val) //{ // Type t = typeof(T); // MemberInfo[] field = t.GetMember(val.ToString()); // object[] attrs = field?.FirstOrDefault().GetCustomAttributes(typeof(DescriptionAttribute), true); // string description = ((DescriptionAttribute)attrs.FirstOrDefault()).Description; // return description; //} /// /// 根据Description获取枚举 /// /// /// /// /// ///// 调用示例 ///GetEnumByDescription("description") public T GetEnumByDescription(string description) where T : Enum { System.Reflection.FieldInfo[] fields = typeof(T).GetFields(); foreach (System.Reflection.FieldInfo field in fields) { object[] objs = field.GetCustomAttributes(typeof(DescriptionAttribute), false); //获取描述属性 if (objs.Length > 0 && (objs[0] as DescriptionAttribute).Description == description) { return (T)field.GetValue(null); } } throw new ArgumentException(string.Format("{0} 未能找到对应的枚举.", description), "Description"); } } /// /// 箱管 箱上线状态 /// public enum CM_IsOnlineEnum { /// /// 已上线 /// [Description("上线")] 上线 = 1, /// /// 确认 /// [Description("待上线")] 待上线 = 0, /// /// 提交审核 /// [Description("下线")] 下线 = -1, } /// /// 箱管 箱来源 /// public enum CM_CtnSourceEnum { /// /// 自有箱 /// [Description("自有箱")] 自有箱 = 0, /// /// 短租租入 /// [Description("短租租入")] 短租租入 = 1, /// /// 长租租入 /// [Description("长租租入")] 长租租入 = 2, } /// /// 箱管 当前业务类型 /// public enum CM_CtnBizStateEnum { ///// ///// 自有箱 ///// //[Description("自有箱")] //自有箱 = 0, /// /// 租入 /// [Description("租入")] 租入 = 0, /// /// 租入退租 /// [Description("租入退租")] 租入退租 = 1, /// /// 租出 /// [Description("租出")] 租出 = 2, /// /// 租出退租 /// [Description("租出退租")] 租出退租 = 3, /// /// 单程租出业务 /// [Description("单程租出业务")] 单程租出业务 = 4, /// /// 买箱 /// [Description("买箱")] 买箱 = 5, /// /// 卖箱 /// [Description("卖箱")] 卖箱 = 6, /// /// 报废 /// [Description("报废")] 报废 = 7, /// /// 单程业务 /// [Description("单程租出业务还箱")] 单程租出业务还箱 = 8, /// /// 单程租入业务 /// [Description("单程租入业务")] 单程租入业务 = 9, /// /// 单程租入业务还箱 /// [Description("单程租入业务还箱")] 单程租入业务还箱 = 10, } /// /// 箱管 箱状态 /// public enum CMCtnStateEnum { /// /// 可用 /// [Description("AV")] AV = 1, /// /// 已订 /// [Description("BK")] BK = 2, /// /// 在途 /// [Description("POS")] POS = 3, /// /// 损坏 /// [Description("DM")] DM = -1, /// /// 维修中 /// [Description("REP")] REP = 0, } /// /// 箱管 箱可用状态 /// public enum CMCtnBreakStateEnum { /// /// 可用 /// [Description("可用")] AV = 1, /// /// 已订 /// /// /// 损坏 /// [Description("损坏")] DM = -1, /// /// 维修中 /// //[Description("维修中")] //REP = 0, } /// /// 箱管 箱运行状态 /// public enum CMCtnFlowStateEnum { /// /// 重箱卸船到码头:DlF- Discharge Inbound Full container at TML /// [Description("DIF")] DIF = 0, /// /// 收货人提箱卸货: /// DCF - C/NEE pick up container from TML and unloading cargo in their warehous or at TML directly /// [Description("DCF")] DCF = 1, /// /// 收货人还空箱:GlM - C/NEE empty return our container to our Local Depot /// [Description("GLM")] GLM = 2, /// /// 坏箱维修计划确认:RPM - Container upload Estimate and confirm to repair at our Local Depot. /// [Description("RPM")] RPM = 3, /// /// 修箱完成进场:GlM - Container competed repair and available to pick up with sound status. /// [Description("GIM")] GIM = 4, /// /// 发货人提空箱:DSM - Container picked up by shipper for export by our good service. /// [Description("DSM")] DSM = 5, /// /// 重箱返场:OBF - Container gate-in Terminal and ready for loading. /// [Description("OBF")] OBF = 6, /// /// 重箱装船:LDF- Container loading on board successful. /// [Description("LDF")] LDF = 7, ///// ///// 已提箱 ///// //[Description("已提箱")] //已提箱 = 100, ///// ///// 已还箱 ///// //[Description("已还箱")] //已还箱 = 101, /// /// 进口 /// [Description("进口")] 进口 = 102, /// /// 出口 /// [Description("出口")] 出口 = 103, /// /// 拆空 /// [Description("拆空")] 拆空 = 104, /// /// 调入 /// [Description("调入")] 调入 = 105, ///// ///// 调入 ///// //[Description("买入")] //买入 = 106, /// /// 调入 /// [Description("空入")] 空入 = 107, /// /// 调入 /// [Description("空出")] 空出 = 108, /// /// 租入 上线:长租租入箱 /// [Description("租入")] 租入 = 111, /// /// 买入 上线:购入箱 /// [Description("买入")] 买入 = 112, /// /// 还回 上线:代表长租租出的退租 /// [Description("还回")] 还回 = 113, /// /// 租出 下线:代表长租租出 /// [Description("租出")] 租出 = 114, /// /// 卖出 下线 /// [Description("卖出")] 卖出 = 115, /// /// 还租 下线:代表长租租入的退租 /// [Description("还租")] 还租 = 116, } /// /// 箱变动来源枚举 /// public enum CMChangeSourceEnum { /// /// 手动批量变动 /// [Description("手动批量变动")] 手动批量变动 = 0, /// /// 租箱租入 /// [Description("租箱租入")] 租箱租入 = 1, /// /// 租箱租出 /// [Description("租箱租出")] 租箱租出 = 2, /// /// 买箱 /// [Description("买箱")] 买箱 =3, /// /// 卖箱 /// [Description("卖箱")] 卖箱 = 4, /// /// 报废 /// [Description("报废箱")] 报废箱 = 5, /// /// 单程 /// [Description("单程")] 单程 = 6, } /// /// 租箱退租 /// public enum CMRentDirectEnum { /// /// 租入 /// [Description("租入")] 租入 = 0, /// /// 退租 /// [Description("租入退租")] 租入退租 = 1, /// /// 租出 /// [Description("租出")] 租出 = 2, /// /// 租出退租 /// [Description("租出退租")] 租出退租 = 3, } /// /// 租箱类型 长租短租 /// public enum CMRentTypeEnum { /// /// 长租 /// [Description("长租")] 长租 = 1, /// /// 短租 /// [Description("短租")] 短租 = 0, /// /// 单程 /// [Description("单程")] 单程 = 2, } /// /// 业务状态 /// //执行动作 1001提交审核 1000撤回 10001驳回 1100审核通过 //状态 "/1000"录入 10001驳回 1001审核中 1100审核通过 /// public enum CM_BillStatusEnum { /// /// 租入 /// [Description("录入")] 录入 = 1000, /// /// 租入退租 /// [Description("驳回")] 驳回 = 10001, /// /// 租出 /// [Description("审核中")] 审核中 = 1001, /// /// 租出退租 /// [Description("审核通过")] 审核通过 = 1100, } public enum CM_ExecutionEnum { /// /// 租入 /// [Description("提交审核")] 提交审核 = 1001, /// /// 租入退租 /// [Description("撤回")] 撤回 = 1000, /// /// 租出 /// [Description("驳回")] 驳回 = 10001, /// /// 租出退租 /// [Description("审核通过")] 审核通过 = 1100, } }