[後端] 修改jsonobject 獲取單資料問題
This commit is contained in:
parent
45c03969ec
commit
0fe5ad831c
@ -1218,6 +1218,8 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
{
|
{
|
||||||
var dataList = responseContentJsonResult["obj"]["list"];
|
var dataList = responseContentJsonResult["obj"]["list"];
|
||||||
if (dataList != null && dataList["obj"].HasValues)
|
if (dataList != null && dataList["obj"].HasValues)
|
||||||
|
{
|
||||||
|
if (Convert.ToInt32(countObj["@val"].ToString()) > 1)
|
||||||
{
|
{
|
||||||
//讀取資料
|
//讀取資料
|
||||||
foreach (var obj in dataList["obj"])
|
foreach (var obj in dataList["obj"])
|
||||||
@ -1246,6 +1248,35 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
string tag = device_item_info.Is_bool == "1" ? "bool" : "real";
|
string tag = device_item_info.Is_bool == "1" ? "bool" : "real";
|
||||||
historyRawData.Value = obj[tag]["@val"].ToString();
|
historyRawData.Value = obj[tag]["@val"].ToString();
|
||||||
|
|
||||||
|
historyRawDatas.Add(historyRawData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HistoryRawData historyRawData = new HistoryRawData();
|
||||||
|
|
||||||
|
//取得設備基本資訊
|
||||||
|
var tempSplit = historyItem.Device_number_point.Split(":");
|
||||||
|
var device_number = tempSplit[0];
|
||||||
|
var point = tempSplit[1];
|
||||||
|
var device_item_info = device_item_infos.Where(x => x.Device_number == device_number && x.Points == point).FirstOrDefault();
|
||||||
|
|
||||||
|
historyRawData.Building_name = device_item_info.Building_name;
|
||||||
|
historyRawData.Main_system_name = device_item_info.Main_system_name;
|
||||||
|
historyRawData.Sub_system_name = device_item_info.Sub_system_name;
|
||||||
|
historyRawData.Device_number = device_item_info.Device_number;
|
||||||
|
historyRawData.Device_name = device_item_info.Device_name;
|
||||||
|
historyRawData.Item_name = device_item_info.Item_name;
|
||||||
|
historyRawData.Points = device_item_info.Points;
|
||||||
|
historyRawData.Unit = device_item_info.Unit;
|
||||||
|
|
||||||
|
//取得時間
|
||||||
|
var abstime = dataList["obj"]["abstime"]["@val"].ToString();
|
||||||
|
historyRawData.Timestamp = Convert.ToDateTime(abstime).ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
//取得資料
|
||||||
|
string tag = device_item_info.Is_bool == "1" ? "bool" : "real";
|
||||||
|
historyRawData.Value = dataList["obj"][tag]["@val"].ToString();
|
||||||
|
|
||||||
historyRawDatas.Add(historyRawData);
|
historyRawDatas.Add(historyRawData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user