[後端] 修好同步功能

[FE API] 可以顯示大公區
This commit is contained in:
keke 2023-08-18 17:33:53 +08:00
parent 276e0052d7
commit 3dcc506236
3 changed files with 9 additions and 6 deletions

View File

@ -116,7 +116,7 @@ namespace Backend.Controllers
string LightSwitchLevel = await niagaraDataSynchronizeRepository.getLightSwitchLevel(); //獲取照明開關 是否在 device or device_node string LightSwitchLevel = await niagaraDataSynchronizeRepository.getLightSwitchLevel(); //獲取照明開關 是否在 device or device_node
await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building, tag_quantity); // 匯入 MySQL table: import_niagara_tag await niagaraDataSynchronizeRepository.InsertNiagaraTagList(ds, building, tag_quantity); // 匯入 MySQL table: import_niagara_tag
await niagaraDataSynchronizeRepository.DeviceComparison(LightSwitchLevel); await niagaraDataSynchronizeRepository.DeviceComparison(LightSwitchLevel);
await niagaraDataSynchronizeRepository.CheckDiffFullNameAndCover(); await niagaraDataSynchronizeRepository.CheckDiffFullNameAndCover(); // *
await niagaraDataSynchronizeRepository.CheckFullNameEmptyReplaceByDeviceName(); await niagaraDataSynchronizeRepository.CheckFullNameEmptyReplaceByDeviceName();
await niagaraDataSynchronizeRepository.InsertBuildingMenu(); await niagaraDataSynchronizeRepository.InsertBuildingMenu();
await niagaraDataSynchronizeRepository.InsertSubSystemFloor(); await niagaraDataSynchronizeRepository.InsertSubSystemFloor();

View File

@ -285,11 +285,14 @@ namespace FrontendWebApi.ApiControllers
foreach(var bm in buildingMenus) foreach(var bm in buildingMenus)
{ {
var safeSystem = bm.main_system.Where(x => x.main_system_tag == "S").FirstOrDefault(); var safeSystem = bm.main_system.Where(x => x.main_system_tag == "S").FirstOrDefault();
if (safeSystem != null)
{
var EmerBuckle = safeSystem.Sub_system.Where(x => x.sub_system_tag == "P").ToList(); var EmerBuckle = safeSystem.Sub_system.Where(x => x.sub_system_tag == "P").ToList();
EmerBuckle.AddRange(safeSystem.Sub_system.Where(x => x.sub_system_tag == "B").ToList()); EmerBuckle.AddRange(safeSystem.Sub_system.Where(x => x.sub_system_tag == "B").ToList());
safeSystem.Sub_system.RemoveAll(x => x.sub_system_tag == "B"); safeSystem.Sub_system.RemoveAll(x => x.sub_system_tag == "B");
} }
} }
}
apiResult.Data = buildingMenus; apiResult.Data = buildingMenus;
apiResult.Code = "0000"; apiResult.Code = "0000";
} }

View File

@ -795,12 +795,12 @@ namespace Repository.BackendRepository.Implement
update device d update device d
JOIN ( JOIN (
select niagara_tags, device_full_name from import_niagara_tag limit 100000 select niagara_tags, device_full_name from import_niagara_tag limit 100000
) m ON m.niagara_tags COLLATE utf8mb4_0900_ai_ci = d.device_number COLLATE utf8mb4_0900_ai_ci ) m ON m.niagara_tags = d.device_number
LEFT JOIN ( LEFT JOIN (
SELECT niagara_tags, device_full_name SELECT niagara_tags, device_full_name
FROM import_niagara_tag FROM import_niagara_tag
LIMIT 100000 LIMIT 100000
) m2 ON m2.niagara_tags COLLATE utf8mb4_0900_ai_ci = d.device_number COLLATE utf8mb4_0900_ai_ci AND m2.device_full_name COLLATE utf8mb4_0900_ai_ci = d.full_name COLLATE utf8mb4_0900_ai_ci ) m2 ON m2.niagara_tags = d.device_number AND m2.device_full_name = d.full_name
SET d.full_name = m.device_full_name SET d.full_name = m.device_full_name
WHERE m2.niagara_tags IS NULL;"); WHERE m2.niagara_tags IS NULL;");
await conn.ExecuteAsync(sb.ToString()); await conn.ExecuteAsync(sb.ToString());