You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

512 lines
13 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

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 {
///// <summary>
///// 根据枚举值获取枚举Description
///// </summary>
///// <typeparam name="T"></typeparam>
///// <param name="val"></param>
///// <returns></returns>
//public static string GetEnumDescriptionFromValue<T>(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;
//}
/// <summary>
/// 根据Description获取枚举
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="val"></param>
/// <returns></returns>
///
///// 调用示例
///GetEnumByDescription<enumStudent>("description")
public T GetEnumByDescription<T>(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");
}
}
/// <summary>
/// 箱管 箱上线状态
/// </summary>
public enum CM_IsOnlineEnum
{
/// <summary>
/// 已上线
/// </summary>
[Description("上线")]
线 = 1,
/// <summary>
/// 确认
/// </summary>
[Description("待上线")]
线 = 0,
/// <summary>
/// 提交审核
/// </summary>
[Description("下线")]
线 = -1,
}
/// <summary>
/// 箱管 箱来源
/// </summary>
public enum CM_CtnSourceEnum
{
/// <summary>
/// 自有箱
/// </summary>
[Description("自有箱")]
= 0,
/// <summary>
/// 短租租入
/// </summary>
[Description("短租租入")]
= 1,
/// <summary>
/// 长租租入
/// </summary>
[Description("长租租入")]
= 2,
}
/// <summary>
/// 箱管 当前业务类型
/// </summary>
public enum CM_CtnBizStateEnum
{
///// <summary>
///// 自有箱
///// </summary>
//[Description("自有箱")]
//自有箱 = 0,
/// <summary>
/// 租入
/// </summary>
[Description("租入")]
= 0,
/// <summary>
/// 租入退租
/// </summary>
[Description("租入退租")]
退 = 1,
/// <summary>
/// 租出
/// </summary>
[Description("租出")]
= 2,
/// <summary>
/// 租出退租
/// </summary>
[Description("租出退租")]
退 = 3,
/// <summary>
/// 单程租出业务
/// </summary>
[Description("单程租出业务")]
= 4,
/// <summary>
/// 买箱
/// </summary>
[Description("买箱")]
= 5,
/// <summary>
/// 卖箱
/// </summary>
[Description("卖箱")]
= 6,
/// <summary>
/// 报废
/// </summary>
[Description("报废")]
= 7,
/// <summary>
/// 单程业务
/// </summary>
[Description("单程租出业务还箱")]
= 8,
/// <summary>
/// 单程租入业务
/// </summary>
[Description("单程租入业务")]
= 9,
/// <summary>
/// 单程租入业务还箱
/// </summary>
[Description("单程租入业务还箱")]
= 10,
}
/// <summary>
/// 箱管 箱状态
/// </summary>
public enum CMCtnStateEnum
{
/// <summary>
/// 可用
/// </summary>
[Description("AV")]
AV = 1,
/// <summary>
/// 已订
/// </summary>
[Description("BK")]
BK = 2,
/// <summary>
/// 在途
/// </summary>
[Description("POS")]
POS = 3,
/// <summary>
/// 损坏
/// </summary>
[Description("DM")]
DM = -1,
/// <summary>
/// 维修中
/// </summary>
[Description("REP")]
REP = 0,
}
/// <summary>
/// 箱管 箱可用状态
/// </summary>
public enum CMCtnBreakStateEnum
{
/// <summary>
/// 可用
/// </summary>
[Description("可用")]
AV = 1,
/// <summary>
/// 已订
/// </summary>
/// <summary>
/// 损坏
/// </summary>
[Description("损坏")]
DM = -1,
/// <summary>
/// 维修中
/// </summary>
//[Description("维修中")]
//REP = 0,
}
/// <summary>
/// 箱管 箱运行状态
/// </summary>
public enum CMCtnFlowStateEnum
{
/// <summary>
/// 重箱卸船到码头DlF- Discharge Inbound Full container at TML
/// </summary>
[Description("DIF")]
DIF = 0,
/// <summary>
/// 收货人提箱卸货:
/// DCF - C/NEE pick up container from TML and unloading cargo in their warehous or at TML directly
/// </summary>
[Description("DCF")]
DCF = 1,
/// <summary>
/// 收货人还空箱GlM - C/NEE empty return our container to our Local Depot
/// </summary>
[Description("GLM")]
GLM = 2,
/// <summary>
/// 坏箱维修计划确认RPM - Container upload Estimate and confirm to repair at our Local Depot.
/// </summary>
[Description("RPM")]
RPM = 3,
/// <summary>
/// 修箱完成进场GlM - Container competed repair and available to pick up with sound status.
/// </summary>
[Description("GIM")]
GIM = 4,
/// <summary>
/// 发货人提空箱DSM - Container picked up by shipper for export by our good service.
/// </summary>
[Description("DSM")]
DSM = 5,
/// <summary>
/// 重箱返场OBF - Container gate-in Terminal and ready for loading.
/// </summary>
[Description("OBF")]
OBF = 6,
/// <summary>
/// 重箱装船LDF- Container loading on board successful.
/// </summary>
[Description("LDF")]
LDF = 7,
///// <summary>
///// 已提箱
///// </summary>
//[Description("已提箱")]
//已提箱 = 100,
///// <summary>
///// 已还箱
///// </summary>
//[Description("已还箱")]
//已还箱 = 101,
/// <summary>
/// 进口
/// </summary>
[Description("进口")]
= 102,
/// <summary>
/// 出口
/// </summary>
[Description("出口")]
= 103,
/// <summary>
/// 拆空
/// </summary>
[Description("拆空")]
= 104,
/// <summary>
/// 调入
/// </summary>
[Description("调入")]
= 105,
///// <summary>
///// 调入
///// </summary>
//[Description("买入")]
//买入 = 106,
/// <summary>
/// 调入
/// </summary>
[Description("空入")]
= 107,
/// <summary>
/// 调入
/// </summary>
[Description("空出")]
= 108,
/// <summary>
/// 租入 上线:长租租入箱
/// </summary>
[Description("租入")]
= 111,
/// <summary>
/// 买入 上线:购入箱
/// </summary>
[Description("买入")]
= 112,
/// <summary>
/// 还回 上线:代表长租租出的退租
/// </summary>
[Description("还回")]
= 113,
/// <summary>
/// 租出 下线:代表长租租出
/// </summary>
[Description("租出")]
= 114,
/// <summary>
/// 卖出 下线
/// </summary>
[Description("卖出")]
= 115,
/// <summary>
/// 还租 下线:代表长租租入的退租
/// </summary>
[Description("还租")]
= 116,
}
/// <summary>
/// 箱变动来源枚举
/// </summary>
public enum CMChangeSourceEnum
{
/// <summary>
/// 手动批量变动
/// </summary>
[Description("手动批量变动")]
= 0,
/// <summary>
/// 租箱租入
/// </summary>
[Description("租箱租入")]
= 1,
/// <summary>
/// 租箱租出
/// </summary>
[Description("租箱租出")]
= 2,
/// <summary>
/// 买箱
/// </summary>
[Description("买箱")]
=3,
/// <summary>
/// 卖箱
/// </summary>
[Description("卖箱")]
= 4,
/// <summary>
/// 报废
/// </summary>
[Description("报废箱")]
= 5,
/// <summary>
/// 单程
/// </summary>
[Description("单程")]
= 6,
}
/// <summary>
/// 租箱退租
/// </summary>
public enum CMRentDirectEnum
{
/// <summary>
/// 租入
/// </summary>
[Description("租入")]
= 0,
/// <summary>
/// 退租
/// </summary>
[Description("租入退租")]
退 = 1,
/// <summary>
/// 租出
/// </summary>
[Description("租出")]
= 2,
/// <summary>
/// 租出退租
/// </summary>
[Description("租出退租")]
退 = 3,
}
/// <summary>
/// 租箱类型 长租短租
/// </summary>
public enum CMRentTypeEnum
{
/// <summary>
/// 长租
/// </summary>
[Description("长租")]
= 1,
/// <summary>
/// 短租
/// </summary>
[Description("短租")]
= 0,
/// <summary>
/// 单程
/// </summary>
[Description("单程")]
= 2,
}
/// <summary>
/// 业务状态
/// //执行动作 1001提交审核 1000撤回 10001驳回 1100审核通过
//状态 "/1000"录入 10001驳回 1001审核中 1100审核通过
/// </summary>
public enum CM_BillStatusEnum
{
/// <summary>
/// 租入
/// </summary>
[Description("录入")]
= 1000,
/// <summary>
/// 租入退租
/// </summary>
[Description("驳回")]
= 10001,
/// <summary>
/// 租出
/// </summary>
[Description("审核中")]
= 1001,
/// <summary>
/// 租出退租
/// </summary>
[Description("审核通过")]
= 1100,
}
public enum CM_ExecutionEnum
{
/// <summary>
/// 租入
/// </summary>
[Description("提交审核")]
= 1001,
/// <summary>
/// 租入退租
/// </summary>
[Description("撤回")]
= 1000,
/// <summary>
/// 租出
/// </summary>
[Description("驳回")]
= 10001,
/// <summary>
/// 租出退租
/// </summary>
[Description("审核通过")]
= 1100,
}
}