From ce941ab2438241fa32080708235434b7648d736a Mon Sep 17 00:00:00 2001 From: dell Date: Thu, 6 Apr 2023 21:32:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E5=8E=86=E5=8F=B2=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=EF=BC=8C=E9=A2=84=E8=A7=88=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/ReportManage/MetaTagAlarmEntity.cs | 32 +- .../ReportManage/MetaTagAlarmService.cs | 33 +- .../Controllers/MetaTagAlarmController.cs | 54 +- .../Views/MetaTagAlarm/Index.cshtml | 937 +++++++++++++++--- 4 files changed, 899 insertions(+), 157 deletions(-) diff --git a/HT.Cloud.Domain/Entity/ReportManage/MetaTagAlarmEntity.cs b/HT.Cloud.Domain/Entity/ReportManage/MetaTagAlarmEntity.cs index 774a34e..fb58eef 100644 --- a/HT.Cloud.Domain/Entity/ReportManage/MetaTagAlarmEntity.cs +++ b/HT.Cloud.Domain/Entity/ReportManage/MetaTagAlarmEntity.cs @@ -50,36 +50,11 @@ namespace HT.Cloud.Domain.ReportManage /// /// /// - [SugarColumn(ColumnName="Archive", ColumnDescription = "",ColumnDataType = "bit(1)")] - public bool Archive { get; set; } - /// - /// - /// - [SugarColumn(ColumnName="DefaultValue", ColumnDescription = "",ColumnDataType = "sql_variant", IsNullable = true)] - public string DefaultValue { get; set; } - /// - /// - /// [SugarColumn(ColumnName="Description", ColumnDescription = "",ColumnDataType = "nvarchar(128)", IsNullable = true)] public string Description { get; set; } /// /// /// - [SugarColumn(ColumnName="Maximum", ColumnDescription = "",ColumnDataType = "real(24)")] - public Single Maximum { get; set; } - /// - /// - /// - [SugarColumn(ColumnName="Minimum", ColumnDescription = "",ColumnDataType = "real(24)")] - public Single Minimum { get; set; } - /// - /// - /// - [SugarColumn(ColumnName="Cycle", ColumnDescription = "",ColumnDataType = "int(10)")] - public int Cycle { get; set; } - /// - /// - /// [SugarColumn(ColumnName="Subsystem", ColumnDescription = "",ColumnDataType = "varchar(64)")] public string Subsystem { get; set; } /// @@ -92,5 +67,10 @@ namespace HT.Cloud.Domain.ReportManage /// [SugarColumn(ColumnName="WriteAddress", ColumnDescription = "",ColumnDataType = "varchar(64)", IsNullable = true)] public string WriteAddress { get; set; } - } + /// + /// 报警类型 + /// + [SugarColumn(ColumnName = "Alarmtype", ColumnDescription = "报警类型", ColumnDataType = "varchar(8)", IsNullable = true)] + public string Alarmtype { get; set; } + } } diff --git a/HT.Cloud.Service/ReportManage/MetaTagAlarmService.cs b/HT.Cloud.Service/ReportManage/MetaTagAlarmService.cs index 609edff..02e4135 100644 --- a/HT.Cloud.Service/ReportManage/MetaTagAlarmService.cs +++ b/HT.Cloud.Service/ReportManage/MetaTagAlarmService.cs @@ -4,6 +4,7 @@ using HT.Cloud.Domain.ReportManage; using SqlSugar; using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -40,7 +41,7 @@ namespace HT.Cloud.Service.ReportManage new SubAllTagReturn() { TagID = (short)subsystem.TagID, - Description = subsystem.Description + $"({subsystem.Units})", + Description = subsystem.Description, Units = subsystem.Units } ); @@ -102,7 +103,35 @@ namespace HT.Cloud.Service.ReportManage //return resultlist.ToJson(); } - private class AlarmValue + public async Task GetAlarmRecordQuick(string HATYPE, string startdt, string enddt) + { + + SugarParameter[] sqlParameters = + { + new SugarParameter("@HATYPE",HATYPE), + new SugarParameter("@Hstartdt",startdt), + new SugarParameter("@Henddt",enddt) + + + }; + var dt = _context.Ado.UseStoredProcedure().GetDataTable("Query_Tag_Alarm_Count", sqlParameters); + var valuelist = DataTableConvertModel.ConvertDataTableToList(dt); + return valuelist.ToJson(); + + } + public async Task GetAlarmSubSystem(string alarmName) + { + var subSystem = repository.IQueryable().Where(x => x.Description == alarmName).First().Subsystem; + return subSystem.ToJson(); + } + private class AlarmValueCount + { + public string Alarmtype { get; set; } + public string Description { get; set; } + public int hcount { get; set; } + public int hztime { get; set; } + } + private class AlarmValue { public string Description { get; set; } public string startdt { get; set; } diff --git a/HT.Cloud.Web/Areas/ReportManage/Controllers/MetaTagAlarmController.cs b/HT.Cloud.Web/Areas/ReportManage/Controllers/MetaTagAlarmController.cs index dd071bf..c5d86c0 100644 --- a/HT.Cloud.Web/Areas/ReportManage/Controllers/MetaTagAlarmController.cs +++ b/HT.Cloud.Web/Areas/ReportManage/Controllers/MetaTagAlarmController.cs @@ -48,8 +48,25 @@ namespace HT.Cloud.Web.Areas.ReportManage.Controllers var data = await _metaTagAlarmService.GetAlarmRecord(TagID, StartTime, EndTime); return Content(data); } + [HttpPost] + public async Task GetAlarmRecordQuick(Alarm_Quick_Params alarm_Quick_Params) + { + var Alarmtype = alarm_Quick_Params.Alarmtype; + var StartTime = Gettime(alarm_Quick_Params.StartTime); + var EndTime = Gettime(alarm_Quick_Params.EndTime); - public string Gettime(string longtime) + var data = await _metaTagAlarmService.GetAlarmRecordQuick(Alarmtype, StartTime, EndTime); + return Content(data); + } + [HttpPost] + public async Task GetAlarmSubSystem(SubSystem_Params subSystem_Params) + { + var AlarmName = subSystem_Params.AlarmName; + var data = await _metaTagAlarmService.GetAlarmSubSystem(AlarmName); + return Content(data); + } + + public string Gettime(string longtime) { long jsTimeStamp = long.Parse(longtime); System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 @@ -76,23 +93,32 @@ namespace HT.Cloud.Web.Areas.ReportManage.Controllers public string SubsysytemName { get; set; } } - //public class HDATETIMEVALUE - //{ - // public String HDATETIME { get; set; } - // public decimal VALUE { get; set; } - //} - //public class ChartData - //{ - // public decimal value { get; set; } - // public String name { get; set; } - //} - - public class Alarm_Params + //public class HDATETIMEVALUE + //{ + // public String HDATETIME { get; set; } + // public decimal VALUE { get; set; } + //} + //public class ChartData + //{ + // public decimal value { get; set; } + // public String name { get; set; } + //} + public class SubSystem_Params + { + public string AlarmName { get; set; } + } + public class Alarm_Params { public string TagID { get; set; } public string StartTime { get; set; } public string EndTime { get; set; } } + public class Alarm_Quick_Params + { + public string Alarmtype { get; set; } + public string StartTime { get; set; } + public string EndTime { get; set; } + } - } + } } diff --git a/HT.Cloud.Web/Areas/ReportManage/Views/MetaTagAlarm/Index.cshtml b/HT.Cloud.Web/Areas/ReportManage/Views/MetaTagAlarm/Index.cshtml index 8a6ae49..206a019 100644 --- a/HT.Cloud.Web/Areas/ReportManage/Views/MetaTagAlarm/Index.cshtml +++ b/HT.Cloud.Web/Areas/ReportManage/Views/MetaTagAlarm/Index.cshtml @@ -10,9 +10,11 @@ - + +
@**@ -
-
-
-
- @*
    *@ -
    -
    -
    -
    -
    -
    +
      +
    • 报警汇总
    • +
    • 报警查询
    • +
    +
    +
    +
    +
    + @*
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    *@ +
    + @*
    +
    +
    +
    +
    *@ + +
    + +
    +
    +
    + +
    + + + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + + + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    + +
    + +
    +
    +
    +
    @*style="width: 100%; height: 100% "*@ + +
    +
    -
    -
    - @*
    -
    -
    +
    +
    +
    +
    +
    + @*
      *@ +
      +
      +
      +
      +
      +
      + +
      + +
      +
      +
      +
      + @*
      +
      +
      +
      +
      *@ + +
      +
      +
      +
      + +
      + +
      +
      +
      +
      +
      + +
      + +
      +
      +
      +
      +
      + +
      + + + +
      +
      +
      +
      +
      +
      + +
      + +
      +
      + +
      + +
      +
      +
      +
      @*style="width: 100%; height: 100% "*@ +
      +
      +
      -
      *@ - -
      -
      -
      -
      - -
      - -
      -
      -
      -
      -
      - -
      - -
      -
      -
      -
      -
      - -
      - - - -
      -
      -
      -
      -
      -
      - -
      - -
      -
      - -
      - -
      -
      -
      -
      @*style="width: 100%; height: 100% "*@ -
      -
      +