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

add handle if CallPartnerApiOnSchedule = 1 and InstantStopTxReport = 1

shayne_lo 6 сар өмнө
parent
commit
116c893777

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

@@ -819,7 +819,16 @@ internal partial class ProfileHandler
 								else
 								{
 									await mainDbService.SetTransactionBillingDone(_request.transactionId, 0, string.Empty);
-								}
+
+                                    IBusinessService customer = await businessServiceFactory.CreateBusinessService(session.CustomerId);
+                                    var feedto = await mainDbService.GetTransaction(_request.transactionId);
+
+                                    NotifyTransactionCompletedResult response = await customer.NotifyTransactionCompleted(feedto, null);
+                                    if (response != null && response.Success)
+                                    {
+                                        await mainDbService.ReportStopTx(_request.transactionId, response);
+                                    }
+                                }
 
 								result.Message = confirm;
 								result.Success = true;

+ 1 - 1
EVCB_OCPP.WSServer/Service/BusinessService/BusinessServiceFactory.cs

@@ -20,7 +20,7 @@ public interface IBusinessService
 
     Task NotifyConnectorUnplugged(string chargeBoxId, string data);
 
-    ValueTask<NotifyTransactionCompletedResult> NotifyTransactionCompleted(TransactionRecord tx, Dictionary<string, decimal> roundedPeriodEnergy);
+    ValueTask<NotifyTransactionCompletedResult> NotifyTransactionCompleted(TransactionRecord tx, Dictionary<string, decimal> roundedPeriodEnergy = null);
 
 }
 

+ 1 - 1
EVCB_OCPP.WSServer/Service/BusinessService/LocalBusinessService.cs

@@ -91,7 +91,7 @@ namespace EVCB_OCPP.WSServer.Service.BusinessService
             await Task.Delay(10);
         }
 
-        public ValueTask<NotifyTransactionCompletedResult> NotifyTransactionCompleted(TransactionRecord tx, Dictionary<string, decimal> roundedPeriodEnergy)
+        public ValueTask<NotifyTransactionCompletedResult> NotifyTransactionCompleted(TransactionRecord tx, Dictionary<string, decimal> roundedPeriodEnergy = null)
         {
             return ValueTask.FromResult<NotifyTransactionCompletedResult>(null);
         }

+ 1 - 1
EVCB_OCPP.WSServer/Service/BusinessService/OuterBusinessService.cs

@@ -315,7 +315,7 @@ namespace EVCB_OCPP.WSServer.Service.BusinessService
             throw new NotImplementedException();
         }
 
-        public async ValueTask<NotifyTransactionCompletedResult> NotifyTransactionCompleted(TransactionRecord tx, Dictionary<string, decimal> roundedPeriodEnergy)
+        public async ValueTask<NotifyTransactionCompletedResult> NotifyTransactionCompleted(TransactionRecord tx, Dictionary<string, decimal> roundedPeriodEnergy = null)
         {
             if (signMaterial == null || !signMaterial.InstantStopTxReport)
             {