From b6e5c470ee8f5150cb473ec5cb1dcfd438502f69 Mon Sep 17 00:00:00 2001 From: dev01 Date: Tue, 25 Oct 2022 17:17:32 +0800 Subject: [PATCH] =?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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +