[後端] 修改同步問題, history 因爲系統不同有不同規則

This commit is contained in:
dev02 2023-08-03 16:20:59 +08:00
parent 3a02ae413d
commit eed3e1fc9f
3 changed files with 11 additions and 6 deletions

View File

@ -160,12 +160,11 @@ namespace Backend.Controllers
obixApiConfig.UserName = variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault(); 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.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(); //obixApiConfig.UrlSlot = variableObix.Where(x => x.Name == "url_slot").Select(x => x.Value).FirstOrDefault();
var urlSlots = backendRepository.GetAllAsync<BuildingDetail>("select obixSlot, area_tag from building where deleted = 0").Result;
var urlSlots = backendRepository.GetAllAsync<string>("select obixSlot from building where deleted = 0").Result;
foreach(var us in urlSlots) foreach(var us in urlSlots)
{ {
var data = svc.obixHisQuery(obixApiConfig.ApiBase + "obix/config/Program/ObixQuery/query/", obixApiConfig.ApiBase + "obix/histories", us, var data = svc.obixHisQuery(obixApiConfig.ApiBase + "obix/config/Program/ObixQuery/query/", obixApiConfig.ApiBase + "obix/histories", us.obixSlot,
obixApiConfig.UserName, obixApiConfig.Password); obixApiConfig.UserName, obixApiConfig.Password, us.area_tag);
ds.AddRange(data); ds.AddRange(data);
} }

View File

@ -124,7 +124,7 @@ namespace Backend.Services.Implement
/// <param name="urlString"></param> /// <param name="urlString"></param>
/// <param name="slot"></param> /// <param name="slot"></param>
/// <returns></returns> /// <returns></returns>
public List<ImpNiaItem> obixHisQuery(string bqlUrlString, string urlString, string slot, string acc, string pass) public List<ImpNiaItem> obixHisQuery(string bqlUrlString, string urlString, string slot, string acc, string pass, string AreaTag)
{ {
//String username = "obixUser"; //String username = "obixUser";
//String password = "Admin123456"; //String password = "Admin123456";
@ -213,7 +213,7 @@ namespace Backend.Services.Implement
namespaceManager.AddNamespace("obix", xmlns); namespaceManager.AddNamespace("obix", xmlns);
// Select all "ref" nodes using an XPath expression // 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) foreach (XmlNode node2 in refNodes)
{ {
string tagName = node2.Attributes["name"].InnerText; string tagName = node2.Attributes["name"].InnerText;

View File

@ -153,4 +153,10 @@ namespace Repository.Models
public string displayName { get; set; } public string displayName { get; set; }
public string disasterValue { get; set; } public string disasterValue { get; set; }
} }
public class BuildingDetail
{
public string area_tag { get; set; }
public string obixSlot { get; set; }
}
} }