Explorar o código

1.停止充電 條件除了充電中加入SuspendEV SuspendEVSE
2.白名單對外開放Full更新
3. 充電槍狀態 修正 Reserved & Unavailable 對應字串有問題

Jessica Tseng %!s(int64=2) %!d(string=hai) anos
pai
achega
eadecfa06e

+ 2 - 1
EVCB_OCPP.WEBAPI/Controllers/Version1/CPOController.cs

@@ -180,7 +180,8 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
                     var _request = new Models.WebAPI.StartTransactionRequest()
                     {
                         ConnectorId = request.ConnectorId,
-                        IdTag = request.Token
+                        IdTag = request.Token                     
+                       
                     };
 
                     string[] parts = Request.RequestUri.ToString().Split('/');

+ 19 - 11
EVCB_OCPP.WEBAPI/Controllers/Version1/InternalController.cs

@@ -83,7 +83,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPut]
-        public HttpResponseMessage Availability(string ChargeBoxId, [FromBody]AvailiabilityRequest Availiability)
+        public HttpResponseMessage Availability(string ChargeBoxId, [FromBody] AvailiabilityRequest Availiability)
         {
             string uuid = Guid.NewGuid().ToString();
             var result = new InternalGenericResponse();
@@ -146,7 +146,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPut]
-        public HttpResponseMessage ChargeBoxConfiguration(string ChargeBoxId, [FromBody]SingleConfigurationRequest SingleConfiguration)
+        public HttpResponseMessage ChargeBoxConfiguration(string ChargeBoxId, [FromBody] SingleConfigurationRequest SingleConfiguration)
         {
             string uuid = Guid.NewGuid().ToString();
             var result = new InternalGenericResponse();
@@ -376,7 +376,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPost]
-        public HttpResponseMessage StartTransaction(string ChargeBoxId, [FromBody]StartTransactionRequest StartTransaction)
+        public HttpResponseMessage StartTransaction(string ChargeBoxId, [FromBody] StartTransactionRequest StartTransaction)
         {
             string uuid = Guid.NewGuid().ToString();
             var result = new InternalGenericResponse();
@@ -394,7 +394,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
                 //check parameter
 
 
-                if (StartTransaction == null 
+                if (StartTransaction == null
                     || (StartTransaction.ConnectorId.HasValue && (chargePointService.GetNumberofConnectors(ChargeBoxId) < StartTransaction.ConnectorId || StartTransaction.ConnectorId < 0)) || string.IsNullOrEmpty(StartTransaction.IdTag) || StartTransaction.IdTag.Length > 20)
                 {
                     return Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse() { Code = 2100, Message = EVCBConfiguration.ERROR_MSG_PARAMETER_OUTOFRANGE_INCORRECT });
@@ -429,11 +429,11 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
                 }
 
 
-                ChargePointStatus? currentStatus = StartTransaction.ConnectorId.HasValue?chargePointService.GetChargePointCurrentSatus(ChargeBoxId, StartTransaction.ConnectorId.Value).Value: (ChargePointStatus?)null;
+                ChargePointStatus? currentStatus = StartTransaction.ConnectorId.HasValue ? chargePointService.GetChargePointCurrentSatus(ChargeBoxId, StartTransaction.ConnectorId.Value).Value : (ChargePointStatus?)null;
+
 
-               
                 if (StartTransaction.ConnectorId.HasValue && chargePointService.GetChargePointCurrentSatus(ChargeBoxId, StartTransaction.ConnectorId.Value).HasValue &&
-                    (currentStatus != ChargePointStatus.Available && currentStatus != ChargePointStatus.Reserved && currentStatus != ChargePointStatus.Preparing ))
+                    (currentStatus != ChargePointStatus.Available && currentStatus != ChargePointStatus.Reserved && currentStatus != ChargePointStatus.Preparing))
                 {
                     return Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse() { Code = 2103, Message = EVCBConfiguration.ERROR_MSG_CONNECTOR_ISNOT_AVAILIABLE_MODE });
                 }
