|
@@ -13,6 +13,7 @@ using EVCB_OCPP.Packet.Messages.Security;
|
|
|
using EVCB_OCPP.Packet.Messages.SmartCharging;
|
|
|
using EVCB_OCPP.Packet.Messages.SubTypes;
|
|
|
using EVCB_OCPP.WSServer.Helper;
|
|
|
+using EVCB_OCPP.WSServer.Service.BusinessService;
|
|
|
using Microsoft.Data.SqlClient;
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
@@ -21,6 +22,7 @@ using Microsoft.Extensions.Logging;
|
|
|
using Newtonsoft.Json;
|
|
|
using OCPPPackage.Profiles;
|
|
|
using System.Data;
|
|
|
+using System.Diagnostics;
|
|
|
|
|
|
namespace EVCB_OCPP.WSServer.Service.DbService;
|
|
|
|
|
@@ -72,6 +74,7 @@ public interface IMainDbService
|
|
|
Task RecordBoardVersions(string machineId, string data);
|
|
|
Task<TransactionRecord> GetTransaction(int txId);
|
|
|
Task SetPncNotifiyResult(int txid, bool isNotifySuccess, string eVCCID);
|
|
|
+ Task ReportStopTx(int txid, NotifyTransactionCompletedResult reportResults);
|
|
|
}
|
|
|
|
|
|
public class MainDbService : IMainDbService
|
|
@@ -644,6 +647,22 @@ public class MainDbService : IMainDbService
|
|
|
await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
+ public async Task ReportStopTx(int txid, NotifyTransactionCompletedResult reportResults)
|
|
|
+ {
|
|
|
+ using var dbConn = await sqlConnectionFactory.CreateAsync();
|
|
|
+
|
|
|
+ var cmd = """
|
|
|
+ UPDATE [dbo].[TransactionRecord]
|
|
|
+ SET StopTransactionReportedOn=@StopTransactionReportedOn, ErrorMsg=@ErrorMsg
|
|
|
+ WHERE Id=@Id
|
|
|
+ """;
|
|
|
+
|
|
|
+ var parameters = new DynamicParameters();
|
|
|
+ parameters.Add("@Id", txid, DbType.Int32, ParameterDirection.Input);
|
|
|
+ parameters.Add("@StopTransactionReportedOn", DateTime.UtcNow, DbType.DateTime, ParameterDirection.Input);
|
|
|
+ parameters.Add("@ErrorMsg", reportResults.ErrorMsg, DbType.String, ParameterDirection.Input, -1);
|
|
|
+ await dbConn.ExecuteAsync(cmd, parameters);
|
|
|
+ }
|
|
|
|
|
|
private void InitUpdateConnectorStatusHandler()
|
|
|
{
|