Răsfoiți Sursa

1. 拿掉 OpenNetwork 沒在用的設定
2. 新增TCC_OCPPLogModule dll 以後可以只換dll 不用Rebuild

Jessica Tseng 1 an în urmă
părinte
comite
53d800155f

+ 7 - 7
EVCB_OCPP.WSServer/App.config

@@ -6,18 +6,18 @@
     <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
     <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
   </configSections>
-   <connectionStrings>
-     <add name="ConnectionLogDBContext" connectionString="data source=172.1.2.216\SQLEXPRESS;initial catalog=StandardOCPP_ConnectionLog;;persist security info=True;user id=tccdev;password=tccdevtest;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
-     <add name="MainDBContext" connectionString="data source=172.1.2.216\SQLEXPRESS;initial catalog=StandardOCPP_Main;;persist security info=True;user id=tccdev;password=tccdevtest;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
-     <add name="MeterValueDBContext" connectionString="data source=172.1.2.216\SQLEXPRESS;initial catalog=StandardOCPP_MeterValue;;persist security info=True;user id=tccdev;password=tccdevtest;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
-     <add name="WebDBContext" connectionString="data source=172.1.2.216\SQLEXPRESS;initial catalog=StandardOCPP_Web;;persist security info=True;user id=tccdev;password=tccdevtest;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
-   </connectionStrings>
+  <connectionStrings>
+    <add name="ConnectionLogDBContext" connectionString="data source=172.1.2.199;initial catalog=StandardOCPP_ConnectionLog;;persist security info=True;user id=Phihong;password=GOGOGO;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
+    <add name="MainDBContext" connectionString="data source=172.1.2.199;initial catalog=StandardOCPP_Main;;persist security info=True;user id=Phihong;password=GOGOGO;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
+    <add name="MeterValueDBContext" connectionString="data source=172.1.2.199;initial catalog=StandardOCPP_MeterValue;;persist security info=True;user id=Phihong;password=GOGOGO;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
+    <add name="WebDBContext" connectionString="data source=172.1.2.199;initial catalog=StandardOCPP_Web;;persist security info=True;user id=Phihong;password=GOGOGO;MultipleActiveResultSets=True;App=EntityFramework; Max Pool Size=500" providerName="System.Data.SqlClient" />
+  </connectionStrings>
   <appSettings>   
      <add key="LocalAuthAPI" value="" />
     <add key="WSPort" value="2012" />
     <add key="WSSPort" value="2016" />
     <add key="AlarmNotificationCond" value="012251,012252,042251,042252,042267,042327,042328,042304,012304" />
-    <add key="SMS_Receivers" value="0983105714,0929168960" />
+    <add key="SMS_Receivers" value="" />
   </appSettings>
   <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" />

BIN
EVCB_OCPP.WSServer/DLL/TCC_OCPPLogModule.dll


+ 5 - 0
EVCB_OCPP.WSServer/EVCB_OCPP.WSServer.csproj

@@ -145,6 +145,10 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
+    <Reference Include="TCC_OCPPLogModule, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>DLL\TCC_OCPPLogModule.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Dto\ChargingPrice.cs" />
@@ -198,6 +202,7 @@
     <Content Include="DLL\SuperSocket.SocketBase.dll" />
     <Content Include="DLL\SuperSocket.SocketEngine.dll" />
     <Content Include="DLL\SuperWebSocket.dll" />
+    <Content Include="DLL\TCC_OCPPLogModule.dll" />
     <Content Include="NLog.config">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <SubType>Designer</SubType>

+ 1 - 1
EVCB_OCPP.WSServer/Properties/AssemblyInfo.cs

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
 
-[assembly: AssemblyInformationalVersion("a733b7d")]
+[assembly: AssemblyInformationalVersion("c9c4b47")]

+ 16 - 6
EVCB_OCPP.WSServer/ProtalServer.cs

