diff --git a/Backend/Controllers/BuildMenuController.cs b/Backend/Controllers/BuildMenuController.cs index ff1db9e..22bdc87 100644 --- a/Backend/Controllers/BuildMenuController.cs +++ b/Backend/Controllers/BuildMenuController.cs @@ -29,7 +29,7 @@ namespace Backend.Controllers try { - var sqlString = @$"select building_guid as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0 ORDER BY A.priority ASC, A.created_at DESC"; + var sqlString = @$"select building_guid as Value, full_name as Name from building a where a.deleted = 0 and a.status = 0 ORDER BY a.priority ASC, a.created_at DESC"; KeyValue = await backendRepository.GetAllAsync(sqlString); apiResult.Code = "0000"; diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index c4f5519..dd73776 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -179,7 +179,7 @@ namespace Backend.Controllers dk.device_close_flashing, dk.device_error_flashing, (SELECT - STRING_AGG( ISNULL(system_key, ' '), ',') + GROUP_CONCAT( IFNULL(system_key, ' '), ',') FROM device_disaster dd JOIN variable v ON v.deleted = 0 AND v.system_type = 'disaster' AND v.system_value = dd.device_system_value WHERE dd.device_guid = d.device_guid @@ -805,7 +805,7 @@ namespace Backend.Controllers try { - var rawDatas = await backendRepository.GetAllAsync("device_import_ckeck_temp", "is_correct = 1 ORDER BY 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(); @@ -871,37 +871,34 @@ namespace Backend.Controllers try { - string sql = @"SELECT - di.device_building_tag, - di.device_system_tag, - di.device_floor_tag, - di.device_name_tag, - di.device_serial_tag, - di.device_number, - di.device_system_category_layer3, - STRING_AGG( ISNULL(v.system_value, ' '), ',') AS Device_disasters, - STRING_AGG( ISNULL(v.system_key, ' '), ',') AS Device_disaster_type_text - FROM - (SELECT - * - FROM device_import_ckeck_temp di - WHERE device_building_tag = @Device_building_tag - AND device_system_tag = @Device_system_tag - AND device_floor_tag = @Device_floor_tag - AND device_name_tag = @Device_name_tag - AND is_correct = 1 - AND device_number NOT IN (SELECT d.device_number FROM device d WHERE d.deleted = 0) - ) di - CROSS APPLY STRING_SPLIT(di.device_disaster, ',') dd - LEFT JOIN variable v ON v.system_type = 'disaster' AND v.system_value = dd.value - GROUP BY di.device_building_tag, - di.device_system_tag, - di.device_floor_tag, - di.device_name_tag, - di.device_serial_tag, - di.device_number, - di.device_system_category_layer3"; - + string sql = @"SELECT + di.device_building_tag, + di.device_system_tag, + di.device_floor_tag, + di.device_last_name_tag as device_name_tag, + di.device_serial_tag, + 0 as device_disaster, + di.niagara_tags as device_number + FROM + ( + SELECT + * + FROM + import_niagara_tag intag + WHERE + device_building_tag = @Device_building_tag + AND device_system_tag = @Device_system_tag + AND device_floor_tag = @Device_floor_tag + AND device_name_tag = @Device_name_tag + AND convert(intag.niagara_tags, nchar) NOT IN ( SELECT convert(d.device_number, nchar) FROM device d WHERE d.deleted = 0 ) + ) di + GROUP BY + di.device_building_tag, + di.device_system_tag, + di.device_floor_tag, + di.device_last_name_tag, + di.device_serial_tag, + di.niagara_tags"; var deviceImports = await backendRepository.GetAllAsync(sql, post); diff --git a/Backend/Views/BuildMenu/Index.cshtml b/Backend/Views/BuildMenu/Index.cshtml index 3fabb76..9aee64f 100644 --- a/Backend/Views/BuildMenu/Index.cshtml +++ b/Backend/Views/BuildMenu/Index.cshtml @@ -131,103 +131,246 @@ -
- -
-
- - -
-
- - -
- -
-
-
-
- - -
-
-
- - -
-
- - @*
+ +
+ +
+ +
+ +
- -
- -
+ +
+ + +
+
+ + +
+
+
+
+
+ + +
+
+
+ + +
+
+ + +
+
+ + @*
+
+ + +
+
+ + +
*@ -
-