From 3598b357a3c923143354c3260c82688ff935bbdb Mon Sep 17 00:00:00 2001 From: dev01 Date: Tue, 24 Oct 2023 18:04:16 +0800 Subject: [PATCH] =?UTF-8?q?[DeviceManage]=20=E5=8F=96=E5=BE=97=E7=B7=8A?= =?UTF-8?q?=E6=80=A5=E6=87=89=E8=AE=8A=E8=A8=AD=E5=82=99=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/DeviceManageController.cs | 29 +++++++++++++++++++ FrontendWebApi/Models/Device.cs | 12 ++++++++ 2 files changed, 41 insertions(+) diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 70b3dab..f849100 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -1083,6 +1083,35 @@ namespace FrontendWebApi.ApiControllers 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); + } + + /// + /// 取得緊急應變設備 + /// + /// + /// + [HttpPost] + [Route("api/Device/GetDisasterDevice")] + public async Task>>> GetDisasterDevice() + { + ApiResult> apiResult = new ApiResult>(); + + try + { + var sqlString = $@" SELECT * FROM device_disaster"; + var fr = await backendRepository.GetAllAsync(sqlString); + apiResult.Code = "0000"; apiResult.Data = fr; } diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs index 21137de..4cf8b13 100644 --- a/FrontendWebApi/Models/Device.cs +++ b/FrontendWebApi/Models/Device.cs @@ -203,4 +203,16 @@ namespace FrontendWebApi.Models public string device_name_tag { get; set; } } + public class DeviceDisaster + { + public string device_guid { get; set; } + public string device_system_value { get; set; } + public string device_building_tag { get; set; } + public string device_system_tag { get; set; } + public string device_name_tag { get; set; } + public string device_floor_tag { get; set; } + public string device_serial_tag { get; set; } + public string device_number { get; set; } + } + }