diff --git a/Backend/Controllers/NiagaraDataSynchronizeController.cs b/Backend/Controllers/NiagaraDataSynchronizeController.cs index cad41e1..cd733f4 100644 --- a/Backend/Controllers/NiagaraDataSynchronizeController.cs +++ b/Backend/Controllers/NiagaraDataSynchronizeController.cs @@ -160,12 +160,11 @@ namespace Backend.Controllers obixApiConfig.UserName = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault(); obixApiConfig.Password = variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault(); //obixApiConfig.UrlSlot = variableObix.Where(x => x.Name == "url_slot").Select(x => x.Value).FirstOrDefault(); - - var urlSlots = backendRepository.GetAllAsync("select obixSlot from building where deleted = 0").Result; + var urlSlots = backendRepository.GetAllAsync("select obixSlot, area_tag from building where deleted = 0").Result; foreach(var us in urlSlots) { - var data = svc.obixHisQuery(obixApiConfig.ApiBase + "obix/config/Program/ObixQuery/query/", obixApiConfig.ApiBase + "obix/histories", us, - obixApiConfig.UserName, obixApiConfig.Password); + var data = svc.obixHisQuery(obixApiConfig.ApiBase + "obix/config/Program/ObixQuery/query/", obixApiConfig.ApiBase + "obix/histories", us.obixSlot, + obixApiConfig.UserName, obixApiConfig.Password, us.area_tag); ds.AddRange(data); } diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index 50cd254..7306142 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -124,7 +124,7 @@ namespace Backend.Services.Implement /// /// /// - public List obixHisQuery(string bqlUrlString, string urlString, string slot, string acc, string pass) + public List obixHisQuery(string bqlUrlString, string urlString, string slot, string acc, string pass, string AreaTag) { //String username = "obixUser"; //String password = "Admin123456"; @@ -213,7 +213,7 @@ namespace Backend.Services.Implement namespaceManager.AddNamespace("obix", xmlns); // Select all "ref" nodes using an XPath expression - XmlNodeList refNodes = xmlDoc2.SelectNodes($"//obix:ref[starts-with(@name, '{building_tag}')]", namespaceManager); + XmlNodeList refNodes = xmlDoc2.SelectNodes($"//obix:ref[starts-with(@name, '{AreaTag ?? building_tag}')]", namespaceManager); foreach (XmlNode node2 in refNodes) { string tagName = node2.Attributes["name"].InnerText; diff --git a/Repository/Models/BackgroundServiceTask.cs b/Repository/Models/BackgroundServiceTask.cs index d806dad..23598da 100644 --- a/Repository/Models/BackgroundServiceTask.cs +++ b/Repository/Models/BackgroundServiceTask.cs @@ -153,4 +153,10 @@ namespace Repository.Models public string displayName { get; set; } public string disasterValue { get; set; } } + + public class BuildingDetail + { + public string area_tag { get; set; } + public string obixSlot { get; set; } + } }