更新设备变量新追加
This commit is contained in:
@ -5,6 +5,8 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using HT.Cloud.Code;
|
||||
using HT.Cloud.Domain.DevicesManage;
|
||||
using Microsoft.Extensions.FileSystemGlobbing.Internal;
|
||||
using Serenity.Services;
|
||||
using SqlSugar;
|
||||
|
||||
namespace HT.Cloud.Service.DevicesManage
|
||||
@ -21,7 +23,7 @@ namespace HT.Cloud.Service.DevicesManage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取服务器中设备与变量组信息树列表和子节点
|
||||
/// 获取服务器中设备与变量组信息树列表和子节点,通讯参数driverid添加T,变量组配置id添加B
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<string> GetALLNode()
|
||||
@ -33,22 +35,22 @@ namespace HT.Cloud.Service.DevicesManage
|
||||
|
||||
var ts = list_drive.Select(a => new
|
||||
{
|
||||
title = a.DriverName,
|
||||
id = a.DriverID,
|
||||
name = a.DriverName,
|
||||
id = a.DriverID.ToString(),
|
||||
children = new[] {
|
||||
new Children
|
||||
{
|
||||
id = "T" + a.DriverID,
|
||||
title = "通讯参数",
|
||||
name = "通讯参数",
|
||||
},
|
||||
new Children
|
||||
{
|
||||
id = "B" + a.DriverID,
|
||||
title = "变量配置",
|
||||
id = "D" + a.DriverID,
|
||||
name = "变量配置",
|
||||
children = list_group.Where(aa=>aa.DriverID == a.DriverID).Select(aa=>new Children
|
||||
{
|
||||
title = aa.GroupName,
|
||||
id = aa.GroupID.ToString(),
|
||||
name = aa.GroupName,
|
||||
id = "B" + aa.GroupID.ToString(),
|
||||
}).ToList()
|
||||
|
||||
}
|
||||
@ -59,15 +61,52 @@ namespace HT.Cloud.Service.DevicesManage
|
||||
// id = aa.GroupID,
|
||||
//}).ToList()
|
||||
}).ToList();
|
||||
|
||||
#region 取消key值引号
|
||||
//string pattern = "\"(\\w+)\"(\\s*:\\s*)";
|
||||
//string replacement = "$1$2";
|
||||
//System.Text.RegularExpressions.Regex rgx = new System.Text.RegularExpressions.Regex(pattern);
|
||||
//return rgx.Replace(ts.ToJsonNullValueHandling(), replacement);
|
||||
#endregion
|
||||
return ts.ToJsonNullValueHandling();
|
||||
}
|
||||
|
||||
public class Children
|
||||
}
|
||||
public class Children
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string title { get; set; }
|
||||
public string name { get; set; }
|
||||
public List<Children> children { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetDriverArgument(int driverId)
|
||||
{
|
||||
var listArgument = _context.Queryable<ArgumentEntity>().Where(x=>x.DriverID == driverId).ToList();
|
||||
var dt = new Dictionary<string, string>();
|
||||
foreach(var argument in listArgument)
|
||||
{
|
||||
dt.Add(argument.PropertyName, argument.PropertyValue);
|
||||
}
|
||||
return dt.ToJson();
|
||||
}
|
||||
public async Task<string> GetGroupVarTable(int groupId)
|
||||
{
|
||||
var listMetaTag = _context.Queryable<MetaTagEntity>().Where(x => x.GroupID == groupId).ToList();
|
||||
|
||||
var metaTagRedata = new MetaTagRedata
|
||||
{
|
||||
code = 0,
|
||||
msg = "",
|
||||
count = listMetaTag.Count,
|
||||
data = listMetaTag
|
||||
};
|
||||
|
||||
return metaTagRedata.ToJson();
|
||||
}
|
||||
public class MetaTagRedata
|
||||
{
|
||||
public int code { get;set; }
|
||||
public string msg { get; set; }
|
||||
public int count { get; set; }
|
||||
public List<MetaTagEntity> data { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user