新增alarm card
This commit is contained in:
parent
f8160779a8
commit
bf7afb4df8
@ -1,11 +1,13 @@
|
||||
using FrontendWebApi.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Repository.BackendRepository.Interface;
|
||||
using Repository.FrontendRepository.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlTypes;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@ -42,5 +44,27 @@ namespace FrontendWebApi.ApiControllers
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("api/AlarmCard")]
|
||||
public async Task<ActionResult<ApiResult<List<VAlarmRecord>>>> AlarmCard()
|
||||
{
|
||||
ApiResult<List<VAlarmRecord>> apiResult = new ApiResult<List<VAlarmRecord>>();
|
||||
try
|
||||
{
|
||||
var sqlString = $@"select * from v_alarm where isOpen = 1";
|
||||
var result = await backendRepository.GetAllAsync<VAlarmRecord>(sqlString);
|
||||
|
||||
apiResult.Data = result;
|
||||
apiResult.Code = "0000";
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
return Ok(apiResult);
|
||||
}
|
||||
return Ok(apiResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using NPOI.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -56,4 +57,14 @@ namespace FrontendWebApi.Models
|
||||
public byte IsSolve { get;set;}
|
||||
public byte IsAck { get;set;}
|
||||
}
|
||||
|
||||
public class VAlarmRecord
|
||||
{
|
||||
public DateTime timestamp { get; set; }
|
||||
public int id { get; set; }
|
||||
public int priority { get; set; }
|
||||
public string alarmClass_txt { get; set; }
|
||||
public string device_name { get; set; }
|
||||
public string errMsg { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user