diff --git a/Backend/Controllers/BuildMenuController.cs b/Backend/Controllers/BuildMenuController.cs index fd9fd32..dcdac30 100644 --- a/Backend/Controllers/BuildMenuController.cs +++ b/Backend/Controllers/BuildMenuController.cs @@ -381,10 +381,10 @@ namespace Backend.Controllers case right_planimetric_click when 1 then '開' when 0 then '關' end right_planimetric_click_name, mv.system_key main_system_guid_name, sv.system_key sub_system_guid_name,lf.full_name left_floor_guid_name, rf.full_name right_floor_guid_name from building_menu bm - left join variable mv on bm.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.deleted = 0 - left join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0 - left join floor lf on lf.floor_guid = bm.left_planimetric_floor_guid - left join floor rf on rf.floor_guid = bm.right_planimetric_floor_guid + join variable mv on bm.main_system_tag = mv.system_value and mv.system_type = @main_system_type and mv.deleted = 0 + join variable sv on bm.sub_system_tag = sv.system_value and sv.system_type = @sub_system_type and sv.deleted = 0 + join floor lf on lf.floor_guid = bm.left_planimetric_floor_guid + join floor rf on rf.floor_guid = bm.right_planimetric_floor_guid where bm.building_tag = @building_tag and bm.main_system_tag in @MainList ORDER BY bm.priority, mv.system_priority ASC, sv.system_priority ASC, sv.created_at DESC ", new { building_tag = post.building_tag, MainList = post.MainList, main_system_type = main_system_type, sub_system_type = sub_system_type }); diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index 75f31b9..c7232dc 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -80,7 +80,7 @@ namespace Backend.Controllers f.floor_map_name, f.priority AS fPriority FROM sub_system_floor ssf - LEFT JOIN floor f ON ssf.floor_tag = f.full_name AND ssf.building_tag = f.building_tag AND f.deleted = 0 + JOIN floor f ON ssf.floor_tag = f.full_name AND ssf.building_tag = f.building_tag AND f.deleted = 0 WHERE ssf.deleted = 0 ORDER BY f.priority, f.created_at "; diff --git a/Backend/appsettings.Development.json b/Backend/appsettings.Development.json index 2c7281e..7704050 100644 --- a/Backend/appsettings.Development.json +++ b/Backend/appsettings.Development.json @@ -29,7 +29,7 @@ "Password": "FVAPxztxpY4gJJKQ/se4bQ==" }, "MSSqlDBConfig": { - "Server": "bJm+UAtbeaTjDmp/A5ep2w==", //0.130 + "Server": "bJm+UAtbeaTjDmp/A5ep2w21==", //0.130 "Port": "S5cUXKnKOacFtFy9+0dtpw==", "Database": "VvfWH/59gQguY2eA2xBCug==", //taipei_dome "Root": "4GCCJGAXzLa8ecdmPAkYKg==", diff --git a/Backend/wwwroot/upload/device_icon/c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg b/Backend/wwwroot/upload/device_icon/c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg new file mode 100644 index 0000000..c002f98 Binary files /dev/null and b/Backend/wwwroot/upload/device_icon/c3235d9e-ccbf-49b6-9349-d45eae02eef3.jpg differ diff --git a/FrontendWebApi/ApiControllers/AlarmRecordController.cs b/FrontendWebApi/ApiControllers/AlarmRecordController.cs index 5daf8be..9739835 100644 --- a/FrontendWebApi/ApiControllers/AlarmRecordController.cs +++ b/FrontendWebApi/ApiControllers/AlarmRecordController.cs @@ -60,9 +60,9 @@ namespace FrontendWebApi.ApiControllers JOIN userinfo u ON u.role_guid = ra.role_guid WHERE u.account = @Account AND ap.building_tag IS NOT NULL ) ap ON bm.building_tag = ap.building_tag - LEFT JOIN building b ON bm.building_tag = b.building_tag - left join variable v2 on ap.ShowView = v2.id and v2.deleted = 0 - left join variable v1 on v2.system_parent_id = v1.id + JOIN building b ON bm.building_tag = b.building_tag and b.deleted = 0 + join variable v2 on ap.ShowView = v2.id and v2.deleted = 0 + join variable v1 on v2.system_parent_id = v1.id GROUP BY b.building_tag, b.full_name, v1.system_value, v1.system_key"; var alarmRecordPanelRawDatas = await frontendRepository.GetAllAsync(sqlBuildingMain, new { Account = account }); diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 9ebc514..8a80b3f 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -1138,6 +1138,8 @@ namespace FrontendWebApi.ApiControllers order by b.priority, v1.system_priority, v2.system_priority, temp.priority;"; var device_item_infos = await frontendRepository.GetAllAsync(sqlDeviceItemInfo, new { Device_number = device_numbers }); + string tagQuantity = await frontendRepository.GetOneAsync("select system_value from variable where system_type = 'obixConfig' and system_key = 'tag_quantity' and deleted = 0;"); + string station = string.Empty; //轉換日期格式 var start = string.Format("{0}T00:00:00.000+08:00", post.Start_timestamp); @@ -1155,7 +1157,19 @@ namespace FrontendWebApi.ApiControllers { var device_number_point = historyItem.Device_number_point.Replace(":", "_"); - HttpWebRequest request = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/FIC_Center/{device_number_point}/~historyQuery/"); + if (tagQuantity.Equals("5")) + station = await frontendRepository.GetOneAsync($@"select parent_path from import_niagara_item_history + where device_building_tag = '{device_number_point.Split("_")[0]}' and device_floor_tag = '{device_number_point.Split("_")[2]}' + and device_name_tag = '{device_number_point.Split("_")[1]}' and device_point_name = '{device_number_point.Split("_")[5]}'"); + else + station = frontendRepository.GetOneAsync($@"select parent_path from import_niagara_item_history + where device_building_tag = '{device_number_point.Split("_")[1].Replace("$3", "")}' and + device_system_tag = '{device_number_point.Split("_")[2]}' and device_name_tag = '{device_number_point.Split("_")[3]}' + and device_floor_tag = '{device_number_point.Split("_")[4]}' and device_master_tag = '{device_number_point.Split("_")[5]}' + and device_last_name_tag = '{device_number_point.Split("_")[6]}' and device_serial_tag = '{device_number_point.Split("_")[7]}' + and device_point_name = '{device_number_point.Split("_")[8]}'").Result; + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create($"{obixApiConfig.ApiBase}obix/histories/{station}/{device_number_point.Replace("$3", "")}/~historyQuery/"); request.Method = "POST"; request.Headers.Add("Authorization", "Basic " + encoded); request.PreAuthenticate = true; diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 1cf2fc5..9e68d8d 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -630,7 +630,6 @@ namespace Repository.BackendRepository.Implement ON d.device_system_tag = m.device_system_tag AND d.device_name_tag = m.device_name_tag AND d.points = m.device_point_name - AND d.full_name = m.full_name SET d.is_link = CASE WHEN m.device_point_name IS NULL THEN 0 ELSE 1 END; "); @@ -652,7 +651,6 @@ namespace Repository.BackendRepository.Implement ON d.device_system_tag = subquery.device_system_tag AND d.device_name_tag = subquery.device_name_tag AND d.points = subquery.device_point_name - AND d.full_name = subquery.full_name SET d.is_show_history = CASE WHEN subquery.device_point_name IS NULL THEN 0 ELSE 1 END WHERE (d.is_show_history);");