From b6e5c470ee8f5150cb473ec5cb1dcfd438502f69 Mon Sep 17 00:00:00 2001 From: dev01 Date: Tue, 25 Oct 2022 17:17:32 +0800 Subject: [PATCH 01/11] =?UTF-8?q?[=E5=BE=8C=E5=8F=B0]=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=88=AA=E9=99=A4=E8=A8=AD=E5=82=99=E7=A8=8B=E5=BA=8F=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/DeviceManageController.cs | 32 +- Backend/Views/DeviceManage/Index.cshtml | 6 +- .../c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg | 3016 +++++++++++++++++ 3 files changed, 3037 insertions(+), 17 deletions(-) create mode 100644 Backend/wwwroot/upload/floor_map/c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index ac5a17d..6240ac4 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -345,12 +345,14 @@ namespace Backend.Controllers var guid = Guid.NewGuid(); var split = device.Device_number.Split('_'); - var device_building_tag = !string.IsNullOrEmpty(split[0]) ? split[0] : ""; - var device_system_tag = !string.IsNullOrEmpty(split[1]) ? split[1] : ""; - var device_floor_tag = !string.IsNullOrEmpty(split[2]) ? split[2] : ""; - var device_name_tag = !string.IsNullOrEmpty(split[3]) ? split[3] : ""; - var device_serial_tag = !string.IsNullOrEmpty(split[4]) ? split[4] : ""; - string device_master = null; + var device_area_tag = !string.IsNullOrEmpty(split[0]) ? split[0] : ""; + var device_building_tag = !string.IsNullOrEmpty(post.Building_tag) ? post.Building_tag : ""; + var device_system_tag = !string.IsNullOrEmpty(post.Main_system_tag) ? post.Main_system_tag : ""; + var device_name_tag = !string.IsNullOrEmpty(post.Sub_system_tag) ? post.Sub_system_tag : ""; + var device_floor_tag = !string.IsNullOrEmpty(post.Floor_tag) ? post.Floor_tag : ""; + var device_last_name = !string.IsNullOrEmpty(split[6]) ? split[6] : ""; + var device_serial_tag = !string.IsNullOrEmpty(split[7]) ? split[7] : ""; + string device_master = "NA"; //針對燈具加入master if (device.Device_system_category_layer3 == "L1" || device.Device_system_category_layer3 == "L2") @@ -361,12 +363,13 @@ namespace Backend.Controllers Dictionary deviceDic = new Dictionary() { { "@device_guid", guid}, - { "@full_name", device_name_tag + device_serial_tag}, + { "@device_area_tag", device_area_tag}, { "@device_building_tag", device_building_tag}, { "@device_system_tag", device_system_tag}, { "@device_floor_tag", device_floor_tag}, { "@device_name_tag", device_name_tag}, { "@device_serial_tag", device_serial_tag}, + { "@device_last_name", device_last_name}, { "@device_master", device_master}, { "@device_number", device.Device_number}, { "@device_system_category_layer3", device.Device_system_category_layer3}, @@ -1255,9 +1258,9 @@ namespace Backend.Controllers private async Task ResetDeviceGroup() { //先刪除整個device_group - var delete_group_sql = @"DROP TABLE IF EXISTS `device_group` ; + var delete_group_sql = @"DROP TABLE IF EXISTS `device_group` ; CREATE TABLE `device_group` ( - `id` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, `device_disaster` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '災類', `device_building_tag` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備東別guid', `device_floor_guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備樓層guid', @@ -1274,13 +1277,14 @@ namespace Backend.Controllers INSERT INTO device_group (device_disaster, device_building_tag, device_floor_guid, device_system_category_layer2, device_system_category_layer3, device_amount) SELECT dd.device_system_value AS device_disaster, - d.building_tag AS device_building_tag, - d.floor_guid AS device_floor_guid, + d.device_building_tag AS device_building_tag, + f.floor_guid AS device_floor_guid, vv.device_system_category_layer2 AS device_system_category_layer2, d.device_system_category_layer3 AS device_system_category_layer3, count(*) AS device_amount FROM device d JOIN device_disaster dd ON d.device_guid = dd.device_guid + JOIN floor f ON d.device_floor_tag = f.full_name JOIN (SELECT v.system_value AS device_system_category_layer3, v2.system_value AS device_system_category_layer2 @@ -1290,8 +1294,8 @@ namespace Backend.Controllers ) vv ON d.device_system_category_layer3 = vv.device_system_category_layer3 WHERE d.deleted = 0 GROUP BY dd.device_system_value, - d.building_tag, - d.floor_guid, + d.device_building_tag, + f.floor_guid, vv.device_system_category_layer2, d.device_system_category_layer3"; @@ -1317,7 +1321,7 @@ namespace Backend.Controllers deviceGroupsDics.Add(deviceGroupDic); } - await backendRepository.ManualInsertBackgroundServiceTask("", "", "device_group", "purge_all_insert", deviceGroupsDics); + #endregion } diff --git a/Backend/Views/DeviceManage/Index.cshtml b/Backend/Views/DeviceManage/Index.cshtml index 41a5bb0..73243f6 100644 --- a/Backend/Views/DeviceManage/Index.cshtml +++ b/Backend/Views/DeviceManage/Index.cshtml @@ -166,7 +166,7 @@
- 區域 + 棟別
@@ -1545,7 +1545,6 @@ return; } else { - device_kind_data = rel.data; //取得單一設備基本資料 @@ -2571,7 +2570,7 @@ //#region 變更新增設備基本資料modal的過濾條件 function ChangeDeviceImportPanel(building_tag, system_tag = "", floor_tag = "") { if (building_tag == undefined && building_tag == null || building_tag == "") { - toast_warning("請先選擇區域"); + toast_warning("請先選擇棟別"); return; } @@ -2734,6 +2733,7 @@ var formData = new FormData(); + formData.append("Building_tag", selectedBuilding_tag); formData.append("Main_system_tag", selectedMain_system_tag); formData.append("Sub_system_tag", selectedSub_system_tag); formData.append("Floor_tag", selectedFloor_tag); diff --git a/Backend/wwwroot/upload/floor_map/c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg b/Backend/wwwroot/upload/floor_map/c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg new file mode 100644 index 0000000..38360db --- /dev/null +++ b/Backend/wwwroot/upload/floor_map/c0de2199-e62b-4f82-b7f7-abacd4e1cd17.svg @@ -0,0 +1,3016 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d9d0b520fcfb9570a6d214be04a19778395bbcec Mon Sep 17 00:00:00 2001 From: dev02 Date: Wed, 26 Oct 2022 09:59:36 +0800 Subject: [PATCH 02/11] =?UTF-8?q?[=E5=BE=8C=E5=8F=B0]=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=88=A4=E6=96=B7=E6=98=AF=E5=90=A6=E6=9C=893d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/BuildMenuController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Backend/Controllers/BuildMenuController.cs b/Backend/Controllers/BuildMenuController.cs index 2abdac1..6c02e75 100644 --- a/Backend/Controllers/BuildMenuController.cs +++ b/Backend/Controllers/BuildMenuController.cs @@ -646,7 +646,7 @@ namespace Backend.Controllers { var sqlString = @$"select v.id from building b - join variable v on v.system_type = @system_type and system_key = N'是否有3D' and v.deleted = 0 + join variable v on v.system_type = @system_type and system_key = N'是否有3D' and system_value = 'Y' and v.deleted = 0 where b.building_tag = @building_tag and (b.orgName_3D + b.saveName_3D) is not null;"; KeyValue = await backendRepository.GetAllAsync(sqlString, new { building_tag = post.building_tag, system_type = system_setting_type }); From fe063b181c009e08326333ce3b80aa6f03f2b31d Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 26 Oct 2022 10:04:44 +0800 Subject: [PATCH 03/11] =?UTF-8?q?[Layout]=20=E7=B7=8A=E6=80=A5=E6=87=89?= =?UTF-8?q?=E8=AE=8A=E8=A8=AD=E5=82=99=20=E9=9A=B1=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Views/Shared/_Layout.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Backend/Views/Shared/_Layout.cshtml b/Backend/Views/Shared/_Layout.cshtml index 4e574ef..47f35ad 100644 --- a/Backend/Views/Shared/_Layout.cshtml +++ b/Backend/Views/Shared/_Layout.cshtml @@ -139,7 +139,7 @@ } - @if (ViewBag.role.Contains("EmergencySettingIndex") + @*@if (ViewBag.role.Contains("EmergencySettingIndex") || ViewBag.role.Contains("EmergencyGroupingIndex") || ViewBag.role.Contains("RescueDeviceFireExtinguisher") || ViewBag.role.Contains("RescueDeviceAED")) @@ -184,7 +184,7 @@ } - } + }*@ @*@if (ViewBag.role.Contains("EmergencyDeviceMenuIndex") || ViewBag.role.Contains("EmergencyContactIndex") From d0cfbe6186c7f2a5c01cb0fdb0c1f3c60fc52979 Mon Sep 17 00:00:00 2001 From: "Darren.NET" Date: Wed, 26 Oct 2022 10:31:16 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E7=A7=BB=E9=99=A4AlarmMonitorWorkerServi?= =?UTF-8?q?ce=E3=80=81Frontend=E3=80=81FrontendWorkerService=E4=B8=89?= =?UTF-8?q?=E5=80=8B=E5=B0=88=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- slnBIMS.sln | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/slnBIMS.sln b/slnBIMS.sln index 7946e66..617496a 100644 --- a/slnBIMS.sln +++ b/slnBIMS.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.31702.278 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32929.385 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendWebApi", "FrontendWebApi\FrontendWebApi.csproj", "{E70B0F92-8E08-4BD5-9CEC-95A2ABC5071F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Frontend", "Frontend\Frontend.csproj", "{4B65CA2A-AB4B-4113-B0E8-486828B07506}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Repository", "Repository\Repository.csproj", "{AE535279-C120-4DC7-AC07-5DB3C618F58C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backend", "Backend\Backend.csproj", "{C0B93B4D-F0AF-4C80-ABF9-5C984425749C}" @@ -15,10 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BackendWorkerService", "Bac EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "z01_WinAPP", "z01_WinAPP\z01_WinAPP.csproj", "{28AC1ECB-436F-4AB8-91A0-1DC9A33708B2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FrontendWorkerService", "FrontendWorkerService\FrontendWorkerService.csproj", "{7B02C712-3283-4948-8713-E341D61FF532}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AlarmMonitorWorkerService", "AlarmMonitorWorkerService\AlarmMonitorWorkerService.csproj", "{24404D5B-C372-41E1-A454-757A06E73CE9}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,10 +23,6 @@ Global {E70B0F92-8E08-4BD5-9CEC-95A2ABC5071F}.Debug|Any CPU.Build.0 = Debug|Any CPU {E70B0F92-8E08-4BD5-9CEC-95A2ABC5071F}.Release|Any CPU.ActiveCfg = Release|Any CPU {E70B0F92-8E08-4BD5-9CEC-95A2ABC5071F}.Release|Any CPU.Build.0 = Release|Any CPU - {4B65CA2A-AB4B-4113-B0E8-486828B07506}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B65CA2A-AB4B-4113-B0E8-486828B07506}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B65CA2A-AB4B-4113-B0E8-486828B07506}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B65CA2A-AB4B-4113-B0E8-486828B07506}.Release|Any CPU.Build.0 = Release|Any CPU {AE535279-C120-4DC7-AC07-5DB3C618F58C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE535279-C120-4DC7-AC07-5DB3C618F58C}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE535279-C120-4DC7-AC07-5DB3C618F58C}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -49,14 +39,6 @@ Global {28AC1ECB-436F-4AB8-91A0-1DC9A33708B2}.Debug|Any CPU.Build.0 = Debug|Any CPU {28AC1ECB-436F-4AB8-91A0-1DC9A33708B2}.Release|Any CPU.ActiveCfg = Release|Any CPU {28AC1ECB-436F-4AB8-91A0-1DC9A33708B2}.Release|Any CPU.Build.0 = Release|Any CPU - {7B02C712-3283-4948-8713-E341D61FF532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7B02C712-3283-4948-8713-E341D61FF532}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B02C712-3283-4948-8713-E341D61FF532}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B02C712-3283-4948-8713-E341D61FF532}.Release|Any CPU.Build.0 = Release|Any CPU - {24404D5B-C372-41E1-A454-757A06E73CE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {24404D5B-C372-41E1-A454-757A06E73CE9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {24404D5B-C372-41E1-A454-757A06E73CE9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {24404D5B-C372-41E1-A454-757A06E73CE9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From fc884ddb61896bdec386f16dbf532e52f08f8ef6 Mon Sep 17 00:00:00 2001 From: dev01 Date: Wed, 26 Oct 2022 15:42:56 +0800 Subject: [PATCH 05/11] =?UTF-8?q?[=E8=A8=AD=E5=82=99=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E8=A8=AD=E5=82=99=E5=9F=BA=E6=9C=AC=E8=B3=87=E6=96=99]=20?= =?UTF-8?q?=E8=A8=AD=E5=82=99=E7=A8=AE=E9=A1=9E=E6=96=B0=E5=A2=9E=E5=8F=8A?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A8=8B=E5=BA=8F=E8=AA=BF=E6=95=B4=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/Controllers/DeviceManageController.cs | 179 +++++++++++++----- Backend/Views/BuildMenu/Index.cshtml | 18 +- Backend/Views/DeviceManage/Index.cshtml | 14 +- .../bcd7cd96-1dbc-4727-a578-ac712b0e9af8.jpg | Bin 0 -> 20441 bytes 4 files changed, 147 insertions(+), 64 deletions(-) create mode 100644 Backend/wwwroot/upload/device_icon/bcd7cd96-1dbc-4727-a578-ac712b0e9af8.jpg diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index 6240ac4..2f9aca4 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -200,9 +200,10 @@ namespace Backend.Controllers JOIN floor f ON d.device_floor_tag = f.full_name AND d.device_building_tag = f.building_tag LEFT JOIN device_kind dk ON dk.device_building_tag = d.device_building_tag AND dk.device_system_tag = d.device_system_tag AND dk.device_name_tag = d.device_name_tag ORDER BY d.priority ASC, d.device_number ASC"; - - var devices = await backendRepository.GetAllAsync(sql, new { - building_tag = post.building_tag, + + var devices = await backendRepository.GetAllAsync(sql, new + { + building_tag = post.building_tag, main_system_tag = post.device_system_tag, sub_system_tag = post.device_name_tag, floor_tag = post.device_floor_tag, @@ -269,7 +270,7 @@ namespace Backend.Controllers JOIN floor f ON d.device_floor_tag = f.full_name "; - object param = new { Deleted = 0, Device_guid = guid ,main_system_type = main_system_type , sub_system_type = sub_system_type }; + object param = new { Deleted = 0, Device_guid = guid, main_system_type = main_system_type, sub_system_type = sub_system_type }; var device = await backendRepository.GetOneAsync(sql, param); @@ -333,7 +334,7 @@ namespace Backend.Controllers { List> deviceDics = new List>(); List> device_disaster_dicts = new List>(); - + PostDeviceKind postDeviceKind = new PostDeviceKind(); using (var reader = new StreamReader(post.SelectedDevicesFile.OpenReadStream())) { string content = reader.ReadToEnd(); @@ -376,6 +377,14 @@ namespace Backend.Controllers { "@created_by", myUserInfo.Userinfo_guid}, }; + postDeviceKind = new PostDeviceKind() + { + Device_building_tag = device_building_tag, + Device_system_tag = device_system_tag, + Device_floor_tag = device_floor_tag, + Device_name_tag = device_name_tag, + }; + deviceDics.Add(deviceDic); if (device.Device_disasters != null) @@ -405,6 +414,8 @@ namespace Backend.Controllers await ResetDeviceGroup(); //重新寫入設備群組 + await AddDeviceKind(postDeviceKind); + apiResult.Code = "0000"; apiResult.Msg = "修改成功"; @@ -807,7 +818,7 @@ namespace Backend.Controllers try { - var rawDatas = await backendRepository.GetAllAsync("import_niagara_tag", null,null,"device_building_tag, device_system_tag, device_floor_tag, device_name_tag"); + var rawDatas = await backendRepository.GetAllAsync("import_niagara_tag", null, null, "device_building_tag, device_system_tag, device_floor_tag, device_name_tag"); var rawDatas_Group_Building_tag = rawDatas.GroupBy(x => x.Device_building_tag).ToList(); List tempFilters = new List(); @@ -966,8 +977,8 @@ namespace Backend.Controllers FROM device d WHERE d.device_building_tag = @building_tag - AND d.device_system_tag = @main_system_tag - AND d.device_name_tag = @sub_system_tag + AND d.device_system_tag = @device_system_tag + AND d.device_name_tag = @device_name_tag -- AND d.floor_guid = @Floor_tag AND d.deleted = 0 ) d @@ -1028,6 +1039,70 @@ namespace Backend.Controllers return apiResult; } + + public async Task AddDeviceKind(PostDeviceKind post) + { + + string sWhere = @$"device_building_tag = @building_tag and device_system_tag = @system_tag and device_name_tag = @name_tag"; + + object param = new { building_tag = post.Device_building_tag, system_tag = post.Device_system_tag, name_tag = post.Device_name_tag }; + + var deviceKind = await backendRepository.GetOneAsync("device_kind", sWhere, param); + + if (deviceKind == null) + { + //新增 + //產生一組GUID + var guid = Guid.NewGuid(); + + //抓出點位名稱 + //var point_name = new PointName(); + + //var sql_device_normal_point = @"SELECT n.points AS device_normal_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_id = @device_normal_point_guid) n"; + //point_name.Device_normal_point_name = await backendRepository.GetOneAsync(sql_device_normal_point, new { device_normal_point_guid = post.Device_normal_point_guid }); + + //var sql_device_close_point = @"SELECT c.points AS device_close_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_close_point_guid) c"; + //point_name.Device_close_point_name = await backendRepository.GetOneAsync(sql_device_close_point, new { device_close_point_guid = post.Device_close_point_guid }); + + //var sql_device_error_point = @"SELECT e.points AS device_error_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_error_point_guid) e"; + //point_name.Device_error_point_name = await backendRepository.GetOneAsync(sql_device_error_point, new { device_error_point_guid = post.Device_error_point_guid }); + + Dictionary deviceKindDic = new Dictionary() + { + { "@device_kind_guid", guid}, + { "@device_building_tag", post.Device_building_tag}, + { "@device_system_tag", post.Device_system_tag}, + //{ "@device_floor_tag", post.Device_floor_tag}, + { "@device_name_tag", post.Device_name_tag}, + { "@device_image", null }, + { "@device_normal_text", post.Device_normal_text}, + { "@device_normal_point_guid", post.Device_normal_point_guid}, + { "@device_normal_point_name", null}, + { "@device_normal_point_col", post.Device_normal_point_col}, + { "@device_normal_point_value", post.Device_normal_point_value}, + { "@device_normal_color", post.Device_normal_color}, + { "@device_normal_flashing", post.Device_normal_flashing}, + { "@device_close_text", post.Device_close_text}, + { "@device_close_point_guid", post.Device_close_point_guid}, + { "@device_close_point_name", null}, + { "@device_close_point_col", post.Device_close_point_col}, + { "@device_close_point_value", post.Device_close_point_value}, + { "@device_close_color", post.Device_close_color}, + { "@device_close_flashing", post.Device_close_flashing}, + { "@device_error_text", post.Device_error_text}, + { "@device_error_point_guid", post.Device_error_point_guid}, + { "@device_error_point_name", null}, + { "@device_error_point_col", post.Device_error_point_col}, + { "@device_error_point_value", post.Device_error_point_value}, + { "@device_error_color", post.Device_error_color}, + { "@device_error_flashing", post.Device_error_flashing}, + { "@device_error_independent", post.Device_error_independent}, + { "@created_by", myUserInfo.Userinfo_guid} + }; + await backendRepository.AddOneByCustomTable(deviceKindDic, "device_kind"); + } + } + /// /// 修改 設備基本資料 /// @@ -1065,14 +1140,14 @@ namespace Backend.Controllers //抓出點位名稱 var point_name = new PointName(); - var sql_device_normal_point = @"SELECT n.points AS device_normal_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_normal_point_guid) n"; - point_name.Device_normal_point_name = await backendRepository.GetOneAsync(sql_device_normal_point, new { device_normal_point_guid = post.Device_normal_point_guid }); + var sql_device_normal_point = @"SELECT n.points AS device_normal_point_name FROM (SELECT * FROM device_item di WHERE di.id = @device_normal_point_id) n"; + point_name.Device_normal_point_name = await backendRepository.GetOneAsync(sql_device_normal_point, new { device_normal_point_id = post.Device_normal_point_guid }); - var sql_device_close_point = @"SELECT c.points AS device_close_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_close_point_guid) c"; - point_name.Device_close_point_name = await backendRepository.GetOneAsync(sql_device_close_point, new { device_close_point_guid = post.Device_close_point_guid }); + var sql_device_close_point = @"SELECT c.points AS device_close_point_name FROM (SELECT * FROM device_item di WHERE di.id = @device_close_point_id) c"; + point_name.Device_close_point_name = await backendRepository.GetOneAsync(sql_device_close_point, new { device_close_point_id = post.Device_close_point_guid }); - var sql_device_error_point = @"SELECT e.points AS device_error_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_error_point_guid) e"; - point_name.Device_error_point_name = await backendRepository.GetOneAsync(sql_device_error_point, new { device_error_point_guid = post.Device_error_point_guid }); + var sql_device_error_point = @"SELECT e.points AS device_error_point_name FROM (SELECT * FROM device_item di WHERE di.id = @device_error_point_id) e"; + point_name.Device_error_point_name = await backendRepository.GetOneAsync(sql_device_error_point, new { device_error_point_id = post.Device_error_point_guid }); Dictionary deviceKindDic = new Dictionary() { @@ -1122,23 +1197,23 @@ namespace Backend.Controllers } #region 新增至派送資料表 - List fileInfos = new List(); - if (post.Device_image_file != null) - { - var split = post.Device_image_file.FileName.Split("."); - var fileName = guid + "." + split[split.Length - 1]; + //List fileInfos = new List(); + //if (post.Device_image_file != null) + //{ + // var split = post.Device_image_file.FileName.Split("."); + // var fileName = guid + "." + split[split.Length - 1]; - var fullPath = Path.Combine(deviceKindFileSaveAsPath, fileName); + // var fullPath = Path.Combine(deviceKindFileSaveAsPath, fileName); - Repository.Models.FileInfo fileInfo = new Repository.Models.FileInfo(); - fileInfo.Folder = "device_icon"; - fileInfo.OriginalFileName = null; - fileInfo.FileName = fileName; - fileInfo.File = fullPath; + // Repository.Models.FileInfo fileInfo = new Repository.Models.FileInfo(); + // fileInfo.Folder = "device_icon"; + // fileInfo.OriginalFileName = null; + // fileInfo.FileName = fileName; + // fileInfo.File = fullPath; - fileInfos.Add(fileInfo); - await backendRepository.ManualInsertFileBackgroundServiceTask("", "", "device_kind", fileInfos); - } + // fileInfos.Add(fileInfo); + // await backendRepository.ManualInsertFileBackgroundServiceTask("", "", "device_kind", fileInfos); + //} #endregion apiResult.Code = "0000"; @@ -1163,14 +1238,14 @@ namespace Backend.Controllers //抓出點位名稱 var point_name = new PointName(); - var sql_device_normal_point = @"SELECT n.points AS device_normal_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_normal_point_guid) n"; - point_name.Device_normal_point_name = await backendRepository.GetOneAsync(sql_device_normal_point, new { device_normal_point_guid = post.Device_normal_point_guid }); + var sql_device_normal_point = @"SELECT n.points AS device_normal_point_name FROM (SELECT * FROM device_item di WHERE di.id = @device_normal_point_id) n"; + point_name.Device_normal_point_name = await backendRepository.GetOneAsync(sql_device_normal_point, new { device_normal_point_id = post.Device_normal_point_guid }); - var sql_device_close_point = @"SELECT c.points AS device_close_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_close_point_guid) c"; - point_name.Device_close_point_name = await backendRepository.GetOneAsync(sql_device_close_point, new { device_close_point_guid = post.Device_close_point_guid }); + var sql_device_close_point = @"SELECT c.points AS device_close_point_name FROM (SELECT * FROM device_item di WHERE di.id = @device_close_point_id) c"; + point_name.Device_close_point_name = await backendRepository.GetOneAsync(sql_device_close_point, new { device_close_point_id = post.Device_close_point_guid }); - var sql_device_error_point = @"SELECT e.points AS device_error_point_name FROM (SELECT * FROM device_item di WHERE di.device_item_guid = @device_error_point_guid) e"; - point_name.Device_error_point_name = await backendRepository.GetOneAsync(sql_device_error_point, new { device_error_point_guid = post.Device_error_point_guid }); + var sql_device_error_point = @"SELECT e.points AS device_error_point_name FROM (SELECT * FROM device_item di WHERE di.id = @device_error_point_id) e"; + point_name.Device_error_point_name = await backendRepository.GetOneAsync(sql_device_error_point, new { device_error_point_id = post.Device_error_point_guid }); Dictionary deviceKindDic = new Dictionary() { @@ -1220,23 +1295,23 @@ namespace Backend.Controllers } #region 新增至派送資料表 - List fileInfos = new List(); - if (post.Device_image_file != null) - { - var split = post.Device_image_file.FileName.Split("."); - var fileName = image_guid + "." + split[split.Length - 1]; + //List fileInfos = new List(); + //if (post.Device_image_file != null) + //{ + // var split = post.Device_image_file.FileName.Split("."); + // var fileName = image_guid + "." + split[split.Length - 1]; - var fullPath = Path.Combine(deviceKindFileSaveAsPath, fileName); + // var fullPath = Path.Combine(deviceKindFileSaveAsPath, fileName); - Repository.Models.FileInfo fileInfo = new Repository.Models.FileInfo(); - fileInfo.Folder = "device_icon"; - fileInfo.OriginalFileName = deviceKind.Device_image; - fileInfo.FileName = fileName; - fileInfo.File = fullPath; + // Repository.Models.FileInfo fileInfo = new Repository.Models.FileInfo(); + // fileInfo.Folder = "device_icon"; + // fileInfo.OriginalFileName = deviceKind.Device_image; + // fileInfo.FileName = fileName; + // fileInfo.File = fullPath; - fileInfos.Add(fileInfo); - await backendRepository.ManualInsertFileBackgroundServiceTask("", "", "device_kind", fileInfos); - } + // fileInfos.Add(fileInfo); + // await backendRepository.ManualInsertFileBackgroundServiceTask("", "", "device_kind", fileInfos); + //} #endregion apiResult.Code = "0000"; @@ -1321,7 +1396,7 @@ namespace Backend.Controllers deviceGroupsDics.Add(deviceGroupDic); } - + #endregion } @@ -1390,7 +1465,7 @@ namespace Backend.Controllers { string sWhere = "device_master_guid = @Device_master_guid"; - object param = new {Device_master_guid = guid }; + object param = new { Device_master_guid = guid }; var deviceMaster = await backendRepository.GetOneAsync("device_master", sWhere, param); @@ -1442,7 +1517,7 @@ namespace Backend.Controllers } string temp_device_master_number = null; - if (!string.IsNullOrEmpty( post.Device_building_tag) && !string.IsNullOrEmpty(post.Device_name_tag)) + if (!string.IsNullOrEmpty(post.Device_building_tag) && !string.IsNullOrEmpty(post.Device_name_tag)) { temp_device_master_number = post.Device_building_tag + "_" + post.Device_name_tag; } @@ -1585,7 +1660,7 @@ namespace Backend.Controllers try { - string sWhere = "deleted = 0 AND sub_system_tag = @Sub_system_tag"; + string sWhere = "deleted = 0 AND device_name_tag = @Sub_system_tag"; object param = new { Sub_system_tag = sub_system_tag }; diff --git a/Backend/Views/BuildMenu/Index.cshtml b/Backend/Views/BuildMenu/Index.cshtml index 55f2e9c..625704e 100644 --- a/Backend/Views/BuildMenu/Index.cshtml +++ b/Backend/Views/BuildMenu/Index.cshtml @@ -175,8 +175,8 @@
-
-
+
+
@@ -263,7 +263,13 @@
- + + +
+
+ @@ -294,7 +300,7 @@
-
+
@@ -973,7 +979,7 @@ $(drawingParent).find('[id^=build_menu_icon_click_url_width_height_modal_div]').hide(); $(drawingParent).find('[id^=build_menu_planimetric_floor_modal_div]').hide(); $(drawingParent).find('[id^=build_menu_systemurl_modal_div]').hide(); - + $(drawingParent).find('[id^=build_menu_planimetric_modal_div]').show(); if ($(value).val() == 2) { $(drawingParent).find('[id^=planimetric_click]').attr("disabled", false); $(drawingParent).find('[id^=build_menu_systemurl_modal_div]').show(); @@ -992,6 +998,8 @@ $(drawingParent).find('[id^=build_menu_blankurl_modal_div]').show(); } else if ($(value).val() == 3) { $(drawingParent).find('[id^=planimetric_click]').prop("checked", false).attr("disabled", true); + } else { + $(drawingParent).find('[id^=build_menu_planimetric_modal_div]').hide(); } }) diff --git a/Backend/Views/DeviceManage/Index.cshtml b/Backend/Views/DeviceManage/Index.cshtml index 73243f6..2b97f38 100644 --- a/Backend/Views/DeviceManage/Index.cshtml +++ b/Backend/Views/DeviceManage/Index.cshtml @@ -1494,10 +1494,10 @@ "url": "/DeviceManage/DeviceKindTableList", "type": "POST", "data": function (d) { - d.Building_tag = selected_building_menu.building_tag ? selected_building_menu.building_tag : ""; - d.Main_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : ""; - d.Sub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : ""; - d.Floor_tag = selected_floor_tag ? selected_floor_tag : ""; + d.building_tag = selected_building_menu.building_tag ? selected_building_menu.building_tag : ""; + d.device_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.main_system_tag : ""; + d.device_name_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : ""; + //d.Floor_tag = selected_floor_tag ? selected_floor_tag : ""; }, "dataSrc": function (rel) { if (rel.code == "9999") { @@ -1574,9 +1574,9 @@ $("#device_close_point_name_modal").append($("