[後端] 修改獲取device_item getway
This commit is contained in:
parent
16ea38418c
commit
61c8e79e9c
@ -7,6 +7,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Quartz;
|
using Quartz;
|
||||||
|
using Repository.BackendRepository.Implement;
|
||||||
using Repository.BackendRepository.Interface;
|
using Repository.BackendRepository.Interface;
|
||||||
using Repository.Helper;
|
using Repository.Helper;
|
||||||
using System;
|
using System;
|
||||||
@ -160,8 +161,12 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
List<Dictionary<string, object>> waterArchiveDayRawDatas = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> waterArchiveDayRawDatas = new List<Dictionary<string, object>>();
|
||||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -218,8 +223,12 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
}
|
}
|
||||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -631,8 +640,12 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
List<Dictionary<string, object>> waterArchiveWeekRawDatas = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> waterArchiveWeekRawDatas = new List<Dictionary<string, object>>();
|
||||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -690,8 +703,12 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
}
|
}
|
||||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -1000,8 +1017,12 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
List<Dictionary<string, object>> waterArchiveMonthRawDatas = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> waterArchiveMonthRawDatas = new List<Dictionary<string, object>>();
|
||||||
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
foreach (var deviceNumberPoint in electricDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
@ -1058,8 +1079,12 @@ namespace BackendWorkerService.Quartz.Jobs
|
|||||||
}
|
}
|
||||||
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
foreach (var deviceNumberPoint in waterDeviceNumberPoints)
|
||||||
{
|
{
|
||||||
device_number = deviceNumberPoint.FullDeviceNumberPoint;
|
device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
|
@ -280,7 +280,12 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
<reltime name='interval' val = 'PT1D' />
|
<reltime name='interval' val = 'PT1D' />
|
||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveDayRequest.Method = "POST";
|
archiveDayRequest.Method = "POST";
|
||||||
@ -371,7 +376,12 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
<reltime name='interval' val = 'PT1D' />
|
<reltime name='interval' val = 'PT1D' />
|
||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveDayRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveDayRequest.Method = "POST";
|
archiveDayRequest.Method = "POST";
|
||||||
@ -460,7 +470,12 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
<reltime name='interval' val = 'PT7D' />
|
<reltime name='interval' val = 'PT7D' />
|
||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveWeekRequest.Method = "POST";
|
archiveWeekRequest.Method = "POST";
|
||||||
@ -545,7 +560,12 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
<reltime name='interval' val = 'PT7D' />
|
<reltime name='interval' val = 'PT7D' />
|
||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveWeekRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveWeekRequest.Method = "POST";
|
archiveWeekRequest.Method = "POST";
|
||||||
@ -636,7 +656,12 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
<reltime name='interval' val = 'PT{dayInMonth}D' />
|
<reltime name='interval' val = 'PT{dayInMonth}D' />
|
||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveMonthRequest.Method = "POST";
|
archiveMonthRequest.Method = "POST";
|
||||||
@ -724,7 +749,12 @@ namespace BackendWorkerService.Services.Implement
|
|||||||
<reltime name='interval' val = 'PT{dayInMonth}D' />
|
<reltime name='interval' val = 'PT{dayInMonth}D' />
|
||||||
</obj>";
|
</obj>";
|
||||||
|
|
||||||
var station = buildingStation.Where(x => x.system_key == deviceNumberPoint.DeviceNumber.Split("_")[1]).Select(x => x.system_value).FirstOrDefault();
|
string device_number = deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "");
|
||||||
|
var station = backgroundServiceRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{device_number.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{device_number.Split("_")[2]}' and device_name_tag = '{device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{device_number.Split("_")[4]}' and device_master_tag = '{device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{device_number.Split("_")[6]}' and device_serial_tag = '{device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{device_number.Split("_")[8]}'").Result;
|
||||||
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{deviceNumberPoint.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
//HttpWebRequest archiveMonthRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/H_E1_B1F_MVCB_MVCBH_V1/~historyRollup/");
|
||||||
archiveMonthRequest.Method = "POST";
|
archiveMonthRequest.Method = "POST";
|
||||||
|
@ -283,8 +283,7 @@
|
|||||||
|
|
||||||
$('#devPointsList').html(strHtml);
|
$('#devPointsList').html(strHtml);
|
||||||
|
|
||||||
if (!hisFirst)
|
if (!hisFirst) {
|
||||||
{
|
|
||||||
let start = new Date($('#his_startdate').val());
|
let start = new Date($('#his_startdate').val());
|
||||||
let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
|
let end = new Date(new Date().setDate(new Date($('#his_enddate input').val()).getDate() + 1));
|
||||||
|
|
||||||
@ -309,7 +308,16 @@
|
|||||||
var edt = new Date(new Date().setDate(sdt.getDate() + 1));
|
var edt = new Date(new Date().setDate(sdt.getDate() + 1));
|
||||||
start = start ?? sdt.toLocaleDateString();
|
start = start ?? sdt.toLocaleDateString();
|
||||||
end = end ?? edt.toLocaleDateString();
|
end = end ?? edt.toLocaleDateString();
|
||||||
// callBackFromHistory();
|
|
||||||
|
let sendData = {
|
||||||
|
device_number: pageAct.deviceNumber,
|
||||||
|
device_point: pageAct.deviceItem
|
||||||
|
}
|
||||||
|
objSendData.Data = sendData;
|
||||||
|
let url = baseApiUrl + "/api/DevGetWay";
|
||||||
|
ytAjax = new YourTeam.Ajax(url, objSendData, function (res) {
|
||||||
|
if (res && res.code == "0000") {
|
||||||
|
pageAct.hisBuiName = res.data;
|
||||||
getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
|
getHistoryDataByBaja(pageAct.deviceNumber + "_" + pageAct.deviceItem,
|
||||||
new Date(start).getTime(),
|
new Date(start).getTime(),
|
||||||
new Date(end).getTime(),
|
new Date(end).getTime(),
|
||||||
@ -317,6 +325,11 @@
|
|||||||
pageAct.hisBuiName,
|
pageAct.hisBuiName,
|
||||||
callBackFromHistory);
|
callBackFromHistory);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$(loadEle).Loading("close");
|
||||||
|
}
|
||||||
|
}, function (res) { $(loadEle).Loading("close"); }, "POST", true).send();
|
||||||
|
}
|
||||||
|
|
||||||
function callBackFromHistory(res = '{"count":0,"data":[]}') {
|
function callBackFromHistory(res = '{"count":0,"data":[]}') {
|
||||||
res = JSON.parse(res);
|
res = JSON.parse(res);
|
||||||
@ -484,7 +497,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
historyTable = new YourTeam.JqDataTables.getTableByStatic(tag, data, columns, column_defs, null, null, null, null, "tpi");
|
||||||
$(tag).DataTable().order([ 3, 'desc' ]);
|
$(tag).DataTable().order([3, 'desc']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,14 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
foreach (var d in listDevicePoint)
|
foreach (var d in listDevicePoint)
|
||||||
{
|
{
|
||||||
string buildingTag = d.DeviceNumber.Split("_")[1];
|
string buildingTag = d.DeviceNumber.Split("_")[1];
|
||||||
var station = buildStation.Where(x => x.system_key == buildingTag).Select(x => x.system_value).FirstOrDefault();
|
var station = backendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{d.FullDeviceNumberPoint.Split("_")[1].Replace("$3", "")}' and
|
||||||
|
device_system_tag = '{d.FullDeviceNumberPoint.Split("_")[2]}' and device_name_tag = '{d.FullDeviceNumberPoint.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{d.FullDeviceNumberPoint.Split("_")[4]}' and device_master_tag = '{d.FullDeviceNumberPoint.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{d.FullDeviceNumberPoint.Split("_")[6]}' and device_serial_tag = '{d.FullDeviceNumberPoint.Split("_")[7]}'
|
||||||
|
and device_point_name = '{d.FullDeviceNumberPoint.Split("_")[8]}'").Result;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(station))
|
||||||
|
{
|
||||||
var archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{d.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
var archiveRequest = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{d.FullDeviceNumberPoint.Replace("$3", "")}/~historyRollup/");
|
||||||
archiveRequest.Method = "POST";
|
archiveRequest.Method = "POST";
|
||||||
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
|
||||||
@ -149,6 +156,11 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
jd.Add(jsonDevice);
|
jd.Add(jsonDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogError("【Device GetWay Error】, device_number: " + d.FullDeviceNumberPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jd != null && jd.Count > 0)
|
if (jd != null && jd.Count > 0)
|
||||||
|
@ -175,5 +175,47 @@ namespace FrontendWebApi.ApiControllers
|
|||||||
}
|
}
|
||||||
return Ok(apiResult);
|
return Ok(apiResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Route("api/DevGetWay")]
|
||||||
|
public async Task<ActionResult<ApiResult<string>>> GetDevGetWay([FromBody] DeviceGetWayInput input)
|
||||||
|
{
|
||||||
|
ApiResult<string> apiResult = new ApiResult<string>(jwt_str);
|
||||||
|
//check input
|
||||||
|
if (input == null || string.IsNullOrEmpty(input.device_number) || string.IsNullOrEmpty(input.device_point))
|
||||||
|
{
|
||||||
|
apiResult.Code = "9998";
|
||||||
|
apiResult.Msg = "資料輸入錯誤。";
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var getWayStr = await backendRepository.GetOneAsync<string>($@"select parent_path from import_niagara_item_history where device_building_tag = '{input.device_number.Split("_")[1]}'
|
||||||
|
and device_system_tag = '{input.device_number.Split("_")[2]}' and device_name_tag = '{input.device_number.Split("_")[3]}'
|
||||||
|
and device_floor_tag = '{input.device_number.Split("_")[4]}' and device_master_tag = '{input.device_number.Split("_")[5]}'
|
||||||
|
and device_last_name_tag = '{input.device_number.Split("_")[6]}' and device_serial_tag = '{input.device_number.Split("_")[7]}'
|
||||||
|
and device_point_name = '{input.device_point}'");
|
||||||
|
|
||||||
|
//check string
|
||||||
|
if (string.IsNullOrEmpty(getWayStr))
|
||||||
|
{
|
||||||
|
apiResult.Code = "9997";
|
||||||
|
apiResult.Msg = "資料獲取錯誤。";
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
apiResult.Data = getWayStr;
|
||||||
|
apiResult.Code = "0000";
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
apiResult.Code = "9999";
|
||||||
|
apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
|
return Ok(apiResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,5 +195,9 @@ namespace FrontendWebApi.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DeviceGetWayInput
|
||||||
|
{
|
||||||
|
public string device_number { get; set; }
|
||||||
|
public string device_point { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user