|
|
@ -18,6 +18,8 @@ namespace Service.Charger;
|
|
|
|
public class ChargerService
|
|
|
|
public class ChargerService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public BinInfoRepository BinInfoRepository { get; set; }
|
|
|
|
public BinInfoRepository BinInfoRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public EquipInfoRepository EquipInfoRepository { get; set; }
|
|
|
|
public ElecPriceModelVersionDetailRepository ElecPriceModelVersionDetailRepository { get; set; }
|
|
|
|
public ElecPriceModelVersionDetailRepository ElecPriceModelVersionDetailRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -45,8 +47,10 @@ public class ChargerService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
byte chargeSoc = StaticStationInfo.ChargeSoc;
|
|
|
|
byte chargeSoc = StaticStationInfo.ChargeSoc;
|
|
|
|
float chargePower = StaticStationInfo.ChargePower;
|
|
|
|
|
|
|
|
return chargerClient.StartCharge(chargeSoc, chargePower);
|
|
|
|
float? chargePower = EquipInfoRepository.QueryPowerByCode(binNo);
|
|
|
|
|
|
|
|
float? power = chargePower == null ? StaticStationInfo.ChargePower : chargePower;
|
|
|
|
|
|
|
|
return chargerClient.StartCharge(chargeSoc,(float)power);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -77,6 +81,7 @@ public class ChargerService
|
|
|
|
|
|
|
|
|
|
|
|
return Result<bool>.Success(true, "发送停止命令成功");
|
|
|
|
return Result<bool>.Success(true, "发送停止命令成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 下发尖峰平谷
|
|
|
|
/// 下发尖峰平谷
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -92,7 +97,6 @@ public class ChargerService
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var chargerClientsValue in chargerClients.Values)
|
|
|
|
foreach (var chargerClientsValue in chargerClients.Values)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
if (chargerClientsValue.Connected)
|
|
|
|
if (chargerClientsValue.Connected)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
chargerClientsValue.SendSetPeakValleyTime(BulidSetPeakValleyTimeObj(version));
|
|
|
|
chargerClientsValue.SendSetPeakValleyTime(BulidSetPeakValleyTimeObj(version));
|
|
|
@ -105,7 +109,8 @@ public class ChargerService
|
|
|
|
public SetPeakValleyTime BulidSetPeakValleyTimeObj(int version)
|
|
|
|
public SetPeakValleyTime BulidSetPeakValleyTimeObj(int version)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails =
|
|
|
|
List<ElecPriceModelVersionDetail> elecPriceModelVersionDetails =
|
|
|
|
ElecPriceModelVersionDetailRepository.QueryListByClause(u => u.Version == version,u=>u.StartHour,OrderByType.Asc);
|
|
|
|
ElecPriceModelVersionDetailRepository.QueryListByClause(u => u.Version == version, u => u.StartHour,
|
|
|
|
|
|
|
|
OrderByType.Asc);
|
|
|
|
SetPeakValleyTime setPeakValleyTime = new SetPeakValleyTime()
|
|
|
|
SetPeakValleyTime setPeakValleyTime = new SetPeakValleyTime()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NumberTime = Convert.ToByte(elecPriceModelVersionDetails.Count),
|
|
|
|
NumberTime = Convert.ToByte(elecPriceModelVersionDetails.Count),
|
|
|
@ -147,10 +152,12 @@ public class ChargerService
|
|
|
|
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
|
|
|
|
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
|
|
|
|
if (binInfos.Count > 0)
|
|
|
|
if (binInfos.Count > 0)
|
|
|
|
batteryStatusInfoResp.btyTotalCount = binInfos.Count();
|
|
|
|
batteryStatusInfoResp.btyTotalCount = binInfos.Count();
|
|
|
|
List<BinInfo> canSwapCounts = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1&&i.Soc > Convert.ToDecimal(StaticStationInfo.SwapSoc));
|
|
|
|
List<BinInfo> canSwapCounts = BinInfoRepository.QueryListByClause(i =>
|
|
|
|
|
|
|
|
i.Exists == 1 && i.Status == 1 && i.Soc > Convert.ToDecimal(StaticStationInfo.SwapSoc));
|
|
|
|
if (canSwapCounts.Count > 0)
|
|
|
|
if (canSwapCounts.Count > 0)
|
|
|
|
batteryStatusInfoResp.canSwapCount = canSwapCounts.Count();
|
|
|
|
batteryStatusInfoResp.canSwapCount = canSwapCounts.Count();
|
|
|
|
List<BinInfo> chargingCounts = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1&&i.ChargeStatus==1);
|
|
|
|
List<BinInfo> chargingCounts =
|
|
|
|
|
|
|
|
BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1 && i.ChargeStatus == 1);
|
|
|
|
if (chargingCounts.Count > 0)
|
|
|
|
if (chargingCounts.Count > 0)
|
|
|
|
batteryStatusInfoResp.chargingCount = chargingCounts.Count();
|
|
|
|
batteryStatusInfoResp.chargingCount = chargingCounts.Count();
|
|
|
|
return Result<BatteryStatusInfoResp>.Success(batteryStatusInfoResp);
|
|
|
|
return Result<BatteryStatusInfoResp>.Success(batteryStatusInfoResp);
|
|
|
|