From 64a3ab5bcb0bc961da28e89c5c089b0448b67379 Mon Sep 17 00:00:00 2001 From: xiaoguo Date: Wed, 1 Nov 2023 15:24:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=8C=E6=88=90=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 | Bin 159744 -> 159744 bytes PVDEMCS/.vs/PVDEMCS/v17/.suo | Bin 155648 -> 186368 bytes .../Controllers/EquipmentRecordController.cs | 50 ++++++ .../Services/IEquipmentRecordService.cs | 30 ++++ .../Services/Impl/EquipmentRecordService.cs | 47 +++++- .../Models/EquipmentRecordDayTotal.cs | 44 +---- .../EquipmentRecordFurnaceMonthTotal.cs | 2 +- .../Models/EquipmentRecordStateMonthTotal.cs | 2 +- .../Services/Models/EquipmentRecordTotal.cs | 56 ++++++ .../Repositories/Entities/EFContext.cs | 25 ++- .../Entities/EquipmentRecordDayTotalEntity.cs | 60 +++++++ .../Entities/EquipmentRecordTotalEntity.cs | 6 - .../IEquipmentRecordRepository.cs | 33 +++- .../Impl/EquipmentRecordRepository.cs | 159 +++++++++++++++--- 14 files changed, 435 insertions(+), 79 deletions(-) create mode 100644 PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordTotal.cs create mode 100644 PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordDayTotalEntity.cs diff --git a/PVDEMCS/.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 b/PVDEMCS/.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 index 337b8f78338bda29ebd3d5d401533ce8752888a8..8d504d86b5858cb57c6016310f6f9b303128b107 100644 GIT binary patch delta 619 zcmbWzyH6BR6vy#9cQYHHAXX%V-+&5>@({fcKrL1ekr$nlC+#R&_J?K-|!u|q3g^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/Controllers/EquipmentRecordController.cs +++ b/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs @@ -126,6 +126,34 @@ namespace PVDEMCS.Controllers return result; } + /// + /// 获取设备状态记录统计分页列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + /// 当前页 + /// 页大小 + [HttpGet] + public Result> GetEquipmentRecordTotalPageList(string equipmentName, string equipmentCode, string equipmentType, int page, int size = 20) + { + var result = _equipmentRecordService.GetEquipmentRecordTotalPageList(equipmentName, equipmentCode, equipmentType, page, size); + return result; + } + + /// + /// 获取设备状态记录统计列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + [HttpGet] + public Result> GetEquipmentRecordTotalList(string equipmentName, string equipmentCode, string equipmentType) + { + var result = _equipmentRecordService.GetEquipmentRecordTotalList(equipmentName, equipmentCode, equipmentType); + return result; + } + /// /// 获取设备总览 /// @@ -207,6 +235,28 @@ namespace PVDEMCS.Controllers return new Result>(alarmList); } + /// + /// 获取设备状态记录月统计 + /// + /// + [HttpGet] + public Result> GetEquipmentRecordStateMonthTotal() + { + var result = _equipmentRecordService.GetEquipmentRecordStateMonthTotal(); + return result; + } + + /// + /// 获取设备记录开炉次数月统计 + /// + /// + [HttpGet] + public Result> GetEquipmentRecordFurnaceMonthTotal() + { + var result = _equipmentRecordService.GetEquipmentRecordFurnaceMonthTotal(); + return result; + } + #endregion } diff --git a/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs b/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs index dba9901..4f05728 100644 --- a/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs +++ b/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs @@ -80,6 +80,36 @@ namespace PVDEMCS.Services /// 结束时间 Result> GetEquipmentRecordDayTotalList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime); + /// + /// 获取设备状态记录统计分页列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + /// 当前页 + /// 页大小 + Result> GetEquipmentRecordTotalPageList(string equipmentName, string equipmentCode, string equipmentType, int page, int size); + + /// + /// 获取设备状态记录统计列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + Result> GetEquipmentRecordTotalList(string equipmentName, string equipmentCode, string equipmentType); + + /// + /// 获取设备状态记录月统计 + /// + /// + Result> GetEquipmentRecordStateMonthTotal(); + + /// + /// 获取设备记录开炉次数月统计 + /// + /// + Result> GetEquipmentRecordFurnaceMonthTotal(); + #endregion } } diff --git a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs index 4b4830d..fca796d 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs @@ -61,7 +61,6 @@ namespace PVDEMCS.Services.Impl /// /// 设备Id /// 设备状态,运行:Run,待机:Stop,报警:Alarm - /// 设备Id /// public Result AddUpdateEquipmentRecord(string equipmentId, string state, DateTime dateTime) { @@ -114,6 +113,52 @@ namespace PVDEMCS.Services.Impl return result; } + /// + /// 获取设备状态记录统计分页列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + /// 当前页 + /// 页大小 + public Result> GetEquipmentRecordTotalPageList(string equipmentName, string equipmentCode, string equipmentType, int page, int size) + { + var result = this._equipmentRecordRepository.GetEquipmentRecordTotalPageList(equipmentName, equipmentCode, equipmentType, page, size); + return result; + } + + /// + /// 获取设备状态记录统计列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + public Result> GetEquipmentRecordTotalList(string equipmentName, string equipmentCode, string equipmentType) + { + var result = this._equipmentRecordRepository.GetEquipmentRecordTotalList(equipmentName, equipmentCode, equipmentType); + return result; + } + + /// + /// 获取设备状态记录月统计 + /// + /// + public Result> GetEquipmentRecordStateMonthTotal() + { + var result = this._equipmentRecordRepository.GetEquipmentRecordStateMonthTotal(); + return result; + } + + /// + /// 获取设备记录开炉次数月统计 + /// + /// + public Result> GetEquipmentRecordFurnaceMonthTotal() + { + var result = this._equipmentRecordRepository.GetEquipmentRecordFurnaceMonthTotal(); + return result; + } + #endregion } } diff --git a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordDayTotal.cs b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordDayTotal.cs index 5fd740f..f35abad 100644 --- a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordDayTotal.cs +++ b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordDayTotal.cs @@ -8,50 +8,8 @@ namespace PVDEMCS.Services.Models; /// 设备状态记录日统计 /// /// -public partial class EquipmentRecordDayTotal +public partial class EquipmentRecordDayTotal: EquipmentRecordTotal { - public string Id { get; set; } - - /// - /// 设备Id - /// - public string EquipmentId { get; set; } - - /// - /// 设备编码 - /// - public string EquipmentCode { get; set; } - - /// - /// 设备名称 - /// - public string EquipmentName { get; set; } - - /// - /// 设备类型:Ionbond,Balzers,Cemecon - /// - public string EquipmentType { get; set; } - - /// - /// 开炉次数 - /// - public int FurnaceNum { get; set; } - - /// - /// 总运行时长 - /// - public decimal TotalRunningTime { get; set; } - - /// - /// 总报警时长 - /// - public decimal TotalAlarmTime { get; set; } - - /// - /// 总待机时长 - /// - public decimal TotalStopTime { get; set; } - /// /// 日期 /// diff --git a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordFurnaceMonthTotal.cs b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordFurnaceMonthTotal.cs index 5c064c1..4fa973e 100644 --- a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordFurnaceMonthTotal.cs +++ b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordFurnaceMonthTotal.cs @@ -18,6 +18,6 @@ /// /// 日期 /// - public DateTime? TotalMonth { get; set; } + public string TotalMonth { get; set; } } } diff --git a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordStateMonthTotal.cs b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordStateMonthTotal.cs index 9eaea42..30382d4 100644 --- a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordStateMonthTotal.cs +++ b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordStateMonthTotal.cs @@ -23,6 +23,6 @@ /// /// 日期 /// - public DateTime? TotalMonth { get; set; } + public string TotalMonth { get; set; } } } diff --git a/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordTotal.cs b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordTotal.cs new file mode 100644 index 0000000..23b541a --- /dev/null +++ b/PVDEMCS/PVDEMCS/Services/Models/EquipmentRecordTotal.cs @@ -0,0 +1,56 @@ + +using System; +using System.Collections.Generic; + +namespace PVDEMCS.Services.Models; + +/// +/// 设备状态记录统计 +/// +/// +public partial class EquipmentRecordTotal +{ + public string Id { get; set; } + + /// + /// 设备Id + /// + public string EquipmentId { get; set; } + + /// + /// 设备编码 + /// + public string EquipmentCode { get; set; } + + /// + /// 设备名称 + /// + public string EquipmentName { get; set; } + + /// + /// 设备类型:Ionbond,Balzers,Cemecon + /// + public string EquipmentType { get; set; } + + /// + /// 开炉次数 + /// + public int FurnaceNum { get; set; } + + /// + /// 总运行时长 + /// + public decimal TotalRunningTime { get; set; } + + /// + /// 总报警时长 + /// + public decimal TotalAlarmTime { get; set; } + + /// + /// 总待机时长 + /// + public decimal TotalStopTime { get; set; } + + +} \ No newline at end of file diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EFContext.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EFContext.cs index e5e4602..046cc46 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EFContext.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EFContext.cs @@ -30,6 +30,8 @@ public partial class EFContext : DbContext public virtual DbSet EquipmentRecords { get; set; } + public virtual DbSet EquipmentRecordDayTotals { get; set; } + public virtual DbSet EquipmentRecordTotals { get; set; } public virtual DbSet SysConfigs { get; set; } @@ -129,18 +131,18 @@ public partial class EFContext : DbContext entity.Property(e => e.CreateAt).HasComment("创建时间"); entity.Property(e => e.CreateBy).HasComment("创建者"); entity.Property(e => e.EndTime).HasComment("设备名称"); - entity.Property(e => e.EquipmentId).HasComment("设备类型:Ionbond,Balzers,Cemecon"); + entity.Property(e => e.EquipmentId).HasComment("设备id"); entity.Property(e => e.StartTime).HasComment("设备编码"); entity.Property(e => e.State).HasComment("设备状态,1:运行,2:待机,3:报警"); entity.Property(e => e.UpdateAt).HasComment("修改时间"); entity.Property(e => e.UpdateBy).HasComment("修改者"); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("PRIMARY"); - entity.ToTable("equipment_record_total", tb => tb.HasComment("设备状态记录日统计\r\n")); + entity.ToTable("equipment_record_day_total", tb => tb.HasComment("设备状态记录日统计\r\n")); entity.Property(e => e.CreateAt).HasComment("创建时间"); entity.Property(e => e.CreateBy).HasComment("创建者"); @@ -154,6 +156,23 @@ public partial class EFContext : DbContext entity.Property(e => e.UpdateBy).HasComment("修改者"); }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PRIMARY"); + + entity.ToTable("equipment_record_total", tb => tb.HasComment("设备状态记录统计\r\n")); + + entity.Property(e => e.CreateAt).HasComment("创建时间"); + entity.Property(e => e.CreateBy).HasComment("创建者"); + entity.Property(e => e.EquipmentId).HasComment("设备Id"); + entity.Property(e => e.FurnaceNum).HasComment("开炉次数"); + entity.Property(e => e.TotalAlarmTime).HasComment("总报警时长"); + entity.Property(e => e.TotalStopTime).HasComment("总待机时长"); + entity.Property(e => e.TotalRunningTime).HasComment("总运行时长"); + entity.Property(e => e.UpdateAt).HasComment("修改时间"); + entity.Property(e => e.UpdateBy).HasComment("修改者"); + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("PRIMARY"); diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordDayTotalEntity.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordDayTotalEntity.cs new file mode 100644 index 0000000..85a7c0c --- /dev/null +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordDayTotalEntity.cs @@ -0,0 +1,60 @@ +// This file has been auto generated by EF Core Power Tools. +#nullable disable +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using PVDEMCS.Services.Repositories.Entities.BaseEntity; + +namespace PVDEMCS.Services.Repositories.Entities; + + +/// +/// 设备状态记录日统计 +/// +/// +[Table("equipment_record_day_total")] +public partial class EquipmentRecordDayTotalEntity : CUBaseEntity +{ + /// + /// 设备Id + /// + [Required] + [Column("equipment_id")] + [StringLength(32)] + public string EquipmentId { get; set; } + + /// + /// 开炉次数 + /// + [Column("furnace_num")] + public int FurnaceNum { get; set; } + + /// + /// 总运行时长 + /// + [Column("total_running_time")] + [Precision(32, 2)] + public decimal TotalRunningTime { get; set; } + + /// + /// 总报警时长 + /// + [Column("total_alarm_time")] + [Precision(32, 2)] + public decimal TotalAlarmTime { get; set; } + + /// + /// 总待机时长 + /// + [Column("total_stop_time")] + [Precision(32, 2)] + public decimal TotalStopTime { get; set; } + /// + /// 日期 + /// + [Column("total_day", TypeName = "datetime")] + public DateTime? TotalDay { get; set; } + +} \ No newline at end of file diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordTotalEntity.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordTotalEntity.cs index ce35b5f..53d9dc9 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordTotalEntity.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Entities/EquipmentRecordTotalEntity.cs @@ -53,10 +53,4 @@ public partial class EquipmentRecordTotalEntity : CUBaseEntity [Precision(32, 2)] public decimal TotalStopTime { get; set; } - /// - /// 日期 - /// - [Column("total_day", TypeName = "datetime")] - public DateTime? TotalDay { get; set; } - } \ No newline at end of file diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs index 8fdc435..b89e8f7 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs @@ -5,6 +5,7 @@ using PVDEMCS.Common; using PVDEMCS.Common.DI; using PVDEMCS.Services.Models; using PVDEMCS.Services.Repositories.Entities; +using Microsoft.EntityFrameworkCore; namespace PVDEMCS.Services.Repositories { @@ -74,7 +75,7 @@ namespace PVDEMCS.Services.Repositories Result> GetEquipmentRecordDayTotalPageList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, int page, int size); /// - /// 获取设备状态记录统计列表 + /// 获取设备状态记录日统计列表 /// /// 设备名称 /// 设备编号 @@ -83,7 +84,35 @@ namespace PVDEMCS.Services.Repositories /// 结束时间 Result> GetEquipmentRecordDayTotalList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime); - + /// + /// 获取设备状态记录统计分页列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + /// 当前页 + /// 页大小 + Result> GetEquipmentRecordTotalPageList(string equipmentName, string equipmentCode, string equipmentType, int page, int size); + + /// + /// 获取设备状态记录统计列表 + /// + /// 设备名称 + /// 设备编号 + /// 设备类型 + Result> GetEquipmentRecordTotalList(string equipmentName, string equipmentCode, string equipmentType); + + /// + /// 获取设备状态记录月统计 + /// + /// + Result> GetEquipmentRecordStateMonthTotal(); + + /// + /// 获取设备记录开炉次数月统计 + /// + /// + Result> GetEquipmentRecordFurnaceMonthTotal(); #endregion } diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs index 40b781a..73ad16f 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs @@ -1,11 +1,13 @@ using AngleSharp.Css.Values; using Masuit.Tools; using Masuit.Tools.Models; +using Microsoft.EntityFrameworkCore; using PVDEMCS.Common; using PVDEMCS.Common.Constant; using PVDEMCS.Common.DI; using PVDEMCS.Services.Models; using PVDEMCS.Services.Repositories.Entities; +using System.Text.RegularExpressions; namespace PVDEMCS.Services.Repositories.Impl { @@ -195,7 +197,7 @@ namespace PVDEMCS.Services.Repositories.Impl } // var furnaceList = (from q in query - join e in context.EquipmentInfos.Where(f=>!f.IsDelete) on q.EquipmentId equals e.Id + join e in context.EquipmentInfos.Where(f => !f.IsDelete) on q.EquipmentId equals e.Id where q.State == EquipmentState.Run select new { @@ -244,7 +246,7 @@ namespace PVDEMCS.Services.Repositories.Impl } } //记录统计时间 - var list = context.EquipmentRecordTotals.Where(f => f.TotalDay == begDate).ToList(); + var list = context.EquipmentRecordDayTotals.Where(f => f.TotalDay == begDate).ToList(); //有记录 foreach (var item in list) { @@ -274,7 +276,7 @@ namespace PVDEMCS.Services.Repositories.Impl foreach (var equipmentId in notRecords.Select(f => f.EquipmentId).Distinct()) { var records = total.Where(f => f.EquipmentId == equipmentId).ToList(); - var item = new EquipmentRecordTotalEntity + var item = new EquipmentRecordDayTotalEntity { EquipmentId = equipmentId, TotalDay = begDate @@ -298,7 +300,7 @@ namespace PVDEMCS.Services.Repositories.Impl } item.Create(); } - context.EquipmentRecordTotals.Add(item); + context.EquipmentRecordDayTotals.Add(item); } context.SaveChanges(); @@ -318,7 +320,7 @@ namespace PVDEMCS.Services.Repositories.Impl #region 设备记录统计 /// - /// 获取设备状态记录统计分页列表 + /// 获取设备状态记录日统计分页列表 /// /// 设备名称 /// 设备编号 @@ -331,7 +333,7 @@ namespace PVDEMCS.Services.Repositories.Impl { using (var context = new EFContext()) { - var query = QueryEquipmentRecordTotal(equipmentName, equipmentCode, equipmentType, begTime, endTime, context); + var query = QueryEquipmentRecordDayTotal(equipmentName, equipmentCode, equipmentType, begTime, endTime, context); var pageList = query.OrderByDescending(f => f.EquipmentCode).ToPagedList(page, size); @@ -340,7 +342,7 @@ namespace PVDEMCS.Services.Repositories.Impl } /// - /// 获取设备状态记录统计列表 + /// 获取设备状态记录日统计列表 /// /// 设备名称 /// 设备编号 @@ -351,7 +353,7 @@ namespace PVDEMCS.Services.Repositories.Impl { using (var context = new EFContext()) { - var query = QueryEquipmentRecordTotal(equipmentName, equipmentCode, equipmentType, begTime, endTime, context); + var query = QueryEquipmentRecordDayTotal(equipmentName, equipmentCode, equipmentType, begTime, endTime, context); var pageList = query.OrderByDescending(f => f.EquipmentCode).ToList(); @@ -359,32 +361,83 @@ namespace PVDEMCS.Services.Repositories.Impl } } + private IQueryable QueryEquipmentRecordDayTotal(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, EFContext context) + { + var query = from recordTotal in context.EquipmentRecordDayTotals + join equipment in context.EquipmentInfos.Where(f => !f.IsDelete) on recordTotal.EquipmentId equals equipment.Id + select new EquipmentRecordDayTotal + { + Id = recordTotal.Id, + EquipmentName = equipment.EquipmentName, + EquipmentCode = equipment.EquipmentCode, + EquipmentType = equipment.EquipmentType, + FurnaceNum = recordTotal.FurnaceNum, + TotalAlarmTime = recordTotal.TotalAlarmTime, + TotalStopTime = recordTotal.TotalStopTime, + TotalRunningTime = recordTotal.TotalRunningTime, + TotalDay = recordTotal.TotalDay, + }; + + if (!equipmentName.IsNullOrEmpty()) + { + query = query.Where(f => f.EquipmentName.StartsWith(equipmentName)); + } + if (!equipmentCode.IsNullOrEmpty()) + { + query = query.Where(f => f.EquipmentCode.StartsWith(equipmentCode)); + } + if (!equipmentType.IsNullOrEmpty()) + { + query = query.Where(f => f.EquipmentType == equipmentType); + } + query = query.Where(f => f.TotalDay >= begTime && f.TotalDay <= endTime); + + return query; + } + /// - /// 获取设备状态记录月统计 + /// 获取设备状态记录统计分页列表 /// - /// - public Result> GetEquipmentRecordStateMonthTotal() + /// 设备名称 + /// 设备编号 + /// 设备类型 + /// 当前页 + /// 页大小 + public Result> GetEquipmentRecordTotalPageList(string equipmentName, string equipmentCode, string equipmentType, int page, int size) { using (var context = new EFContext()) - { } + { + var query = QueryEquipmentRecordTotal(equipmentName, equipmentCode, equipmentType, context); + + var pageList = query.OrderByDescending(f => f.EquipmentCode).ToPagedList(page, size); - return null; + return new Result>(pageList); + } } /// - /// 获取设备记录开炉次数月统计 + /// 获取设备状态记录统计列表 /// - /// - public Result> GetEquipmentRecordFurnaceMonthTotal() + /// 设备名称 + /// 设备编号 + /// 设备类型 + public Result> GetEquipmentRecordTotalList(string equipmentName, string equipmentCode, string equipmentType) { - return null; + using (var context = new EFContext()) + { + var query = QueryEquipmentRecordTotal(equipmentName, equipmentCode, equipmentType, context); + + var pageList = query.OrderByDescending(f => f.EquipmentCode).ToList(); + + return new Result>(pageList); + } } - private IQueryable QueryEquipmentRecordTotal(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, EFContext context) + private IQueryable QueryEquipmentRecordTotal(string equipmentName, string equipmentCode, string equipmentType, EFContext context) { - var query = from recordTotal in context.EquipmentRecordTotals + var query = from recordTotal in context.EquipmentRecordDayTotals join equipment in context.EquipmentInfos.Where(f => !f.IsDelete) on recordTotal.EquipmentId equals equipment.Id - select new EquipmentRecordDayTotal + select new EquipmentRecordTotal { Id = recordTotal.Id, EquipmentName = equipment.EquipmentName, @@ -394,7 +447,6 @@ namespace PVDEMCS.Services.Repositories.Impl TotalAlarmTime = recordTotal.TotalAlarmTime, TotalStopTime = recordTotal.TotalStopTime, TotalRunningTime = recordTotal.TotalRunningTime, - TotalDay = recordTotal.TotalDay, }; if (!equipmentName.IsNullOrEmpty()) @@ -409,11 +461,74 @@ namespace PVDEMCS.Services.Repositories.Impl { query = query.Where(f => f.EquipmentType == equipmentType); } - query = query.Where(f => f.TotalDay >= begTime && f.TotalDay <= endTime); return query; } + /// + /// 获取设备状态记录月统计 + /// + /// + public Result> GetEquipmentRecordStateMonthTotal() + { + //获取今年第一天和最后一天 + var begDate = DateTime.Now.ToString("yyyy-01-01"); + var endDate = DateTime.Parse(begDate).AddYears(1).AddSeconds(-1).ToString("yyyy-01-01"); + using (var context = new EFContext()) + { + var list = context.Database.SqlQuery(@$"SELECT + SUM(total_running_time) AS TotalRunningTime, + SUM(total_alarm_time) AS TotalAlarmTime, + SUM(total_stop_time) AS TotalStopTime, + MONTH(total_day) AS TotalMonth + FROM + + equipment_record_total + WHERE + + total_day >= '{begDate}' + + AND total_day <= '{endDate}' + GROUP BY + TotalMonth").ToList(); + + return new Result>(list); + } + + } + + /// + /// 获取设备记录开炉次数月统计 + /// + /// + public Result> GetEquipmentRecordFurnaceMonthTotal() + { + //获取今年第一天和最后一天 + var begDate = DateTime.Now.ToString("yyyy-01-01"); + var endDate = DateTime.Parse(begDate).AddYears(1).AddSeconds(-1).ToString("yyyy-01-01"); + using (var context = new EFContext()) + { + var list = context.Database.SqlQuery(@$"SELECT + SUM( furnace_num ) AS FurnaceNum, + equipment_info.equipment_type AS EquipmentType, + MONTH ( total_day ) AS TotalMonth + FROM + equipment_record_total + JOIN equipment_info ON equipment_record_total.equipment_id = equipment_info.id + WHERE + total_day >= '{begDate}' + AND total_day <= '{endDate}' + GROUP BY + TotalMonth, + EquipmentType").ToList(); + + return new Result>(list); + } + } + + + + #endregion } } From ad76f74bad386b80c4cee798be150537337fb612 Mon Sep 17 00:00:00 2001 From: xiaoguo Date: Wed, 1 Nov 2023 15:25:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20sql=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SQL/pvdemcs.sql | 50 ++++++++++++++++++++----------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/SQL/pvdemcs.sql b/SQL/pvdemcs.sql index a5bee8b..9493a7a 100644 --- a/SQL/pvdemcs.sql +++ b/SQL/pvdemcs.sql @@ -11,7 +11,7 @@ Target Server Version : 80034 File Encoding : 65001 - Date: 30/10/2023 00:17:45 + Date: 01/11/2023 15:24:59 */ SET NAMES utf8mb4; @@ -40,10 +40,6 @@ CREATE TABLE `device_info` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PLC控制器' ROW_FORMAT = DYNAMIC; --- ---------------------------- --- Records of device_info --- ---------------------------- - -- ---------------------------- -- Table structure for device_point -- ---------------------------- @@ -69,10 +65,6 @@ CREATE TABLE `device_point` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'PLC点位' ROW_FORMAT = DYNAMIC; --- ---------------------------- --- Records of device_point --- ---------------------------- - -- ---------------------------- -- Table structure for equipment_info -- ---------------------------- @@ -94,10 +86,6 @@ CREATE TABLE `equipment_info` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备信息' ROW_FORMAT = Dynamic; --- ---------------------------- --- Records of equipment_info --- ---------------------------- - -- ---------------------------- -- Table structure for equipment_record -- ---------------------------- @@ -116,8 +104,23 @@ CREATE TABLE `equipment_record` ( ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备状态记录明显' ROW_FORMAT = Dynamic; -- ---------------------------- --- Records of equipment_record +-- Table structure for equipment_record_day_total -- ---------------------------- +DROP TABLE IF EXISTS `equipment_record_day_total`; +CREATE TABLE `equipment_record_day_total` ( + `id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL, + `equipment_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备Id', + `furnace_num` int NOT NULL COMMENT '开炉次数', + `total_running_time` decimal(32, 2) NOT NULL COMMENT '总运行时长', + `total_alarm_time` decimal(32, 2) NOT NULL COMMENT '总报警时长', + `total_stop_time` decimal(32, 2) NOT NULL COMMENT '总待机时长', + `total_day` datetime NULL DEFAULT NULL COMMENT '日期', + `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者', + `create_at` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '修改者', + `update_at` datetime NULL DEFAULT NULL COMMENT '修改时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备状态记录日统计\r\n' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for equipment_record_total @@ -130,17 +133,12 @@ CREATE TABLE `equipment_record_total` ( `total_running_time` decimal(32, 2) NOT NULL COMMENT '总运行时长', `total_alarm_time` decimal(32, 2) NOT NULL COMMENT '总报警时长', `total_stop_time` decimal(32, 2) NOT NULL COMMENT '总待机时长', - `total_day` datetime NULL DEFAULT NULL COMMENT '日期', `create_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '创建者', `create_at` datetime NULL DEFAULT NULL COMMENT '创建时间', `update_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '修改者', `update_at` datetime NULL DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备状态记录日统计\r\n' ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of equipment_record_total --- ---------------------------- +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '设备状态记录统计\r\n' ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for sys_config @@ -161,11 +159,7 @@ CREATE TABLE `sys_config` ( `delete_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '删除者', `delete_at` datetime NULL DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 120 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '参数配置表' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sys_config --- ---------------------------- +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '参数配置表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Table structure for sys_user @@ -194,10 +188,6 @@ CREATE TABLE `sys_user` ( `delete_by` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '删除者', `delete_at` datetime NULL DEFAULT NULL COMMENT '删除时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户信息表' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sys_user --- ---------------------------- +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户信息表' ROW_FORMAT = DYNAMIC; SET FOREIGN_KEY_CHECKS = 1;