diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index d447fc9..9ae6333 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -71,11 +71,12 @@ namespace Backend.Services.Implement { row.point_name = s2[i]; } - else if (i == 1) + + if (i == 0) { row.tag_name += s2[i]; } - else if (i > 1 && i < s2.Length - 2) + else { row.tag_name += "_" + s2[i]; } diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index 0ef65e9..e14e36c 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -57,10 +57,12 @@ namespace Repository.BackendRepository.Implement //N4資料groupBy後放入import_niagara_tag資料表 var ds2 = ds.GroupBy(x => new { - tag_name2 = x.tag_name + tag_name2 = x.tag_name, + displayName2 = x.displayName }).Select(x => new Device_value { - tag_name = x.Key.tag_name2 + tag_name = x.Key.tag_name2, + displayName = x.Key.displayName2 }); StringBuilder sb = new StringBuilder(); @@ -72,7 +74,7 @@ namespace Repository.BackendRepository.Implement if (arrTag.Length == 8) { - sb.Append($@" insert import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag, + sb.Append($@" insert into import_niagara_tag(niagara_tags, device_area_tag, device_building_tag, device_system_tag, device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, device_full_name, atDateTime) values('" + row.tag_name + "', '" + arrTag[0] + "', '" + @@ -82,8 +84,8 @@ namespace Repository.BackendRepository.Implement arrTag[4] + "', '" + arrTag[5] + "', '" + arrTag[6] + "', '" + - arrTag[7] + "', " + - row.displayName + "', '" + + arrTag[7] + "', '" + + row.displayName + "', " + "now());"); } }