@@ -29,7 +29,7 @@ using System.Security.Authentication;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Xml.Linq;
-
+using TCC_OCPPLogModule;
 
 namespace EVCB_OCPP.WSServer
 {
@@ -62,6 +62,7 @@ namespace EVCB_OCPP.WSServer
         private DateTime _CheckWeatherDt = DateTime.UtcNow;
         private LoadingBalanceService _loadingBalanceService = new LoadingBalanceService();
         private Dictionary<string, TCCWeatherDto> TCCStationDic = new Dictionary<string, TCCWeatherDto>();
+        private IOCPPLogModule _ocppLogModule = new LogModuleFactory().CreateOCPPLogModule();
 
         private List<string> needConfirmActions = new List<string>()
         {
@@ -368,12 +369,11 @@ namespace EVCB_OCPP.WSServer
             var appServer = new OCPPWSServer(new List<OCPPSubProtocol>() { new OCPPSubProtocol(), new OCPPSubProtocol(" ocpp1.6"), new OCPPSubProtocol("ocpp2.0") });
 
             List<IListenerConfig> llistener = new List<IListenerConfig>();
-            //System.Net.IPAddress.Any.ToString()
-            // llistener.Add(new ListenerConfig { Ip = "", Port = Convert.ToInt32(wssserverPort), Backlog = 100, Security = serverSecurity });
+
             llistener.Add(new ListenerConfig { Ip = System.Net.IPAddress.Any.ToString(), Port = Convert.ToInt32(GlobalConfig.GetWS_Port()), Backlog = 100, Security = "None" });
             llistener.Add(new ListenerConfig { Ip = System.Net.IPAddress.Any.ToString(), Port = Convert.ToInt32(GlobalConfig.GetWSS_Port()), Backlog = 100, Security = SslProtocols.Tls12.ToString() });
 
-            // llistener.Add(new ListenerConfig { Ip = System.Net.IPAddress.Any.ToString(), Port = Convert.ToInt32(GlobalConfig.GetWSS_Port()), Backlog = 100, Security = SslProtocols.Tls11.ToString() });
+          
             var config = ConfigurationManager.GetSection("superSocket") as IConfigurationSource;
             ICertificateConfig Certificate = config.Servers.ElementAt(0).Certificate;
             IEnumerable<IListenerConfig> listeners = llistener;
@@ -2141,7 +2141,7 @@ namespace EVCB_OCPP.WSServer
         {
             try
             {
-
+                var dd = DateTime.UtcNow;
                 if (clientData == null || string.IsNullOrEmpty(data)) return;
 
                 if (clientData.ChargeBoxId == null)
@@ -2152,7 +2152,7 @@ namespace EVCB_OCPP.WSServer
                 {
                     string sp = "[dbo].[uspInsertMachineConnectionLog] @CreatedOn," +
                           "@ChargeBoxId,@MessageType,@Data,@Msg,@IsSent,@EVSEEndPoint,@Session";
-                    var dd = DateTime.UtcNow;
+
                     SqlParameter[] parameter =
                     {
                       new SqlParameter("CreatedOn",dd),
@@ -2167,6 +2167,16 @@ namespace EVCB_OCPP.WSServer
 
                     db.Database.ExecuteSqlCommand(sp, parameter);
                 }
+
+                if (clientData.ChargeBoxId != null && _ocppLogModule != null && messageType != "Connection")
+                {
+                    MessageTypeEnum messageTypeEnum = messageType.Contains("Request") ? MessageTypeEnum.CALL :
+                        messageType.Contains("Confirmation") ? MessageTypeEnum.CALLRESULT : MessageTypeEnum.CALLERROR;
+
+                    _ocppLogModule.HandleOCPPLog(messageTypeEnum, clientData.ChargeBoxId, data, dd);
+                }
+
+
             }
             catch (Exception ex)
             {

BIN
SuperWebSocket/bin/Debug/SuperSocket.Common.dll


BIN
SuperWebSocket/bin/Debug/SuperWebSocket.dll


BIN
SuperWebSocket/bin/Debug/SuperWebSocket.pdb