From 4ab5ab470009a2f330d961f0557c1be6644cf564 Mon Sep 17 00:00:00 2001 From: lxw Date: Tue, 25 Jun 2024 10:49:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E6=B3=A8=E8=A7=A3=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/Attr/RemarkAttribute.cs | 37 ------ Entity/Constant/CloudEnum.cs | 209 +++++++++++++++++---------------- Entity/Constant/InfoEnum.cs | 89 +++++++------- 3 files changed, 150 insertions(+), 185 deletions(-) delete mode 100644 Entity/Attr/RemarkAttribute.cs diff --git a/Entity/Attr/RemarkAttribute.cs b/Entity/Attr/RemarkAttribute.cs deleted file mode 100644 index eaf60b6..0000000 --- a/Entity/Attr/RemarkAttribute.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Reflection; - -namespace Entity.Attr; - -public class RemarkAttribute : System.Attribute -{ - private string _Remark; - - public RemarkAttribute(string remark) - { - this._Remark = remark; - } - - public string GetRemark() - { - return this._Remark; - } -} - -public static class RemarkExtend -{ - public static string GetRemark(this global::System.Enum value) - { - Type type = value.GetType(); - FieldInfo? fieldInfo = type.GetField(value.ToString()); - if (fieldInfo != null && fieldInfo.IsDefined(typeof(RemarkAttribute), true)) - { - System.Attribute? attribute = fieldInfo.GetCustomAttribute(typeof(RemarkAttribute)); - if (attribute != null) - { - return ((RemarkAttribute)attribute).GetRemark(); - } - } - - return value.ToString(); - } -} \ No newline at end of file diff --git a/Entity/Constant/CloudEnum.cs b/Entity/Constant/CloudEnum.cs index 5ec6feb..fe464a2 100644 --- a/Entity/Constant/CloudEnum.cs +++ b/Entity/Constant/CloudEnum.cs @@ -1,4 +1,5 @@ using Entity.Attr; +using HybirdFrameworkCore.Attribute; namespace Entity.Constant; @@ -12,8 +13,8 @@ public class CloudEnum /// public enum WhetherToBattery : byte { - [Remark("可以开始换电")] Success = 1, - [Remark("终止换电")] StopBattery = 2 + [Const("可以开始换电")] Success = 1, + [Const("终止换电")] StopBattery = 2 } /// @@ -21,10 +22,10 @@ public class CloudEnum /// public enum PeriodNumber : int { - [Remark("尖")] Pointed = 1, - [Remark("峰")] Peak = 2, - [Remark("平")] Flat = 3, - [Remark("谷")] Valley = 4 + [Const("尖")] Pointed = 1, + [Const("峰")] Peak = 2, + [Const("平")] Flat = 3, + [Const("谷")] Valley = 4 } /// @@ -32,8 +33,8 @@ public class CloudEnum /// public enum RenewalMethod : int { - [Remark("覆盖所有记录")] Cover = 1, - [Remark("增量更新")] Increment = 2 + [Const("覆盖所有记录")] Cover = 1, + [Const("增量更新")] Increment = 2 } /// @@ -41,8 +42,8 @@ public class CloudEnum /// public enum AuthenticationMethod : int { - [Remark("车牌号")] VehicleNo = 1, - [Remark("rfid")] RFID = 2 + [Const("车牌号")] VehicleNo = 1, + [Const("rfid")] RFID = 2 } /// @@ -50,9 +51,9 @@ public class CloudEnum /// public enum ServiceStatus : int { - [Remark("未知")] Unknown = 0, - [Remark("换电站服务启用")] Start = 1, - [Remark("换电站服务停用")] Stop = 2 + [Const("未知")] Unknown = 0, + [Const("换电站服务启用")] Start = 1, + [Const("换电站服务停用")] Stop = 2 } /// @@ -61,13 +62,13 @@ public class CloudEnum public enum PowerStationType { // 单仓左 - [Remark("01")] Left, + [Const("01")] Left, // 单仓右 - [Remark("02")] Righ, + [Const("02")] Righ, // 双仓 - [Remark("03")] Pair + [Const("03")] Pair } /// @@ -75,14 +76,14 @@ public class CloudEnum /// public enum Result : byte { - [Remark("成功")] Success = 0, - [Remark("失败")] Fail = 1 + [Const("成功")] Success = 0, + [Const("失败")] Fail = 1 } public enum ResultInt : byte { - [Remark("成功")] Success = 0, - [Remark("失败")] Fail = 1 + [Const("成功")] Success = 0, + [Const("失败")] Fail = 1 } /// @@ -90,10 +91,10 @@ public class CloudEnum /// public enum EquipmentResult : int { - [Remark("成功")] Success = 0, - [Remark("设备不存在")] NoEquipment = 1, - [Remark("系统未找到对应的设备编码")] NoEquipmentCode = 2, - [Remark("设备数量和后台不一致当")] ItSNotTheSame = 3, + [Const("成功")] Success = 0, + [Const("设备不存在")] NoEquipment = 1, + [Const("系统未找到对应的设备编码")] NoEquipmentCode = 2, + [Const("设备数量和后台不一致当")] ItSNotTheSame = 3, } /// @@ -101,11 +102,11 @@ public class CloudEnum /// public enum SignInResult : int { - [Remark("成功")] Success = 0, - [Remark("设备不存在")] NoEquipment = 1, - [Remark("非法设备")] Rogue = 2, - [Remark("站控软件版本错误")] VersionError = 3, - [Remark("协议版本错误")] ProtocolError = 4 + [Const("成功")] Success = 0, + [Const("设备不存在")] NoEquipment = 1, + [Const("非法设备")] Rogue = 2, + [Const("站控软件版本错误")] VersionError = 3, + [Const("协议版本错误")] ProtocolError = 4 } /// @@ -113,13 +114,13 @@ public class CloudEnum /// public enum VehicleAuthResult : int { - [Remark("成功")] Success = 0, - [Remark("没找到匹配的车辆(未入网)")] NoVehicle = 1, - [Remark("没有找到车辆匹配的 VIN")] NoVehicleVIN = 2, - [Remark("车辆已经进入黑名单")] Blacklist = 3, - [Remark("账户余额不足")] TheBalanceIsInsufficient = 4, - [Remark("未预约")] NoAppointments = 5, - [Remark("没有招到对应的 rfid 卡号")] NoRfid = 6 + [Const("成功")] Success = 0, + [Const("没找到匹配的车辆(未入网)")] NoVehicle = 1, + [Const("没有找到车辆匹配的 VIN")] NoVehicleVIN = 2, + [Const("车辆已经进入黑名单")] Blacklist = 3, + [Const("账户余额不足")] TheBalanceIsInsufficient = 4, + [Const("未预约")] NoAppointments = 5, + [Const("没有招到对应的 rfid 卡号")] NoRfid = 6 } /// @@ -127,8 +128,8 @@ public class CloudEnum /// public enum AuthMethod : int { - [Remark("站内鉴权(默认)")] InsideTheStation = 0, - [Remark("站外")] OffSite = 1, + [Const("站内鉴权(默认)")] InsideTheStation = 0, + [Const("站外")] OffSite = 1, } /// @@ -136,9 +137,9 @@ public class CloudEnum /// public enum UploadTheDevice : int { - [Remark("不需要上传")] NoUpload = 0, - [Remark("需要重新上传")] AnewUpload = 1, - [Remark("初始上传")] PrimaryUpload = 2 + [Const("不需要上传")] NoUpload = 0, + [Const("需要重新上传")] AnewUpload = 1, + [Const("初始上传")] PrimaryUpload = 2 } /// @@ -146,8 +147,8 @@ public class CloudEnum /// public enum OperationType : int { - [Remark("应答")] Response = 1, - [Remark("请求")] Request = 2 + [Const("应答")] Response = 1, + [Const("请求")] Request = 2 } /// @@ -155,8 +156,8 @@ public class CloudEnum /// public enum Encryption : int { - [Remark("不加密")] NoEncrypt = 0, - [Remark("AES")] AES = 1 + [Const("不加密")] NoEncrypt = 0, + [Const("AES")] AES = 1 } /// @@ -164,9 +165,9 @@ public class CloudEnum /// public enum AirConditioningStatus : byte { - [Remark("停机")] Stop = 0, - [Remark("开启")] Open = 1, - [Remark("运行")] Run = 2 + [Const("停机")] Stop = 0, + [Const("开启")] Open = 1, + [Const("运行")] Run = 2 } /// @@ -174,9 +175,9 @@ public class CloudEnum /// public enum AirConditioningMode : byte { - [Remark("制冷")] Refrigeration = 1, - [Remark("制热")] Heating = 2, - [Remark("其他")] Other = 3 + [Const("制冷")] Refrigeration = 1, + [Const("制热")] Heating = 2, + [Const("其他")] Other = 3 } /// @@ -184,10 +185,10 @@ public class CloudEnum /// public enum WorkingStatus : int { - [Remark("未知")] Unknown = 0, - [Remark("空闲")] FreeTime = 1, - [Remark("工作中")] Work = 2, - [Remark("工作完成")] WorkDone = 3, + [Const("未知")] Unknown = 0, + [Const("空闲")] FreeTime = 1, + [Const("工作中")] Work = 2, + [Const("工作完成")] WorkDone = 3, } /// @@ -195,19 +196,19 @@ public class CloudEnum /// public enum BatterySwapStatus : int { - [Remark("未知")] Unknown = 0, - [Remark("空闲")] FreeTime = 1, - [Remark("占位")] Occupancy = 2, - [Remark("换电准备")] PrepareForBatterySwapping = 3, - [Remark("换电开始")] TheBatterySwapBegins = 4, - [Remark("换电中")] BatterySwapping = 5, - [Remark("换电完成")] TheBatterySwapIsComplete = 6, - [Remark("换电中故障,等待修复")] TheFaultIsToBeFixed = 7, - [Remark("换电中故障,修复完成")] TheFaultFixIsComplete = 8, - [Remark("换电暂停")] TheBatterySwapIsSuspended = 9, - [Remark("换电继续")] TheBatterySwapContinues = 10, - [Remark("换电完成,车辆未驶离")] TheBatterySwapWasCompletedAndDidNotLeave = 11, - [Remark("换电完成,车辆驶离")] FinishDrivingAwayTheVehicle = 12 + [Const("未知")] Unknown = 0, + [Const("空闲")] FreeTime = 1, + [Const("占位")] Occupancy = 2, + [Const("换电准备")] PrepareForBatterySwapping = 3, + [Const("换电开始")] TheBatterySwapBegins = 4, + [Const("换电中")] BatterySwapping = 5, + [Const("换电完成")] TheBatterySwapIsComplete = 6, + [Const("换电中故障,等待修复")] TheFaultIsToBeFixed = 7, + [Const("换电中故障,修复完成")] TheFaultFixIsComplete = 8, + [Const("换电暂停")] TheBatterySwapIsSuspended = 9, + [Const("换电继续")] TheBatterySwapContinues = 10, + [Const("换电完成,车辆未驶离")] TheBatterySwapWasCompletedAndDidNotLeave = 11, + [Const("换电完成,车辆驶离")] FinishDrivingAwayTheVehicle = 12 } /// @@ -215,9 +216,9 @@ public class CloudEnum /// public enum WhetherThereIsACarOrNot : int { - [Remark("未知")] Unknown = 0, - [Remark("有车")] HaveVehicle = 1, - [Remark("无车")] NoVehicle = 2, + [Const("未知")] Unknown = 0, + [Const("有车")] HaveVehicle = 1, + [Const("无车")] NoVehicle = 2, } /// @@ -225,9 +226,9 @@ public class CloudEnum /// public enum LockedState : int { - [Remark("未知")] Unknown = 0, - [Remark("加锁状态")] LockedStatus = 1, - [Remark("解锁状态")] UnlockStatus = 2, + [Const("未知")] Unknown = 0, + [Const("加锁状态")] LockedStatus = 1, + [Const("解锁状态")] UnlockStatus = 2, } /// @@ -235,13 +236,13 @@ public class CloudEnum /// public enum FailureLevel : int { - [Remark("正常")] Normal = 0, - [Remark("故障等级一")] FaultLevelOne = 1, - [Remark("故障等级二")] FaultLeveTwo = 2, - [Remark("故障等级三")] FaultLeveThree = 3, - [Remark("故障等级四")] FaultLeveFour = 4, - [Remark("故障等级五")] FaultLeveFive = 5, - [Remark("故障等级六")] FaultLeveSix = 6 + [Const("正常")] Normal = 0, + [Const("故障等级一")] FaultLevelOne = 1, + [Const("故障等级二")] FaultLeveTwo = 2, + [Const("故障等级三")] FaultLeveThree = 3, + [Const("故障等级四")] FaultLeveFour = 4, + [Const("故障等级五")] FaultLeveFive = 5, + [Const("故障等级六")] FaultLeveSix = 6 } /// @@ -249,8 +250,8 @@ public class CloudEnum /// public enum EscalationMethod : int { - [Remark("自动")] Automatic = 1, - [Remark("人工手动")] Manual = 2 + [Const("自动")] Automatic = 1, + [Const("人工手动")] Manual = 2 } /// @@ -258,8 +259,8 @@ public class CloudEnum /// public enum ChargingMethod : int { - [Remark("站内充电")] OnSiteCharging = 0, - [Remark("站外充电")] ChargingOffSite = 1 + [Const("站内充电")] OnSiteCharging = 0, + [Const("站外充电")] ChargingOffSite = 1 } /// @@ -267,10 +268,10 @@ public class CloudEnum /// public enum OperationalStatus : int { - [Remark("营业状态")] BusinessStatus = 1, - [Remark("暂停营业状态")] TemporarilyClosed = 2, - [Remark("设备维护状态")] DeviceMaintenanceStatus = 3, - [Remark("歇业状态")] ClosedStatus = 4 + [Const("营业状态")] BusinessStatus = 1, + [Const("暂停营业状态")] TemporarilyClosed = 2, + [Const("设备维护状态")] DeviceMaintenanceStatus = 3, + [Const("歇业状态")] ClosedStatus = 4 } /// @@ -278,8 +279,8 @@ public class CloudEnum /// public enum OrderCancellation : byte { - [Remark("正常")] Normal = 0, - [Remark("取消")] Cancel = 1 + [Const("正常")] Normal = 0, + [Const("取消")] Cancel = 1 } /// @@ -287,8 +288,8 @@ public class CloudEnum /// public enum WhetherTheBatterySwapIsSuccessful : byte { - [Remark("失败")] Fail = 0, - [Remark("成功")] Success = 1 + [Const("失败")] Fail = 0, + [Const("成功")] Success = 1 } /// @@ -296,8 +297,8 @@ public class CloudEnum /// public enum BatterySwapResults : byte { - [Remark("正常")] Normal = 0, - [Remark("失败")] Fail = 1 + [Const("正常")] Normal = 0, + [Const("失败")] Fail = 1 } /// @@ -305,8 +306,8 @@ public class CloudEnum /// public enum OrderType : int { - [Remark("不是")] No = 0, - [Remark("是")] Yes = 1 + [Const("不是")] No = 0, + [Const("是")] Yes = 1 } /// @@ -314,9 +315,9 @@ public class CloudEnum /// public enum BatteryAppointments : int { - [Remark("预约电池失败")] Fail = 1, - [Remark("换电站无电池可预约")] NoBattery = 2, - [Remark("预约成功")] Success = 2 + [Const("预约电池失败")] Fail = 1, + [Const("换电站无电池可预约")] NoBattery = 2, + [Const("预约成功")] Success = 2 } /// @@ -324,9 +325,9 @@ public class CloudEnum /// public enum AnsweringTheBatterySwapRequest : int { - [Remark("换电请求成功")] TheBatterySwapRequestIsSuccessful = 1, - [Remark("换电请求失败")] TheBatterySwapRequestFailed = 2, - [Remark("取消换电请求成功")] CancelTheBatterySwapRequestIsSuccessful = 3, - [Remark("取消换电请求失败")] TCancelheBatterySwapRequestFailed = 2 + [Const("换电请求成功")] TheBatterySwapRequestIsSuccessful = 1, + [Const("换电请求失败")] TheBatterySwapRequestFailed = 2, + [Const("取消换电请求成功")] CancelTheBatterySwapRequestIsSuccessful = 3, + [Const("取消换电请求失败")] TCancelheBatterySwapRequestFailed = 2 } } \ No newline at end of file diff --git a/Entity/Constant/InfoEnum.cs b/Entity/Constant/InfoEnum.cs index 166dc2e..8182e5c 100644 --- a/Entity/Constant/InfoEnum.cs +++ b/Entity/Constant/InfoEnum.cs @@ -1,5 +1,6 @@ using System.Runtime.InteropServices; using Entity.Attr; +using HybirdFrameworkCore.Attribute; namespace Entity.Constant; @@ -57,66 +58,66 @@ public class InfoEnum public enum SelectBinStatusInfo : byte { - [Remark("通道的电池仓无可用换电电池")] NoBattery, - [Remark("可以换电")] Success, - [Remark("结束充电电池数量不足")] LessOfFinishCharging, - [Remark("空仓数量不足")] LessOfEmptyBin, - [Remark("符合soc限制数量不足")] LessOfSoc, - [Remark("结束充电大于3分钟的数量不足")] LessOf3Minute, - [Remark("预约电池异常")] AmtError, + [Const("通道的电池仓无可用换电电池")] NoBattery, + [Const("可以换电")] Success, + [Const("结束充电电池数量不足")] LessOfFinishCharging, + [Const("空仓数量不足")] LessOfEmptyBin, + [Const("符合soc限制数量不足")] LessOfSoc, + [Const("结束充电大于3分钟的数量不足")] LessOf3Minute, + [Const("预约电池异常")] AmtError, } public enum AmtOrderStatus : byte { - [Remark("预约成功")] Success = 1, - [Remark("预约取消")] Cancel = 2, - [Remark("预约失败")] Fail = 3, - [Remark("换电完成")] SwapFinish = 4, - [Remark("换电失败")] SwapFail = 5, - [Remark("换电中")] Swapping = 6, - [Remark("预约过期")] Expire = 7, + [Const("预约成功")] Success = 1, + [Const("预约取消")] Cancel = 2, + [Const("预约失败")] Fail = 3, + [Const("换电完成")] SwapFinish = 4, + [Const("换电失败")] SwapFail = 5, + [Const("换电中")] Swapping = 6, + [Const("预约过期")] Expire = 7, } //云平台上报步序 public enum BusinessSwappingForCloudState : byte { - [Remark("未知")] UnKnown, - [Remark("空闲")] Idle, - [Remark("占位")] TakeUp, - [Remark("换电准备")] SwapReady, - [Remark("开始换电")] BeginSwap, - [Remark("换电中")] Swapping, - [Remark("换电完成")] SwapFinish, - [Remark("换电中故障,等待修复")] SwappingErrWait, - [Remark("换电中故障,修复完成")] SwappingErrDone, - [Remark("换电暂停")] SwapPause, - [Remark("换电继续")] SwapContinue, - [Remark("换电完成(车辆未驶离)")] SwapDoneWithVel, - [Remark("换电完成(车辆驶离)")] SwapDoneWithoutVel + [Const("未知")] UnKnown, + [Const("空闲")] Idle, + [Const("占位")] TakeUp, + [Const("换电准备")] SwapReady, + [Const("开始换电")] BeginSwap, + [Const("换电中")] Swapping, + [Const("换电完成")] SwapFinish, + [Const("换电中故障,等待修复")] SwappingErrWait, + [Const("换电中故障,修复完成")] SwappingErrDone, + [Const("换电暂停")] SwapPause, + [Const("换电继续")] SwapContinue, + [Const("换电完成(车辆未驶离)")] SwapDoneWithVel, + [Const("换电完成(车辆驶离)")] SwapDoneWithoutVel } //小步状态 public enum BusinessSwappingStep { - [Remark("空闲")] Idel, - [Remark("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag, - [Remark("rfid扫描完成")] RfidReadFlag, - [Remark("云平台车辆认证")] CloudVelCheckFlag, - [Remark("车辆到位")] CarInPositionFlag, - [Remark("云平台下发换电指令")] CloudCarCanStartFlag, - [Remark("车辆解锁")] VelUnlockFlag, - [Remark("下发plc选包")] DistributeSelectPackFlag, + [Const("空闲")] Idel, + [Const("车辆到站(入口雷达检测到车辆驶入)")] RadarInFlag, + [Const("rfid扫描完成")] RfidReadFlag, + [Const("云平台车辆认证")] CloudVelCheckFlag, + [Const("车辆到位")] CarInPositionFlag, + [Const("云平台下发换电指令")] CloudCarCanStartFlag, + [Const("车辆解锁")] VelUnlockFlag, + [Const("下发plc选包")] DistributeSelectPackFlag, - [Remark("开始换电")] StartSwappingFlag, - [Remark("拆旧电池完成")] UnOldBatteryFlag, - [Remark("入库旧电池完成")] StorageOldBatteryFlag, - [Remark("搬运新电池完成")] OutNewBatteryFlag, - [Remark("安装新电池完成")] InstallNewBatteryFlag, - [Remark("安装完成")] FinishNewBatteryFlag, - [Remark("车辆上锁")] VelLockFlag, - [Remark("换电完成(车辆驶离)")] RadarOutFlag, - [Remark("换电失败(车辆驶离)")] RadarOutFailFlag, + [Const("开始换电")] StartSwappingFlag, + [Const("拆旧电池完成")] UnOldBatteryFlag, + [Const("入库旧电池完成")] StorageOldBatteryFlag, + [Const("搬运新电池完成")] OutNewBatteryFlag, + [Const("安装新电池完成")] InstallNewBatteryFlag, + [Const("安装完成")] FinishNewBatteryFlag, + [Const("车辆上锁")] VelLockFlag, + [Const("换电完成(车辆驶离)")] RadarOutFlag, + [Const("换电失败(车辆驶离)")] RadarOutFailFlag, }