This commit is contained in:
dev01 2022-11-10 14:34:59 +08:00
commit 582b8b97ba
2 changed files with 36 additions and 18 deletions

View File

@ -113,7 +113,7 @@ namespace FrontendWebApi.ApiControllers
foreach (var a in alerts) foreach (var a in alerts)
{ {
var sqlString = $@"select formId from operation_record where error_code = @error_code"; var sqlString = $@"select formId from operation_record where error_code = @error_code";
var formId = backendRepository.GetOneAsync<string>(sqlString, new { @error_code = a.error_code }); var formId = backendRepository.GetOneAsync<string>(sqlString, new { @error_code = a.uuid });
RowPosition += 1; RowPosition += 1;
row = sheet.CreateRow(RowPosition); row = sheet.CreateRow(RowPosition);
for (var i = 0; i < 8; i++) for (var i = 0; i < 8; i++)
@ -121,11 +121,11 @@ namespace FrontendWebApi.ApiControllers
cell = row.CreateCell(i); cell = row.CreateCell(i);
if (i == 0) if (i == 0)
{ {
cell.SetCellValue(a.building_tag + a.floor_tag); cell.SetCellValue(a.buildingFloorName);
} }
if (i == 1) if (i == 1)
{ {
cell.SetCellValue(a.error_code); cell.SetCellValue(a.uuid);
} }
if (i == 2) if (i == 2)
{ {
@ -133,19 +133,19 @@ namespace FrontendWebApi.ApiControllers
} }
if (i == 3) if (i == 3)
{ {
cell.SetCellValue(a.error_type); cell.SetCellValue(a.alarmClass);
} }
if (i == 4) if (i == 4)
{ {
cell.SetCellValue(a.device_number); cell.SetCellValue(a.sourceName_zh);
} }
if (i == 5) if (i == 5)
{ {
cell.SetCellValue(a.error_reason); cell.SetCellValue(a.msgText);
} }
if (i == 6) if (i == 6)
{ {
cell.SetCellValue(a.ACKconfirm); cell.SetCellValue(a.ackState_zh);
} }
if (i == 7) if (i == 7)
{ {
@ -178,8 +178,8 @@ namespace FrontendWebApi.ApiControllers
{ {
foreach(var a in alerts) foreach(var a in alerts)
{ {
var sqlString = $@"select * from operation_record where error_code = @error_code"; var sqlString = $@"select formId from operation_record where error_code = @error_code";
var formId = await backendRepository.GetOneAsync<string>(sqlString, new { @error_code = a.error_code }); var formId = await backendRepository.GetOneAsync<string>(sqlString, new { @error_code = a.uuid });
a.formId = formId; a.formId = formId;
} }
} }

View File

@ -1,14 +1,32 @@
namespace FrontendWebApi.Models using System;
using System.Collections.Generic;
namespace FrontendWebApi.Models
{ {
public class Alert : Actor public class Alert
{ {
public string building_tag { get; set; } public string buildingFloorName { get; set; } //building_name and floor_name
public string floor_tag { get; set; } public string uuid { get; set; } //error_code
public string error_code { get; set; } public string alarmClass { get; set; } //error_type
public string error_type { get; set; } public string msgText { get; set; } //error_reason
public string device_number { get; set; } public string sourceName_zh { get; set; } //device_number
public string error_reason { get; set; } public string ackState { get; set; } //ACKconfirm: Acked/Unacked
public string ACKconfirm { get; set; } public DateTime timestamp { get; set; }//發生時間 occur time
public string formId { get; set; } public string formId { get; set; }
public string ackState_zh
{
get
{
Dictionary<string, string> name = new Dictionary<string, string>()
{
{ "Acked" , "確認" },
{ "Unacked" , "未確認" }
};
return name[ackState];
}
}
public string created_at { get { return timestamp.ToString(); } set { } }
public string Created_at { get { return Convert.ToDateTime(created_at).ToString("yyyy-MM-dd HH:mm:ss"); } set { created_at = value; } } //發生時間顯示
} }
} }