Merge branch 'master' of https://gitea.mjm-staging.developers-homelab.net/BIMS/BIMS
This commit is contained in:
commit
e7ad2e2261
@ -747,5 +747,46 @@ namespace Backend.Controllers
|
||||
return apiResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新設備 3d坐標, forge_dbid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult<string>> ImportDevForCor([FromBody] List<ImportDevForCoo> post)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
if (post != null)
|
||||
{
|
||||
if (post.Count > 0)
|
||||
{
|
||||
foreach(var idfc in post)
|
||||
{
|
||||
Dictionary<string, object> device = new Dictionary<string, object>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
@ -666,5 +666,44 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/GetDevForCor")]
|
||||
public async Task<ActionResult<List<DevForCor>>> GetDevForCor([FromBody] List<Device> post)
|
||||
{
|
||||
ApiResult<List<DevForCor>> apiResult = new ApiResult<List<DevForCor>>();
|
||||
List<DevForCor> device = new List<DevForCor>();
|
||||
|
||||
try
|
||||
{
|
||||
if (post != null)
|
||||
{
|
||||
if (post.Count > 0)
|
||||
{
|
||||
foreach (var p in post)
|
||||
{
|
||||
var d = await backendRepository.GetOneAsync<DevForCor>($@"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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user