refactor:燈具新增顯示模組參數,關聯devicenode

This commit is contained in:
史萬澤 2023-03-13 15:26:34 +08:00
parent 7c6e0b6411
commit 5b496e07b7
4 changed files with 28 additions and 4 deletions

View File

@ -812,7 +812,7 @@ License: You must have a valid license purchased only from wrapbootstrap.com (li
/*"lib/jquery-validation/dist/additional-methods.min",*/ /* 會影響 messages_zh_TW 文字呈現 */ /*"lib/jquery-validation/dist/additional-methods.min",*/ /* 會影響 messages_zh_TW 文字呈現 */
"lib/jquery-validation/dist/localization/messages_zh_TW", "lib/jquery-validation/dist/localization/messages_zh_TW",
"lib/jquery-ui/jquery-ui.min", "lib/jquery-ui/jquery-ui.min",
"lib/chart.js_4.1.2/chart.umd", "lib/chart.js/chart.min",
"lib/dropzone/dropzone-min", "lib/dropzone/dropzone-min",
"lib/jstree-master/jstree.min", "lib/jstree-master/jstree.min",
"lib/notifications/sweetalert2/sweetalert2.bundle", "lib/notifications/sweetalert2/sweetalert2.bundle",

View File

@ -10,6 +10,7 @@ using Repository.FrontendRepository.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Data.SqlTypes;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -261,6 +262,9 @@ namespace FrontendWebApi.ApiControllers
{ {
ApiResult<List<FloorList>> apiResult = new ApiResult<List<FloorList>>(); ApiResult<List<FloorList>> apiResult = new ApiResult<List<FloorList>>();
//是否顯示DeviceNode
string sqlStringqueryModuleLightNodeDisplay = $"SELECT system_value FROM variable WHERE system_type = 'module' AND system_key = 'displaynode'";
string displayNode = await backendRepository.GetOneAsync<string>(sqlStringqueryModuleLightNodeDisplay);
if (string.IsNullOrEmpty(fd.sub_system_tag)) if (string.IsNullOrEmpty(fd.sub_system_tag))
{ {
apiResult.Code = "0001"; apiResult.Code = "0001";
@ -317,7 +321,7 @@ namespace FrontendWebApi.ApiControllers
f.device_list = dl; f.device_list = dl;
} }
apiResult.Module = displayNode;
apiResult.Data = fl; apiResult.Data = fl;
apiResult.Code = "0000"; apiResult.Code = "0000";
} }
@ -751,12 +755,30 @@ namespace FrontendWebApi.ApiControllers
@device_name_tag = p.device_name_tag, @device_name_tag = p.device_name_tag,
@device_floor_tag = p.device_floor_tag @device_floor_tag = p.device_floor_tag
}; };
var d = await backendRepository.GetAllAsync<DevForCor>($@"select device_guid,device_number,device_floor_tag,device_coordinate_3d,forge_dbid, full_name var dl = await backendRepository.GetAllAsync<DevForCor>($@"select device_guid,device_number,device_floor_tag,device_coordinate_3d,forge_dbid, full_name
from device where deleted = 0 and device_area_tag = @device_area_tag and device_building_tag = @device_building_tag from device where deleted = 0 and device_area_tag = @device_area_tag and device_building_tag = @device_building_tag
and device_system_tag = @device_system_tag and device_name_tag = @device_name_tag and device_system_tag = @device_system_tag and device_name_tag = @device_name_tag
and device_floor_tag = ifnull(@device_floor_tag, device_floor_tag) ", param); and device_floor_tag = ifnull(@device_floor_tag, device_floor_tag) ", param);
apiResult.Data = d; foreach (var d in dl)
{
var sql_node = $@"SELECT
dn.device_node_guid,
dn.device_guid,
dn.full_name AS Device_node_full_name,
dn.device_node_coordinate,
dn.priority,
dn.forge_dbid
FROM device_node dn
WHERE dn.deleted = 0 AND dn.device_guid = @device_guid
ORDER BY dn.priority ASC";
d.Device_nodes = await backendRepository.GetAllAsync<DeviceNode>(sql_node, new { device_guid = d.device_guid });
}
apiResult.Data = dl;
apiResult.Code = "0000"; apiResult.Code = "0000";
} }
else else

View File

@ -149,6 +149,7 @@ namespace FrontendWebApi.Models
public string device_coordinate_3d { get; set; } public string device_coordinate_3d { get; set; }
public string full_name { get; set; } public string full_name { get; set; }
public int? forge_dbid { get; set; } public int? forge_dbid { get; set; }
public List<DeviceNode> Device_nodes { get; set; }
} }
public class DevNodeForCor public class DevNodeForCor

View File

@ -202,6 +202,7 @@ namespace FrontendWebApi.Models
ErrorCode errorCode = new ErrorCode(); ErrorCode errorCode = new ErrorCode();
private string msg = string.Empty; private string msg = string.Empty;
public string Code { get; set; } public string Code { get; set; }
public string Module { get; set; }
public string Msg public string Msg
{ {
get get