diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 1f0e2eb..60866ea 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -898,6 +898,52 @@ namespace FrontendWebApi.ApiControllers var param = new { @main_system_tag = fdi.main_system_tag, @sub_system_tag = fdi.sub_system_tag, @points = fdi.points }; var fr = await backendRepository.GetAllAsync(sqlString, param); + apiResult.Code = "0000"; + apiResult.Data = fr; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + return Ok(apiResult); + } + return Ok(apiResult); + } + + /// + /// 取得 Forge 3D 模型不可見的類型 + /// + /// + [HttpPost] + [Route("api/Device/GetForgeInvType")] + public async Task>>> GetForgeInvType([FromBody] string search_tag) + { + ApiResult> apiResult = new ApiResult>(); + + try + { + var sqlString = $@"SELECT + v1.system_key AS 'invisible_type', + v1.system_value AS 'invisible_value', + v2.system_value AS 'sub_system_tag' + FROM variable v1 + LEFT JOIN variable v2 ON v2.id = v1.system_parent_id AND v2.deleted = '0' + WHERE + v1.deleted = '0' + AND v1.system_type = 'forge_3d_invisible_type' + AND ( + (@isDef = true AND v1.system_key = 'default_value') + OR (@isDef = false AND v2.system_value = @sub_system_tag) + OR (@isDef = false AND @sub_system_tag IS NULL AND v1.system_key = 'default_value') + OR (@isDef = false AND @sub_system_tag IS NULL AND v2.system_value = v2.system_value) + )"; + + var param = new { sub_system_tag = search_tag == "forge_default" ? null : search_tag, isDef = search_tag == "forge_default" }; + + var fr = await backendRepository.GetAllAsync(sqlString, param); + + apiResult.Code = "0000"; apiResult.Data = fr; } diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs index 0508d4e..92ba15a 100644 --- a/FrontendWebApi/Models/Device.cs +++ b/FrontendWebApi/Models/Device.cs @@ -164,4 +164,14 @@ namespace FrontendWebApi.Models public string points { get; set; } } + + public class ForgeInvisible + { + public string invisible_type { get; set; } + public string invisible_value { get; set; } + public string sub_system_tag { get; set; } + + } + + }