diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs
index 4e2b2aa..08eed00 100644
--- a/FrontendWebApi/ApiControllers/DeviceManageController.cs
+++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs
@@ -219,7 +219,7 @@ namespace FrontendWebApi.ApiControllers
try
{
- var sqlString = $@"select f.full_name as floor_tag
+ var sqlString = $@"select f.full_name as floor_tag, f.floor_guid
from sub_system_floor ssf
join floor f on ssf.floor_tag = f.full_name and ssf.building_tag = f.building_tag and f.deleted = 0
where ssf.deleted = 0 and f.building_tag = @building_tag and sub_system_tag = @sub_system_tag order by f.priority";
@@ -789,5 +789,45 @@ namespace FrontendWebApi.ApiControllers
}
return Ok(apiResult);
}
+
+ ///
+ /// 樓層列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("api/Device/GetNextFloor")]
+ public async Task>> GetNextFloor([FromBody] Floor f)
+ {
+ ApiResult apiResult = new ApiResult();
+
+ if (string.IsNullOrEmpty(f.floor_guid))
+ {
+ apiResult.Code = "0002";
+ apiResult.Msg = "需傳入樓層guid";
+ return apiResult;
+ }
+
+ try
+ {
+ var sqlString = $@" SELECT * FROM floor WHERE
+ priority = (SELECT MIN(priority) FROM floor WHERE priority > (SELECT priority FROM floor WHERE floor_guid = @floor_guid)
+ AND building_tag = (SELECT building_tag FROM floor WHERE floor_guid = @floor_guid))
+ AND building_tag = (SELECT building_tag FROM floor WHERE floor_guid = @floor_guid)";
+ var param = new { @floor_guid = f.floor_guid };
+ var fr = await backendRepository.GetOneAsync(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);
+ }
}
}
\ No newline at end of file
diff --git a/FrontendWebApi/ApiControllers/MyBaseApiController.cs b/FrontendWebApi/ApiControllers/MyBaseApiController.cs
index f347c2c..e7a966b 100644
--- a/FrontendWebApi/ApiControllers/MyBaseApiController.cs
+++ b/FrontendWebApi/ApiControllers/MyBaseApiController.cs
@@ -35,14 +35,14 @@ namespace FrontendWebApi.ApiControllers
public string actionName;
public string main_system_type = "device_system_category_layer2";
public string sub_system_type = "device_system_category_layer3";
- public string forge_node_name_system_type = "forge_check_node_name";
+ public string forge_node_name_system_type = "forge_check_tag_id";
public ErrorCode errorCode = new ErrorCode();
[Authorize]
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
controllerName = ControllerContext.RouteData.Values["controller"].ToString(); //controller名稱
actionName = ControllerContext.RouteData.Values["action"].ToString(); //action名稱
-
+
var ctx = filterContext.HttpContext;
ctx.Response.Headers.Add("Access-Control-Allow-Origin", "*");
ctx.Response.Headers.Add("Access-Control-Allow-Headers", "*");
diff --git a/FrontendWebApi/Models/Device.cs b/FrontendWebApi/Models/Device.cs
index 0c67ea5..c854265 100644
--- a/FrontendWebApi/Models/Device.cs
+++ b/FrontendWebApi/Models/Device.cs
@@ -24,6 +24,7 @@ namespace FrontendWebApi.Models
{
public string full_name { get; set; }
public string floor_tag { get; set; }
+ public string floor_guid { get; set; }
public string map_name { get; set; }
public string floor_map_name { get; set; }
public string urn_3D { get; set; }