[Backend] N4同步: device_kind重複問題修正
This commit is contained in:
parent
4d29bb220c
commit
125696a5d3
@ -229,6 +229,18 @@ namespace Repository.BackendRepository.Implement
|
|||||||
//新增至device, is_link = 1
|
//新增至device, is_link = 1
|
||||||
if (result.Count > 0)
|
if (result.Count > 0)
|
||||||
{
|
{
|
||||||
|
var result2 = result.GroupBy(x => new
|
||||||
|
{
|
||||||
|
device_building_tag2 = x.device_building_tag,
|
||||||
|
device_system_tag2 = x.device_system_tag,
|
||||||
|
device_name_tag2 = x.device_name_tag
|
||||||
|
}).Select(x => new Device_item8
|
||||||
|
{
|
||||||
|
device_building_tag = x.Key.device_building_tag2,
|
||||||
|
device_system_tag = x.Key.device_system_tag2,
|
||||||
|
device_name_tag = x.Key.device_name_tag2
|
||||||
|
});
|
||||||
|
|
||||||
foreach (var data in result)
|
foreach (var data in result)
|
||||||
{
|
{
|
||||||
sb.Append($@" insert device(device_guid, deleted, status, priority, is_link, device_area_tag,
|
sb.Append($@" insert device(device_guid, deleted, status, priority, is_link, device_area_tag,
|
||||||
@ -246,7 +258,9 @@ namespace Repository.BackendRepository.Implement
|
|||||||
data.device_serial_tag + "', '" +
|
data.device_serial_tag + "', '" +
|
||||||
data.niagara_tags + "', '" +
|
data.niagara_tags + "', '" +
|
||||||
data.device_system_tag + "', now(), now() );");
|
data.device_system_tag + "', now(), now() );");
|
||||||
|
}
|
||||||
|
foreach (var data in result)
|
||||||
|
{
|
||||||
sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag,
|
sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag,
|
||||||
device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent,
|
device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent,
|
||||||
created_by, created_at)
|
created_by, created_at)
|
||||||
|
Loading…
Reference in New Issue
Block a user