|
@@ -227,40 +227,53 @@ namespace EVCB_OCPP.TaskScheduler.Services
|
|
|
po.MaxDegreeOfParallelism = System.Environment.ProcessorCount;
|
|
|
Parallel.ForEach(reportlst, po, async (r) =>
|
|
|
{
|
|
|
- var request = new
|
|
|
+
|
|
|
+ if(!string.IsNullOrEmpty(r.Fee) && string.IsNullOrEmpty(r.Receipt))
|
|
|
{
|
|
|
- ChargeBoxId = r.ChargeBoxId,
|
|
|
- ConnectorId = r.ConnectorId,
|
|
|
- SessionId = r.Id,
|
|
|
- MeterStart = r.MeterStart,
|
|
|
- MeterStop = r.MeterStop,
|
|
|
- IdTag = r.StartIdTag,
|
|
|
- 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()),
|
|
|
- Receipt = r.Receipt,
|
|
|
- TotalCost = r.Cost,
|
|
|
- Fee = r.Fee
|
|
|
+ //如果有計費但還沒結算 不回報給客戶
|
|
|
+ completecounter++;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var request = new
|
|
|
+ {
|
|
|
+ ChargeBoxId = r.ChargeBoxId,
|
|
|
+ ConnectorId = r.ConnectorId,
|
|
|
+ SessionId = r.Id,
|
|
|
+ MeterStart = r.MeterStart,
|
|
|
+ MeterStop = r.MeterStop,
|
|
|
+ IdTag = r.StartIdTag,
|
|
|
+ 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()),
|
|
|
+ Receipt = r.Receipt,
|
|
|
+ TotalCost = r.Cost,
|
|
|
+ Fee = r.Fee
|
|
|
+
|
|
|
+ };
|
|
|
|
|
|
- };
|
|
|
|
|
|
- var response = await httpClient.Post(_partnerAPIRoot + "completed_session", new Dictionary<string, string>()
|
|
|
+
|
|
|
+ var response = await httpClient.Post(_partnerAPIRoot + "completed_session", new Dictionary<string, string>()
|
|
|
{
|
|
|
{ "PartnerId",customerId.ToString()}
|
|
|
|
|
|
}, JsonConvert.SerializeObject(request, DefaultSetting.JSONSERIALIZER_FORMAT), _saltkey);
|
|
|
|
|
|
|
|
|
- lock (responseLock)
|
|
|
- {
|
|
|
- sendBack.Add(r.Id, new TransactionResponse()
|
|
|
+ lock (responseLock)
|
|
|
{
|
|
|
- StopTransactionReportedOn = DateTime.Now,
|
|
|
- ErrorMsg = response.Success ? null :
|
|
|
- (response.Exception == null ? response.Response : response.Exception.ToString())
|
|
|
- });
|
|
|
- completecounter++;
|
|
|
+ sendBack.Add(r.Id, new TransactionResponse()
|
|
|
+ {
|
|
|
+ StopTransactionReportedOn = DateTime.Now,
|
|
|
+ ErrorMsg = response.Success ? null :
|
|
|
+ (response.Exception == null ? response.Response : response.Exception.ToString())
|
|
|
+ });
|
|
|
+ completecounter++;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
|
|
|
});
|
|
|
|