|
@@ -57,7 +57,7 @@ public class StationConfigService
|
|
|
public async Task CheckAndUpdateEvseConfig(WsClientData session, CancellationToken token = default)
|
|
|
{
|
|
|
var chargeBoxId = session.ChargeBoxId;
|
|
|
- var stationId = await webDbService.GetEvseStation(chargeBoxId);
|
|
|
+ var stationId = await webDbService.GetEvseStation(chargeBoxId, token);
|
|
|
if (stationId is null)
|
|
|
{
|
|
|
return;
|
|
@@ -66,7 +66,7 @@ public class StationConfigService
|
|
|
if (session.StationId != stationId)
|
|
|
{
|
|
|
session.StationId = stationId;
|
|
|
- await UpdateEvseConfig(chargeBoxId, stationId.Value);
|
|
|
+ await UpdateEvseConfig(chargeBoxId, stationId.Value, token);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -100,8 +100,7 @@ public class StationConfigService
|
|
|
var connectedEvses = portalServer.GetClientDic().Values;
|
|
|
foreach (var evse in connectedEvses)
|
|
|
{
|
|
|
- if (evse.IsCheckIn &&
|
|
|
- evse.StationId is not null &&
|
|
|
+ if (evse.StationId is not null &&
|
|
|
modifiedStations.Contains(evse.StationId.Value))
|
|
|
{
|
|
|
await UpdateEvseConfig(evse.ChargeBoxId, evse.StationId.Value);
|
|
@@ -113,9 +112,11 @@ public class StationConfigService
|
|
|
{
|
|
|
List<string> modifiedEvses = new();
|
|
|
var connectedEvses = portalServer.GetClientDic().Values.ToList();
|
|
|
+ var evseStationPair = await webDbService.GetEvseStationPair(connectedEvses.Select(x => x.ChargeBoxId).ToList());
|
|
|
foreach (var evse in connectedEvses)
|
|
|
{
|
|
|
- var currentStation = await webDbService.GetEvseStation(evse.ChargeBoxId);
|
|
|
+ //var currentStation = await webDbService.GetEvseStation(evse.ChargeBoxId);
|
|
|
+ int? currentStation = evseStationPair.ContainsKey(evse.ChargeBoxId) ? evseStationPair[evse.ChargeBoxId] : null;
|
|
|
if (currentStation is null)
|
|
|
{
|
|
|
evse.StationId = null;
|