Merge branch 'master' into kai
This commit is contained in:
commit
49d748a891
@ -277,8 +277,8 @@ namespace SolarPower.Controllers
|
|||||||
analysisDevice.Series.Add(PR);
|
analysisDevice.Series.Add(PR);
|
||||||
|
|
||||||
DeviceHistoryInfo modelTemperature = new DeviceHistoryInfo();
|
DeviceHistoryInfo modelTemperature = new DeviceHistoryInfo();
|
||||||
modelTemperature.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["ModelTemperature"]);
|
modelTemperature.Name = string.Format("{0}:{1}", powerStation.Name, analysisDevice.MultipleYaxes["Temperature"]);
|
||||||
modelTemperature.YaxesKey = "ModelTemperature";
|
modelTemperature.YaxesKey = "Temperature";
|
||||||
modelTemperature.Values = new List<double>();
|
modelTemperature.Values = new List<double>();
|
||||||
foreach (var history in temp_item)
|
foreach (var history in temp_item)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using SolarPower.Models;
|
using SolarPower.Models;
|
||||||
using SolarPower.Models.Company;
|
using SolarPower.Models.Company;
|
||||||
using SolarPower.Models.PowerStation;
|
using SolarPower.Models.PowerStation;
|
||||||
@ -12,7 +13,9 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
namespace SolarPower.Controllers
|
namespace SolarPower.Controllers
|
||||||
{
|
{
|
||||||
@ -1419,6 +1422,7 @@ namespace SolarPower.Controllers
|
|||||||
public async Task<ApiResult<string>> SaveException(ExceptionModal exceptionModal)
|
public async Task<ApiResult<string>> SaveException(ExceptionModal exceptionModal)
|
||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
|
var url = "10.1.100.138";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PowerStation powerStation = null;
|
PowerStation powerStation = null;
|
||||||
@ -1447,6 +1451,8 @@ namespace SolarPower.Controllers
|
|||||||
"UpperLimit",
|
"UpperLimit",
|
||||||
};
|
};
|
||||||
await powerStationRepository.AddException(Exception, properties, powerStation.SiteDB);
|
await powerStationRepository.AddException(Exception, properties, powerStation.SiteDB);
|
||||||
|
Fetch_PostWithJSONFormat("http://" + url + ":8080/obix/config/Solar/S"+ powerStation.Code+ "01/API/PR_UpperLimit/set", exceptionModal.UpperLimit.ToString());
|
||||||
|
Fetch_PostWithJSONFormat("http://" + url + ":8080/obix/config/Solar/S" + powerStation.Code + "01/API/PR_LowerLimit/set", exceptionModal.LowerLimit.ToString());
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "新增成功";
|
apiResult.Msg = "新增成功";
|
||||||
@ -1474,6 +1480,9 @@ namespace SolarPower.Controllers
|
|||||||
"UpperLimit",
|
"UpperLimit",
|
||||||
};
|
};
|
||||||
await powerStationRepository.UpdateException(Exception, properties, powerStation.SiteDB);
|
await powerStationRepository.UpdateException(Exception, properties, powerStation.SiteDB);
|
||||||
|
Fetch_PostWithJSONFormat("http://" + url + ":8080/obix/config/Solar/S" + powerStation.Code + "01/API/PR_UpperLimit/set", exceptionModal.UpperLimit.ToString());
|
||||||
|
Fetch_PostWithJSONFormat("http://" + url + ":8080/obix/config/Solar/S" + powerStation.Code + "01/API/PR_LowerLimit/set", exceptionModal.LowerLimit.ToString());
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "儲存成功";
|
apiResult.Msg = "儲存成功";
|
||||||
}
|
}
|
||||||
@ -2979,5 +2988,42 @@ namespace SolarPower.Controllers
|
|||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public JObject Fetch_PostWithJSONFormat(string url, string paramter)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string username = "SolarAPI";
|
||||||
|
string password = "Admin123456";
|
||||||
|
string encoded = Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
|
||||||
|
|
||||||
|
HttpWebRequest Postrequest = (HttpWebRequest)WebRequest.Create(url);
|
||||||
|
Postrequest.Method = "POST";
|
||||||
|
Postrequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||||
|
Postrequest.PreAuthenticate = true;
|
||||||
|
|
||||||
|
using (var streamWriter = new StreamWriter(Postrequest.GetRequestStream()))
|
||||||
|
{
|
||||||
|
string json = "<real val=\"" + paramter + "\"/>";
|
||||||
|
streamWriter.Write(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpWebResponse response = (HttpWebResponse)Postrequest.GetResponse();
|
||||||
|
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
|
||||||
|
XmlDocument xmlDoc = new XmlDocument();
|
||||||
|
xmlDoc.LoadXml(responseString);
|
||||||
|
string jsonText = JsonConvert.SerializeXmlNode(xmlDoc);
|
||||||
|
JObject resultVal = (JObject)JsonConvert.DeserializeObject(jsonText);
|
||||||
|
|
||||||
|
return resultVal;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Fetch_PostWithJSONFormat:" + ex );
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,7 +126,7 @@
|
|||||||
{ key: "Irradiance", title: "日照度", default: true },
|
{ key: "Irradiance", title: "日照度", default: true },
|
||||||
{ key: "KWHKWP", title: "發電小時", default: false },
|
{ key: "KWHKWP", title: "發電小時", default: false },
|
||||||
{ key: "PR", title: "PR %", default: false },
|
{ key: "PR", title: "PR %", default: false },
|
||||||
{ key: "ModelTemperature", title: "模組溫度", default: false },
|
{ key: "Temperature", title: "模組溫度", default: false },
|
||||||
{ key: "SolarHour", title: "日照小時", default: false }
|
{ key: "SolarHour", title: "日照小時", default: false }
|
||||||
]
|
]
|
||||||
var PWR_compare_col = [
|
var PWR_compare_col = [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user