修該obix config

This commit is contained in:
dev02 2023-04-24 18:29:45 +08:00
parent ff2d6a4e68
commit 85b6553db7
2 changed files with 23 additions and 6 deletions

View File

@ -45,16 +45,22 @@ namespace Backend.Controllers
try
{
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
var variableObix = backendRepository.GetAllAsync<Backend.Models.KeyValue>(sqlObix).Result;
var obixApiConfig = new Backend.Models.ObixApiConfig();
EDFunction ed = new EDFunction();
obixApiConfig.ApiBase = variableObix.Where(x => x.Name == "ApiBase").Select(x => x.Value).FirstOrDefault() + "obix/config/Program/ObixQuery/query/";
obixApiConfig.UrlSlot = variableObix.Where(x => x.Name == "url_slot").Select(x => x.Value).FirstOrDefault();
obixApiConfig.TagQuantity = variableObix.Where(x => x.Name == "tag_quantity").Select(x => x.Value).FirstOrDefault();
List<Device_value> ds;
string url_slot = backEndConfig.GetUrlSlot();
string tag_quantity = backEndConfig.Getobixtag_quantity();
string top100 = "";//" top 100 ";
webRequestService svc = new webRequestService();
string bql = url_slot + "bql:select " + top100 + " * from baja:Folder ";
string bql = obixApiConfig.UrlSlot + "bql:select " + top100 + " * from baja:Folder ";
//ds = svc.obixQuery("http://192.168.0.136:8080/obix/config/Arena/Program/ObixQuery/query/", bql);
//ds = svc.obixQuery("http://localhost:8080/obix/config/Program/ObixQuery/query/", bql);
ds = svc.obixQuery(backEndConfig.GetobixQuery(), bql, tag_quantity);//三菱
ds = svc.obixQuery(obixApiConfig.ApiBase, bql, obixApiConfig.TagQuantity);//三菱
apiResult.Code = "0000";
apiResult.Data = ds;
@ -119,10 +125,19 @@ namespace Backend.Controllers
try
{
List<ImpNiaItem> ds;
string url_slot = backEndConfig.GetUrlSlot();
webRequestService svc = new webRequestService();
ds = svc.obixHisQuery(backEndConfig.GetobixHisBqlQuery(), backEndConfig.GetobixHisUrlQuery(), url_slot, backEndConfig.Getobixtag_acc(), backEndConfig.Getobixtag_pass());//三菱
var sqlObix = $@"SELECT system_value as Value, system_key as Name FROM variable WHERE deleted = 0 AND system_type = 'obixConfig'";
var variableObix = backendRepository.GetAllAsync<Backend.Models.KeyValue>(sqlObix).Result;
var obixApiConfig = new Backend.Models.ObixApiConfig();
EDFunction ed = new EDFunction();
obixApiConfig.ApiBase = variableObix.Where(x => x.Name == "ApiBase").Select(x => x.Value).FirstOrDefault();
obixApiConfig.UserName = ed.AESDecrypt(variableObix.Where(x => x.Name == "UserName").Select(x => x.Value).FirstOrDefault());
obixApiConfig.Password = ed.AESDecrypt(variableObix.Where(x => x.Name == "Password").Select(x => x.Value).FirstOrDefault());
obixApiConfig.UrlSlot = ed.AESDecrypt(variableObix.Where(x => x.Name == "url_slot").Select(x => x.Value).FirstOrDefault());
ds = svc.obixHisQuery(obixApiConfig.ApiBase + "obix/config/Program/ObixQuery/query/", obixApiConfig.ApiBase + "obix/histories",obixApiConfig.UrlSlot, obixApiConfig.UserName,
obixApiConfig.Password);
apiResult.Code = "0000";
apiResult.Data = ds.Where(x => x.device_building_tag == building.building).ToList(); ;

View File

@ -10,5 +10,7 @@ namespace Backend.Models
public string ApiBase { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string UrlSlot { get; set; }
public string TagQuantity { get; set; }
}
}