新增电池状态数量展示

master
lch 6 months ago
parent ec623c35e6
commit 6e66601ef1

@ -44,6 +44,12 @@ namespace Entity.DbModel.Station
[SugarColumn(ColumnName = "name")] [SugarColumn(ColumnName = "name")]
public string Name { get; set; } public string Name { get; set; }
/// <summary>
/// 在位状态0-不在位1-在位;其他-无效
/// </summary>
[SugarColumn(ColumnName = "exists")]
public int Exists { get; set; }
/// <summary> /// <summary>
/// Desc:电池编号 /// Desc:电池编号
/// Default: /// Default:

@ -1,13 +0,0 @@
namespace Entity.Dto.Req;
public class DistributeElecPriceReq
{
/// <summary>
/// 充电机号
/// </summary>
public string BinNo { get; set; }
/// <summary>
/// 电价模型详情:版本
/// </summary>
public int Version { get; set; }
}

@ -0,0 +1,17 @@
namespace Entity.Dto.Resp;
public class BatteryStatusInfoResp
{
/// <summary>
/// 电池总数
/// </summary>
public int btyTotalCount { get;set; }
/// <summary>
/// 正在充电数量
/// </summary>
public int chargingCount { get;set; }
/// <summary>
/// 满足换电数量
/// </summary>
public int canSwapCount { get;set; }
}

@ -1,9 +1,11 @@
using Entity.DbModel.Station; using Entity.DbModel.Station;
using Entity.Dto.Resp;
using HybirdFrameworkCore.Autofac.Attribute; using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.Entity;
using Repository.Station; using Repository.Station;
using Service.Charger.Client; using Service.Charger.Client;
using Service.Charger.Msg.Host.Req; using Service.Charger.Msg.Host.Req;
using Service.Init;
using SqlSugar; using SqlSugar;
namespace Service.Charger; namespace Service.Charger;
@ -77,7 +79,7 @@ public class ChargerService
/// </summary> /// </summary>
/// <param name="binNo"></param> /// <param name="binNo"></param>
/// <returns></returns> /// <returns></returns>
public Result<bool> DistributeElecPriceForCharge(string binNo,int version) public Result<bool> DistributeElecPriceForCharge(int version)
{ {
Dictionary<string,ChargerClient> chargerClients = ClientMgr.Dictionary; Dictionary<string,ChargerClient> chargerClients = ClientMgr.Dictionary;
if (chargerClients.Values.Count <= 0) if (chargerClients.Values.Count <= 0)
@ -131,4 +133,23 @@ public class ChargerService
}; };
return setPeakValleyTime; return setPeakValleyTime;
} }
/// <summary>
/// 电池状态信息:电池总数 满电数量、充电中、故障电池、维护中电池
/// </summary>
/// <returns></returns>
public Result<BatteryStatusInfoResp> BatteryStatusInfo()
{
BatteryStatusInfoResp batteryStatusInfoResp = new BatteryStatusInfoResp();
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
if (binInfos.Count > 0)
batteryStatusInfoResp.btyTotalCount = binInfos.Count();
List<BinInfo> canSwapCounts = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1&&i.Soc > Convert.ToDecimal(StaticStationInfo.SwapSoc));
if (canSwapCounts.Count > 0)
batteryStatusInfoResp.canSwapCount = canSwapCounts.Count();
List<BinInfo> chargingCounts = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1&&i.ChargeStatus==1);
if (chargingCounts.Count > 0)
batteryStatusInfoResp.chargingCount = chargingCounts.Count();
return Result<BatteryStatusInfoResp>.Fail();
}
} }

@ -110,10 +110,21 @@ public class ChargeController : ControllerBase
/// </summary> /// </summary>
/// <param name="version"></param> /// <param name="version"></param>
[HttpGet] [HttpGet]
[Route("DistributeElecPriceForCharge")] [Route("DistributeElecPriceForCharge/{Version}")]
public Result<bool> DistributeElecPriceForCharge([FromBody] DistributeElecPriceReq input ) public Result<bool> DistributeElecPriceForCharge(int Version)
{ {
return _chargerService.DistributeElecPriceForCharge(input.BinNo,input.Version); return _chargerService.DistributeElecPriceForCharge(Version);
} }
//BatteryStatusInfo
/// <summary>
/// 电池状态信息:电池总数 满电数量、充电中、故障电池、维护中电池
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("BatteryStatusInfo")]
public Result<BatteryStatusInfoResp> BatteryStatusInfo()
{
return _chargerService.BatteryStatusInfo();
}
} }
Loading…
Cancel
Save