|
|
@ -27,7 +27,60 @@ public class ChargeController : ControllerBase
|
|
|
|
_chargerService = chargerService;
|
|
|
|
_chargerService = chargerService;
|
|
|
|
_binInfoService = binInfoService;
|
|
|
|
_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>
|
|
|
|
/// <summary>
|
|
|
|
/// 仓位信息
|
|
|
|
/// 仓位信息
|
|
|
|