From 2206f5a3fee99d4dabe00d59ffb5924e641b8bee Mon Sep 17 00:00:00 2001 From: dev02 Date: Tue, 18 Jul 2023 15:02:18 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E4=BF=AE=E6=94=B9niagar?= =?UTF-8?q?a=E5=90=8C=E6=AD=A5=E9=A0=90=E8=A8=AD=E5=80=BC,=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=B0=B4=E9=9B=BB=E8=A1=A8=E5=88=97=E8=A1=A8=E5=95=8F?= =?UTF-8?q?=E9=A1=8C,=20=E4=BF=AE=E6=94=B9=E6=8E=92=E5=BA=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontendWebApi/ApiControllers/BuildController.cs | 2 +- .../ApiControllers/HydroMeterController.cs | 8 ++++---- FrontendWebApi/appsettings.Development.json | 4 ++-- .../Implement/NiagaraDataSynchronizeRepository.cs | 14 ++++++-------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/FrontendWebApi/ApiControllers/BuildController.cs b/FrontendWebApi/ApiControllers/BuildController.cs index 2b37cd9..abe3f57 100644 --- a/FrontendWebApi/ApiControllers/BuildController.cs +++ b/FrontendWebApi/ApiControllers/BuildController.cs @@ -580,7 +580,7 @@ namespace FrontendWebApi.ApiControllers {disasterjoinsql} LEFT JOIN building_menu bm ON d.device_building_tag = bm.building_tag AND d.device_system_tag = bm.main_system_tag AND d.device_name_tag = bm.sub_system_tag where d.deleted = 0 and d.device_building_tag = '{post.building_tag}' {sWhere} - order by d.device_number ASC, d.priority ASC"; + order by d.priority ASC, left(device_serial_tag, LENGTH(device_serial_tag) - 1) ASC"; var devicelist = await backendRepository.GetAllAsync(sql); diff --git a/FrontendWebApi/ApiControllers/HydroMeterController.cs b/FrontendWebApi/ApiControllers/HydroMeterController.cs index 2ff72b7..f1ccac0 100644 --- a/FrontendWebApi/ApiControllers/HydroMeterController.cs +++ b/FrontendWebApi/ApiControllers/HydroMeterController.cs @@ -244,10 +244,10 @@ namespace FrontendWebApi.ApiControllers : input.tableType == "month" ? (Int32.Parse(input.startTime.Split("-")[0]) + 1) + "-01-01" : input.tableType == "year" ? (Int32.Parse(input.endTime) + 1).ToString() + "-01-01" : null; - string dbDateName = startTime.Split("-")[0].ToString().PadLeft(4, '0') + startTime.Split("-")[1].ToString().PadLeft(2, '0'); string sqlWhere = ""; string sqlGroup = ""; string sqlAvgRawData = ""; + string dbDateName = startTime.Split("-")[0].ToString().PadLeft(4, '0') + startTime.Split("-")[1].ToString().PadLeft(2, '0'); string buildingSql = ""; string tag_quantity = await backendRepository.GetOneAsync("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0"); @@ -272,7 +272,7 @@ namespace FrontendWebApi.ApiControllers else sqlAvgRawData = " round(avg_rawdata, 2) as avg_rawdata, start_timestamp, end_timestamp "; - var table = input.tableType == "year" ? "archive_electric_meter_month" : "archive_electric_meter_" + input.tableType + (input.tableType == "day" ? "_" + dbDateName : ""); + var table = input.tableType == "year" ? "archive_water_meter_month" : "archive_water_meter_" + input.tableType + (input.tableType == "day" ? "_" + dbDateName : ""); var schema = await backendRepository.GetOneAsync($"select system_value from variable where system_type = 'project_name'"); var isTable = await backendRepository.GetOneAsync($"select table_name from information_schema.tables where table_name = '{table}' and table_schema = '{schema.Split('/')[0]}'"); if (string.IsNullOrEmpty(isTable)) //check for has table or not @@ -307,9 +307,9 @@ namespace FrontendWebApi.ApiControllers left join ( select device_number, {sqlAvgRawData} from {table} - where start_timestamp >= {aemmStaDate} and end_timestamp < {aemmEndDate} and point = 'RCV' {buildingSql} + where start_timestamp >= @startTime and end_timestamp < @endTime and point = 'RCV' {buildingSql} {sqlWhere} {sqlGroup} - ) aemm on aemm.start_timestamp >= fd.date and aemm.end_timestamp < DATE_ADD(fd.date, INTERVAL +1 {input.tableType}) and aemm.device_number = fd.device_number + ) aemm on aemm.start_timestamp >= {aemmStaDate} and aemm.end_timestamp < {aemmEndDate} and aemm.device_number = fd.device_number order by fd.device_number, fd.date"; var rawData = await backendRepository.GetAllAsync(sql, diff --git a/FrontendWebApi/appsettings.Development.json b/FrontendWebApi/appsettings.Development.json index 43c8565..f976969 100644 --- a/FrontendWebApi/appsettings.Development.json +++ b/FrontendWebApi/appsettings.Development.json @@ -17,8 +17,8 @@ "Server": "FYlY+w0XDIz+jmF2rlZWJw==", //0.201 "Port": "js2LutKe+rdjzdxMPQUrvQ==", //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 - "Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp - //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome + //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp + "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 65271e6..6f6b1c5 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -581,14 +581,12 @@ namespace Repository.BackendRepository.Implement #region insert building_menu if (bm.Count == 0) { - sb.Append(@"insert building_menu(building_tag, main_system_tag, sub_system_tag, device_building_tag, device_system_tag, + sb.Append(@$"insert building_menu(building_tag, main_system_tag, sub_system_tag, device_building_tag, device_system_tag, + left_drawing, left_icon_click, left_icon_click_url_width, left_icon_click_url_height, left_planimetric_click, is_link, created_by, created_at, updated_by, updated_at) - VALUES ('" + data.device_building_tag + "', '" + - data.device_system_tag + "', '" + - data.device_name_tag + "', '" + - data.device_building_tag + "', '" + - data.device_system_tag + "', " + - "1, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now(), 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now() );"); + values('{data.device_building_tag}', '{data.device_system_tag}', '{data.device_name_tag}', '{data.device_building_tag}', '{data.device_system_tag}', + 2, 0, 0, 0, 1 + 1, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now(), 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now());"); } #endregion } @@ -772,7 +770,7 @@ namespace Repository.BackendRepository.Implement sb.Append("update device d inner JOIN import_niagara_tag m ON m.niagara_tags = d.device_number " + "set d.full_name=m.device_full_name " + "where m.device_full_name<>d.full_name;"); - await conn.ExecuteAsync(sb.ToString(), commandTimeout: 200); + await conn.ExecuteAsync(sb.ToString(), commandTimeout: 999); } catch (Exception exception) {