[後端] 修改同步問題, history 因爲系統不同有不同規則
This commit is contained in:
parent
3a02ae413d
commit
eed3e1fc9f
@ -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<string>("select obixSlot from building where deleted = 0").Result;
|
||||
var urlSlots = backendRepository.GetAllAsync<BuildingDetail>("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);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ namespace Backend.Services.Implement
|
||||
/// <param name="urlString"></param>
|
||||
/// <param name="slot"></param>
|
||||
/// <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 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;
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user