diff --git a/Service/Equipment/EquipmentType.cs b/Common/Const/EquipmentType.cs
similarity index 51%
rename from Service/Equipment/EquipmentType.cs
rename to Common/Const/EquipmentType.cs
index 1633595..7f6f2f4 100644
--- a/Service/Equipment/EquipmentType.cs
+++ b/Common/Const/EquipmentType.cs
@@ -1,8 +1,9 @@
-namespace Service.Equipment;
+namespace Common.Const;
public enum EquipmentType
{
Charger,
Ammeter,
- WaterCool
-}
\ No newline at end of file
+ WaterCool,
+ Plc
+}
diff --git a/HybirdFrameworkCore/Entity/Result.cs b/HybirdFrameworkCore/Entity/Result.cs
index 3cd3831..21fa9f4 100644
--- a/HybirdFrameworkCore/Entity/Result.cs
+++ b/HybirdFrameworkCore/Entity/Result.cs
@@ -8,12 +8,14 @@
///
/// 状态码
///
-
+
public int Status { get; set; } = 200;
+
///
/// 操作是否成功
///
public bool IsSuccess { get; set; } = false;
+
///
/// 返回信息
///
@@ -29,12 +31,10 @@
///
/// 消息
///
- public static Result Success(string msg = "成功")
+ public static Result Success(T t = default)
{
- return Message(true, msg, default);
+ return Message(true, "成功", t);
}
-
-
///
/// 返回成功
@@ -46,9 +46,8 @@
{
return Message(true, msg, data);
}
-
-
-
+
+
///
/// 返回失败
///
@@ -58,8 +57,8 @@
{
return Message(false, msg, default);
}
-
-
+
+
///
/// 返回失败
///
@@ -70,7 +69,7 @@
{
return Message(false, msg, data);
}
-
+
///
/// 返回消息
///
@@ -82,7 +81,7 @@
{
return new Result() { Msg = msg, Data = data, IsSuccess = success };
}
-
+
///
/// 返回消息
///
@@ -90,15 +89,9 @@
/// 消息
/// 数据
///
- public static Result Message(bool success, T data)
+ public static Result Message(bool success, T data)
{
- return new Result() { Msg="查询成功", Data = data, IsSuccess = success };
+ return new Result() { Msg = "查询成功", Data = data, IsSuccess = success };
}
-
-
-
}
-
-
-
}
diff --git a/Service/Charger/ChargerService.cs b/Service/Charger/ChargerService.cs
index 604820c..358a509 100644
--- a/Service/Charger/ChargerService.cs
+++ b/Service/Charger/ChargerService.cs
@@ -72,7 +72,7 @@ public class ChargerService
chargerClient.SendRemoteStopCharging();
- return Result.Success("发送停止命令成功");
+ return Result.Success(true, "发送停止命令成功");
}
///
/// 下发尖峰平谷
diff --git a/Service/Charger/Client/ChargerClient.cs b/Service/Charger/Client/ChargerClient.cs
index 91a37b8..0542ea1 100644
--- a/Service/Charger/Client/ChargerClient.cs
+++ b/Service/Charger/Client/ChargerClient.cs
@@ -188,7 +188,7 @@ public class ChargerClient : TcpClient
}
///
- ///
+ ///
///
///
public void ReceiveMsgHandle(ASDU asdu)
@@ -411,7 +411,7 @@ public class ChargerClient : TcpClient
}
///
- /// 3.4.7 监控平台下发掉线停止充电
+ /// 3.4.7 监控平台下发掉线停止充电
///
/// 0:不使能 1:使能
public Result SendOfflineStopCharging(byte enabled)
@@ -445,7 +445,7 @@ public class ChargerClient : TcpClient
}
///
- ///
+ ///
///
public Result SendQueryBattery()
{
@@ -467,7 +467,7 @@ public class ChargerClient : TcpClient
#region 启动充电
///
- ///
+ ///
///
public Result StartCharge()
{
@@ -503,7 +503,7 @@ public class ChargerClient : TcpClient
string? lockKey = redisHelper.GetStrValue($"chargeNo{BinNo}Start");
if (!string.IsNullOrWhiteSpace(lockKey))
{
- return Result.Success($"charger-{BinNo} is starting");
+ return Result.Success(true, $"charger-{BinNo} is starting");
}
redisHelper.SetKeyValueStr($"chargeNo{BinNo}Start", DateTime.Now.ToString("f"), TimeSpan.FromMinutes(1));
@@ -533,7 +533,7 @@ public class ChargerClient : TcpClient
#endregion
///
- ///
+ ///
///
///
public bool Connect()
@@ -548,7 +548,7 @@ public class ChargerClient : TcpClient
}
///
- ///
+ ///
///
///
///
@@ -559,4 +559,4 @@ public class ChargerClient : TcpClient
ChannelUtils.AddAttr(Channel, ChargerConst.EqmCode, sn);
ChannelUtils.AddAttr(Channel, ChargerConst.DestAddr, destAddr);
}
-}
\ No newline at end of file
+}
diff --git a/Service/Charger/Client/ClientMgr.cs b/Service/Charger/Client/ClientMgr.cs
index 7485e43..416e5cd 100644
--- a/Service/Charger/Client/ClientMgr.cs
+++ b/Service/Charger/Client/ClientMgr.cs
@@ -1,4 +1,5 @@
using Autofac;
+using Common.Const;
using DotNetty.Transport.Channels;
using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac;
@@ -7,7 +8,6 @@ using HybirdFrameworkDriver.Session;
using log4net;
using Repository.Station;
using Service.Charger.Common;
-using Service.Equipment;
namespace Service.Charger.Client;