From 4fff1630c921b7ecf5cc58c1348778cb31de77dd Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 16 May 2023 14:12:39 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8C=E6=AD=A5niagara=5Fitem=20full=5Fname=20=E5=95=8F?= =?UTF-8?q?=E9=A1=8C,=20=E4=BF=AE=E6=94=B9=E5=8D=B3=E4=BD=BF=E6=AD=B7?= =?UTF-8?q?=E5=8F=B2=E8=B3=87=E6=96=99api=E8=BC=B8=E5=87=BA=E6=9E=B6?= =?UTF-8?q?=E6=A7=8B,=20=E4=BF=AE=E6=94=B9get=20floor=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/BuildController.cs | 2 +- FrontendWebApi/ApiControllers/HistoryController.cs | 7 +++++-- FrontendWebApi/Models/HistoryClass.cs | 6 ++++++ .../Implement/NiagaraDataSynchronizeRepository.cs | 4 +++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index c751dc4..e0e91ec 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -288,7 +288,7 @@ namespace FrontendWebApi.ApiControllers List Floors = new List(); var floorsql = await backendRepository.GetAllAsync($@" select * from (select * from sub_system_floor ssf where ssf.deleted = 0 and ssf.status = 0 and ssf.building_tag = '{get.building_tag}' and ssf.main_system_tag = '{get.main_system_tag}' and ssf.sub_system_tag = '{get.sub_system_tag}') a - left join floor on floor.full_name = a.floor_tag order by floor.priority"); + left join floor on floor.full_name = a.floor_tag and a.building_tag = floor.building_tag order by floor.priority"); Sub_system sub_System = new Sub_system() { sub_system_tag = sub_system.sub_system_tag, diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index ff8622a..0a043e3 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1122,10 +1122,13 @@ namespace FrontendWebApi.ApiControllers { foreach (var tn in tableName) { + var data = new HistoryRealTimeOutput(); + data.deviceNumber = tn; var sql = $@"select timestamp as timeStamp, round(value, 2) as value from {tn} where replace(convert(varchar, [timestamp], 111), '/', '-') >= @startTime and replace(convert(varchar, [timestamp], 111), '/', '-') <= @endTime ordr by timestamp"; - apiResult.Data.AddRange( - await backgroundServiceMsSqlRepository.GetAllAsync(sql, new { startTime = input.startTime, endTime = input.endTime }) + data.HistoryRealTime.AddRange( + await backgroundServiceMsSqlRepository.GetAllAsync(sql, new { startTime = input.startTime, endTime = input.endTime }) ); + apiResult.Data.Add(data); } } } diff --git a/FrontendWebApi/Models/HistoryClass.cs b/FrontendWebApi/Models/HistoryClass.cs index 2c97502..37032a9 100644 --- a/FrontendWebApi/Models/HistoryClass.cs +++ b/FrontendWebApi/Models/HistoryClass.cs @@ -304,6 +304,12 @@ namespace FrontendWebApi.Models } public class HistoryRealTimeOutput + { + public string deviceNumber { get; set; } + public List HistoryRealTime { get; set; } + } + + public class HistoryRealTime { public double value { get; set; } public DateTime timeStamp { get; set; } diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 674fef8..1f2824e 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -249,8 +249,10 @@ namespace Repository.BackendRepository.Implement sb.Append($@" update import_niagara_item a join dic_system b on a.device_name_tag COLLATE utf8mb4_general_ci = b.s2_code set device_system_tag = b.s1_code - where (device_system_tag <> 'S' and device_system_tag <> 'CWB')"); + where (device_system_tag <> 'S' and device_system_tag <> 'CWB');"); } + + sb.Append($@" update import_niagara_item set full_name = device_point_name where full_name = '' or full_name is null;"); await conn.ExecuteAsync(sb.ToString()); sb.Clear(); }