Эх сурвалжийг харах

add main commit 798df193053386b10fdc3adc038b4e0953fa7875
Commit 798df193: 1. 補上結束充電一定會統計充電量 (MeasurandId=52)
2. StopTransaction Response 無法發送 紀錄原因在Log

Robert 1 жил өмнө
parent
commit
77df1c4659

+ 1 - 1
EVCB_OCPP.WSServer/Jobs/DenyModelCheckJob.cs

@@ -41,7 +41,7 @@ public class DenyModelCheckJob : IJob
         try
         {
             GlobalConfig.DenyModelNames = await webDbService.GetDenyModelNames();
-            logger.LogDebug("Current DenyList:[{0}]", string.Join(",", GlobalConfig.DenyModelNames));
+            //logger.LogDebug("Current DenyList:[{0}]", string.Join(",", GlobalConfig.DenyModelNames));
 
             if (string.IsNullOrEmpty(GlobalConfig.DenyModelNames[0]))
             {

+ 15 - 7
EVCB_OCPP.WSServer/Message/CoreProfileHandler.cs

@@ -471,7 +471,7 @@ internal partial class ProfileHandler
                             catch (Exception ex)
                             {
 
-                                Console.WriteLine(string.Format("{0} :{1}", session.ChargeBoxId + " RunningCost", ex.Message));
+                                logger.LogTrace(string.Format("{0} :{1}", session.ChargeBoxId + " RunningCost", ex.Message));
 
                             }
 
@@ -749,6 +749,14 @@ internal partial class ProfileHandler
                                     receipt: string.Empty,
                                     cost: session.IsBilling ? -1 : 0);
 
+                                if (_request.transactionData == null || _request.transactionData.Count == 0)
+                                {
+                                    _request.transactionData = new List<MeterValue>()
+                                            {
+                                                new MeterValue() {  timestamp= _request.timestamp, sampledValue=new List<SampledValue>()}
+                                            };
+                                }
+
                                 if (_request.transactionData != null && _request.transactionData.Count > 0)
                                 {
                                     //清除 StopTransaction TransactionData 
@@ -910,7 +918,7 @@ internal partial class ProfileHandler
                     break;
                 default:
                     {
-                        Console.WriteLine(string.Format("Not Implement {0} Logic(ExecuteCoreRequest)", request.GetType().ToString().Replace("OCPPPackage.Messages.Core.", "")));
+                        logger.LogWarning(string.Format("Not Implement {0} Logic(ExecuteCoreRequest)", request.GetType().ToString().Replace("OCPPPackage.Messages.Core.", "")));
                     }
                     break;
             }
@@ -1092,7 +1100,7 @@ internal partial class ProfileHandler
                                         var tx = await db.TransactionRecord.Where(x => x.Id == txEnergy.TxId).FirstOrDefaultAsync();
                                         if (tx == null)
                                         {
-                                            Console.WriteLine("Tx is empty");
+                                            logger.LogWarning("Tx is empty");
                                             return result;
                                         }
 
@@ -1275,7 +1283,7 @@ internal partial class ProfileHandler
                                                 //{ "to","jessica_tseng@phihong.com.tw"}
                                            }, null);
 
-                                            Console.WriteLine(JsonConvert.SerializeObject(mail_response));
+                                            logger.LogTrace(JsonConvert.SerializeObject(mail_response));
 
                                         }
                                         #endregion
@@ -1526,7 +1534,7 @@ internal partial class ProfileHandler
                                         string oldValue = string.Empty;
                                         if (item.key == null)
                                         {
-                                            Console.WriteLine("*********************");
+                                            logger.LogTrace("*********************");
                                         }
                                         var foundConfig = configure.Find(x => x.ConfigureName == item.key);
 
@@ -1535,7 +1543,7 @@ internal partial class ProfileHandler
                                         {
                                             if (foundConfig.ConfigureName == null)
                                             {
-                                                Console.WriteLine("*********************");
+                                                logger.LogTrace("*********************");
                                             }
 
                                             if (foundConfig.ConfigureName == "SecurityProfile")
@@ -1630,7 +1638,7 @@ internal partial class ProfileHandler
                     break;
                 default:
                     {
-                        Console.WriteLine(string.Format("Not Implement {0} Logic(ExecuteCoreConfirm)", confirm.GetType().ToString().Replace("OCPPPackage.Messages.Core.", "")));
+                        logger.LogWarning(string.Format("Not Implement {0} Logic(ExecuteCoreConfirm)", confirm.GetType().ToString().Replace("OCPPPackage.Messages.Core.", "")));
                     }
                     break;
             }

+ 1 - 0
EVCB_OCPP.WSServer/ProtalServer.cs

@@ -984,6 +984,7 @@ namespace EVCB_OCPP.WSServer
                                 if (action == Actions.StopTransaction && replyResult.CallErrorMsg == "Reject Response Message")
                                 {
                                     //do nothing 
+                                    logger.LogWarning(replyResult.Exception.ToString());
                                 }
                                 else
                                 {