diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 198b170..665065e 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -169,30 +169,30 @@ namespace Repository.BackendRepository.Implement sb.Clear(); stopwatchSection.Stop(); await KeepTimeLog("Insert into import_niagara_tag", stopwatchSection.ElapsedMilliseconds); + } - //巨蛋特殊處理 - if (isDome) + //巨蛋特殊處理 + if (isDome) + { + stopwatchSection = new Stopwatch(); + stopwatchSection.Start(); + sb.Append($@" -- tag 第二碼為小類(除了安全系統之外) + update import_niagara_tag set device_name_tag = device_system_tag + where (device_system_tag <> 'S' and device_system_tag <> 'CWB' and device_system_tag <> 'B' and + (device_system_tag <> 'FM' or device_system_tag <> 'APS' or device_system_tag <> 'VICL')); + + update import_niagara_tag a + join variable b on a.device_name_tag COLLATE utf8mb4_general_ci = b.system_value and b.deleted = 0 and b.system_type = 'device_system_category_layer3' + join variable v1 on b.system_parent_id = v1.id + set device_system_tag = v1.system_value -- tag 第二碼為小類(除了安全系統之外) + where (device_system_tag <> 'S' and device_system_tag <> 'CWB' and device_system_tag <> 'B' and + (device_system_tag <> 'FM' or device_system_tag <> 'APS' or device_system_tag <> 'VICL')); -- 安全系統 第二段大類 第四段小類"); + using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) { - stopwatchSection = new Stopwatch(); - stopwatchSection.Start(); - sb.Append($@" -- tag 第二碼為小類(除了安全系統之外) - update import_niagara_tag set device_name_tag = device_system_tag - where (device_system_tag <> 'S' and device_system_tag <> 'CWB' and device_system_tag <> 'B' and - (device_system_tag <> 'FM' or device_system_tag <> 'APS' or device_system_tag <> 'VICL')); - - update import_niagara_tag a - join variable b on a.device_name_tag COLLATE utf8mb4_general_ci = b.system_value and b.deleted = 0 and b.system_type = 'device_system_category_layer3' - join variable v1 on b.system_parent_id = v1.id - set device_system_tag = v1.system_value -- tag 第二碼為小類(除了安全系統之外) - where (device_system_tag <> 'S' and device_system_tag <> 'CWB' and device_system_tag <> 'B' and - (device_system_tag <> 'FM' or device_system_tag <> 'APS' or device_system_tag <> 'VICL')); -- 安全系統 第二段大類 第四段小類"); - using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled)) - { - await conn.ExecuteAsync(sb.ToString()); - } - stopwatchSection.Stop(); - await KeepTimeLog("巨蛋特殊處理", stopwatchSection.ElapsedMilliseconds); + await conn.ExecuteAsync(sb.ToString()); } + stopwatchSection.Stop(); + await KeepTimeLog("巨蛋特殊處理", stopwatchSection.ElapsedMilliseconds); } stopwatch.Stop(); await KeepTimeLog("InsertNiagaraTagList", stopwatch.ElapsedMilliseconds);