[後端] 修改left join 問題, 修改同步deviceitem 判斷
[前端] 修改請求niagara history url 架構, 修改left join 問題
This commit is contained in:
parent
4c89e53542
commit
3b12a644de
@ -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 });
|
||||
|
@ -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
|
||||
";
|
||||
|
@ -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==",
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
@ -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<AlarmRecordPanelRawData>(sqlBuildingMain, new { Account = account });
|
||||
|
@ -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<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_numbers });
|
||||
string tagQuantity = await frontendRepository.GetOneAsync<string>("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<string>($@"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<string>($@"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;
|
||||
|
@ -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);");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user