充电订单bug修改

master
rszn 6 months ago
parent e71014e383
commit d5d847064a

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

@ -8,12 +8,14 @@
/// <summary>
/// 状态码
/// </summary>
public int Status { get; set; } = 200;
/// <summary>
/// 操作是否成功
/// </summary>
public bool IsSuccess { get; set; } = false;
/// <summary>
/// 返回信息
/// </summary>
@ -29,12 +31,10 @@
/// </summary>
/// <param name="msg">消息</param>
/// <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>
/// 返回成功
@ -46,9 +46,8 @@
{
return Message(true, msg, data);
}
/// <summary>
/// 返回失败
/// </summary>
@ -58,8 +57,8 @@
{
return Message(false, msg, default);
}
/// <summary>
/// 返回失败
/// </summary>
@ -70,7 +69,7 @@
{
return Message(false, msg, data);
}
/// <summary>
/// 返回消息
/// </summary>
@ -82,7 +81,7 @@
{
return new Result<T>() { Msg = msg, Data = data, IsSuccess = success };
}
/// <summary>
/// 返回消息
/// </summary>
@ -90,15 +89,9 @@
/// <param name="msg">消息</param>
/// <param name="data">数据</param>
/// <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();
return Result<bool>.Success("发送停止命令成功");
return Result<bool>.Success(true, "发送停止命令成功");
}
/// <summary>
/// 下发尖峰平谷

@ -188,7 +188,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
}
/// <summary>
///
///
/// </summary>
/// <param name="asdu"></param>
public void ReceiveMsgHandle(ASDU asdu)
@ -411,7 +411,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
}
/// <summary>
/// 3.4.7 监控平台下发掉线停止充电
/// 3.4.7 监控平台下发掉线停止充电
/// </summary>
/// <param name="enabled"> 0不使能 1使能</param>
public Result<bool> SendOfflineStopCharging(byte enabled)
@ -445,7 +445,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
}
/// <summary>
///
///
/// </summary>
public Result<bool> SendQueryBattery()
{
@ -467,7 +467,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
#region 启动充电
/// <summary>
///
///
/// </summary>
public Result<bool> StartCharge()
{
@ -503,7 +503,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
string? lockKey = redisHelper.GetStrValue($"chargeNo{BinNo}Start");
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));
@ -533,7 +533,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
#endregion
/// <summary>
///
///
/// </summary>
/// <returns></returns>
public bool Connect()
@ -548,7 +548,7 @@ public class ChargerClient : TcpClient<IBaseHandler, Decoder, Encoder>
}
/// <summary>
///
///
/// </summary>
/// <param name="sn"></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.DestAddr, destAddr);
}
}
}

@ -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;

Loading…
Cancel
Save