[後端] 修改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 Microsoft.AspNetCore.Localization;
using MySqlX.XDevAPI.Relational; using MySqlX.XDevAPI.Relational;
using Backend.Models; using Backend.Models;
using NPOI.OpenXmlFormats.Dml;
namespace Backend.Services.Implement namespace Backend.Services.Implement
{ {
@ -263,9 +264,12 @@ namespace Backend.Services.Implement
row.parent_path = stationName; row.parent_path = stationName;
//full_name 其實是點位名稱 point_name //full_name 其實是點位名稱 point_name
row.full_name = conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).Select(x => x.displayName).FirstOrDefault(); var deviceNumber = tagName.Substring(0, tagName.LastIndexOf(tagName.Split("_")[5]) - 1);
if (conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault() != null) var point = tagName.Split("_")[5];
conPoint.Where(x => x.name.Contains(tagName.Replace('_', '/')) && !x.isHistory).FirstOrDefault().isHistory = true; 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; row.isHistory = true;
result.Add(row); 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';"); var isDome = await GetOneAsync<string>("select system_value from variable where deleted = 0 and system_type = 'project_name';");
if (sb.Length > 0) 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 sb.Append($@" update import_niagara_item a join dic_system b
on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code