BaseEnumExtensions 迁移

zw
lxw 5 months ago
parent 97ab015bc3
commit 54670415ae

@ -1,36 +0,0 @@
using System.ComponentModel;
using System.Reflection;
using Entity.Attr;
namespace Entity.Constant;
public class BaseEnumExtensions
{
//根据枚举获取注释(使用remark注解)
public static string GetDescription(Enum value)
{
FieldInfo field = value.GetType().GetField(value.ToString());
RemarkAttribute attribute =
Attribute.GetCustomAttribute(field, typeof(RemarkAttribute)) as RemarkAttribute;
return attribute == null ? value.ToString() : attribute.GetRemark();
}
//根据code获取枚举
public static T GetEnumByCode<T>(int code) where T : Enum
{
return (T)Enum.ToObject(typeof(T), code);
}
//根据code获取值
public static string GetEnumDescriptionByCode<T>(int code) where T : Enum
{
return GetDescription((T)Enum.ToObject(typeof(T), code));
}
public static string GetNameByEnum<T>(Enum value) where T : Enum
{
return Enum.GetName(typeof(T), value);
}
}

@ -32,6 +32,9 @@ public class SwappingStateMachine : IDisposable
//手动确认换电成功 //手动确认换电成功
public bool ManualSwapSuccFlag { get; set; } = false; public bool ManualSwapSuccFlag { get; set; } = false;
//手动确认解锁/上锁成功
public bool ManualConfirmCarOperateFlag { get; set; }
public OperateModel OperateModel = null; public OperateModel OperateModel = null;
@ -302,6 +305,7 @@ public class SwappingStateMachine : IDisposable
PlcSwapFlag = false; PlcSwapFlag = false;
ManualSwapSuccFlag = false; ManualSwapSuccFlag = false;
OperateModel = null; OperateModel = null;
ManualConfirmCarOperateFlag = false;
CancelFlag = false; CancelFlag = false;
StopFlag = false; StopFlag = false;

@ -195,7 +195,7 @@ public class MonitorService
if (!result) if (!result)
{ {
Log.Error("BatteryRelocation PlcMgr.HoldOn() =false"); Log.Error("BatteryRelocation PlcMgr.HoldOn() =false");
return Result<bool>.Fail(); return Result<bool>.Fail();
} }
Log.Info($"battery move task Manual removeBinNo={removeBinNo}, putBinNo={putBinNo} "); Log.Info($"battery move task Manual removeBinNo={removeBinNo}, putBinNo={putBinNo} ");

Loading…
Cancel
Save