添加变量名称导入
This commit is contained in:
@ -9,6 +9,9 @@ using HT.Cloud.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using HT.Cloud.Service.DevicesManage;
|
||||
using System.Text.RegularExpressions;
|
||||
using HT.Cloud.Domain.DevicesManage;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace HT.Cloud.Web.Areas.DevicesManage.Controllers
|
||||
{
|
||||
@ -73,6 +76,57 @@ namespace HT.Cloud.Web.Areas.DevicesManage.Controllers
|
||||
var data = await _metaTagService.GetGroupVarTreeTable(groupIId);
|
||||
return Content(data);
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> ImportExcelToTableData(string[] groupId)
|
||||
{
|
||||
//var data = await _metaTagService.ImportExcelToTableData(metaTags);
|
||||
var list = JsonConvert.DeserializeObject<List<Meta_Tag>>(groupId[0].Remove(0, 17).Remove(groupId[0].Length - 17 - 2, 2));
|
||||
|
||||
|
||||
list.Remove(list[0]);
|
||||
List<MetaTagEntity> metaTags = new List<MetaTagEntity>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
try
|
||||
{
|
||||
MetaTagEntity metaTag = new MetaTagEntity();
|
||||
metaTag.TagID = int.Parse(item.TagID);
|
||||
metaTag.TagName = item.TagName;
|
||||
metaTag.DataType = short.Parse(item.TagID);
|
||||
metaTag.DataSize = int.Parse(item.DataSize);
|
||||
metaTag.Address = item.Address;
|
||||
metaTag.GroupID = int.Parse(item.GroupID);
|
||||
metaTag.IsActive = true;
|
||||
metaTag.Archive = true;
|
||||
metaTag.DefaultValue = item.DefaultValue;
|
||||
metaTag.Description = item.Description;
|
||||
metaTag.Maximum = float.Parse(item.Maximum);
|
||||
metaTag.Minimum = float.Parse(item.Minimum);
|
||||
metaTag.Cycle = int.Parse(item.Cycle);
|
||||
metaTag.Subsystem = item.Subsystem;
|
||||
metaTag.Units = item.Units;
|
||||
metaTag.WriteAddress = item.WriteAddress;
|
||||
metaTag.SysType = item.SysType;
|
||||
metaTag.SysAddress = item.SysAddress;
|
||||
if (item.IFloatPlaces == "")
|
||||
{
|
||||
metaTag.IFloatPlaces = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
metaTag.IFloatPlaces = short.Parse(item.IFloatPlaces);
|
||||
}
|
||||
metaTags.Add(metaTag);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
var data = await _metaTagService.ImportExcelToTableData(metaTags);
|
||||
return Content(data);
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task<ActionResult> SaveArgument(string driverId, string name, string value)
|
||||
{
|
||||
@ -80,5 +134,32 @@ namespace HT.Cloud.Web.Areas.DevicesManage.Controllers
|
||||
return Content(data);
|
||||
}
|
||||
|
||||
}
|
||||
public class Meta_Tag
|
||||
{
|
||||
public string TagID { get; set; }
|
||||
|
||||
public string TagName { get; set; }
|
||||
|
||||
public string DataType { get; set; }
|
||||
|
||||
public string DataSize { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string GroupID { get; set; }
|
||||
public string IsActive { get; set; }
|
||||
public string Archive { get; set; }
|
||||
public string DefaultValue { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Maximum { get; set; }
|
||||
public string Minimum { get; set; }
|
||||
public string Cycle { get; set; }
|
||||
public string Subsystem { get; set; }
|
||||
public string Units { get; set; }
|
||||
public string WriteAddress { get; set; }
|
||||
public string SysType { get; set; }
|
||||
public string SysAddress { get; set; }
|
||||
public string IFloatPlaces { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user