Преглед на файлове

Fix SetChargingProfile
a.拿掉設定RecurrencyKind 判斷
b.TransactionId => SessionId

Jessica Tseng преди 2 години
родител
ревизия
faa6726df2

+ 2 - 4
EVCB_OCPP.WEBAPI/Controllers/Version1/InternalController.cs

@@ -1002,9 +1002,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
                 //check parameter
                 if (ChargingProfile == null ||
                     ChargingProfile.connectorId < 0 ||
-                  !(ChargingProfile.ChargingProfile != null && IsValidEnum<ChargingProfileKindType>((int)ChargingProfile.ChargingProfile.chargingProfileKind)) ||
-                  !(ChargingProfile.ChargingProfile != null && ChargingProfile.ChargingProfile.recurrencyKind.HasValue && IsValidEnum<RecurrencyKindType>((int)ChargingProfile.ChargingProfile.recurrencyKind)) ||
-                  !(ChargingProfile.ChargingProfile != null && ChargingProfile.ChargingProfile.recurrencyKind.HasValue && IsValidEnum<RecurrencyKindType>((int)ChargingProfile.ChargingProfile.recurrencyKind)) ||
+                  !(ChargingProfile.ChargingProfile != null && IsValidEnum<ChargingProfileKindType>((int)ChargingProfile.ChargingProfile.chargingProfileKind)) ||                
                   !(ChargingProfile.ChargingProfile != null && IsValidEnum<ChargingProfilePurposeType>((int)ChargingProfile.ChargingProfile.chargingProfilePurpose)) ||
                   !(ChargingProfile.ChargingProfile != null && ChargingProfile.ChargingProfile.chargingSchedule != null && IsValidEnum<ChargingRateUnitType>((int)ChargingProfile.ChargingProfile.chargingSchedule.chargingRateUnit)))
                 {
@@ -1026,7 +1024,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version1
                         chargingProfilePurpose = ChargingProfile.ChargingProfile.chargingProfilePurpose,
                         recurrencyKind = ChargingProfile.ChargingProfile.recurrencyKind,
                         stackLevel = ChargingProfile.ChargingProfile.stackLevel,
-                        transactionId = ChargingProfile.ChargingProfile.TransactionId,
+                        transactionId = ChargingProfile.ChargingProfile.SessionId,
                         validFrom = ChargingProfile.ChargingProfile.validFrom == null ? (DateTime?)null : DateTime.SpecifyKind(ChargingProfile.ChargingProfile.validFrom.Value, DateTimeKind.Utc),
                         validTo = ChargingProfile.ChargingProfile.validTo == null ? (DateTime?)null : DateTime.SpecifyKind(ChargingProfile.ChargingProfile.validTo.Value, DateTimeKind.Utc),
                         chargingSchedule = new ChargingSchedule()

+ 9 - 11
EVCB_OCPP.WEBAPI/Controllers/Version2/ocpp16/OCPP16_InternalController.cs

@@ -86,7 +86,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
         [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();
@@ -149,7 +149,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
         [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();
@@ -379,7 +379,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
         [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();
@@ -434,7 +434,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
                 var currentStatus = chargePointService.GetChargePointCurrentSatus(ChargeBoxId, StartTransaction.ConnectorId.Value).Value;
 
                 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 });
                 }
@@ -782,7 +782,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
         [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();
@@ -868,7 +868,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
         [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();
@@ -976,7 +976,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
         [ResponseType(typeof(ErrorResponse))]
         [ResponseType(typeof(InternalGenericResponse))]
         [HttpPost]
-        public HttpResponseMessage SetChargingProfile(string ChargeBoxId, [FromBody]ChargingProfileRequest ChargingProfile)
+        public HttpResponseMessage SetChargingProfile(string ChargeBoxId, [FromBody] ChargingProfileRequest ChargingProfile)
         {
 
 
@@ -997,9 +997,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
                 if (ChargingProfile == null ||
                     ChargingProfile.connectorId < 0 ||
                   !(ChargingProfile.ChargingProfile != null && IsValidEnum<ChargingProfileKindType>((int)ChargingProfile.ChargingProfile.chargingProfileKind)) ||
-                  !(ChargingProfile.ChargingProfile != null && ChargingProfile.ChargingProfile.recurrencyKind.HasValue && IsValidEnum<RecurrencyKindType>((int)ChargingProfile.ChargingProfile.recurrencyKind)) ||
-                  !(ChargingProfile.ChargingProfile != null && ChargingProfile.ChargingProfile.recurrencyKind.HasValue && IsValidEnum<RecurrencyKindType>((int)ChargingProfile.ChargingProfile.recurrencyKind)) ||
-                  !(ChargingProfile.ChargingProfile != null && IsValidEnum<ChargingProfilePurposeType>((int)ChargingProfile.ChargingProfile.chargingProfilePurpose)) ||
+                 !(ChargingProfile.ChargingProfile != null && IsValidEnum<ChargingProfilePurposeType>((int)ChargingProfile.ChargingProfile.chargingProfilePurpose)) ||
                   !(ChargingProfile.ChargingProfile != null && ChargingProfile.ChargingProfile.chargingSchedule != null && IsValidEnum<ChargingRateUnitType>((int)ChargingProfile.ChargingProfile.chargingSchedule.chargingRateUnit)))
                 {
                     return Request.CreateResponse(HttpStatusCode.BadRequest, new ErrorResponse() { Code = 2100, Message = EVCBConfiguration.ERROR_MSG_PARAMETER_OUTOFRANGE_INCORRECT });
@@ -1020,7 +1018,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp16
                         chargingProfilePurpose = ChargingProfile.ChargingProfile.chargingProfilePurpose,
                         recurrencyKind = ChargingProfile.ChargingProfile.recurrencyKind,
                         stackLevel = ChargingProfile.ChargingProfile.stackLevel,
-                        transactionId = ChargingProfile.ChargingProfile.TransactionId,
+                        transactionId = ChargingProfile.ChargingProfile.SessionId,
                         validFrom = ChargingProfile.ChargingProfile.validFrom == null ? (DateTime?)null : DateTime.SpecifyKind(ChargingProfile.ChargingProfile.validFrom.Value, DateTimeKind.Utc),
                         validTo = ChargingProfile.ChargingProfile.validTo == null ? (DateTime?)null : DateTime.SpecifyKind(ChargingProfile.ChargingProfile.validTo.Value, DateTimeKind.Utc),
                         chargingSchedule = new ChargingSchedule()

+ 1 - 1
EVCB_OCPP.WEBAPI/Controllers/Version2/ocpp201/OCPP201_InternalController.cs

@@ -805,7 +805,7 @@ namespace EVCB_OCPP.WEBAPI.Controllers.Version2.ocpp201
                         ChargingProfilePurpose = (EVCB_OCPP20.Packet.DataTypes.EnumTypes.ChargingProfilePurposeEnumType)(int)ChargingProfile.ChargingProfile.chargingProfilePurpose + 1,
                         RecurrencyKind = (EVCB_OCPP20.Packet.DataTypes.EnumTypes.RecurrencyKindEnumType)(int)ChargingProfile.ChargingProfile.recurrencyKind,
                         StackLevel = ChargingProfile.ChargingProfile.stackLevel,
-                        TransactionId = ChargingProfile.ChargingProfile.TransactionId.Value.ToString(),
+                        TransactionId = ChargingProfile.ChargingProfile.SessionId.Value.ToString(),
                         ValidFrom = ChargingProfile.ChargingProfile.validFrom == null ? (DateTime?)null : DateTime.SpecifyKind(ChargingProfile.ChargingProfile.validFrom.Value, DateTimeKind.Utc),
                         ValidTo = ChargingProfile.ChargingProfile.validTo == null ? (DateTime?)null : DateTime.SpecifyKind(ChargingProfile.ChargingProfile.validTo.Value, DateTimeKind.Utc),
                         ChargingSchedule = new ChargingScheduleType()

+ 1 - 1
EVCB_OCPP.WEBAPI/Models/WebAPI/SetChargingProfileRequest.cs

@@ -22,7 +22,7 @@ namespace EVCB_OCPP.WEBAPI.Models.WebAPI
 
     public class AdvancedChargingProfiles
     {
-        public int? TransactionId { set; get; }
+        public int? SessionId { set; get; }
 
         [Required]
         public int chargingProfileId { get; set; }

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

@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
 //
 // 您可以指定所有值或預設修訂和組件數目
 // 指定為預設值:
-[assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
-[assembly: AssemblyInformationalVersion("5f2d7fc")]
+[assembly: AssemblyVersion("2.0.0.0")]
+[assembly: AssemblyFileVersion("2.0.0.0")]
+[assembly: AssemblyInformationalVersion("de40cb5")]