From eed3e1fc9f04e482843c3a1dfa703b053c82156f Mon Sep 17 00:00:00 2001 From: dev02 Date: Thu, 3 Aug 2023 16:20:59 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=95=8F=E9=A1=8C,=20history=20=E5=9B=A0?= =?UTF-8?q?=E7=88=B2=E7=B3=BB=E7=B5=B1=E4=B8=8D=E5=90=8C=E6=9C=89=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E8=A6=8F=E5=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/NiagaraDataSynchronizeController.cs | 7 +++---- Backend/Services/Implement/webRequestService.cs | 4 ++-- Repository/Models/BackgroundServiceTask.cs | 6 ++++++ 3 files changed, 11 insertions(+), 6 deletions(-) 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; } + } }