前端 API: 增加 device_node.coordinate_3D 給燈具使用
This commit is contained in:
parent
70d691fde3
commit
707ae51080
@ -767,6 +767,7 @@ namespace FrontendWebApi.ApiControllers
|
||||
dn.device_guid,
|
||||
dn.full_name AS Device_node_full_name,
|
||||
dn.device_node_coordinate,
|
||||
dn.device_node_coordinate_3d,
|
||||
dn.priority,
|
||||
dn.forge_dbid
|
||||
FROM device_node dn
|
||||
@ -776,8 +777,6 @@ namespace FrontendWebApi.ApiControllers
|
||||
d.Device_nodes = await backendRepository.GetAllAsync<DeviceNode>(sql_node, new { device_guid = d.device_guid });
|
||||
}
|
||||
|
||||
|
||||
|
||||
apiResult.Data = dl;
|
||||
apiResult.Code = "0000";
|
||||
}
|
||||
|
@ -206,6 +206,7 @@ namespace FrontendWebApi.Models
|
||||
public string Device_guid { get; set; }
|
||||
public string Device_node_full_name { get; set; }
|
||||
public string Device_node_coordinate { get; set; }
|
||||
public string Device_node_coordinate_3D { get; set; }
|
||||
public int Priority { get; set; }
|
||||
public int forge_dbid { get; set; }
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ namespace Repository.BackendRepository.Implement
|
||||
{
|
||||
sb.Append($@" insert device(device_guid, deleted, status, priority, is_link, device_area_tag,
|
||||
device_building_tag, device_system_tag, device_name_tag, full_name, device_floor_tag, device_master,
|
||||
device_last_name, device_serial_tag, device_number, device_system_category_layer3, created_at, updated_at)
|
||||
device_last_name, device_serial_tag, device_number, device_system_category_layer3, visible, created_at, updated_at)
|
||||
values(uuid(), 0, 1, 0, 1, '" +
|
||||
data.device_area_tag + "', '" +
|
||||
data.device_building_tag + "', '" +
|
||||
@ -230,7 +230,7 @@ namespace Repository.BackendRepository.Implement
|
||||
data.device_last_name_tag + "', '" +
|
||||
data.device_serial_tag + "', '" +
|
||||
data.niagara_tags + "', '" +
|
||||
data.device_system_tag + "', now(), now() );");
|
||||
data.device_system_tag + "', 1, now(), now() );");
|
||||
}
|
||||
|
||||
foreach (var data in result2)
|
||||
@ -301,7 +301,7 @@ namespace Repository.BackendRepository.Implement
|
||||
result = (await conn.QueryAsync<NiagaraTagsForItem>(sb.ToString())).ToList<NiagaraTagsForItem>();
|
||||
|
||||
sb.Clear();
|
||||
//新增至device, is_link = 1
|
||||
# region 新增至device, is_link = 1
|
||||
if (result.Count > 0)
|
||||
{
|
||||
foreach (var data in result)
|
||||
@ -334,12 +334,24 @@ namespace Repository.BackendRepository.Implement
|
||||
sb.Clear();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
//device有,niagara沒有,is_link 更新成 0
|
||||
//sb.Append($@" SET SQL_SAFE_UPDATES = 0;
|
||||
// UPDATE device_item d LEFT JOIN import_niagara_item m
|
||||
// ON d.device_system_tag = m.device_system_tag and d.device_name_tag = m.device_name_tag and d.points = m.device_point_name
|
||||
// SET d.is_link = 0, d.is_show_history = 0
|
||||
// WHERE m.device_point_name IS NULL");
|
||||
|
||||
//本次有匯入的 isLink 改為 1, 沒有的 isLink = 0
|
||||
sb.Append($@" SET SQL_SAFE_UPDATES = 0;
|
||||
UPDATE device_item d LEFT JOIN import_niagara_item m
|
||||
ON d.device_system_tag = m.device_system_tag and d.device_name_tag = m.device_name_tag and d.points = m.device_point_name
|
||||
SET d.is_link = 0, d.is_show_history = 0
|
||||
WHERE m.device_point_name IS NULL");
|
||||
ON d.device_system_tag = m.device_system_tag and d.device_name_tag = m.device_name_tag and d.points = m.device_point_name
|
||||
SET d.is_link = case when device_point_name is null then 0 else 1 end ,
|
||||
d.is_show_history = case when device_point_name is null then 0 else 1 end");
|
||||
|
||||
await conn.ExecuteAsync(sb.ToString());
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
Loading…
Reference in New Issue
Block a user