修改同步问题

This commit is contained in:
dev02 2023-01-30 16:04:29 +08:00
parent a61f20daa0
commit c42708f30a
2 changed files with 10 additions and 7 deletions

View File

@ -71,11 +71,12 @@ namespace Backend.Services.Implement
{ {
row.point_name = s2[i]; row.point_name = s2[i];
} }
else if (i == 1)
if (i == 0)
{ {
row.tag_name += s2[i]; row.tag_name += s2[i];
} }
else if (i > 1 && i < s2.Length - 2) else
{ {
row.tag_name += "_" + s2[i]; row.tag_name += "_" + s2[i];
} }

View File

@ -57,10 +57,12 @@ namespace Repository.BackendRepository.Implement
//N4資料groupBy後放入import_niagara_tag資料表 //N4資料groupBy後放入import_niagara_tag資料表
var ds2 = ds.GroupBy(x => new var ds2 = ds.GroupBy(x => new
{ {
tag_name2 = x.tag_name tag_name2 = x.tag_name,
displayName2 = x.displayName
}).Select(x => new Device_value }).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(); StringBuilder sb = new StringBuilder();
@ -72,7 +74,7 @@ namespace Repository.BackendRepository.Implement
if (arrTag.Length == 8) 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('" + device_name_tag, device_floor_tag, device_master_tag, device_last_name_tag, device_serial_tag, device_full_name, atDateTime) values('" +
row.tag_name + "', '" + row.tag_name + "', '" +
arrTag[0] + "', '" + arrTag[0] + "', '" +
@ -82,8 +84,8 @@ namespace Repository.BackendRepository.Implement
arrTag[4] + "', '" + arrTag[4] + "', '" +
arrTag[5] + "', '" + arrTag[5] + "', '" +
arrTag[6] + "', '" + arrTag[6] + "', '" +
arrTag[7] + "', " + arrTag[7] + "', '" +
row.displayName + "', '" + row.displayName + "', " +
"now());"); "now());");
} }
} }