@@ -441,6 +441,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
                 {
                     var _request = new RemoteStartTransactionRequest()
                     {
+
                         connectorId = StartTransaction.ConnectorId,
                         idTag = StartTransaction.IdTag,
                         chargingProfile = StartTransaction.ChargingProfile == null ? null :
@@ -520,7 +521,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
 
                 var _ConnectorStatus = chargePointService.GetChargePointCurrentSatus(ChargeBoxId, _ConnectorId);
 
-                if (!(_ConnectorStatus.HasValue && _ConnectorStatus == ChargePointStatus.Charging))
+                if (!(_ConnectorStatus.HasValue && _ConnectorStatus == ChargePointStatus.Charging || _ConnectorStatus == ChargePointStatus.SuspendedEVSE || _ConnectorStatus == ChargePointStatus.SuspendedEV))
                 {
 
                     return Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse() { Code = 2105, Message = EVCBConfiguration.ERROR_MSG_CONNECTOR_ISNOT_CHARGING_MODE });
@@ -781,7 +782,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPost]
-        public HttpResponseMessage SendLocalList(string ChargeBoxId, [FromBody]LocalListRequest LocalList)
+        public HttpResponseMessage SendLocalList(string ChargeBoxId, [FromBody] LocalListRequest LocalList)
         {
             string uuid = Guid.NewGuid().ToString();
             var result = new InternalGenericResponse();
@@ -795,6 +796,13 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
 
                     return Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse() { Code = 2101, Message = EVCBConfiguration.ERROR_MSG_CHARGEBOXID_ISNT_EXIST_OR_OFFLINE });
                 }
+                if (LocalList != null && !LocalList.UpdateType.HasValue)
+                {
+                    if (!LocalList.UpdateType.HasValue)
+                    {
+                        LocalList.UpdateType = 2;
+                    }
+                }
 
                 //check parameter
                 if (LocalList == null ||
@@ -867,7 +875,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPost]
-        public HttpResponseMessage SendDataTransfer(string ChargeBoxId, string VenderId, [FromBody]string Data, string MessageId = "")
+        public HttpResponseMessage SendDataTransfer(string ChargeBoxId, string VenderId, [FromBody] string Data, string MessageId = "")
         {
             string uuid = Guid.NewGuid().ToString();
             var result = new InternalGenericResponse();
@@ -975,7 +983,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPost]
-        public HttpResponseMessage SetChargingProfile(string ChargeBoxId, [FromBody]ChargingProfileRequest ChargingProfile)
+        public HttpResponseMessage SetChargingProfile(string ChargeBoxId, [FromBody] ChargingProfileRequest ChargingProfile)
         {
 
 

+ 2 - 2
EVCB_OCPP.WEBAPI/Models/WebAPI/LocalListRequest.cs

@@ -18,8 +18,8 @@ namespace EVCB_OCPP.WEBAPI.Models.WebAPI
         [Required]
         public List<OCPPAuthorizationData> LocalAuthorizationList { set; get; }
 
-        [Required]
-        public int UpdateType { set; get; }
+        
+        public int? UpdateType { set; get; }
 
     }
 

+ 1 - 1
EVCB_OCPP.WEBAPI/Properties/AssemblyInfo.cs

@@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
 // 指定為預設值:
 [assembly: AssemblyVersion("0.1.0.0")]
 [assembly: AssemblyFileVersion("0.1.0.0")]
-[assembly: AssemblyInformationalVersion("93d91fb")]
+[assembly: AssemblyInformationalVersion("306104d")]

+ 2 - 2
EVCB_OCPP.WEBAPI/Services/ChargePointService.cs

@@ -529,12 +529,12 @@ namespace EVCB_OCPP.WEBAPI.Services
                         result = Status.Finishing;
                     }
                     break;
-                case 7://Unavailable
+                case 8://Unavailable
                     {
                         result = Status.Unavailable;
                     }
                     break;
-                case 8://Reserved
+                case 7://Reserved
                     {
                         result = Status.Reserved;
                     }