Browse Source

修正 station 經緯度 datatype string => decimal

Jessica Tseng 3 years ago
parent
commit
89bb02fa40

+ 2 - 2
EVCB_OCPP.WEBAPI/Models/WebAPI/Dto/GeoLocation.cs

@@ -11,12 +11,12 @@ namespace EVCB_OCPP.WEBAPI.Models.WebAPI.Dto
         /// Latitude of the point in decimal degree. Example: 50.770774. Decimal
         ///separator: "." Regex: -?[0-9]{1,2}\.[0-9]{5,7}
         /// </summary>
-        public string Latitude { set; get; }
+        public decimal Latitude { set; get; }
 
         /// <summary>
         /// Longitude of the point in decimal degree. Example: -126.104965. Decimal
         ///separator: "." Regex: -?[0-9]{1,3}\.[0-9]{5,7}
         /// </summary>
-        public string Longitude { set; get; }
+        public decimal Longitude { set; get; }
     }
 }

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

@@ -1,6 +1,7 @@
 using Dapper;
 using EVCB_OCPP.Packet.Messages.SubTypes;
 using EVCB_OCPP.WEBAPI.Models;
+using EVCB_OCPP.WEBAPI.Models.WebAPI;
 using EVCB_OCPP.WEBAPI.Models.WebAPI.Dto;
 using System;
 using System.Collections.Generic;
@@ -119,7 +120,7 @@ namespace EVCB_OCPP.WEBAPI.Services
                 cp.RatedPower = _machine.RatedPower;
                 cp.Status = _machine.Online ? Status.Available : Status.Remove;
                 cp.LastUpdated = _machine.CreatedOn > _machine.OfflineOn ? _machine.CreatedOn : _machine.OfflineOn;
-                cp.Coordinates = new GeoLocation() { Latitude = _machine.Latitude.ToString(), Longitude = _machine.Longitude.ToString() };
+                cp.Coordinates = new GeoLocation() { Latitude = _machine.Latitude, Longitude = _machine.Longitude };
                 cp.Connectors = new List<Connector>();
                 var _Connectors = GetConnectorStatus(_machine.ChargeBoxId);
                 for (int i = 1; i <= _machine.GunAmt; i++)