From c42708f30a8bdb0decef846ffbcd291277d0c132 Mon Sep 17 00:00:00 2001 From: dev02 Date: Mon, 30 Jan 2023 16:04:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Services/Implement/webRequestService.cs | 5 +++-- .../Implement/NiagaraDataSynchronizeRepository.cs | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index d447fc9..9ae6333 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -71,11 +71,12 @@ namespace Backend.Services.Implement { row.point_name = s2[i]; } - else if (i == 1) + + if (i == 0) { row.tag_name += s2[i]; } - else if (i > 1 && i < s2.Length - 2) + else { row.tag_name += "_" + s2[i]; } diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 0ef65e9..e14e36c 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -57,10 +57,12 @@ namespace Repository.BackendRepository.Implement //N4資料groupBy後放入import_niagara_tag資料表 var ds2 = ds.GroupBy(x => new { - tag_name2 = x.tag_name + tag_name2 = x.tag_name, + displayName2 = x.displayName }).Select(x => new Device_value { - tag_name = x.Key.tag_name2 + tag_name = x.Key.tag_name2, + displayName = x.Key.displayName2 }); StringBuilder sb = new StringBuilder(); @@ -72,7 +74,7 @@ namespace Repository.BackendRepository.Implement if (arrTag.Length == 8) { - sb.Append($@" insert import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag, + sb.Append($@" insert into import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag, device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, device_full_name, atDateTime) values('" + row.tag_name + "', '" + arrTag[0] + "', '" + @@ -82,8 +84,8 @@ namespace Repository.BackendRepository.Implement arrTag[4] + "', '" + arrTag[5] + "', '" + arrTag[6] + "', '" + - arrTag[7] + "', " + - row.displayName + "', '" + + arrTag[7] + "', '" + + row.displayName + "', " + "now());"); } }