diff --git a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs index c2f2f41..fe3a51c 100644 --- a/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs +++ b/Repository/BackendRepository/Implement/NiagaraDataSynchronizeRepository.cs @@ -69,19 +69,22 @@ namespace Repository.BackendRepository.Implement { if (string.IsNullOrEmpty(row.tag_name)) continue; string[] arrTag = row.tag_name.Split('_'); - - sb.Append($@" insert 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, atDateTime) values('" + - row.tag_name + "', '" + - arrTag[0] + "', '" + - arrTag[1] + "', '" + - arrTag[2] + "', '" + - arrTag[3] + "', '" + - arrTag[4] + "', '" + - arrTag[5] + "', '" + - arrTag[6] + "', '" + - arrTag[7] + "', " + - "now());"); + + if (arrTag.Length == 8) + { + sb.Append($@" insert 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, atDateTime) values('" + + row.tag_name + "', '" + + arrTag[0] + "', '" + + arrTag[1] + "', '" + + arrTag[2] + "', '" + + arrTag[3] + "', '" + + arrTag[4] + "', '" + + arrTag[5] + "', '" + + arrTag[6] + "', '" + + arrTag[7] + "', " + + "now());"); + } } if (sb.Length > 0) { @@ -140,18 +143,21 @@ namespace Repository.BackendRepository.Implement string[] arrTag = row.tag_name.Split('_'); #region for item - Device_item8 row_item = new Device_item8(); - row_item.tag_name = row.tag_name; - row_item.device_area_tag = arrTag[0]; - row_item.device_building_tag = arrTag[1]; - row_item.device_system_tag = arrTag[2]; - row_item.device_name_tag = arrTag[3]; - row_item.device_floor_tag = arrTag[4]; - row_item.device_master_tag = arrTag[5]; - row_item.device_last_name_tag = arrTag[6]; - row_item.device_serial_tag = arrTag[7]; - row_item.point_name = row.point_name; - dt_item.Add(row_item); + if (arrTag.Length == 8) + { + Device_item8 row_item = new Device_item8(); + row_item.tag_name = row.tag_name; + row_item.device_area_tag = arrTag[0]; + row_item.device_building_tag = arrTag[1]; + row_item.device_system_tag = arrTag[2]; + row_item.device_name_tag = arrTag[3]; + row_item.device_floor_tag = arrTag[4]; + row_item.device_master_tag = arrTag[5]; + row_item.device_last_name_tag = arrTag[6]; + row_item.device_serial_tag = arrTag[7]; + row_item.point_name = row.point_name; + dt_item.Add(row_item); + } #endregion }