From ad012d602b1dc7a0eb265e8585f6004a9b241dc8 Mon Sep 17 00:00:00 2001 From: xiaoguo Date: Wed, 1 Nov 2023 23:53:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PVDEMCS/.vs/PVDEMCS/v17/.suo | Bin 163840 -> 163840 bytes PVDEMCS/PVDEMCS/Services/IDeviceService.cs | 4 ++ .../Services/IEquipmentRecordService.cs | 7 ++- PVDEMCS/PVDEMCS/Services/IEquipmentService.cs | 13 +++-- PVDEMCS/PVDEMCS/Services/ISysConfigService.cs | 13 +++-- .../PVDEMCS/Services/Impl/DeviceService.cs | 8 ++- .../Services/Impl/EquipmentRecordService.cs | 6 +- .../PVDEMCS/Services/Impl/EquipmentService.cs | 12 ++-- .../PVDEMCS/Services/Impl/SysConfigService.cs | 13 +++-- .../Repositories/IDeviceRepository.cs | 10 ++-- .../IEquipmentRecordRepository.cs | 7 ++- .../Repositories/IEquipmentRepository.cs | 8 +-- .../Repositories/ISysConfigRepository.cs | 9 +-- .../Repositories/Impl/DeviceRepository.cs | 8 ++- .../Impl/EquipmentRecordRepository.cs | 55 +++++++++--------- .../Repositories/Impl/EquipmentRepository.cs | 6 +- .../Repositories/Impl/SysConfigRepository.cs | 9 +-- 17 files changed, 103 insertions(+), 85 deletions(-) diff --git a/PVDEMCS/.vs/PVDEMCS/v17/.suo b/PVDEMCS/.vs/PVDEMCS/v17/.suo index e318c28d2bdb149fc2b747107011bfab668eee9e..b8763c023314a3a3abe2caf0d16bebed3f9ad17b 100644 GIT binary patch delta 743 zcmb8tO=uHA6bJBm)1A60(I(bbp(#lvMGui~v>ypnQBdr~qWFOak$l)9y_kX@^`OMY zn?>6`X%vdoMXKn@?x7$p1ihAO1&z^EP5r**ps0s7{#RS^D#LH)&6}NlyR(~2RwR=Z z1AA%x{e2#(UG~Oaa*s^W7wemBrInpRh)M{+B8T-xe;uMO*aacj0#P^!XJMgKDsjJN zXc$YJ(GE}tS1YgX#M&z0Hg#C}5hVFK(kBp|veOy0#&H@!99%r7uBgQR>h7G?Q~sS? zcF`0p7v)~vqdh=^uW5$EF4>MrInQcwa&ohZ|EWHrJj#BI5>F|wm3Q>6*z;Tpk%bqK zgSYSs@-PRl;SDTeR{`TZyo2}f0Y1Vf_za6&f7d&hFs!1x$*F=kiZIv9wVa9Qn!|p$ zXts(+YpTni;o|Nx9;|7^w3Z7~Rq2F58Yi+E6289-ss3**3(m4IF5j^x3aIiOf;3k>h%h0r&nZ5Br+W_L?3rEi>}m^oiDJ}M>4 rTN~2_i)vh#o>Fg@^XI*O_x3xti?xT+H!skpiE|ezMSaDwA`SckC0FSm delta 442 zcmZo@;A&{#nh?O4zcEmTiKW!M`Nrl#wtmJ*EIJbU3=9nafj|dH^8>L6lt0;pMMWhI z$Y};*SE!&dkWK{RP#~@ZViq8t+{0opc@GEANX$Fjpsgn)e&o8p$*rde7w3*4{AM+$BwasdCZZS>|GGnsaZ0C1KeEKDQ zCXMM6Rx-}meBgis-b9=QU5|XIpt& zoKZ`0wUy /// 控制器编号 /// 控制器名称 + /// 是否启用 /// 当前页 /// 页大小 /// @@ -29,6 +30,7 @@ namespace PVDEMCS.Services /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// Result> GetDeviceInfoList(string deviceCode="", string deviceName = "", bool? activated = false); @@ -72,6 +74,7 @@ namespace PVDEMCS.Services /// 设备类型 /// 点位编号 /// 点位列表 + /// 是否启用 /// 当前页 /// 页大小 /// @@ -87,6 +90,7 @@ namespace PVDEMCS.Services /// 设备类型 /// 点位编号 /// 点位列表 + /// 是否启用 /// Result> GetDevicePointList(string deviceName="", string deviceCode = "", string equipmentName = "", string equipmentCode = "", string equipmentType = "", string pointCode = "", string pointName = "", bool? activated = true); diff --git a/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs b/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs index 0f1cba1..0e8574a 100644 --- a/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs +++ b/PVDEMCS/PVDEMCS/Services/IEquipmentRecordService.cs @@ -6,9 +6,9 @@ using PVDEMCS.Services.Repositories.Entities; namespace PVDEMCS.Services { - /* - * 设备数据记录与统计 服务层 接口 - */ + /// + /// 设备数据记录与统计 服务层 接口 + /// public interface IEquipmentRecordService : IDependency { #region 设备状态记录 @@ -51,6 +51,7 @@ namespace PVDEMCS.Services /// /// 设备Id /// 设备状态,运行:Run,待机:Stop,报警:Alarm + /// 记录时间 /// Result AddUpdateEquipmentRecord(string equipmentId, string state, DateTime dateTime); diff --git a/PVDEMCS/PVDEMCS/Services/IEquipmentService.cs b/PVDEMCS/PVDEMCS/Services/IEquipmentService.cs index 7d2fa9c..42d30f1 100644 --- a/PVDEMCS/PVDEMCS/Services/IEquipmentService.cs +++ b/PVDEMCS/PVDEMCS/Services/IEquipmentService.cs @@ -6,9 +6,9 @@ using PVDEMCS.Services.Models; namespace PVDEMCS.Services { - /* - * 设备管理 服务层 接口 - */ + /// + /// 设备管理 服务层 接口 + /// public interface IEquipmentService : IDependency { /// @@ -28,6 +28,7 @@ namespace PVDEMCS.Services /// /// 设备名称 /// 设备编号 + /// 设备类型 /// 是否启用 Result> GetEquipmentList(string equipmentName = "", string equipmentCode = "", string equipmentType = "", bool? activated = true); @@ -41,21 +42,21 @@ namespace PVDEMCS.Services /// /// 添加设备信息 /// - /// + /// /// Result AddEquipment(EquipmentInfo info); /// /// 更新设备信息 /// - /// + /// /// Result UpdateEquipment(EquipmentInfo info); /// /// 删除设备信息 /// - /// + /// /// Result DeleteEquipment(string id); } diff --git a/PVDEMCS/PVDEMCS/Services/ISysConfigService.cs b/PVDEMCS/PVDEMCS/Services/ISysConfigService.cs index 862cc2c..d792d01 100644 --- a/PVDEMCS/PVDEMCS/Services/ISysConfigService.cs +++ b/PVDEMCS/PVDEMCS/Services/ISysConfigService.cs @@ -6,9 +6,9 @@ using PVDEMCS.Services.Models; namespace PVDEMCS.Services { - /* - * 系统参数设置 服务层 接口 - */ + /// + /// 系统参数设置 服务层 接口 + /// public interface ISysConfigService : IDependency { /// @@ -39,21 +39,22 @@ namespace PVDEMCS.Services /// /// 获取获取系统参数设置明细 /// - /// + /// + /// /// Result GetSysConfigDetailNameOrKey(string name, string key = ""); /// /// 添加系统参数设置 /// - /// + /// /// Result AddSysConfig(SysConfig info); /// /// 更新系统参数设置 /// - /// + /// Result UpdateSysConfig(SysConfig info); diff --git a/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs b/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs index 8d80cc9..686866f 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs @@ -30,6 +30,7 @@ namespace PVDEMCS.Services.Impl /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// 当前页 /// 页大小 /// @@ -45,6 +46,7 @@ namespace PVDEMCS.Services.Impl /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// public Result> GetDeviceInfoList(string deviceCode, string deviceName, bool? activated = false) { @@ -120,6 +122,7 @@ namespace PVDEMCS.Services.Impl /// 设备类型 /// 点位编号 /// 点位列表 + /// 是否启用 /// 当前页 /// 页大小 /// @@ -140,6 +143,7 @@ namespace PVDEMCS.Services.Impl /// 设备类型 /// 点位编号 /// 点位列表 + /// 是否启用 /// public Result> GetDevicePointList(string deviceName, string deviceCode, string equipmentName, string equipmentCode, string equipmentType, string pointCode, string pointName, bool? activated) { @@ -171,7 +175,7 @@ namespace PVDEMCS.Services.Impl /// /// 添加PLC控制器点位 /// - /// + /// /// public Result AddDevicePoint(DevicePoint info) { @@ -183,7 +187,7 @@ namespace PVDEMCS.Services.Impl /// /// 更新PLC控制器点位 /// - /// + /// /// public Result UpdateDevicePoint(DevicePoint info) { diff --git a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs index dcf79c5..a1436de 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentRecordService.cs @@ -11,9 +11,9 @@ using PVDEMCS.Services.Repositories.Entities; namespace PVDEMCS.Services.Impl { - /* - * 设备数据记录与统计 服务层 实现 - */ + /// + /// 设备数据记录与统计 服务层 实现 + /// internal class EquipmentRecordService : IEquipmentRecordService { private readonly IEquipmentRecordRepository _equipmentRecordRepository; diff --git a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs index 33673d7..6692703 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs @@ -13,9 +13,9 @@ using Masuit.Tools; namespace PVDEMCS.Services.Impl { - /* - * 设备管理 服务层 接口 - */ + /// + /// 设备管理 服务层 接口 + /// internal class EquipmentService : IEquipmentService { private readonly IEquipmentRepository _equipmentRepository; @@ -123,7 +123,7 @@ namespace PVDEMCS.Services.Impl /// /// 添加设备信息 /// - /// + /// /// public Result AddEquipment(EquipmentInfo info) { @@ -135,7 +135,7 @@ namespace PVDEMCS.Services.Impl /// /// 更新设备信息 /// - /// + /// /// public Result UpdateEquipment(EquipmentInfo info) { @@ -147,7 +147,7 @@ namespace PVDEMCS.Services.Impl /// /// 删除设备信息 /// - /// + /// /// public Result DeleteEquipment(string id) { diff --git a/PVDEMCS/PVDEMCS/Services/Impl/SysConfigService.cs b/PVDEMCS/PVDEMCS/Services/Impl/SysConfigService.cs index 98dfc47..d284b6a 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/SysConfigService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/SysConfigService.cs @@ -10,9 +10,9 @@ using PVDEMCS.Services.Repositories.Impl; namespace PVDEMCS.Services.Impl { - /* - * 系统参数设置 服务层 实现 - */ + /// + /// 系统参数设置 服务层 实现 + /// internal class SysConfigService : ISysConfigService { private readonly ISysConfigRepository _sysConfigRepository; @@ -70,7 +70,8 @@ namespace PVDEMCS.Services.Impl /// /// 获取获取系统参数设置明细 /// - /// + /// 名称 + /// 键值 /// public Result GetSysConfigDetailNameOrKey(string name, string key = "") { @@ -90,7 +91,7 @@ namespace PVDEMCS.Services.Impl /// /// 添加系统参数设置 /// - /// + /// /// public Result AddSysConfig(SysConfig info) { @@ -102,7 +103,7 @@ namespace PVDEMCS.Services.Impl /// /// 更新系统参数设置 /// - /// + /// public Result UpdateSysConfig(SysConfig info) { diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/IDeviceRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/IDeviceRepository.cs index e6ddea4..ab6bbd5 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/IDeviceRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/IDeviceRepository.cs @@ -7,10 +7,10 @@ using PVDEMCS.Services.Models; namespace PVDEMCS.Services.Repositories { - /* - * PLC控制器 数据层 接口 - */ - public interface IDeviceRepository: IDependency + /// + /// PLC控制器 数据层 接口 + /// + public interface IDeviceRepository : IDependency { #region PLC控制器 @@ -19,6 +19,7 @@ namespace PVDEMCS.Services.Repositories /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// 当前页 /// 页大小 /// @@ -29,6 +30,7 @@ namespace PVDEMCS.Services.Repositories /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// Result> GetDeviceInfoList(string deviceCode, string deviceName, bool? activated = false); diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs index 5f34159..4355a1b 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRecordRepository.cs @@ -9,9 +9,9 @@ using Microsoft.EntityFrameworkCore; namespace PVDEMCS.Services.Repositories { - /* - * 设备数据记录与统计 数据层 接口 - */ + /// + /// 设备数据记录与统计 数据层 接口 + /// public interface IEquipmentRecordRepository : IDependency { #region 设备状态记录 @@ -47,6 +47,7 @@ namespace PVDEMCS.Services.Repositories /// /// 设备Id /// 设备状态,运行:Run,待机:Stop,报警:Alarm + /// 记录时间 /// Result AddUpdateEquipmentRecord(string equipmentId, string state, DateTime dateTime); diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRepository.cs index 5d5affe..c0320c0 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/IEquipmentRepository.cs @@ -7,9 +7,9 @@ using PVDEMCS.Services.Models; namespace PVDEMCS.Services.Repositories { - /* - * 设备管理 数据层 接口 - */ + /// + /// 设备管理 数据层 接口 + /// public interface IEquipmentRepository : IDependency { /// @@ -56,7 +56,7 @@ namespace PVDEMCS.Services.Repositories /// /// 删除设备信息 /// - /// + /// /// Result DeleteEquipment(string id); } diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/ISysConfigRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/ISysConfigRepository.cs index d6c69db..f09ebc0 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/ISysConfigRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/ISysConfigRepository.cs @@ -7,9 +7,9 @@ using PVDEMCS.Services.Models; namespace PVDEMCS.Services.Repositories { - /* - * 系统参数设置 数据层 接口 - */ + /// + /// 系统参数设置 数据层 接口 + /// public interface ISysConfigRepository : IDependency { /// @@ -40,7 +40,8 @@ namespace PVDEMCS.Services.Repositories /// /// 获取获取系统参数设置明细 /// - /// + /// + /// /// Result GetSysConfigDetailNameOrKey(string name, string key = ""); diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs index 7e631e8..33e95a1 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs @@ -13,9 +13,9 @@ using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace PVDEMCS.Services.Repositories.Impl { - /* - * PLC控制器 数据层 实现 - */ + /// + /// PLC控制器 数据层 实现 + /// internal class DeviceRepository : IDeviceRepository { #region PLC控制器 @@ -25,6 +25,7 @@ namespace PVDEMCS.Services.Repositories.Impl /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// 当前页 /// 页大小 /// @@ -46,6 +47,7 @@ namespace PVDEMCS.Services.Repositories.Impl /// /// 控制器编号 /// 控制器名称 + /// 是否启用 /// public Result> GetDeviceInfoList(string deviceCode, string deviceName, bool? activated = false) { diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs index 44aeb45..6be12ec 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs @@ -108,7 +108,7 @@ namespace PVDEMCS.Services.Repositories.Impl /// /// 设备Id /// 设备状态,运行:Run,待机:Stop,报警:Alarm - /// 设备Id + /// 记录时间 /// public Result AddUpdateEquipmentRecord(string equipmentId, string state, DateTime dateTime) { @@ -333,38 +333,40 @@ namespace PVDEMCS.Services.Repositories.Impl TotalAlarmTime = f.Sum(f => f.TotalAlarmTime), TotalStopTime = f.Sum(f => f.TotalStopTime), }).ToList(); - if (values.Count > 0) + if (values.Count == 0) { - if (list.IsNullOrEmpty()) + return new Result("没有汇总数据"); + } + + if (list.IsNullOrEmpty()) + { + foreach (var item in values) { - foreach (var item in values) - { - item.Create(); - } - context.EquipmentRecordTotals.AddRange(values); + item.Create(); } - else + context.EquipmentRecordTotals.AddRange(values); + } + else + { + foreach (var item in list) { - foreach (var item in list) + var value = values.Where(f => f.EquipmentId == item.EquipmentId).FirstOrDefault(); + if (value.IsNullOrEmpty()) { - var value = values.Where(f => f.EquipmentId == item.EquipmentId).FirstOrDefault(); - if (value.IsNullOrEmpty()) - { - value.Create(); - context.EquipmentRecordTotals.Add(value); - } - else - { - item.FurnaceNum += value.FurnaceNum; - item.TotalAlarmTime += value.TotalAlarmTime; - item.TotalRunningTime += value.TotalRunningTime; - item.TotalStopTime += value.TotalStopTime; - item.Update(); - } + value.Create(); + context.EquipmentRecordTotals.Add(value); + } + else + { + item.FurnaceNum += value.FurnaceNum; + item.TotalAlarmTime += value.TotalAlarmTime; + item.TotalRunningTime += value.TotalRunningTime; + item.TotalStopTime += value.TotalStopTime; + item.Update(); } } - context.SaveChanges(); } + context.SaveChanges(); return new Result(); @@ -603,9 +605,6 @@ namespace PVDEMCS.Services.Repositories.Impl } } - - - #endregion } } diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRepository.cs index b89e750..10fcee0 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRepository.cs @@ -8,9 +8,9 @@ using PVDEMCS.Services.Repositories.Entities; namespace PVDEMCS.Services.Repositories { - /* - * 设备信息 数据层 实现 - */ + /// + /// 设备信息 数据层 实现 + /// internal class EquipmentRepository : IEquipmentRepository { /// diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/SysConfigRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/SysConfigRepository.cs index 6176eea..b430501 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/SysConfigRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/SysConfigRepository.cs @@ -7,9 +7,9 @@ using PVDEMCS.Services.Repositories.Entities; namespace PVDEMCS.Services.Repositories.Impl { - /* - * 系统参数设置 数据层 实现 - */ + /// + /// 系统参数设置 数据层 实现 + /// internal class SysConfigRepository : ISysConfigRepository { /// @@ -101,7 +101,8 @@ namespace PVDEMCS.Services.Repositories.Impl /// /// 获取获取系统参数设置明细 /// - /// + /// + /// /// public Result GetSysConfigDetailNameOrKey(string name, string key) {