Przeglądaj źródła

add main db commit 4b3798b9
防呆抓不到SOC 問題

Robert 1 rok temu
rodzic
commit
f5a8cdcfbf

+ 4 - 1
EVCB_OCPP.WSServer/Message/CoreProfileHandler.cs

@@ -699,7 +699,10 @@ internal partial class ProfileHandler
                                     SOCCollection.Sort();
                                     logger.LogDebug(string.Format("SOCCollection:" + String.Join(",", SOCCollection.Select(x => x.ToString()).ToArray())));
 
-                                    await mainDbService.UpdateTransactionSOC(transaction.Id, SOCCollection.First().ToString("0"), SOCCollection.Last().ToString("0"));
+                                    await mainDbService.UpdateTransactionSOC(
+                                        transaction.Id,
+                                        startsoc: SOCCollection.Count == 0 ? "" : SOCCollection.First().ToString("0"),
+                                        stopsoc: SOCCollection.Count == 0 ? "" : SOCCollection.Last().ToString("0");
                                 }
                                 #endregion
 

+ 1 - 1
EVCB_OCPP.WSServer/Service/MainDbService.cs

@@ -38,7 +38,7 @@ public interface IMainDbService
     Task<TransactionRecord> GetTransactionForStopTransaction(int transactionId, string chargeBoxId);
     Task UpdateTransaction(int transactionId, int meterStop, DateTime stopTime, int stopReasonId, string stopReason, string stopIdTag, string receipt, int cost);
     Task<bool> UpdateHeartBeats(IEnumerable<Machine> heartBeatsData);
-    Task UpdateTransactionSOC(int id, string v1, string v2);
+    Task UpdateTransactionSOC(int id, string startsoc, string stopsoc);
 }
 
 public class MainDbService : IMainDbService