|
|
|
@ -18,6 +18,8 @@ namespace Service.Charger;
|
|
|
|
|
public class ChargerService
|
|
|
|
|
{
|
|
|
|
|
public BinInfoRepository BinInfoRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
public EquipInfoRepository EquipInfoRepository { get; set; }
|
|
|
|
|
public ElecPriceModelVersionDetailRepository ElecPriceModelVersionDetailRepository { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -45,8 +47,10 @@ public class ChargerService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
@ -77,6 +81,7 @@ public class ChargerService
|
|
|
|
|
|
|
|
|
|
return Result<bool>.Success(true, "发送停止命令成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 下发尖峰平谷
|
|
|
|
|
/// </summary>
|
|
|
|
@ -84,7 +89,7 @@ public class ChargerService
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public Result<bool> DistributeElecPriceForCharge(int version)
|
|
|
|
|
{
|
|
|
|
|
ConcurrentDictionary<string,ChargerClient> chargerClients = ClientMgr.Dictionary;
|
|
|
|
|
ConcurrentDictionary<string, ChargerClient> chargerClients = ClientMgr.Dictionary;
|
|
|
|
|
if (chargerClients.Values.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
return Result<bool>.Fail();
|
|
|
|
@ -92,7 +97,6 @@ public class ChargerService
|
|
|
|
|
|
|
|
|
|
foreach (var chargerClientsValue in chargerClients.Values)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (chargerClientsValue.Connected)
|
|
|
|
|
{
|
|
|
|
|
chargerClientsValue.SendSetPeakValleyTime(BulidSetPeakValleyTimeObj(version));
|
|
|
|
@ -105,10 +109,11 @@ public class ChargerService
|
|
|
|
|
public SetPeakValleyTime BulidSetPeakValleyTimeObj(int version)
|
|
|
|
|
{
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
NumberTime =Convert.ToByte( elecPriceModelVersionDetails.Count),
|
|
|
|
|
NumberTime = Convert.ToByte(elecPriceModelVersionDetails.Count),
|
|
|
|
|
StartHH1 = Convert.ToByte(elecPriceModelVersionDetails[0].StartHour),
|
|
|
|
|
StartHH2 = Convert.ToByte(elecPriceModelVersionDetails[1].StartHour),
|
|
|
|
|
StartHH3 = Convert.ToByte(elecPriceModelVersionDetails[2].StartHour),
|
|
|
|
@ -145,14 +150,16 @@ public class ChargerService
|
|
|
|
|
{
|
|
|
|
|
BatteryStatusInfoResp batteryStatusInfoResp = new BatteryStatusInfoResp();
|
|
|
|
|
List<BinInfo> binInfos = BinInfoRepository.QueryListByClause(i => i.Exists == 1 && i.Status == 1);
|
|
|
|
|
if(binInfos.Count>0)
|
|
|
|
|
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)
|
|
|
|
|
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)
|
|
|
|
|
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>.Success(batteryStatusInfoResp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|