From 9e33f4c368e506b4449649e90e26039966046f8d Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 19 May 2023 10:06:18 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9niagar?= =?UTF-8?q?a=20=E5=90=8C=E6=AD=A5=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Services/Implement/webRequestService.cs | 10 +++++++--- .../Implement/NiagaraDataSynchronizeRepository.cs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index 2528ae5..96e0630 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -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); } diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 1f2824e..ebf60a8 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -244,7 +244,7 @@ namespace Repository.BackendRepository.Implement var isDome = await GetOneAsync("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