|
|
@ -1,4 +1,6 @@
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
using AutoMapper;
|
|
|
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
|
|
|
using Entity.Dto.Resp;
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using HybirdFrameworkCore.Entity;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Repository.Station;
|
|
|
|
using Repository.Station;
|
|
|
@ -19,24 +21,40 @@ public class ChargeController : ControllerBase
|
|
|
|
private ChargerService _chargerService;
|
|
|
|
private ChargerService _chargerService;
|
|
|
|
private BinInfoRepository _binInfoRepository;
|
|
|
|
private BinInfoRepository _binInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
public ChargeController(ChargerService chargerService,BinInfoRepository binInfoRepository)
|
|
|
|
public ChargeController(ChargerService chargerService, BinInfoRepository binInfoRepository)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_chargerService = chargerService;
|
|
|
|
_chargerService = chargerService;
|
|
|
|
_binInfoRepository = binInfoRepository;
|
|
|
|
_binInfoRepository = binInfoRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 仓位信息
|
|
|
|
/// 仓位信息
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>仓位信息列表</returns>
|
|
|
|
/// <returns>仓位信息列表</returns>
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
[Route("/api/ChrgMonitor/GetChargMonitorChargBinData")]
|
|
|
|
[Route("/api/ChrgMonitor/GetChargMonitorChargBinData")]
|
|
|
|
public Result<List<BinInfo>> GetChargMonitorChargBinData()
|
|
|
|
public Result<List<BinInfoResp>> GetChargMonitorChargBinData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Result<List<BinInfo>>.Success(_binInfoRepository.Query());
|
|
|
|
List<BinInfo> binInfos = _binInfoRepository.Query();
|
|
|
|
|
|
|
|
var configuration = new MapperConfiguration(cfg => cfg.CreateMap<BinInfo, BinInfoResp>());
|
|
|
|
|
|
|
|
var mapper = configuration.CreateMapper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 转换为 BinInfoResp 列表
|
|
|
|
|
|
|
|
List<BinInfoResp> binInfoList = mapper.Map<List<BinInfoResp>>(binInfos);
|
|
|
|
|
|
|
|
// 功率赋值
|
|
|
|
|
|
|
|
foreach (var binInfoResp in binInfoList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ChargerClient? chargerClient = ClientMgr.GetBySn(binInfoResp.Code);
|
|
|
|
|
|
|
|
if (chargerClient != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
binInfoResp.power = chargerClient.RealTimeChargePower;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result<List<BinInfoResp>>.Success(binInfoList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 仓位禁用
|
|
|
|
/// 仓位禁用
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -48,7 +66,7 @@ public class ChargeController : ControllerBase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Result<bool>.Success(_binInfoRepository.UpdateStatus(data));
|
|
|
|
return Result<bool>.Success(_binInfoRepository.UpdateStatus(data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 获取仓位实时功率
|
|
|
|
/// 获取仓位实时功率
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -62,7 +80,7 @@ public class ChargeController : ControllerBase
|
|
|
|
.ToArray();
|
|
|
|
.ToArray();
|
|
|
|
return Result<float[]>.Success(results);
|
|
|
|
return Result<float[]>.Success(results);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 通过仓号启动充电
|
|
|
|
/// 通过仓号启动充电
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|