|
@@ -215,8 +215,9 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
.Select(x => x.ConfigureSetting).FirstOrDefault();
|
|
|
|
|
|
if (configVaule != null)
|
|
|
- {
|
|
|
+ {
|
|
|
int.TryParse(configVaule, out heartbeat_interval);
|
|
|
+ heartbeat_interval = heartbeat_interval == 0 ? GlobalConfig.GetHEARTBEAT_INTERVAL() : heartbeat_interval;
|
|
|
}
|
|
|
}
|
|
|
if (session.IsPending == true)
|
|
@@ -612,11 +613,11 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
{
|
|
|
var transaction = db.TransactionRecord.Where(x => x.Id == stopRequest.transactionId
|
|
|
&& x.ChargeBoxId == session.ChargeBoxId).FirstOrDefault();
|
|
|
-
|
|
|
+
|
|
|
var businessService = BusinessServiceFactory.CreateBusinessService(session.CustomerId.ToString());
|
|
|
idTagInfo = string.IsNullOrEmpty(stopRequest.idTag) ? null : (stopRequest.idTag == "Backend" ?
|
|
|
new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted } : (await businessService.Authorize(session.ChargeBoxId, stopRequest.idTag, transaction.ConnectorId)).IdTagInfo);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#region PnC 邏輯
|
|
|
if (!string.IsNullOrEmpty(stopRequest.idTag))
|
|
@@ -691,8 +692,20 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
transaction.Receipt = string.Empty;
|
|
|
transaction.Cost = session.IsBilling ? -1 : 0;
|
|
|
|
|
|
- if (stopRequest.transactionData != null && stopRequest.transactionData.Count > 0)
|
|
|
+ if (stopRequest.transactionData == null || stopRequest.transactionData.Count == 0)
|
|
|
+ {
|
|
|
+ stopRequest.transactionData = new List<MeterValue>()
|
|
|
+ {
|
|
|
+ new MeterValue() { timestamp= stopRequest.timestamp, sampledValue=new List<SampledValue>()}
|
|
|
+ };
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (stopRequest.transactionData != null && stopRequest.transactionData.Count >= 0)
|
|
|
{
|
|
|
+ //清除 StopTransaction TransactionData
|
|
|
+ stopRequest.transactionData[0].sampledValue.Clear();
|
|
|
+
|
|
|
stopRequest.transactionData[0].sampledValue.Add(new SampledValue()
|
|
|
{
|
|
|
context = ReadingContext.Transaction_End,
|
|
@@ -703,6 +716,8 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
measurand = Measurand.TotalEnergy,
|
|
|
value = decimal.Subtract(transaction.MeterStop, transaction.MeterStart).ToString()
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
await db.SaveChangesAsync();
|
|
@@ -747,7 +762,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
if (stopRequest.transactionData != null)
|
|
|
{
|
|
|
if (stopRequest.transactionData.Count > 0)
|
|
|
- {
|
|
|
+ {
|
|
|
using (var _meterDb = new MeterValueDBContext())
|
|
|
{
|
|
|
foreach (var item in stopRequest.transactionData)
|