Explorar o código

1. 針對UCAR UCARTEST 兩個Customer 旗下的電樁設定timeoffset
2.統一回調客人API 時間格式yyyy-MM-dd'T'HH':'mm':'ss'Z'

Jessica Tseng %!s(int64=2) %!d(string=hai) anos
pai
achega
674465c164

+ 10 - 5
EVCB_OCPP.WSServer/GlobalConfig.cs

@@ -15,16 +15,22 @@ namespace EVCB_OCPP.WSServer
             "OCPP20_WSSUrl"
         };
 
+        public static  string UTC_DATETIMEFORMAT = "yyyy-MM-dd'T'HH':'mm':'ss'Z'";
+
         public static string TCC_API_URL = string.Empty;
 
         public static string TCC_SALTKEY = string.Empty;
 
         public static string OCPP20_WSUrl = string.Empty;
 
-        public static string OCPP20_WSSUrl = string.Empty;  
-
-      
+        public static string OCPP20_WSSUrl = string.Empty;
 
+        public static JsonSerializerSettings JSONSERIALIZER_FORMAT = new JsonSerializerSettings()
+        {
+            NullValueHandling = NullValueHandling.Ignore,
+            Formatting = Formatting.None,
+            DateFormatString = UTC_DATETIMEFORMAT
+        };
 
         /// <summary>
         /// 預設心跳間隔時間 單位:秒
@@ -123,13 +129,12 @@ namespace EVCB_OCPP.WSServer
         }
 
         public static readonly int DB_DefaultConnectionTimeout = 60;
-        public static readonly string UTC_DATETIMEFORMAT = "yyyy/MM/dd'T'HH':'mm':'ss'Z'";
+   
         /// <summary>
         /// 預設 Null的 DateTime 
         /// </summary>
         public static DateTime DefaultNullTime = new DateTime(1991, 1, 1);
 
-        public static JsonSerializerSettings JSONSERIALIZER_FORMAT = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None };
 
 
 

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

@@ -35,4 +35,4 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyVersion("1.0.5.0")]
 [assembly: AssemblyFileVersion("1.0.5.0")]
 
-[assembly: AssemblyInformationalVersion("f9b64a5")]
+[assembly: AssemblyInformationalVersion("f9f2942")]

+ 31 - 4
EVCB_OCPP.WSServer/ProtalServer.cs

@@ -139,7 +139,7 @@ namespace EVCB_OCPP.WSServer
 
             Task serverHealthTask = new Task(HealthCheckTrigger, _ct);
             serverHealthTask.Start();
-           
+
             while (true)
             {
                 var input = Console.ReadLine();
@@ -720,10 +720,37 @@ namespace EVCB_OCPP.WSServer
                                     if (((BootNotificationConfirmation)replyResult.Message).status == Packet.Messages.SubTypes.RegistrationStatus.Accepted)
                                     {
 
-
-
                                         CheckVersion(session.ChargeBoxId);
                                         CheckEVSEConfigure(session.ChargeBoxId);
+                                        if (session.CustomerId == new Guid("298918C0-6BB5-421A-88CC-4922F918E85E")|| session.CustomerId == new Guid("9E6BFDCC-09FB-4DAB-A428-43FE507600A3"))
+                                        {
+                                            using (var db = new MainDBContext())
+                                            {
+                                                db.ServerMessage.Add(new ServerMessage()
+                                                {
+                                                    ChargeBoxId = session.ChargeBoxId,
+                                                    CreatedBy = "Server",
+                                                    CreatedOn = DateTime.UtcNow,
+                                                    OutAction = Actions.ChangeConfiguration.ToString(),
+                                                    OutRequest = JsonConvert.SerializeObject(
+                                                   new ChangeConfigurationRequest()
+                                                   {
+                                                       key = "TimeOffset",
+                                                       value = "+08:00"
+
+                                                   },
+                                                   new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore, Formatting = Formatting.None }),
+                                                    SerialNo = Guid.NewGuid().ToString(),
+                                                    InMessage = string.Empty
+
+                                                });
+
+
+                                                db.SaveChanges();
+                                            }                                              
+
+                                        }
+
 
                                         if (session.CustomerId == new Guid("009E603C-79CD-4620-A2B8-D9349C0E8AD8"))
                                         {
@@ -1967,7 +1994,7 @@ namespace EVCB_OCPP.WSServer
                 foreach (var item in removeList)
                 {
                     needConfirmPacketList.Remove(item);
-                }               
+                }
             }
         }
 

+ 2 - 3
EVCB_OCPP.WSServer/Service/OuterBusinessService.cs

@@ -159,8 +159,7 @@ namespace EVCB_OCPP.WSServer.Service
                 if (signMaterial.CallsThirdParty)
                 {
 
-                    logger.Info(" NotifyFaultStatus======================================>");
-                    logger.Info(JsonConvert.SerializeObject(details));
+              
 
 
                     var response = await httpClient.Post(signMaterial.APIUrl + "connectorfault", new Dictionary<string, string>()
@@ -170,7 +169,7 @@ namespace EVCB_OCPP.WSServer.Service
                             }, details, signMaterial.SaltKey).ConfigureAwait(false);
 
                   
-                    logger.Info(JsonConvert.SerializeObject(response));
+                   
                 }