Browse Source

temp commit

Robert 11 months ago
parent
commit
03bcddfd69

+ 3 - 0
EVCB_OCPP.WSServer/Jobs/ServerMessageJob.cs

@@ -25,18 +25,21 @@ public class ServerMessageJob : IJob
     public ServerMessageJob(
         ProtalServer protalServer,
         ConfirmWaitingMessageSerevice confirmWaitingMessageSerevice,
+        VendorIdReplaceService vendorIdReplaceService,
         IConfiguration configuration,
         IDbContextFactory<MainDBContext> maindbContextFactory,
         ILogger<ServerMessageJob> logger)
     {
         this.protalServer = protalServer;
         this.confirmWaitingMessageSerevice = confirmWaitingMessageSerevice;
+        this.vendorIdReplaceService = vendorIdReplaceService;
         this.maindbContextFactory = maindbContextFactory;
         this.logger = logger;
     }
 
     private readonly ProtalServer protalServer;
     private readonly ConfirmWaitingMessageSerevice confirmWaitingMessageSerevice;
+    private readonly VendorIdReplaceService vendorIdReplaceService;
     private readonly IDbContextFactory<MainDBContext> maindbContextFactory;
     private readonly ILogger<ServerMessageJob> logger;
 

+ 1 - 0
EVCB_OCPP.WSServer/Program.cs

@@ -80,6 +80,7 @@ namespace EVCB_OCPP.WSServer
             app.Urls.Add("http://*:80");
 
             app.InitStationConfigService();
+            app.InitVendorIdReplaceService();
             app.Run();
             //host.Run();
         }

+ 8 - 5
EVCB_OCPP.WSServer/Service/VendorIdReplaceService.cs

@@ -38,6 +38,9 @@ namespace EVCB_OCPP.WSServer.Service
             this.logger = logger;
         }
 
+
+        private static string Session_VID_Key = "StationConfigService_Station";
+
         private readonly ProtalServer protalServer;
         private readonly ServerMessageService messageService;
         private readonly ConfirmWaitingMessageSerevice confirmWaitingMessageSerevice;
@@ -61,7 +64,7 @@ namespace EVCB_OCPP.WSServer.Service
                 return;
             }
 
-
+            SetSessionVendorId(wsClient, vendorId.value);
         }
 
 
@@ -75,20 +78,20 @@ namespace EVCB_OCPP.WSServer.Service
         private int? GetSessionVendorId(WsClientData session)
         {
             if (session is null ||
-                !session.Data.ContainsKey(Session_Station_Key))
+                !session.Data.ContainsKey(Session_VID_Key))
             {
                 return null;
             }
-            return (int?)session.Data[Session_Station_Key];
+            return (int?)session.Data[Session_VID_Key];
         }
 
-        private void SetSessionStation(WsClientData session, int? stationId)
+        private void SetSessionVendorId(WsClientData session, string vid)
         {
             if (session is null)
             {
                 return;
             }
-            session.Data[Session_Station_Key] = stationId;
+            session.Data[Session_VID_Key] = vid;
         }
     }
 }