|
@@ -150,17 +150,11 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
|
|
|
_dbService.ReportStartTx(sendBack);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Console.WriteLine("Assigned_StartTransactionCallbackTask Exception: " + ex.GetBaseException().ToString());
|
|
|
+ logger.Error("Assigned_StartTransactionCallbackTask Exception: " + ex.GetBaseException().ToString());
|
|
|
}
|
|
|
|
|
|
ChargeRecordCallCounter++;
|
|
@@ -170,8 +164,8 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
}
|
|
|
|
|
|
async public Task ReportStopTransaction()
|
|
|
- {
|
|
|
-
|
|
|
+ {
|
|
|
+
|
|
|
var items = _dbService.GetNeedReportSession(customerId, false, 1000);
|
|
|
|
|
|
Stopwatch watch = new Stopwatch();
|
|
@@ -200,12 +194,17 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
}
|
|
|
while (ChargeRecordCallCounter != groupTasks.Count)
|
|
|
{
|
|
|
+ if (watch.ElapsedMilliseconds / 1000 > 300)
|
|
|
+ {
|
|
|
+ logger.Error(customerId + " ReportStopTransaction Lock "+ ChargeRecordCallCounter+" "+ groupTasks.Count);
|
|
|
+ break;
|
|
|
+ }
|
|
|
await Task.Delay(10);
|
|
|
}
|
|
|
|
|
|
watch.Stop();
|
|
|
|
|
|
- Console.WriteLine("ReportStopTransaction Task(" + items.Count() + ") : It takes " + watch.ElapsedMilliseconds / 1000 + " Seconds");
|
|
|
+ logger.Debug("ReportStopTransaction Task(" + items.Count() + ") : It takes " + watch.ElapsedMilliseconds / 1000 + " Seconds");
|
|
|
|
|
|
}
|
|
|
|
|
@@ -228,11 +227,11 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
Parallel.ForEach(reportlst, po, async (r) =>
|
|
|
{
|
|
|
|
|
|
- if(!string.IsNullOrEmpty(r.Fee) && string.IsNullOrEmpty(r.Receipt))
|
|
|
+ if (!string.IsNullOrEmpty(r.Fee) && string.IsNullOrEmpty(r.Receipt))
|
|
|
{
|
|
|
//如果有計費但還沒結算 不回報給客戶
|
|
|
completecounter++;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -247,6 +246,7 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
StartTime = r.StartTime.ToString(DefaultSetting.UTC_DATETIMEFORMAT),
|
|
|
StopTime = r.StopTime.ToString(DefaultSetting.UTC_DATETIMEFORMAT),
|
|
|
StopReason = r.StopReasonId < 1 ? "Unknown" : (r.StopReasonId > 12 ? "Unknown" : ((Reason)r.StopReasonId).ToString()),
|
|
|
+ ReservationId=r.ReservationId,
|
|
|
Receipt = r.Receipt,
|
|
|
TotalCost = r.Cost,
|
|
|
Fee = r.Fee
|
|
@@ -273,13 +273,14 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
completecounter++;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
});
|
|
|
|
|
|
while (completecounter != reportlst.Count)
|
|
|
{
|
|
|
- await Task.Delay(10);
|
|
|
+ logger.Debug(completecounter + " " + reportlst.Count);
|
|
|
+ await Task.Delay(10000);
|
|
|
}
|
|
|
|
|
|
_dbService.ReportStopTx(sendBack);
|
|
@@ -294,7 +295,7 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Console.WriteLine("Assigned_StartTransactionCallbackTask Exception: " + ex.GetBaseException().ToString());
|
|
|
+ logger.Error("Assigned_StartTransactionCallbackTask Exception: " + ex.GetBaseException().ToString());
|
|
|
}
|
|
|
|
|
|
ChargeRecordCallCounter++;
|
|
@@ -420,7 +421,7 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- Console.WriteLine("Assigned_ReportExecutionofRemoteCommandTask Exception: " + ex.GetBaseException().ToString());
|
|
|
+ logger.Debug("Assigned_ReportExecutionofRemoteCommandTask Exception: " + ex.GetBaseException().ToString());
|
|
|
}
|
|
|
|
|
|
ChargeRecordCallCounter++;
|