手动鉴权,功率调节

master
tq 6 months ago
parent e42f8981bf
commit c7ae5b25c8

@ -259,10 +259,11 @@ public partial class BinInfoResp
/// Nullable:
/// </summary>
public DateTime? ChargingStopTime { get; set; }
/// <summary>
/// 是否鉴权
/// Default:
/// Nullable:
/// </summary>
public bool IsAuthed { get; set; }
public bool IsAuthed { get; set; } = false;
}

@ -28,6 +28,59 @@ public class ChargeController : ControllerBase
_binInfoService = binInfoService;
}
/// <summary>
/// 获取充电机code列表
/// </summary>
/// <returns>充电机code列表返回</returns>
[HttpGet]
[Route("GetChargerCodeList")]
public async Task<Result<List<string>>> GetChargerCodeList()
{
List<string> keysList = new List<string>(ClientMgr.Dictionary.Keys);
return Result<List<string>>.Success(keysList);
}
/// <summary>
/// 给充电机发鉴权
/// </summary>
/// <param name="code">充电机编码</param>
/// <returns>发送结果</returns>
[HttpGet]
[Route("ChargerSendAuth/{code}")]
public Result<bool> ChargerSendAuth(string code)
{
ChargerClient? chargerClient = ClientMgr.GetBySn(code);
if (chargerClient != null)
{
chargerClient.SendAuth();
return Result<bool>.Success(true);
}
return Result<bool>.Fail("充电机未连接");
}
/// <summary>
/// 给充电机发送功率调节指令
/// </summary>
/// <param name="code">充电机编码</param>
/// <returns>发送结果</returns>
[HttpGet]
[Route("SendPowerRegulation/{code}/{power}")]
public Result<bool> SendPowerRegulation(string code,float power)
{
ChargerClient? chargerClient = ClientMgr.GetBySn(code);
if (chargerClient != null)
{
chargerClient.SendPowerRegulation(power);
return Result<bool>.Success(true);
}
return Result<bool>.Fail("充电机未连接");
}
/// <summary>
/// 仓位信息

Loading…
Cancel
Save