|
@@ -152,6 +152,8 @@ namespace EVCB_OCPP.WEBAPI.Services.Integration
|
|
|
for (int i = 1; i <= _machine.GunAmt; i++)
|
|
|
{
|
|
|
var _RefConnector = _Connectors.Where(x => x.ConnectorId == i).FirstOrDefault();
|
|
|
+ if (_RefConnector == null) continue;
|
|
|
+
|
|
|
cp.Connectors.Add(new Connector()
|
|
|
{
|
|
|
ConnectorId = _RefConnector == null ? i : _RefConnector.ConnectorId,
|
|
@@ -388,14 +390,29 @@ namespace EVCB_OCPP.WEBAPI.Services.Integration
|
|
|
parameters.Add("@TransactionId", transactionDatas[j].Id, DbType.String, ParameterDirection.Input);
|
|
|
parameters.Add("@MeasurandId", requiredMeasurands[i], DbType.String, ParameterDirection.Input);
|
|
|
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
- using (SqlConnection conn = new SqlConnection(meterConnectionString))
|
|
|
+ int retry = 0;
|
|
|
+ string date = DateTime.UtcNow.ToString("yyMMdd");
|
|
|
+
|
|
|
+ while (retry < 2)
|
|
|
{
|
|
|
- string date = transactionDatas[j].StartTime.ToString("yyMMdd");
|
|
|
- string strSql = "Select Top(1) * from [dbo].[ConnectorMeterValueRecord" + date + "] where ChargeBoxId=@ChargeBoxId and TransactionId=@TransactionId and MeasurandId=@MeasurandId order by CreatedOn desc;";
|
|
|
- meterModel = conn.Query<ConnectorMeterValueModel>(strSql, parameters, null, true, EVCBConfiguration.DB_DefaultConnectionTimeout).FirstOrDefault();
|
|
|
+ retry++;
|
|
|
+ using (SqlConnection conn = new SqlConnection(meterConnectionString))
|
|
|
+ {
|
|
|
+ string strSql = "Select Top(1) * from [dbo].[ConnectorMeterValueRecord" + date + "] where ChargeBoxId=@ChargeBoxId and TransactionId=@TransactionId and MeasurandId=@MeasurandId order by CreatedOn desc;";
|
|
|
+ meterModel = conn.Query<ConnectorMeterValueModel>(strSql, parameters, null, true, EVCBConfiguration.DB_DefaultConnectionTimeout).FirstOrDefault();
|
|
|
+ if (meterModel == null)
|
|
|
+ {
|
|
|
+ date = transactionDatas[j].StartTime.ToString("yyMMdd");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retry = 2;
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (meterModel != null)
|