|
@@ -8,6 +8,7 @@ using EVCB_OCPP.Packet.Messages.SubTypes;
|
|
|
using EVCB_OCPP.WSServer.Dto;
|
|
|
using EVCB_OCPP.WSServer.Service;
|
|
|
using Newtonsoft.Json;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
using NLog;
|
|
|
using OCPPPackage.Profiles;
|
|
|
using OCPPServer.Protocol;
|
|
@@ -102,7 +103,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
TotalCost = creditDeductResult.amount,
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
var response = await httpClient.Post(GlobalConfig.TCC_API_URL + "prepare_issue_invoice", new Dictionary<string, string>()
|
|
|
{
|
|
|
{ "PartnerId",session.CustomerId.ToString()}
|
|
@@ -441,7 +442,36 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
int _transactionId = -1;
|
|
|
|
|
|
var businessService = BusinessServiceFactory.CreateBusinessService(session.CustomerId.ToString());
|
|
|
- var _idTagInfo = _request.idTag == "Backend" ? new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted } : await businessService.Authorize(session.ChargeBoxId, _request.idTag);
|
|
|
+
|
|
|
+ var _idTagInfo = new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted };
|
|
|
+ if (_request.idTag != "Backend")
|
|
|
+ {
|
|
|
+ var authorization_result = await businessService.Authorize(session.ChargeBoxId, _request.idTag);
|
|
|
+ _idTagInfo = authorization_result.IdTagInfo;
|
|
|
+
|
|
|
+ if (authorization_result.ChargePointFee != null)
|
|
|
+ {
|
|
|
+ var price = authorization_result.ChargePointFee.Where(x => x.IsAC == session.IsAC).First();
|
|
|
+ if (price != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (session.UserPrices.ContainsKey(_request.idTag))
|
|
|
+ {
|
|
|
+ session.UserPrices[_request.idTag] = price.PerkWhFee.HasValue ? JsonConvert.SerializeObject(new List<ChargingPrice>() { new ChargingPrice() { StartTime = "00:00", EndTime = "23:59", Fee = price.PerkWhFee.Value } }) : price.PerHourFee.Value.ToString();
|
|
|
+ session.UserPrices[_request.idTag] += "|+" + authorization_result.AccountBalance + "+" + "&" + price.ParkingFee + "&|" + price.Currency;
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ session.UserPrices.Add(_request.idTag, price.PerkWhFee.HasValue ? JsonConvert.SerializeObject(new List<ChargingPrice>() { new ChargingPrice() { StartTime = "00:00", EndTime = "23:59", Fee = price.PerkWhFee.Value } }) : price.PerHourFee.Value.ToString());
|
|
|
+ session.UserPrices[_request.idTag] += "|+" + authorization_result.AccountBalance + "+" + "&" + price.ParkingFee + "&|" + price.Currency;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
|
|
|
if (session.CustomerId.ToString().ToUpper() == "8456AED9-6DD9-4BF3-A94C-9F5DCB9506F7" && _idTagInfo.status == AuthorizationStatus.ConcurrentTx)
|
|
|
{
|
|
@@ -482,11 +512,20 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
MeterStart = _request.meterStart,
|
|
|
CustomerId = _CustomerId,
|
|
|
StartTime = _request.timestamp.ToUniversalTime(),
|
|
|
- ReservationId = _request.reservationId.HasValue ? _request.reservationId.Value : 0,
|
|
|
+ ReservationId = _request.reservationId.HasValue ? _request.reservationId.Value : 0,
|
|
|
};
|
|
|
|
|
|
- _newTransaction.Fee = !session.IsBilling ? string.Empty : session.BillingMethod == 1 ? JsonConvert.SerializeObject(session.ChargingPrices) : session.ChargingFeebyHour.ToString();
|
|
|
- _newTransaction.Fee += !session.IsBilling ? string.Empty :"|+" + accountBalance + "+" + "&" + session.ParkingFee + "&|" + session.Currency;
|
|
|
+ if (session.UserPrices.ContainsKey(_request.idTag))
|
|
|
+ {
|
|
|
+ _newTransaction.Fee = !session.IsBilling ? string.Empty : session.UserPrices[_request.idTag];
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _newTransaction.Fee = !session.IsBilling ? string.Empty : session.BillingMethod == 1 ? JsonConvert.SerializeObject(session.ChargingPrices) : session.ChargingFeebyHour.ToString();
|
|
|
+ _newTransaction.Fee += !session.IsBilling ? string.Empty : "|+" + accountBalance + "+" + "&" + session.ParkingFee + "&|" + session.Currency;
|
|
|
+ }
|
|
|
+
|
|
|
db.TransactionRecord.Add(_newTransaction);
|
|
|
|
|
|
db.SaveChanges();
|
|
@@ -523,16 +562,15 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
var businessService = BusinessServiceFactory.CreateBusinessService(session.CustomerId.ToString());
|
|
|
|
|
|
- //特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
|
|
|
- var _idTagInfo = string.IsNullOrEmpty(_request.idTag) ? null : (_request.idTag == "Backend" ? new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted } : await businessService.Authorize(session.ChargeBoxId, _request.idTag));
|
|
|
+ var _idTagInfo = string.IsNullOrEmpty(_request.idTag) ? null : (_request.idTag == "Backend" ?
|
|
|
+ new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted } : (await businessService.Authorize(session.ChargeBoxId, _request.idTag)).IdTagInfo);
|
|
|
|
|
|
+ //特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
|
|
|
if (session.CustomerId.ToString().ToUpper() == "8456AED9-6DD9-4BF3-A94C-9F5DCB9506F7" && _idTagInfo != null && _idTagInfo.status == AuthorizationStatus.ConcurrentTx)
|
|
|
{
|
|
|
_idTagInfo = new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted };
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
using (var db = new MainDBContext())
|
|
|
{
|
|
|
var transaction = db.TransactionRecord.Where(x => x.Id == _request.transactionId
|
|
@@ -562,6 +600,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
transaction.MeterStop = _request.meterStop;
|
|
|
transaction.StopTime = _request.timestamp.ToUniversalTime();
|
|
|
transaction.StopReasonId = _request.reason.HasValue ? (int)_request.reason.Value : 0;
|
|
|
+ transaction.StopReason = _request.reason.HasValue ? _request.reason.Value.ToString() : Reason.Local.ToString();
|
|
|
transaction.StopIdTag = _request.idTag;
|
|
|
transaction.Receipt = string.Empty;
|
|
|
transaction.Cost = session.IsBilling ? -1 : 0;
|
|
@@ -610,6 +649,8 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #region Save MeterValue
|
|
|
+
|
|
|
if (_request.transactionData != null)
|
|
|
{
|
|
|
if (_request.transactionData.Count > 0)
|
|
@@ -650,6 +691,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
|
|
|
}
|
|
|
break;
|
|
@@ -657,14 +699,48 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
{
|
|
|
AuthorizeRequest _request = request as AuthorizeRequest;
|
|
|
|
|
|
-
|
|
|
- //特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
|
|
|
var businessService = BusinessServiceFactory.CreateBusinessService(session.CustomerId.ToString());
|
|
|
var confirm = new AuthorizeConfirmation()
|
|
|
{
|
|
|
- idTagInfo = _request.idTag == "Backend" ? new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted } : await businessService.Authorize(session.ChargeBoxId, _request.idTag)
|
|
|
+ idTagInfo = new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted }
|
|
|
};
|
|
|
+ if (_request.idTag != "Backend")
|
|
|
+ {
|
|
|
+ var authorization_result = await businessService.Authorize(session.ChargeBoxId, _request.idTag);
|
|
|
+ confirm.idTagInfo = authorization_result.IdTagInfo;
|
|
|
+
|
|
|
+ if(authorization_result.ChargePointFee!=null)
|
|
|
+ {
|
|
|
+ var price = authorization_result.ChargePointFee.Where(x => x.IsAC == session.IsAC).First();
|
|
|
+ if (price != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (session.UserPrices.ContainsKey(_request.idTag))
|
|
|
+ {
|
|
|
+ session.UserPrices[_request.idTag] = price.PerkWhFee.HasValue ? JsonConvert.SerializeObject(new List<ChargingPrice>() { new ChargingPrice() { StartTime = "00:00", EndTime = "23:59", Fee = price.PerkWhFee.Value } }) : price.PerHourFee.Value.ToString();
|
|
|
+ session.UserPrices[_request.idTag] += "|+" + authorization_result.AccountBalance + "+" + "&" + price.ParkingFee + "&|" + price.Currency;
|
|
|
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ session.UserPrices.Add(_request.idTag, price.PerkWhFee.HasValue ? JsonConvert.SerializeObject(new List<ChargingPrice>() { new ChargingPrice() { StartTime = "00:00", EndTime = "23:59", Fee = price.PerkWhFee.Value } }) : price.PerHourFee.Value.ToString());
|
|
|
+ session.UserPrices[_request.idTag] += "|+" + authorization_result.AccountBalance + "+" + "&" + price.ParkingFee + "&|" + price.Currency;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (session.UserDisplayPrices.ContainsKey(_request.idTag))
|
|
|
+ {
|
|
|
+ session.UserDisplayPrices[_request.idTag] = price.DisplayMessage;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ session.UserDisplayPrices.Add(_request.idTag, price.DisplayMessage);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //特例****飛宏客戶旗下的電樁,若遇到Portal沒回應的狀況 ~允許充電
|
|
|
if (session.CustomerId.ToString().ToUpper() == "8456AED9-6DD9-4BF3-A94C-9F5DCB9506F7" && confirm.idTagInfo.status == AuthorizationStatus.ConcurrentTx)
|
|
|
{
|
|
|
confirm.idTagInfo = new IdTagInfo() { expiryDate = DateTime.UtcNow.AddDays(1), status = AuthorizationStatus.Accepted };
|
|
@@ -701,7 +777,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- internal MessageResult ExecuteCoreConfirm(Actions action, ClientData session, IConfirmation confirm, string requestId)
|
|
|
+ async internal Task<MessageResult> ExecuteCoreConfirm(Actions action, ClientData session, IConfirmation confirm, string requestId)
|
|
|
{
|
|
|
MessageResult result = new MessageResult() { Success = true };
|
|
|
|
|
@@ -724,7 +800,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = string.IsNullOrEmpty(_confirm.data) ? "" : _confirm.data;
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
if (_request.messageId == "ID_FirmwareVersion")
|
|
@@ -737,14 +813,15 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
db.Machine.Attach(machine);
|
|
|
machine.BoardVersions = _confirm.data;
|
|
|
db.Entry(machine).Property(x => x.BoardVersions).IsModified = true;
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (_request.messageId == "ID_TxEnergy")
|
|
|
+ if (_request.messageId == "ID_TxEnergy") //計費
|
|
|
{
|
|
|
if (_confirm.status == DataTransferStatus.Accepted)
|
|
|
{
|
|
|
+ decimal couponPoint = 0m;
|
|
|
string receipt = string.Empty;
|
|
|
List<ChargingBill> bill = new List<ChargingBill>();
|
|
|
List<ChargingPrice> chargingPrices = new List<ChargingPrice>();
|
|
@@ -828,7 +905,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
// 計算停車費
|
|
|
var parkingFee = decimal.Parse(feedto.Fee.Split('&')[1]);
|
|
|
- var stoptime = feedto.StopTime==GlobalConfig.DefaultNullTime ? DateTime.Parse(DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm")) : DateTime.Parse(feedto.StopTime.ToString("yyyy/MM/dd HH:mm"));
|
|
|
+ var stoptime = feedto.StopTime == GlobalConfig.DefaultNullTime ? DateTime.Parse(DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm")) : DateTime.Parse(feedto.StopTime.ToString("yyyy/MM/dd HH:mm"));
|
|
|
var starttime = DateTime.Parse(feedto.StartTime.ToString("yyyy/MM/dd HH:mm"));
|
|
|
var totalHours = stoptime.Subtract(starttime).TotalHours;
|
|
|
var parkingCost = Decimal.Multiply((decimal)totalHours, parkingFee);
|
|
@@ -836,6 +913,8 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
if (feedto.StopTime != GlobalConfig.DefaultNullTime)
|
|
|
{
|
|
|
+ var customerInfo = db.Customer.Where(x => x.Id == session.CustomerId).Select(x => new { x.InstantStopTxReport, x.ApiUrl, x.ApiKey }).FirstOrDefault();
|
|
|
+
|
|
|
decimal accountBalance = 0;
|
|
|
decimal.TryParse(feedto.Fee.Split('+')[1], out accountBalance);
|
|
|
|
|
@@ -845,7 +924,10 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
Console.WriteLine("Tx is empty");
|
|
|
return result;
|
|
|
}
|
|
|
- if (tx.UploadedtoTTIA) return result;
|
|
|
+
|
|
|
+ if (tx.BillingDone) return result;
|
|
|
+
|
|
|
+
|
|
|
var startTime = new DateTime(tx.StartTime.Year, tx.StartTime.Month, tx.StartTime.Day, tx.StartTime.Hour, 0, 0);
|
|
|
List<ChargingBill> confirmbill = new List<ChargingBill>();
|
|
|
receipt = string.Format("({0} )Energy:", chargedEnergy);
|
|
@@ -919,14 +1001,57 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
tx.Cost = chargingCost + parkingCost;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ if (customerInfo != null && customerInfo.InstantStopTxReport)
|
|
|
+ {
|
|
|
+
|
|
|
+ var request = new
|
|
|
+ {
|
|
|
+ ChargeBoxId = tx.ChargeBoxId,
|
|
|
+ ConnectorId = tx.ConnectorId,
|
|
|
+ SessionId = tx.Id,
|
|
|
+ MeterStart = tx.MeterStart,
|
|
|
+ MeterStop = tx.MeterStop,
|
|
|
+ IdTag = tx.StartIdTag,
|
|
|
+ StartTime = tx.StartTime.ToString(GlobalConfig.UTC_DATETIMEFORMAT),
|
|
|
+ StopTime = tx.StopTime.ToString(GlobalConfig.UTC_DATETIMEFORMAT),
|
|
|
+ StopReason = tx.StopReasonId < 1 ? "Unknown" : (tx.StopReasonId > 12 ? "Unknown" : ((Reason)tx.StopReasonId).ToString()),
|
|
|
+ Receipt = tx.Receipt,
|
|
|
+ TotalCost = tx.Cost,
|
|
|
+ Fee = tx.Fee
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ var response = await httpClient.Post(customerInfo.ApiUrl + "completed_session", new Dictionary<string, string>()
|
|
|
+ {
|
|
|
+ { "PartnerId",session.CustomerId.ToString()}
|
|
|
+
|
|
|
+ }, request, customerInfo.ApiKey);
|
|
|
+
|
|
|
+ var _httpResult = JsonConvert.DeserializeObject<CPOOuterResponse>(response.Response);
|
|
|
+ JObject jo = JObject.Parse(_httpResult.Data);
|
|
|
+ if (jo.ContainsKey("CouponPoint"))
|
|
|
+ {
|
|
|
+ couponPoint = jo["CouponPoint"].Value<Decimal>();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (jo.ContainsKey("FarewellMessage"))
|
|
|
+ {
|
|
|
+ string _Message = jo["FarewellMessage"].Value<string>();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
tx.Receipt = receipt;
|
|
|
- tx.UploadedtoTTIA = true;
|
|
|
+ tx.BillingDone = true;
|
|
|
db.Configuration.AutoDetectChangesEnabled = false;
|
|
|
db.Configuration.ValidateOnSaveEnabled = false;
|
|
|
db.TransactionRecord.Attach(tx);
|
|
|
db.Entry(tx).Property(x => x.Cost).IsModified = true;
|
|
|
db.Entry(tx).Property(x => x.Receipt).IsModified = true;
|
|
|
- db.Entry(tx).Property(x => x.UploadedtoTTIA).IsModified = true;
|
|
|
+ db.Entry(tx).Property(x => x.BillingDone).IsModified = true;
|
|
|
|
|
|
db.ServerMessage.Add(new ServerMessage()
|
|
|
{
|
|
@@ -949,7 +1074,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
parkTime = (int)stoptime.Subtract(starttime).TotalSeconds,
|
|
|
parkingFee = parkingCost,
|
|
|
currency = currency,
|
|
|
- couponPoint = 0,
|
|
|
+ couponPoint = couponPoint,
|
|
|
accountBalance = accountBalance - tx.Cost
|
|
|
})
|
|
|
})
|
|
@@ -961,7 +1086,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
}); ;
|
|
|
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
|
|
|
using (var meterdb = new MeterValueDBContext())
|
|
|
{
|
|
@@ -993,10 +1118,11 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
parameters.Add("@IdTag", tx.StartIdTag, DbType.String, ParameterDirection.Input);
|
|
|
parameters.Add("@parentIdTag", accountBalance - tx.Cost, DbType.String, ParameterDirection.Input);
|
|
|
string strSql = "update [dbo].[LocalListDetail] set parentIdTag =@parentIdTag where ListId = 27 and IdTag=@IdTag; ";
|
|
|
- conn.Execute(strSql, parameters);
|
|
|
+ await conn.ExecuteAsync(strSql, parameters);
|
|
|
|
|
|
}
|
|
|
|
|
|
+ #region 提供給PHA 過CDFA認證 使用
|
|
|
if (tx.CustomerId == Guid.Parse("10C7F5BD-C89A-4E2A-8611-B617E0B41A73"))
|
|
|
{
|
|
|
var mail_response = new OuterHttpClient().PostFormDataAsync("http://ocpp.phihong.com.tw/CDFA/" + tx.Id, new Dictionary<string, string>()
|
|
@@ -1009,6 +1135,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
Console.WriteLine(JsonConvert.SerializeObject(mail_response));
|
|
|
|
|
|
}
|
|
|
+ #endregion
|
|
|
|
|
|
}
|
|
|
else
|
|
@@ -1045,7 +1172,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
}); ;
|
|
|
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
|
|
|
using (var meterdb = new MeterValueDBContext())
|
|
|
{
|
|
@@ -1076,8 +1203,9 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+ #region 台泥
|
|
|
if (_request.messageId == "ID_GetTxUserInfo")
|
|
|
{
|
|
|
var txUserInfo = JsonConvert.DeserializeObject<ID_GetTxUserInfo>(_confirm.data);
|
|
@@ -1103,6 +1231,8 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -1121,7 +1251,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = _confirm.status.ToString();
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1143,7 +1273,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = _confirm.status.ToString();
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1164,7 +1294,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = _confirm.status.ToString();
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1185,7 +1315,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = _confirm.status.ToString();
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1206,7 +1336,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = _confirm.status.ToString();
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1252,7 +1382,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1334,8 +1464,6 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
var operation = db.MachineOperateRecord.Where(x => x.SerialNo == requestId &&
|
|
|
x.ChargeBoxId == session.ChargeBoxId && x.Status == 0).FirstOrDefault();
|
|
|
|
|
@@ -1348,7 +1476,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
|
|
|
}
|
|
|
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -1374,7 +1502,7 @@ namespace EVCB_OCPP.WSServer.Message
|
|
|
operation.Status = 1;//電樁有回覆
|
|
|
operation.EVSE_Status = (int)_confirm.status;
|
|
|
operation.EVSE_Value = _confirm.status.ToString();
|
|
|
- db.SaveChanges();
|
|
|
+ await db.SaveChangesAsync();
|
|
|
}
|
|
|
|
|
|
}
|