[後端] 修改device_item些api 增加判斷building_tag, niagara同步device_item增加building_tag
[前端] 修改api發送增加building_tag
This commit is contained in:
parent
188dc425a6
commit
938a7cdb7e
@ -1653,18 +1653,18 @@ namespace Backend.Controllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取得子系統的device item
|
/// 取得子系統的device item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="guid"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ApiResult<List<Device_item>>> GetDeviceItem(string sub_system_tag)
|
public async Task<ApiResult<List<Device_item>>> GetDeviceItem(DeviceItemInput input)
|
||||||
{
|
{
|
||||||
ApiResult<List<Device_item>> apiResult = new ApiResult<List<Device_item>>();
|
ApiResult<List<Device_item>> apiResult = new ApiResult<List<Device_item>>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sWhere = "deleted = 0 AND device_name_tag = @Sub_system_tag";
|
string sWhere = "deleted = 0 AND device_name_tag = @Sub_system_tag and device_building_tag = @device_building_tag";
|
||||||
|
|
||||||
object param = new { Sub_system_tag = sub_system_tag };
|
object param = new { Sub_system_tag = input.sub_system_tag, device_building_tag = input.building_tag };
|
||||||
|
|
||||||
var deviceItems = await backendRepository.GetAllAsync<Device_item>("device_item", sWhere, param);
|
var deviceItems = await backendRepository.GetAllAsync<Device_item>("device_item", sWhere, param);
|
||||||
|
|
||||||
|
@ -581,14 +581,14 @@ namespace Backend.Controllers
|
|||||||
ApiResult<List<Device_item>> apiResult = new ApiResult<List<Device_item>>();
|
ApiResult<List<Device_item>> apiResult = new ApiResult<List<Device_item>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var building_tag = await backendRepository.GetOneAsync<string>($@"select system_value from variable where system_type = 'project_name' and deleted = 0");
|
||||||
var sql = @"SELECT di.*
|
var sql = @"SELECT di.*
|
||||||
FROM device_item di
|
FROM device_item di
|
||||||
JOIN variable sv ON di.device_name_tag = sv.system_value
|
JOIN variable sv ON di.device_name_tag = sv.system_value
|
||||||
JOIN variable mv ON sv.system_parent_id = mv.id AND di.device_system_tag = mv.system_value
|
JOIN variable mv ON sv.system_parent_id = mv.id AND di.device_system_tag = mv.system_value
|
||||||
WHERE sv.id = @id AND di.deleted = @Deleted";
|
WHERE sv.id = @id AND di.deleted = @Deleted and di.device_building_tag = @building_tag";
|
||||||
|
|
||||||
object param = new { Deleted = 0, id = id };
|
object param = new { Deleted = 0, id = id, building_tag = building_tag.Split("/")[1] };
|
||||||
|
|
||||||
var systemSubs = await backendRepository.GetAllAsync<Device_item>(sql, param);
|
var systemSubs = await backendRepository.GetAllAsync<Device_item>(sql, param);
|
||||||
|
|
||||||
|
@ -78,4 +78,10 @@ namespace Backend.Models
|
|||||||
public string guid { get; set; }
|
public string guid { get; set; }
|
||||||
public string subguid { get; set; }
|
public string subguid { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DeviceItemInput
|
||||||
|
{
|
||||||
|
public string sub_system_tag { get; set; }
|
||||||
|
public string building_tag { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1551,7 +1551,8 @@
|
|||||||
var selectedSub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
|
var selectedSub_system_tag = selected_building_menu.main_system ? selected_building_menu.main_system.sub_system ? selected_building_menu.main_system.sub_system.sub_system_tag : "" : "";
|
||||||
var url = "/DeviceManage/GetDeviceItem";
|
var url = "/DeviceManage/GetDeviceItem";
|
||||||
var send_data = {
|
var send_data = {
|
||||||
sub_system_tag: selectedSub_system_tag
|
sub_system_tag: selectedSub_system_tag,
|
||||||
|
building_tag: selected_device_building_tag
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
|
@ -471,7 +471,7 @@ namespace Repository.BackendRepository.Implement
|
|||||||
isBool = 1;
|
isBool = 1;
|
||||||
}
|
}
|
||||||
sb.Append($@"insert device_item(deleted, points, is_show, is_show_riserDiagram, is_controll, is_bool, is_show_history, is_link,
|
sb.Append($@"insert device_item(deleted, points, is_show, is_show_riserDiagram, is_controll, is_bool, is_show_history, is_link,
|
||||||
device_system_tag, device_name_tag, full_name, parent_path, created_at, updated_at)
|
device_system_tag, device_name_tag, device_building_tag, full_name, parent_path, created_at, updated_at)
|
||||||
VALUES (0, '" +
|
VALUES (0, '" +
|
||||||
data.device_point_name + "', 1, 0, " +
|
data.device_point_name + "', 1, 0, " +
|
||||||
isControll + "," +
|
isControll + "," +
|
||||||
@ -480,6 +480,7 @@ namespace Repository.BackendRepository.Implement
|
|||||||
", 1, '" +
|
", 1, '" +
|
||||||
data.device_system_tag + "', '" +
|
data.device_system_tag + "', '" +
|
||||||
data.device_name_tag + "', '" +
|
data.device_name_tag + "', '" +
|
||||||
|
data.device_building_tag + "', '" +
|
||||||
data.full_name + "', '" +
|
data.full_name + "', '" +
|
||||||
data.parent_path + "', " +
|
data.parent_path + "', " +
|
||||||
"now(), now());");
|
"now(), now());");
|
||||||
|
Loading…
Reference in New Issue
Block a user