[後端] 修改niagara 同步問題

This commit is contained in:
dev02 2023-05-19 10:06:18 +08:00
parent 7b55ec92af
commit 9e33f4c368
2 changed files with 8 additions and 4 deletions

View File

@ -20,6 +20,7 @@ using NPOI.SS.Formula.Functions;
using Microsoft.AspNetCore.Localization;
using MySqlX.XDevAPI.Relational;
using Backend.Models;
using NPOI.OpenXmlFormats.Dml;
namespace Backend.Services.Implement
{
@ -263,9 +264,12 @@ namespace Backend.Services.Implement
row.parent_path = stationName;
//full_name 其實是點位名稱 point_name
row.full_name = conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
if (conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault() != null)
conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault().isHistory = true;
var deviceNumber = tagName.Substring(0, tagName.LastIndexOf(tagName.Split("_")[5]) - 1);
var point = tagName.Split("_")[5];
conPoint = conPoint.Where(x => x.name.Split("/").Length > 6).ToList();
row.full_name = conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).Select(x => x.displayName).FirstOrDefault();
if (conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).FirstOrDefault() != null)
conPoint.Where(x => x.name.Split("/")[5] == deviceNumber && x.name.Split("/")[6] == point && !x.isHistory).FirstOrDefault().isHistory = true;
row.isHistory = true;
result.Add(row);
}

View File

@ -244,7 +244,7 @@ namespace Repository.BackendRepository.Implement
var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
if (sb.Length > 0)
{
if (isDome == "ibms_dome_dome/D2")
if (isDome == "ibms_dome_dome/D2" || isDome == "ibms_dome_hotel/H")
{
sb.Append($@" update import_niagara_item a join dic_system b
on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code