|
|
@ -1,6 +1,10 @@
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
using Repository.Station;
|
|
|
|
using Service.Charger;
|
|
|
|
using Service.Charger;
|
|
|
|
|
|
|
|
using Service.Charger.Client;
|
|
|
|
|
|
|
|
using Service.Charger.Msg.Charger.Req;
|
|
|
|
|
|
|
|
|
|
|
|
namespace WebStarter.Controllers;
|
|
|
|
namespace WebStarter.Controllers;
|
|
|
|
|
|
|
|
|
|
|
@ -9,23 +13,63 @@ namespace WebStarter.Controllers;
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
[Produces("application/json")]
|
|
|
|
[Produces("application/json")]
|
|
|
|
[ApiController]
|
|
|
|
[ApiController]
|
|
|
|
[Route("/api[controller]")]
|
|
|
|
[Route("/api/[controller]")]
|
|
|
|
public class ChargeController : ControllerBase
|
|
|
|
public class ChargeController : ControllerBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private ChargerService _chargerService;
|
|
|
|
private ChargerService _chargerService;
|
|
|
|
|
|
|
|
private BinInfoRepository _binInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
public ChargeController(ChargerService chargerService)
|
|
|
|
public ChargeController(ChargerService chargerService,BinInfoRepository binInfoRepository)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_chargerService = chargerService;
|
|
|
|
_chargerService = chargerService;
|
|
|
|
|
|
|
|
_binInfoRepository = binInfoRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 仓位信息
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns>仓位信息列表</returns>
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[Route("/api/ChrgMonitor/GetChargMonitorChargBinData")]
|
|
|
|
|
|
|
|
public Result<List<BinInfo>> GetChargMonitorChargBinData()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Result<List<BinInfo>>.Success(_binInfoRepository.Query());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 仓位禁用
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="data">需要禁用仓id</param>
|
|
|
|
|
|
|
|
/// <returns>仓位信息列表</returns>
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
|
|
|
[Route("/api/TBsChargingBinInfo/ChargingBinDisable{data}")]
|
|
|
|
|
|
|
|
public Result<bool> ChargingBinDisable(int data)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return Result<bool>.Success(_binInfoRepository.UpdateStatus(data));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 获取仓位实时功率
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <returns>仓位实时功率列表</returns>
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
|
|
[Route("/api/ChrgMonitor/GetBinPowers")]
|
|
|
|
|
|
|
|
public Result<float[]> GetBinPowers()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
float[] results = ClientMgr.Dictionary.Values
|
|
|
|
|
|
|
|
.Select(chargerClient => chargerClient.RealTimeChargePower)
|
|
|
|
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
return Result<float[]>.Success(results);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 通过仓号启动充电
|
|
|
|
/// 通过仓号启动充电
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="binNo">仓号</param>
|
|
|
|
/// <param name="binNo">仓号</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/StartChargeByBinNo/{binNo}")]
|
|
|
|
[Route("/api/ChrgMonitor/StartChargeByBinNo/{binNo}")]
|
|
|
|
public Result<bool> StartChargeByBinNo(string binNo)
|
|
|
|
public Result<bool> StartChargeByBinNo(string binNo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _chargerService.StartChargeByBinNo(binNo);
|
|
|
|
return _chargerService.StartChargeByBinNo(binNo);
|
|
|
@ -37,7 +81,7 @@ public class ChargeController : ControllerBase
|
|
|
|
/// <param name="binNo">仓号</param>
|
|
|
|
/// <param name="binNo">仓号</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/StopChargeByBinNo/{binNo}")]
|
|
|
|
[Route("/api/ChrgMonitor/StopChargeByBinNo/{binNo}")]
|
|
|
|
public Result<bool> StopChargeByBinNo(string binNo)
|
|
|
|
public Result<bool> StopChargeByBinNo(string binNo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _chargerService.StartChargeByBinNo(binNo);
|
|
|
|
return _chargerService.StartChargeByBinNo(binNo);
|
|
|
|