diff --git a/Backend/Controllers/DeviceImportController.cs b/Backend/Controllers/DeviceImportController.cs
index 1d90cbf..1f2218b 100644
--- a/Backend/Controllers/DeviceImportController.cs
+++ b/Backend/Controllers/DeviceImportController.cs
@@ -747,5 +747,46 @@ namespace Backend.Controllers
return apiResult;
}
+ ///
+ /// 更新設備 3d坐標, forge_dbid
+ ///
+ ///
+ [HttpPost]
+ public async Task> ImportDevForCor([FromBody] List post)
+ {
+ ApiResult apiResult = new ApiResult();
+ try
+ {
+ if (post != null)
+ {
+ if (post.Count > 0)
+ {
+ foreach(var idfc in post)
+ {
+ Dictionary device = new Dictionary();
+ device.Add("@device_coordinate_3d", idfc.device_coordinate_3d);
+ device.Add("@forge_dbid", idfc.forge_dbid);
+
+ await backendRepository.UpdateOneByCustomTable(device, "device", $@" device_number = '{idfc.device_number}'");
+ }
+ }
+ apiResult.Code = "0000";
+ apiResult.Msg = "編輯成功";
+ }
+ else
+ {
+ apiResult.Code = "0001";
+ apiResult.Msg = "無資料輸入";
+ }
+ }
+ catch (Exception exception)
+ {
+ apiResult.Code = "9999";
+ apiResult.Msg = "系統內部錯誤,請聯絡管理者。";
+ Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
+ }
+
+ return apiResult;
+ }
}
}
diff --git a/Backend/Models/Device.cs b/Backend/Models/Device.cs
index 15c17f4..668e3f7 100644
--- a/Backend/Models/Device.cs
+++ b/Backend/Models/Device.cs
@@ -263,4 +263,11 @@ namespace Backend.Models
public string Point { get; set; }
public string FullDeviceNumberPoint { get; set; }
}
+
+ public class ImportDevForCoo
+ {
+ public string device_number { get; set; }
+ public string device_coordinate_3d { get; set; }
+ public int forge_dbid { get; set; }
+ }
}
diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs
index 82c105b..f87cdc8 100644
--- a/FrontendWebApi/ApiControllers/DeviceManageController.cs
+++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs
@@ -666,5 +666,44 @@ namespace FrontendWebApi.ApiControllers
}
return Ok(apiResult);
}
+
+ [HttpPost]
+ [Route("api/GetDevForCor")]
+ public async Task>> GetDevForCor([FromBody] List post)
+ {
+ ApiResult> apiResult = new ApiResult>();
+ List device = new List();
+
+ try
+ {
+ if (post != null)
+ {
+ if (post.Count > 0)
+ {
+ foreach (var p in post)
+ {
+ var d = await backendRepository.GetOneAsync($@"select * from device where deleted = 0 and device_number = @device_number and device_floor_tag = @device_floor_tag", new { @device_number = p.device_number, @device_floor_tag = p.device_floor_tag });
+ if (d != null)
+ device.Add(d);
+ }
+ }
+ apiResult.Data = device;
+ apiResult.Code = "0000";
+ }
+ else
+ {
+ apiResult.Msg = "無資料數入";
+ apiResult.Code = "0001";
+ }
+ }
+ 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/Models/Device.cs b/FrontendWebApi/Models/Device.cs
index 7f0389e..ce886dd 100644
--- a/FrontendWebApi/Models/Device.cs
+++ b/FrontendWebApi/Models/Device.cs
@@ -120,4 +120,12 @@ namespace FrontendWebApi.Models
public string device_node_guid { get; set; }
public string device_node_name { get; set; }
}
+
+ public class DevForCor
+ {
+ public string device_guid { get; set; }
+ public string device_number { get; set; }
+ public string device_coordinate_3d { get; set; }
+ public int forge_dbid { get; set; }
+ }
}