充电订单bug修改

master
rszn 7 months ago
parent e71014e383
commit d5d847064a

@ -1,8 +1,9 @@
namespace Service.Equipment; namespace Common.Const;
public enum EquipmentType public enum EquipmentType
{ {
Charger, Charger,
Ammeter, Ammeter,
WaterCool WaterCool,
} Plc
}

@ -8,12 +8,14 @@
/// <summary> /// <summary>
/// 状态码 /// 状态码
/// </summary> /// </summary>
public int Status { get; set; } = 200; public int Status { get; set; } = 200;
/// <summary> /// <summary>
/// 操作是否成功 /// 操作是否成功
/// </summary> /// </summary>
public bool IsSuccess { get; set; } = false; public bool IsSuccess { get; set; } = false;
/// <summary> /// <summary>
/// 返回信息 /// 返回信息
/// </summary> /// </summary>
@ -29,12 +31,10 @@
/// </summary> /// </summary>
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
/// <returns></returns> /// <returns></returns>
public static Result<T> Success(string msg = "成功") public static Result<T> Success(T t = default)
{ {
return Message(true, msg, default); return Message(true, "成功", t);
} }
/// <summary> /// <summary>
/// 返回成功 /// 返回成功
@ -46,9 +46,8 @@
{ {
return Message(true, msg, data); return Message(true, msg, data);
} }
/// <summary> /// <summary>
/// 返回失败 /// 返回失败
/// </summary> /// </summary>
@ -58,8 +57,8 @@
{ {
return Message(false, msg, default); return Message(false, msg, default);
} }
/// <summary> /// <summary>
/// 返回失败 /// 返回失败
/// </summary> /// </summary>
@ -70,7 +69,7 @@
{ {
return Message(false, msg, data); return Message(false, msg, data);
} }
/// <summary> /// <summary>
/// 返回消息 /// 返回消息
/// </summary> /// </summary>
@ -82,7 +81,7 @@
{ {
return new Result<T>() { Msg = msg, Data = data, IsSuccess = success }; return new Result<T>() { Msg = msg, Data = data, IsSuccess = success };
} }
/// <summary> /// <summary>
/// 返回消息 /// 返回消息
/// </summary> /// </summary>
@ -90,15 +89,9 @@
/// <param name="msg">消息</param> /// <param name="msg">消息</param>
/// <param name="data">数据</param> /// <param name="data">数据</param>
/// <returns></returns> /// <returns></returns>
public static Result<T> Message(bool success, T data) public static Result<T> Message(bool success, T data)
{ {
return new Result<T>() { Msg="查询成功", Data = data, IsSuccess = success }; return new Result<T>() { Msg = "查询成功", Data = data, IsSuccess = success };
} }
} }
} }

@ -72,7 +72,7 @@ public class ChargerService
chargerClient.SendRemoteStopCharging(); chargerClient.SendRemoteStopCharging();
return Result<bool>.Success("发送停止命令成功"); return Result<bool>.Success(true, "发送停止命令成功");
} }
/// <summary> /// <summary>
/// 下发尖峰平谷 /// 下发尖峰平谷

@ -188,7 +188,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="asdu"></param> /// <param name="asdu"></param>
public void ReceiveMsgHandle(ASDU asdu) public void ReceiveMsgHandle(ASDU asdu)
@ -411,7 +411,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
} }
/// <summary> /// <summary>
/// 3.4.7 监控平台下发掉线停止充电 /// 3.4.7 监控平台下发掉线停止充电
/// </summary> /// </summary>
/// <param name="enabled"> 0不使能 1使能</param> /// <param name="enabled"> 0不使能 1使能</param>
public Result<bool> SendOfflineStopCharging(byte enabled) public Result<bool> SendOfflineStopCharging(byte enabled)
@ -445,7 +445,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Result<bool> SendQueryBattery() public Result<bool> SendQueryBattery()
{ {
@ -467,7 +467,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
#region 启动充电 #region 启动充电
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Result<bool> StartCharge() public Result<bool> StartCharge()
{ {
@ -503,7 +503,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
string? lockKey = redisHelper.GetStrValue($"chargeNo{BinNo}Start"); string? lockKey = redisHelper.GetStrValue($"chargeNo{BinNo}Start");
if (!string.IsNullOrWhiteSpace(lockKey)) if (!string.IsNullOrWhiteSpace(lockKey))
{ {
return Result<bool>.Success($"charger-{BinNo} is starting"); return Result<bool>.Success(true, $"charger-{BinNo} is starting");
} }
redisHelper.SetKeyValueStr($"chargeNo{BinNo}Start", DateTime.Now.ToString("f"), TimeSpan.FromMinutes(1)); redisHelper.SetKeyValueStr($"chargeNo{BinNo}Start", DateTime.Now.ToString("f"), TimeSpan.FromMinutes(1));
@ -533,7 +533,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
#endregion #endregion
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public bool Connect() public bool Connect()
@ -548,7 +548,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="sn"></param> /// <param name="sn"></param>
/// <param name="destAddr"></param> /// <param name="destAddr"></param>
@ -559,4 +559,4 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
ChannelUtils.AddAttr(Channel, ChargerConst.EqmCode, sn); ChannelUtils.AddAttr(Channel, ChargerConst.EqmCode, sn);
ChannelUtils.AddAttr(Channel, ChargerConst.DestAddr, destAddr); ChannelUtils.AddAttr(Channel, ChargerConst.DestAddr, destAddr);
} }
} }

@ -1,4 +1,5 @@
using Autofac; using Autofac;
using Common.Const;
using DotNetty.Transport.Channels; using DotNetty.Transport.Channels;
using Entity.DbModel.Station; using Entity.DbModel.Station;
using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.Autofac;
@ -7,7 +8,6 @@ using HybirdFrameworkDriver.Session;
using log4net; using log4net;
using Repository.Station; using Repository.Station;
using Service.Charger.Common; using Service.Charger.Common;
using Service.Equipment;
namespace Service.Charger.Client; namespace Service.Charger.Client;

Loading…
Cancel
Save