diff --git a/PVDEMCS/.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 b/PVDEMCS/.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 index 1277061..829ec73 100644 Binary files a/PVDEMCS/.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 and b/PVDEMCS/.vs/PVDEMCS/DesignTimeBuild/.dtbcache.v2 differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/15847690-decd-45de-99ca-485a8d07f5b0.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/15847690-decd-45de-99ca-485a8d07f5b0.vsidx new file mode 100644 index 0000000..e7adabe Binary files /dev/null and b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/15847690-decd-45de-99ca-485a8d07f5b0.vsidx differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/1b9b7666-498a-470f-ae0b-069dc88728d1.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/1b9b7666-498a-470f-ae0b-069dc88728d1.vsidx deleted file mode 100644 index f30a378..0000000 Binary files a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/1b9b7666-498a-470f-ae0b-069dc88728d1.vsidx and /dev/null differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/1f6357d5-e1ed-4d14-9519-dbdd7c936292.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/1f6357d5-e1ed-4d14-9519-dbdd7c936292.vsidx deleted file mode 100644 index 239a375..0000000 Binary files a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/1f6357d5-e1ed-4d14-9519-dbdd7c936292.vsidx and /dev/null differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/29ccd813-ab10-4dbc-96e2-4e38de2c2356.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/29ccd813-ab10-4dbc-96e2-4e38de2c2356.vsidx deleted file mode 100644 index ac626ce..0000000 Binary files a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/29ccd813-ab10-4dbc-96e2-4e38de2c2356.vsidx and /dev/null differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/312186de-6f4a-4d6a-8ded-ea57279cf970.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/312186de-6f4a-4d6a-8ded-ea57279cf970.vsidx new file mode 100644 index 0000000..8147e38 Binary files /dev/null and b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/312186de-6f4a-4d6a-8ded-ea57279cf970.vsidx differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/5483d7d2-4fe6-478b-bf73-e3a75ac0b0db.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/5483d7d2-4fe6-478b-bf73-e3a75ac0b0db.vsidx new file mode 100644 index 0000000..15bfda0 Binary files /dev/null and b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/5483d7d2-4fe6-478b-bf73-e3a75ac0b0db.vsidx differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/76492144-562e-4d4f-852e-d153ee704c8f.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/76492144-562e-4d4f-852e-d153ee704c8f.vsidx new file mode 100644 index 0000000..679d1d7 Binary files /dev/null and b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/76492144-562e-4d4f-852e-d153ee704c8f.vsidx differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/7cf1e42f-a411-422c-90cb-90c8fa59b2d6.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/7cf1e42f-a411-422c-90cb-90c8fa59b2d6.vsidx deleted file mode 100644 index e46d9b4..0000000 Binary files a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/7cf1e42f-a411-422c-90cb-90c8fa59b2d6.vsidx and /dev/null differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/8cb64b6c-060f-4449-beb6-15489e6bf7bc.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/8cb64b6c-060f-4449-beb6-15489e6bf7bc.vsidx deleted file mode 100644 index ed2f218..0000000 Binary files a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/8cb64b6c-060f-4449-beb6-15489e6bf7bc.vsidx and /dev/null differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/d135ed4d-7f1c-42cf-9352-2a3ad653a271.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/d135ed4d-7f1c-42cf-9352-2a3ad653a271.vsidx deleted file mode 100644 index 43183cf..0000000 Binary files a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/d135ed4d-7f1c-42cf-9352-2a3ad653a271.vsidx and /dev/null differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/ebd8713c-f426-4e07-96ed-2a2cf8971804.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/ebd8713c-f426-4e07-96ed-2a2cf8971804.vsidx new file mode 100644 index 0000000..ae48cf8 Binary files /dev/null and b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/ebd8713c-f426-4e07-96ed-2a2cf8971804.vsidx differ diff --git a/PVDEMCS/.vs/PVDEMCS/FileContentIndex/fc9c3a71-d989-456d-878f-756c3346c678.vsidx b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/fc9c3a71-d989-456d-878f-756c3346c678.vsidx new file mode 100644 index 0000000..fbbd6de Binary files /dev/null and b/PVDEMCS/.vs/PVDEMCS/FileContentIndex/fc9c3a71-d989-456d-878f-756c3346c678.vsidx differ diff --git a/PVDEMCS/.vs/PVDEMCS/v17/.suo b/PVDEMCS/.vs/PVDEMCS/v17/.suo index 5bc093d..ed71165 100644 Binary files a/PVDEMCS/.vs/PVDEMCS/v17/.suo and b/PVDEMCS/.vs/PVDEMCS/v17/.suo differ diff --git a/PVDEMCS/PVDEMCS/Common/Devices/IDeviceConfiguration.cs b/PVDEMCS/PVDEMCS/Common/Devices/IDeviceConfiguration.cs deleted file mode 100644 index c6eacb1..0000000 --- a/PVDEMCS/PVDEMCS/Common/Devices/IDeviceConfiguration.cs +++ /dev/null @@ -1,12 +0,0 @@ -using PVDEMCS.Common.DI; -using PVDEMCS.Services; - -namespace PVDEMCS.Common.Devices -{ - public interface IDeviceConfiguration : IDependency - { - - } - - -} diff --git a/PVDEMCS/PVDEMCS/Common/Devices/Impl/DeviceConfiguration.cs b/PVDEMCS/PVDEMCS/Common/Devices/Impl/DeviceConfiguration.cs deleted file mode 100644 index 6257b95..0000000 --- a/PVDEMCS/PVDEMCS/Common/Devices/Impl/DeviceConfiguration.cs +++ /dev/null @@ -1,50 +0,0 @@ -using PVDEMCS.Services; -using System.Threading; - -namespace PVDEMCS.Common.Devices.Impl -{ - public class DeviceConfiguration : IDeviceConfiguration - { - private IDeviceService deviceService; - - private List monitors = new List(); - - public DeviceConfiguration(IDeviceService device) - { - this.deviceService = device; - } - - public void Load() - { - monitors.Clear(); - var result = this.deviceService.GetDeviceInfoList("", "", true); - if (result.IsSuccess) - { - var devices = result.Content; - foreach (var device in devices) - { - var deviceMonitor = new DeviceMonitor(device); - var devicePoints = deviceService.GetDevicePointList(device.DeviceName); - if (devicePoints.IsSuccess && devicePoints.Content.Count>0) - { - deviceMonitor.Load(devicePoints.Content.ToArray()); - } - deviceMonitor.ErrorMessage += DeviceMonitor_ErrorMessage; - deviceMonitor.PointChnage += DeviceMonitor_PointChnage; - monitors.Add(deviceMonitor); - Task task = deviceMonitor.StartAsync(); - } - } - } - - private void DeviceMonitor_PointChnage(object sender, Services.Models.DevicePoint e) - { - - } - - private void DeviceMonitor_ErrorMessage(object sender, string e) - { - - } - } -} diff --git a/PVDEMCS/PVDEMCS/Controllers/DeviceController.cs b/PVDEMCS/PVDEMCS/Controllers/DeviceController.cs index aa91253..50c3dae 100644 --- a/PVDEMCS/PVDEMCS/Controllers/DeviceController.cs +++ b/PVDEMCS/PVDEMCS/Controllers/DeviceController.cs @@ -1,9 +1,11 @@ using AngleSharp.Dom; +using Masuit.Tools; using Masuit.Tools.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using PVDEMCS.Common; using PVDEMCS.Common.Constant; +using PVDEMCS.Devices; using PVDEMCS.Services; using PVDEMCS.Services.Models; using SharpCompress.Common; @@ -19,10 +21,12 @@ namespace PVDEMCS.Controllers public class DeviceController : Controller { private IDeviceService _deviceService; + private IDeviceRun _deviceRun; - public DeviceController(IDeviceService deviceService) + public DeviceController(IDeviceService deviceService, IDeviceRun deviceRun) { _deviceService = deviceService; + _deviceRun = deviceRun; } #region PLC控制器 @@ -38,22 +42,44 @@ namespace PVDEMCS.Controllers public Result> GetDevicePageList(string deviceCode, string deviceName, bool? activated, int page, int size = 20) { var result = _deviceService.GetDevicePageList(deviceCode, deviceName, activated, page, size); + if (result.IsSuccess) + { + GetDeviceIsConnected(result.Content.Data); + } return result; } + /// /// 获取PLC控制器列表 /// /// 控制器编号 /// 控制器名称 - /// + /// 是否启用 + /// /// [HttpGet] public Result> GetDeviceInfoList(string deviceCode, string deviceName, bool? activated = false) { var result = _deviceService.GetDeviceInfoList(deviceCode, deviceName, activated); + if (result.IsSuccess) + { + GetDeviceIsConnected(result.Content); + } return result; } + [NonAction] + private void GetDeviceIsConnected(List list) + { + if (list.IsNullOrEmpty() &&!_deviceRun.GetDeviceIsConnected.IsNullOrEmpty()) + { + foreach (var item in list) + { + item.isConnected = _deviceRun.GetDeviceIsConnected[item.DeviceCode]; + } + } + } + /// /// 获取PLC控制器明细 /// @@ -121,6 +147,10 @@ namespace PVDEMCS.Controllers public Result> GetDevicePointPageList(string deviceName, string deviceCode, string equipmentName, string equipmentCode, string equipmentType, string pointCode, string pointName, bool? activated, int page, int size = 20) { var result = _deviceService.GetDevicePointPageList(deviceName, deviceCode, equipmentName, equipmentCode, equipmentType, pointCode, pointName, activated, page, size); + if (result.IsSuccess) + { + GetPointValue(result.Content.Data); + } return result; } @@ -139,9 +169,23 @@ namespace PVDEMCS.Controllers public Result> GetDevicePointList(string deviceName, string deviceCode, string equipmentName, string equipmentCode, string equipmentType, string pointCode, string pointName, bool? activated) { var result = _deviceService.GetDevicePointList(deviceName, deviceCode, equipmentName, equipmentCode, equipmentType, pointCode, pointName, activated); + GetPointValue(result.Content); return result; } + [NonAction] + private void GetPointValue(List list) + { + var points = _deviceRun.GetDevicePoints; + if (!list.IsNullOrEmpty() && !points.IsNullOrEmpty()) + { + foreach (var item in list) + { + item.ObjectValue = points.Where(f => f.PointCode == item.PointCode).Select(f => f.ObjectValue).FirstOrDefault(); + } + } + } + /// /// 获取PLC控制器点位明细 /// @@ -172,7 +216,7 @@ namespace PVDEMCS.Controllers /// /// [HttpPost] - public Result UpdateDevicePoint(DevicePoint entity) + public Result UpdateDevicePoint(DevicePoint entity) { var result = _deviceService.UpdateDevicePoint(entity); return result; @@ -184,7 +228,7 @@ namespace PVDEMCS.Controllers /// /// [HttpPost] - public Result DeleteDevicePoint(string id) + public Result DeleteDevicePoint(string id) { var result = _deviceService.DeleteDevicePoint(id); return result; diff --git a/PVDEMCS/PVDEMCS/Controllers/EquipmentController.cs b/PVDEMCS/PVDEMCS/Controllers/EquipmentController.cs index c0f9c3c..f7ee878 100644 --- a/PVDEMCS/PVDEMCS/Controllers/EquipmentController.cs +++ b/PVDEMCS/PVDEMCS/Controllers/EquipmentController.cs @@ -1,9 +1,12 @@ -using Masuit.Tools.Models; +using Masuit.Tools; +using Masuit.Tools.Models; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using PVDEMCS.Common; using PVDEMCS.Common.Constant; +using PVDEMCS.Devices; using PVDEMCS.Services; +using PVDEMCS.Services.Impl; using PVDEMCS.Services.Models; using System; @@ -18,7 +21,8 @@ namespace PVDEMCS.Controllers { private IEquipmentService _equipmentService; - public EquipmentController(IEquipmentService equipmentService) + + public EquipmentController(IEquipmentService equipmentService) { this._equipmentService = equipmentService; } @@ -33,9 +37,10 @@ namespace PVDEMCS.Controllers /// 页大小 /// [HttpGet] - public Result> GetEquipmentPageList(string equipmentName, string equipmentCode, string equipmentType, bool? activated, int page, int size) + public Result> GetEquipmentPageList(string equipmentName, string equipmentCode, string equipmentType, bool? activated, int page, int size = 20) { - var result = this._equipmentService.GetEquipmentPageList(equipmentName,equipmentCode,equipmentType,activated,page,size); + var result = this._equipmentService.GetEquipmentPageList(equipmentName, equipmentCode, equipmentType, activated, page, size); + return result; } @@ -49,9 +54,11 @@ namespace PVDEMCS.Controllers public Result> GetEquipmentList(string equipmentName, string equipmentCode, string equipmentType, bool? activated) { var result = this._equipmentService.GetEquipmentList(equipmentName, equipmentCode, equipmentType, activated); + return result; } + /// /// 获取设备明显 /// diff --git a/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs b/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs index 6215512..7e70782 100644 --- a/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs +++ b/PVDEMCS/PVDEMCS/Controllers/EquipmentRecordController.cs @@ -17,9 +17,13 @@ namespace PVDEMCS.Controllers public class EquipmentRecordController : Controller { private IEquipmentRecordService _equipmentRecordService; - public EquipmentRecordController(IEquipmentRecordService equipmentRecordService) + + private IDeviceService _deviceService; + + public EquipmentRecordController(IEquipmentRecordService equipmentRecordService, IDeviceService deviceService) { this._equipmentRecordService = equipmentRecordService; + this._deviceService = deviceService; } #region 设备状态记录 @@ -36,9 +40,9 @@ namespace PVDEMCS.Controllers /// 页大小 /// [HttpGet] - public Result> GetEquipmentRecordPageList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, int page, int size) + public Result> GetEquipmentRecordPageList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, int page, int size = 20) { - var result= _equipmentRecordService.GetEquipmentRecordPageList(equipmentName, equipmentCode, equipmentType, begTime, endTime, page, size); + var result = _equipmentRecordService.GetEquipmentRecordPageList(equipmentName, equipmentCode, equipmentType, begTime, endTime, page, size); return result; } @@ -91,7 +95,7 @@ namespace PVDEMCS.Controllers #region 设备记录统计 /// - /// 获取设备状态记录统计分页列表 + /// 获取设备状态记录统计(日)分页列表 /// /// 设备名称 /// 设备编号 @@ -101,14 +105,14 @@ namespace PVDEMCS.Controllers /// 当前页 /// 页大小 [HttpGet] - public Result> GetEquipmentRecordDayTotalPageList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, int page, int size) + public Result> GetEquipmentRecordDayTotalPageList(string equipmentName, string equipmentCode, string equipmentType, DateTime begTime, DateTime endTime, int page, int size = 20) { - var result = _equipmentRecordService.GetEquipmentRecordDayTotalPageList(equipmentName,equipmentCode,equipmentType,begTime,endTime,page,size); + var result = _equipmentRecordService.GetEquipmentRecordDayTotalPageList(equipmentName, equipmentCode, equipmentType, begTime, endTime, page, size); return result; } /// - /// 获取设备状态记录统计列表 + /// 获取设备状态记录统计(日)列表 /// /// 设备名称 /// 设备编号 @@ -122,6 +126,18 @@ namespace PVDEMCS.Controllers return result; } + /// + /// 获取设备总览 + /// + /// + [HttpGet] + public Result> GetEquipmentStateView() + { + var points = _deviceService.GetDevicePointList(activated: true); + + return null; + } + #endregion } } diff --git a/PVDEMCS/PVDEMCS/Controllers/SysConfigController.cs b/PVDEMCS/PVDEMCS/Controllers/SysConfigController.cs index 79de6ab..c93b4ea 100644 --- a/PVDEMCS/PVDEMCS/Controllers/SysConfigController.cs +++ b/PVDEMCS/PVDEMCS/Controllers/SysConfigController.cs @@ -17,7 +17,7 @@ namespace PVDEMCS.Controllers public class SysConfigController : Controller { private ISysConfigService _sysConfigService; - public SysConfigController(ISysConfigService sysConfigService) + public SysConfigController(ISysConfigService sysConfigService) { this._sysConfigService = sysConfigService; } @@ -30,9 +30,9 @@ namespace PVDEMCS.Controllers /// 页大小 /// [HttpGet] - public Result> GetSysConfigPageList(string configName, string configKey, int page, int size) + public Result> GetSysConfigPageList(string configName, string configKey, int page, int size = 20) { - var result = this._sysConfigService.GetSysConfigPageList(configName,configKey,page,size); + var result = this._sysConfigService.GetSysConfigPageList(configName, configKey, page, size); return result; } diff --git a/PVDEMCS/PVDEMCS/Common/Devices/DeviceType.cs b/PVDEMCS/PVDEMCS/Devices/DeviceType.cs similarity index 95% rename from PVDEMCS/PVDEMCS/Common/Devices/DeviceType.cs rename to PVDEMCS/PVDEMCS/Devices/DeviceType.cs index 29b9a81..80e6900 100644 --- a/PVDEMCS/PVDEMCS/Common/Devices/DeviceType.cs +++ b/PVDEMCS/PVDEMCS/Devices/DeviceType.cs @@ -1,4 +1,4 @@ -namespace PVDEMCS.Common.Devices +namespace PVDEMCS.Devices { public sealed class DeviceProtocol { diff --git a/PVDEMCS/PVDEMCS/Devices/IDeviceRun.cs b/PVDEMCS/PVDEMCS/Devices/IDeviceRun.cs new file mode 100644 index 0000000..a0710aa --- /dev/null +++ b/PVDEMCS/PVDEMCS/Devices/IDeviceRun.cs @@ -0,0 +1,34 @@ +using PVDEMCS.Common.DI; +using PVDEMCS.Services; +using PVDEMCS.Services.Models; +using System.Threading; + +namespace PVDEMCS.Devices +{ + /// + /// 设备运行 + /// + public interface IDeviceRun : IDependency + { + + /// + /// 获取所有点位信息 + /// + List GetDevicePoints { get; } + + /// + /// 获取控制器连接状态 + /// + Dictionary GetDeviceIsConnected { get; } + + /// + /// 开始运行 + /// + void Run(); + + /// + /// 停止运行 + /// + void Stop(); + } +} diff --git a/PVDEMCS/PVDEMCS/Common/Devices/IPLCCommunicationService.cs b/PVDEMCS/PVDEMCS/Devices/IPLCCommunicationService.cs similarity index 95% rename from PVDEMCS/PVDEMCS/Common/Devices/IPLCCommunicationService.cs rename to PVDEMCS/PVDEMCS/Devices/IPLCCommunicationService.cs index d613b68..08e6538 100644 --- a/PVDEMCS/PVDEMCS/Common/Devices/IPLCCommunicationService.cs +++ b/PVDEMCS/PVDEMCS/Devices/IPLCCommunicationService.cs @@ -8,13 +8,14 @@ using System.Text; using System.Threading.Tasks; using HslCommunication.Profinet.Siemens; using PVDEMCS.Common.DI; +using PVDEMCS.Common; -namespace PVDEMCS.Common.Devices +namespace PVDEMCS.Devices { /// /// PLC通信接口 /// - public interface IPLCCommunicationService + public interface IPLCCommunicationService { /// /// 是否已连接 @@ -108,14 +109,14 @@ namespace PVDEMCS.Common.Devices /// /// 写入地址 /// - Result Write(string address, Int16 value); + Result Write(string address, short value); /// /// 写入Int32值 /// /// 写入地址 /// - Result Write(string address, Int32 value); + Result Write(string address, int value); /// /// 写入float值 @@ -226,14 +227,14 @@ namespace PVDEMCS.Common.Devices /// /// 写入地址 /// - Task WriteAsync(string address, Int16 value); + Task WriteAsync(string address, short value); /// /// 写入Int32值 /// /// 写入地址 /// - Task WriteAsync(string address, Int32 value); + Task WriteAsync(string address, int value); /// /// 写入float值 diff --git a/PVDEMCS/PVDEMCS/Common/Devices/Impl/DeviceMonitor.cs b/PVDEMCS/PVDEMCS/Devices/Impl/DeviceMonitor.cs similarity index 83% rename from PVDEMCS/PVDEMCS/Common/Devices/Impl/DeviceMonitor.cs rename to PVDEMCS/PVDEMCS/Devices/Impl/DeviceMonitor.cs index e88b8a9..1045f08 100644 --- a/PVDEMCS/PVDEMCS/Common/Devices/Impl/DeviceMonitor.cs +++ b/PVDEMCS/PVDEMCS/Devices/Impl/DeviceMonitor.cs @@ -1,10 +1,15 @@ using Masuit.Tools; +using PVDEMCS.Common; +using PVDEMCS.Devices; using PVDEMCS.Services.Models; using System.Security.Cryptography; -namespace PVDEMCS.Common.Devices.Impl +namespace PVDEMCS.Devices.Impl { - public class DeviceMonitor + /// + /// 控制器点位监控 + /// + public class DeviceMonitor { private DeviceInfo deviceInfo; private IPLCCommunicationService plcCommunicationService; @@ -14,10 +19,9 @@ namespace PVDEMCS.Common.Devices.Impl public DeviceMonitor(DeviceInfo deviceInfo) { this.deviceInfo = deviceInfo; - this.devicePoints = new List(); + devicePoints = new List(); PointMonitor(); } - /// /// PLC 点位改变触发 /// @@ -28,6 +32,17 @@ namespace PVDEMCS.Common.Devices.Impl /// public event EventHandler ErrorMessage; + /// + /// 控制器编号 + /// + public string DeviceCode + { + get + { + return deviceInfo.DeviceCode; + } + } + /// /// 间隔时间 /// @@ -39,6 +54,26 @@ namespace PVDEMCS.Common.Devices.Impl return plcCommunicationService; } } + + /// + /// 连接状态 + /// + public bool isConnected + { + get + { + return plcCommunicationService.isConnected; + } + } + + /// + /// 监控是否运行 + /// + public bool IsRun + { + get { return IsRun; } + } + /// /// 当前点位集合 /// @@ -55,8 +90,8 @@ namespace PVDEMCS.Common.Devices.Impl /// public void Init(string address, int port = 0) { - this.deviceInfo.Host = address; - this.deviceInfo.Port = port; + deviceInfo.Host = address; + deviceInfo.Port = port; } /// @@ -75,7 +110,7 @@ namespace PVDEMCS.Common.Devices.Impl /// public void Load(params DevicePoint[] points) { - if (points.IsNullOrEmpty()) + if (points.IsNullOrEmpty()) { throw new ArgumentException($"{nameof(points)}: 不能为空!"); } @@ -101,11 +136,11 @@ namespace PVDEMCS.Common.Devices.Impl { if (plcCommunicationService == null) { - plcCommunicationService = new S7CommunicationService(this.deviceInfo.Protocol); + plcCommunicationService = new S7CommunicationService(deviceInfo.Protocol); } if (!plcCommunicationService.isConnected) { - var result = await plcCommunicationService.ConnectionAsync(this.deviceInfo.Host, this.deviceInfo.Port); + var result = await plcCommunicationService.ConnectionAsync(deviceInfo.Host, deviceInfo.Port); if (!result.IsSuccess) { ErrorMessage?.Invoke(this, "开始PLC连接失败:" + result.Message); @@ -167,42 +202,42 @@ namespace PVDEMCS.Common.Devices.Impl var type = point.DataType; var plcService = plcCommunicationService; //Boolean - if (type.Equals(typeof(Boolean))) + if (type.Equals(typeof(bool))) { var result = await plcService.ReadBoolAsync(point.Address); GetReturnValue(point, result); return; } //Byte - if (type.Equals(typeof(Byte))) + if (type.Equals(typeof(byte))) { var result = await plcService.ReadByteAsync(point.Address); GetReturnValue(point, result); return; } //Byte - if (type.Equals(typeof(Byte))) + if (type.Equals(typeof(byte))) { var result = await plcService.ReadByteAsync(point.Address); GetReturnValue(point, result); return; } //Int16 - if (type.Equals(typeof(Int16))) + if (type.Equals(typeof(short))) { var result = await plcService.ReadInt16Async(point.Address); GetReturnValue(point, result); return; } //Int32 - if (type.Equals(typeof(Int32))) + if (type.Equals(typeof(int))) { var result = await plcService.ReadInt32Async(point.Address); GetReturnValue(point, result); return; } //Int64 - if (type.Equals(typeof(Int64))) + if (type.Equals(typeof(long))) { var result = await plcService.ReadLongAsync(point.Address); GetReturnValue(point, result); @@ -216,7 +251,7 @@ namespace PVDEMCS.Common.Devices.Impl return; } //double - if (type.Equals(typeof(Double))) + if (type.Equals(typeof(double))) { var result = await plcService.ReadDoubleAsync(point.Address); GetReturnValue(point, result); diff --git a/PVDEMCS/PVDEMCS/Devices/Impl/DeviceRun.cs b/PVDEMCS/PVDEMCS/Devices/Impl/DeviceRun.cs new file mode 100644 index 0000000..78677aa --- /dev/null +++ b/PVDEMCS/PVDEMCS/Devices/Impl/DeviceRun.cs @@ -0,0 +1,181 @@ +using AngleSharp.Css.Dom; +using Masuit.Tools; +using PVDEMCS.Common.Constant; +using PVDEMCS.Devices; +using PVDEMCS.Services; +using PVDEMCS.Services.Models; +using System.Threading; + +namespace PVDEMCS.Devices.Impl +{ + /// + /// 设备运行 + /// + public class DeviceRun : IDeviceRun + { + private IDeviceService deviceService; + private IEquipmentRecordService equipmentRecordService; + private List monitors = new List(); + private object lockObj = new object(); + private object lockObj1 = new object(); + + public DeviceRun(IDeviceService deviceService, IEquipmentRecordService equipmentRecordService) + { + this.deviceService = deviceService; + this.equipmentRecordService = equipmentRecordService; + TaskRun(); + } + + /// + /// 获取所有点位信息 + /// + public List GetDevicePoints + { + get + { + return monitors.SelectMany(f => f.Points).ToList(); + } + } + + /// + /// 获取控制器连接状态 + /// + public Dictionary GetDeviceIsConnected + { + get + { + return monitors.ToDictionary(f => f.DeviceCode, f => f.isConnected); + } + } + + /// + /// 开始运行 + /// + public void Run() + { + Stop(); + + monitors.Clear(); + + var result = deviceService.GetDeviceInfoList("", "", true); + if (result.IsSuccess) + { + var devices = result.Content; + foreach (var device in devices) + { + var deviceMonitor = new DeviceMonitor(device); + var devicePoints = deviceService.GetDevicePointList(device.DeviceName); + if (devicePoints.IsSuccess && devicePoints.Content.Count > 0) + { + deviceMonitor.Load(devicePoints.Content.ToArray()); + } + deviceMonitor.ErrorMessage += DeviceMonitor_ErrorMessage; + deviceMonitor.PointChnage += DeviceMonitor_PointChnage; ; + monitors.Add(deviceMonitor); + Task task = deviceMonitor.StartAsync(); + } + } + } + + /// + /// 停止运行 + /// + public void Stop() + { + foreach (var item in monitors) + { + var task = item.StartAsync(); + } + } + + private void TaskRun() + { + Task.Run(() => + { + while (true) + { + lock (lockObj) + { + RunEquipmentRecord(); + + Thread.Sleep(1000); + } + } + }); + + + Task.Run(() => + { + while (true) + { + lock (lockObj1) + { + RunEquipmentRecordTotal(); + + Thread.Sleep(1000 * 60); + } + } + }); + } + + //记录设备数据 + private void RunEquipmentRecord() + { + foreach (var monitor in monitors) + { + if (!monitor.IsRun) + { + continue; + } + var points = monitor.Points; + if (!points.IsNullOrEmpty()) + { + continue; + } + + var equipmentIds = points.Select(f => f.EquipmentId).Distinct(); + foreach (var id in equipmentIds) + { + var list = points.Where(f => f.EquipmentId == id).ToList(); + if (list.Count >= 2) + { + var startStop = list.Where(f => f.ActionType == ActionType.StartStop).FirstOrDefault(); + var fault = list.Where(f => f.ActionType == ActionType.Fault).FirstOrDefault(); + if (!startStop.IsNullOrEmpty() && + !fault.IsNullOrEmpty() && + !startStop.ObjectValue.IsNullOrEmpty() && + !fault.ObjectValue.IsNullOrEmpty()) + { + var state = EquipmentState.Run; + + if (fault.GetValue()) + { + state = EquipmentState.Alarm; + } + else if (!startStop.GetValue()) + { + state = EquipmentState.Stop; + } + equipmentRecordService.AddUpdateEquipmentRecord(id, state, DateTime.Now); + } + } + } + } + } + + //记录设备数据统计 + private void RunEquipmentRecordTotal() + { + equipmentRecordService.RunEquipmentRecordTotal(DateTime.Now); + } + + private void DeviceMonitor_PointChnage(object sender, DevicePoint e) + { + } + + private void DeviceMonitor_ErrorMessage(object sender, string e) + { + Console.WriteLine(e); + } + } +} diff --git a/PVDEMCS/PVDEMCS/Common/Devices/Impl/S7CommunicationService.cs b/PVDEMCS/PVDEMCS/Devices/Impl/S7CommunicationService.cs similarity index 97% rename from PVDEMCS/PVDEMCS/Common/Devices/Impl/S7CommunicationService.cs rename to PVDEMCS/PVDEMCS/Devices/Impl/S7CommunicationService.cs index 854b862..efbfaa4 100644 --- a/PVDEMCS/PVDEMCS/Common/Devices/Impl/S7CommunicationService.cs +++ b/PVDEMCS/PVDEMCS/Devices/Impl/S7CommunicationService.cs @@ -13,8 +13,10 @@ using HslCommunication; using HslCommunication.Profinet.Siemens; using HslCommunication.Reflection; using PVDEMCS.Common.Tools; +using PVDEMCS.Devices; +using PVDEMCS.Common; -namespace PVDEMCS.Common.Devices.Impl +namespace PVDEMCS.Devices.Impl { /// /// PLC通信服务 SiemensS7 smart200 实现 @@ -30,7 +32,8 @@ namespace PVDEMCS.Common.Devices.Impl public S7CommunicationService(string deviceProtocol) { - switch (deviceProtocol) { + switch (deviceProtocol) + { case DeviceProtocol.S7_400: siemensS7Net = new SiemensS7Net(SiemensPLCS.S400); break; @@ -49,7 +52,7 @@ namespace PVDEMCS.Common.Devices.Impl case DeviceProtocol.S7_200Smart: siemensS7Net = new SiemensS7Net(SiemensPLCS.S200Smart); break; - default : + default: throw new ArgumentException($"DeviceProtocol 参数不正确,没有{deviceProtocol}协议"); } siemensS7Net.ConnectTimeOut = 3000; @@ -213,7 +216,7 @@ namespace PVDEMCS.Common.Devices.Impl /// /// 写入地址 /// - public Result Write(string address, Int16 value) + public Result Write(string address, short value) { var operateResult = siemensS7Net.Write(address, value); var result = ConvertResult(operateResult); @@ -225,7 +228,7 @@ namespace PVDEMCS.Common.Devices.Impl /// /// 写入地址 /// - public Result Write(string address, Int32 value) + public Result Write(string address, int value) { var operateResult = siemensS7Net.Write(address, value); var result = ConvertResult(operateResult); @@ -428,7 +431,7 @@ namespace PVDEMCS.Common.Devices.Impl /// /// 写入地址 /// - public async Task WriteAsync(string address, Int16 value) + public async Task WriteAsync(string address, short value) { var operateResult = await siemensS7Net.WriteAsync(address, value); var result = ConvertResult(operateResult); @@ -440,7 +443,7 @@ namespace PVDEMCS.Common.Devices.Impl /// /// 写入地址 /// - public async Task WriteAsync(string address, Int32 value) + public async Task WriteAsync(string address, int value) { var operateResult = await siemensS7Net.WriteAsync(address, value); var result = ConvertResult(operateResult); diff --git a/PVDEMCS/PVDEMCS/Program.cs b/PVDEMCS/PVDEMCS/Program.cs index 1458d54..41d40a5 100644 --- a/PVDEMCS/PVDEMCS/Program.cs +++ b/PVDEMCS/PVDEMCS/Program.cs @@ -1,8 +1,8 @@ using Masuit.Tools; using Microsoft.EntityFrameworkCore; using Microsoft.OpenApi.Models; -using PVDEMCS.Common.Devices; using PVDEMCS.Common.DI; +using PVDEMCS.Devices; using System.Configuration; using System.Reflection; @@ -52,8 +52,10 @@ app.MapControllers(); app.Lifetime.ApplicationStarted.Register(() => { - var deviceConfiguration = app.Services.GetService(); - //deviceConfiguration + var deviceRun = app.Services.GetService(); + + deviceRun.Run(); + }); app.Run(); diff --git a/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs b/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs index 37966a6..8d80cc9 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/DeviceService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using PVDEMCS.Common; using PVDEMCS.Common.Tools; +using PVDEMCS.Devices; using PVDEMCS.Services.Models; using PVDEMCS.Services.Repositories; using PVDEMCS.Services.Repositories.Entities; @@ -20,6 +21,7 @@ namespace PVDEMCS.Services.Impl public DeviceService(IDeviceRepository deviceRepository) { this._deviceRepository = deviceRepository; + } #region PLC控制器 diff --git a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs index 5886941..33673d7 100644 --- a/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs +++ b/PVDEMCS/PVDEMCS/Services/Impl/EquipmentService.cs @@ -8,6 +8,8 @@ using PVDEMCS.Common.Constant; using PVDEMCS.Common.Tools; using PVDEMCS.Services.Repositories.Entities; using PVDEMCS.Services.Repositories.Impl; +using PVDEMCS.Devices; +using Masuit.Tools; namespace PVDEMCS.Services.Impl { @@ -16,11 +18,13 @@ namespace PVDEMCS.Services.Impl */ internal class EquipmentService : IEquipmentService { - private readonly EquipmentRepository _equipmentRepository; + private readonly IEquipmentRepository _equipmentRepository; + private readonly IDeviceRun _deviceRun; - public EquipmentService(EquipmentRepository equipmentRepository) + public EquipmentService(IEquipmentRepository equipmentRepository, IDeviceRun deviceRun) { this._equipmentRepository = equipmentRepository; + this._deviceRun = deviceRun; } /// @@ -36,6 +40,10 @@ namespace PVDEMCS.Services.Impl public Result> GetEquipmentPageList(string equipmentName, string equipmentCode, string equipmentType, bool? activated, int page, int size) { var result = this._equipmentRepository.GetEquipmentPageList(equipmentName, equipmentCode, equipmentType, activated, page, size); + if (result.IsSuccess) + { + GetEquipmentState(result.Content.Data); + } return result; } @@ -48,9 +56,50 @@ namespace PVDEMCS.Services.Impl public Result> GetEquipmentList(string equipmentName, string equipmentCode, string equipmentType, bool? activated) { var result = this._equipmentRepository.GetEquipmentList(equipmentName, equipmentCode, equipmentType, activated); + if (result.IsSuccess) + { + GetEquipmentState(result.Content); + } return result; } + /// + /// 获取设备状态 + /// + /// + private void GetEquipmentState(List equipmentInfos) + { + var points = _deviceRun.GetDevicePoints; + if (!equipmentInfos.IsNullOrEmpty() && !points.IsNullOrEmpty()) + { + foreach (var equipmentInfo in equipmentInfos) + { + var list = points.Where(f => f.EquipmentId == equipmentInfo.Id).ToList(); + if (list.Count >= 2) + { + var startStop = list.Where(f => f.ActionType == ActionType.StartStop).FirstOrDefault(); + var fault = list.Where(f => f.ActionType == ActionType.Fault).FirstOrDefault(); + if (!startStop.IsNullOrEmpty() && + !fault.IsNullOrEmpty() && + !startStop.ObjectValue.IsNullOrEmpty() && + !fault.ObjectValue.IsNullOrEmpty()) + { + var state = EquipmentState.Run; + if (fault.GetValue()) + { + state = EquipmentState.Alarm; + } + else if (!startStop.GetValue()) + { + state = EquipmentState.Stop; + } + equipmentInfo.State = state; + } + } + } + } + } + /// /// 获取设备明显 /// diff --git a/PVDEMCS/PVDEMCS/Services/Models/DeviceInfo.cs b/PVDEMCS/PVDEMCS/Services/Models/DeviceInfo.cs index 0be70f0..4b37d76 100644 --- a/PVDEMCS/PVDEMCS/Services/Models/DeviceInfo.cs +++ b/PVDEMCS/PVDEMCS/Services/Models/DeviceInfo.cs @@ -47,4 +47,9 @@ public partial class DeviceInfo /// public string Remark { get; set; } + /// + /// 设备连接状态 + /// + public Boolean isConnected { get; set; } + } \ No newline at end of file diff --git a/PVDEMCS/PVDEMCS/Services/Models/DevicePoint.cs b/PVDEMCS/PVDEMCS/Services/Models/DevicePoint.cs index f919639..d423d0a 100644 --- a/PVDEMCS/PVDEMCS/Services/Models/DevicePoint.cs +++ b/PVDEMCS/PVDEMCS/Services/Models/DevicePoint.cs @@ -2,6 +2,8 @@ #nullable disable using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; namespace PVDEMCS.Services.Models; @@ -47,6 +49,11 @@ public partial class DevicePoint /// public string EquipmentType { get; set; } + /// + /// 点位所属动作,启动停止:start_stop;故障:fault + /// + public string ActionType { get; set; } + /// /// 点位编号 /// @@ -79,4 +86,13 @@ public partial class DevicePoint public Object ObjectValue { get; set; } + public T GetValue() + { + if (ObjectValue is T) + { + return (T)ObjectValue; + } + return default; + } + } \ No newline at end of file diff --git a/PVDEMCS/PVDEMCS/Services/Models/EquipmentStateView.cs b/PVDEMCS/PVDEMCS/Services/Models/EquipmentStateView.cs new file mode 100644 index 0000000..242d83d --- /dev/null +++ b/PVDEMCS/PVDEMCS/Services/Models/EquipmentStateView.cs @@ -0,0 +1,28 @@ +namespace PVDEMCS.Services.Models +{ + /// + /// 设备状态总览 + /// + public class EquipmentStateView + { + /// + /// 设备类型:ALL(所有),Ionbond,Balzers,Cemecon + /// + public string EquipmentType { get; set; } + + /// + /// 运行数量 + /// + public int Run { get; set; } + + /// + /// 待机数量 + /// + public int Stop { get; set; } + + /// + /// 报警数量 + /// + public int Alarm { get; set; } + } +} diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs index 908525a..f894ace 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/DeviceRepository.cs @@ -279,6 +279,7 @@ namespace PVDEMCS.Services.Repositories.Impl PointName = point.PointName, Address = point.Address, DataType = point.DataType, + ActionType = point.ActionType, Remark = point.Remark, }; if (!deviceName.IsNullOrEmpty()) diff --git a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs index 7138598..138d3d0 100644 --- a/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs +++ b/PVDEMCS/PVDEMCS/Services/Repositories/Impl/EquipmentRecordRepository.cs @@ -110,11 +110,6 @@ namespace PVDEMCS.Services.Repositories.Impl /// public Result AddUpdateEquipmentRecord(string equipmentId, string state, DateTime dateTime) { - if (!EquipmentState.HaveState(state)) - { - return new Result($"【{state}】状态不正确!"); - } - using (var context = new EFContext()) { var entity = context.EquipmentRecords.Where(f => f.EquipmentId == equipmentId).OrderByDescending(f => f.StartTime).FirstOrDefault(); @@ -162,7 +157,7 @@ namespace PVDEMCS.Services.Repositories.Impl var result = new Result(); using (var context = new EFContext()) { - var query = context.EquipmentRecords.Where(f => f.StartTime >= begDate && f.StartTime <= endDate); + var query = context.EquipmentRecords.Where(f => f.StartTime >= begDate && f.StartTime <= endDate).ToList(); //获取状态统计时间 var total = query.GroupBy(f => new { f.EquipmentId, f.State }) .Select(f => new TotalRecord @@ -397,6 +392,9 @@ namespace PVDEMCS.Services.Repositories.Impl return query; } + + + #endregion } } diff --git a/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.dll b/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.dll index c735b2a..c54a77d 100644 Binary files a/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.dll and b/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.dll differ diff --git a/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.pdb b/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.pdb index 72e25f0..f03fc66 100644 Binary files a/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.pdb and b/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.pdb differ diff --git a/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.xml b/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.xml index cc84393..1202b31 100644 --- a/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.xml +++ b/PVDEMCS/PVDEMCS/bin/Debug/net6.0/PVDEMCS.xml @@ -59,845 +59,922 @@ 报警 - + - PLC 点位改变触发 + 自定义扩展 Autofac 方法 - + - 获取错误相信 + 依赖注入接口,表示该接口的实现类将自动注册到IoC容器中 - + - 间隔时间 + PLC控制器 - + - 当前点位集合 + 获取PLC控制器分页列表 + 控制器编号 + 控制器名称 + 当前页 + 页大小 + - + - PLC地址与端口 + 获取PLC控制器列表 + 控制器编号 + 控制器名称 + 是否启用 + /// - + - 获取PLC通信接口 + 获取PLC控制器明细 - + 主键Id + - + - 加载点位集合 + 添加PLC控制器 - + + - + - 清理所有点位 + 更新PLC控制器 + - + - 开始监控 + 删除PLC控制器 + - + - 停止监控 + 获取PLC控制器点位分页列表 + 控制器编号 + 控制器名称 + 设备名称 + 设备编号 + 设备类型 + 点位编号 + 点位列表 + 当前页 + 页大小 + - + - 获取PLC点位信息 + 获取PLC控制器点位列表 - + 控制器编号 + 控制器名称 + 设备名称 + 设备编号 + 设备类型 + 点位编号 + 点位列表 - + - PLC通信服务 SiemensS7 smart200 实现 + 获取PLC控制器点位明细 + Id + - + - 是否已连接 + 添加PLC控制器点位 + + - + - 连接PLC(长连接) + 更新PLC控制器点位 - - + + - + - 关闭连接PLC(长连接) + 删除PLC控制器点位 + + - + - 读取指定地址的byte[]值 + 设备管理 - - - + - 读取指定地址的bool值 + 获取设备分页列表 - + 设备名称 + 设备编号 + 设备类型 + 是否启用 + 当前页 + 页大小 - + - 读取指定地址的byte值 + 获取设备列表 - - + 设备名称 + 设备编号 + 是否启用 - + - 读取指定地址的Int16值 + 获取设备明显 - + - + - 读取指定地址的Int32值 + 添加设备信息 - + - + - 读取指定地址的long值 + 更新设备信息 - + - + - 读取指定地址的Float值 + 删除设备信息 + - + - 读取指定地址的double值 + 设备数据记录与统计 - - + - 写入bool值 + 获取设备状态记录分页列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 + 当前页 + 页大小 + - + - 写入byte值 + 获取设备状态记录列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 + - + - 写入Int16值 + 添加或更新设备状态记录 + 1.如果设备最新记录状态没有改变则更新结束时间 + 2.如果没有记录则添加记录 - 写入地址 - + 设备Id + 设备状态,运行:Run,待机:Stop,报警:Alarm + 记录时间 + - + - 写入Int32值 + 获取设备状态记录统计(日)分页列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 + 当前页 + 页大小 - + - 写入float值 + 获取设备状态记录统计(日)列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 - + - 写入double值 + 获取设备总览 - 写入地址 - + - + - 写入long值 + 系统参数设置 - 写入地址 - - + - 连接PLC(长连接) + 获取系统参数设置分页列表 - - + 参数名称 + 参数键值 + 当前页 + 页大小 + - + - 关闭连接PLC(长连接) + 获取系统参数设置列表 + 参数名称 + 参数键值 + - + - 读取指定地址的byte[]值 + 获取获取系统参数设置明细 - + - + - 读取指定地址的bool值 + 获取获取系统参数设置明细 - + + /// - + - 读取指定地址的byte值 + 添加系统参数设置 - + - + - 读取指定地址的Int16值 + 更新系统参数设置 - - + - + - 读取指定地址的Int32值 + 删除系统参数设置 - - + - + - 读取指定地址的long值 + 设备运行 - - - + - 读取指定地址的Float值 + 获取所有点位信息 - - + - 读取指定地址的double值 + 获取控制器连接状态 - - + - 写入bool值 + 开始运行 - 写入地址 - - + - 写入byte值 + 停止运行 - 写入地址 - - + - 写入Int16值 + 控制器点位监控 - 写入地址 - - + - 写入Int32值 + PLC 点位改变触发 - 写入地址 - - + - 写入float值 + 获取错误相信 - 写入地址 - - + - 写入double值 + 控制器编号 - 写入地址 - - + - 写入long值 + 间隔时间 - 写入地址 - - + - 转换 result (将框架结果结构转换成当前程序结果结构) + 连接状态 - - - + - 转换 result (将框架结果结构转换成当前程序结果结构) + 监控是否运行 - + + + + 当前点位集合 + + + + + PLC地址与端口 + + + + + 获取PLC通信接口 + + + + + + 加载点位集合 + + + + + + 清理所有点位 + + + + + 开始监控 + + + + + 停止监控 + + + + + 获取PLC点位信息 + + - + - PLC通信接口 + 设备运行 + + + + + 获取所有点位信息 + + + + + 获取控制器连接状态 - + + + 开始运行 + + + + + 停止运行 + + + + + PLC通信服务 SiemensS7 smart200 实现 + + + 是否已连接 - + 连接PLC(长连接) - + 关闭连接PLC(长连接) - + 读取指定地址的byte[]值 - + 读取指定地址的bool值 - + 读取指定地址的byte值 - + 读取指定地址的Int16值 - + 读取指定地址的Int32值 - + 读取指定地址的long值 - + 读取指定地址的Float值 - + 读取指定地址的double值 - + 写入bool值 写入地址 - + 写入byte值 写入地址 - + 写入Int16值 写入地址 - + 写入Int32值 写入地址 - + 写入float值 写入地址 - + 写入double值 写入地址 - + 写入long值 写入地址 - + 连接PLC(长连接) - + 关闭连接PLC(长连接) - + 读取指定地址的byte[]值 - + 读取指定地址的bool值 - + 读取指定地址的byte值 - + 读取指定地址的Int16值 - + 读取指定地址的Int32值 - + 读取指定地址的long值 - + 读取指定地址的Float值 - + 读取指定地址的double值 - + 写入bool值 写入地址 - + 写入byte值 写入地址 - + 写入Int16值 写入地址 - + 写入Int32值 写入地址 - + 写入float值 写入地址 - + 写入double值 写入地址 - + 写入long值 写入地址 - + - 自定义扩展 Autofac 方法 + 转换 result (将框架结果结构转换成当前程序结果结构) + + - + - 依赖注入接口,表示该接口的实现类将自动注册到IoC容器中 + 转换 result (将框架结果结构转换成当前程序结果结构) + + - + - PLC控制器 + PLC通信接口 - + - 获取PLC控制器分页列表 + 是否已连接 - 控制器编号 - 控制器名称 - 当前页 - 页大小 - - + - 获取PLC控制器列表 + 连接PLC(长连接) - 控制器编号 - 控制器名称 + + + + + + 关闭连接PLC(长连接) + + + + + 读取指定地址的byte[]值 + + - + - 获取PLC控制器明细 + 读取指定地址的bool值 - 主键Id + - + - 添加PLC控制器 + 读取指定地址的byte值 - + - + - 更新PLC控制器 + 读取指定地址的Int16值 - + + - + - 删除PLC控制器 + 读取指定地址的Int32值 - + + - + - 获取PLC控制器点位分页列表 + 读取指定地址的long值 - 控制器编号 - 控制器名称 - 设备名称 - 设备编号 - 设备类型 - 点位编号 - 点位列表 - 当前页 - 页大小 + - + - 获取PLC控制器点位列表 + 读取指定地址的Float值 - 控制器编号 - 控制器名称 - 设备名称 - 设备编号 - 设备类型 - 点位编号 - 点位列表 - + - 获取PLC控制器点位明细 + 读取指定地址的double值 - Id - + - 添加PLC控制器点位 + 写入bool值 - - + 写入地址 + - + - 更新PLC控制器点位 + 写入byte值 - - + 写入地址 + - + - 删除PLC控制器点位 + 写入Int16值 - - + 写入地址 + - + - 设备管理 + 写入Int32值 + 写入地址 + - + - 获取设备分页列表 + 写入float值 - 设备名称 - 设备编号 - 设备类型 - 是否启用 - 当前页 - 页大小 - + 写入地址 + - + - 获取设备列表 + 写入double值 - 设备名称 - 设备编号 - 是否启用 + 写入地址 + - + - 获取设备明显 + 写入long值 - - + 写入地址 + - + - 添加设备信息 + 连接PLC(长连接) - - + + - + - 更新设备信息 + 关闭连接PLC(长连接) - - - + - 删除设备信息 + 读取指定地址的byte[]值 - + - + - 设备数据记录与统计 + 读取指定地址的bool值 + + - + - 获取设备状态记录分页列表 + 读取指定地址的byte值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 - 当前页 - 页大小 + - + - 获取设备状态记录列表 + 读取指定地址的Int16值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 + - + - 添加或更新设备状态记录 - 1.如果设备最新记录状态没有改变则更新结束时间 - 2.如果没有记录则添加记录 + 读取指定地址的Int32值 - 设备Id - 设备状态,运行:Run,待机:Stop,报警:Alarm - 记录时间 + - + - 获取设备状态记录统计分页列表 + 读取指定地址的long值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 - 当前页 - 页大小 + + - + - 获取设备状态记录统计列表 + 读取指定地址的Float值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 + - + - 系统参数设置 + 读取指定地址的double值 + - + - 获取系统参数设置分页列表 + 写入bool值 - 参数名称 - 参数键值 - 当前页 - 页大小 - + 写入地址 + - + - 获取系统参数设置列表 + 写入byte值 - 参数名称 - 参数键值 - + 写入地址 + - + - 获取获取系统参数设置明细 + 写入Int16值 - - + 写入地址 + - + - 获取获取系统参数设置明细 + 写入Int32值 - - /// - + 写入地址 + - + - 添加系统参数设置 + 写入float值 - - + 写入地址 + - + - 更新系统参数设置 + 写入double值 - + 写入地址 + - + - 删除系统参数设置 + 写入long值 - + 写入地址 + @@ -1305,6 +1382,12 @@ 设备编号 是否启用 + + + 获取设备状态 + + + 获取设备明显 @@ -1475,6 +1558,11 @@ 备注 + + + 设备连接状态 + + PLC点位 @@ -1515,6 +1603,11 @@ 设备类型:Ionbond,Balzers,Cemecon + + + 点位所属动作,启动停止:start_stop;故障:fault + + 点位编号 @@ -1671,6 +1764,31 @@ 日期 + + + 设备状态总览 + + + + + 设备类型:ALL(所有),Ionbond,Balzers,Cemecon + + + + + 运行数量 + + + + + 待机数量 + + + + + 报警数量 + + 参数配置表 diff --git a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.csproj.CoreCompileInputs.cache b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.csproj.CoreCompileInputs.cache index 2562c5e..a651056 100644 --- a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.csproj.CoreCompileInputs.cache +++ b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -343174067cd832fbade3d0f003640c7839b8168f +3e345de9ad93be7a11cd4479e87ec2ba29d50159 diff --git a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.dll b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.dll index c735b2a..c54a77d 100644 Binary files a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.dll and b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.dll differ diff --git a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.pdb b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.pdb index 72e25f0..f03fc66 100644 Binary files a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.pdb and b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.pdb differ diff --git a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.xml b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.xml index cc84393..1202b31 100644 --- a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.xml +++ b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/PVDEMCS.xml @@ -59,845 +59,922 @@ 报警 - + - PLC 点位改变触发 + 自定义扩展 Autofac 方法 - + - 获取错误相信 + 依赖注入接口,表示该接口的实现类将自动注册到IoC容器中 - + - 间隔时间 + PLC控制器 - + - 当前点位集合 + 获取PLC控制器分页列表 + 控制器编号 + 控制器名称 + 当前页 + 页大小 + - + - PLC地址与端口 + 获取PLC控制器列表 + 控制器编号 + 控制器名称 + 是否启用 + /// - + - 获取PLC通信接口 + 获取PLC控制器明细 - + 主键Id + - + - 加载点位集合 + 添加PLC控制器 - + + - + - 清理所有点位 + 更新PLC控制器 + - + - 开始监控 + 删除PLC控制器 + - + - 停止监控 + 获取PLC控制器点位分页列表 + 控制器编号 + 控制器名称 + 设备名称 + 设备编号 + 设备类型 + 点位编号 + 点位列表 + 当前页 + 页大小 + - + - 获取PLC点位信息 + 获取PLC控制器点位列表 - + 控制器编号 + 控制器名称 + 设备名称 + 设备编号 + 设备类型 + 点位编号 + 点位列表 - + - PLC通信服务 SiemensS7 smart200 实现 + 获取PLC控制器点位明细 + Id + - + - 是否已连接 + 添加PLC控制器点位 + + - + - 连接PLC(长连接) + 更新PLC控制器点位 - - + + - + - 关闭连接PLC(长连接) + 删除PLC控制器点位 + + - + - 读取指定地址的byte[]值 + 设备管理 - - - + - 读取指定地址的bool值 + 获取设备分页列表 - + 设备名称 + 设备编号 + 设备类型 + 是否启用 + 当前页 + 页大小 - + - 读取指定地址的byte值 + 获取设备列表 - - + 设备名称 + 设备编号 + 是否启用 - + - 读取指定地址的Int16值 + 获取设备明显 - + - + - 读取指定地址的Int32值 + 添加设备信息 - + - + - 读取指定地址的long值 + 更新设备信息 - + - + - 读取指定地址的Float值 + 删除设备信息 + - + - 读取指定地址的double值 + 设备数据记录与统计 - - + - 写入bool值 + 获取设备状态记录分页列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 + 当前页 + 页大小 + - + - 写入byte值 + 获取设备状态记录列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 + - + - 写入Int16值 + 添加或更新设备状态记录 + 1.如果设备最新记录状态没有改变则更新结束时间 + 2.如果没有记录则添加记录 - 写入地址 - + 设备Id + 设备状态,运行:Run,待机:Stop,报警:Alarm + 记录时间 + - + - 写入Int32值 + 获取设备状态记录统计(日)分页列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 + 当前页 + 页大小 - + - 写入float值 + 获取设备状态记录统计(日)列表 - 写入地址 - + 设备名称 + 设备编号 + 设备类型 + 开始时间 + 结束时间 - + - 写入double值 + 获取设备总览 - 写入地址 - + - + - 写入long值 + 系统参数设置 - 写入地址 - - + - 连接PLC(长连接) + 获取系统参数设置分页列表 - - + 参数名称 + 参数键值 + 当前页 + 页大小 + - + - 关闭连接PLC(长连接) + 获取系统参数设置列表 + 参数名称 + 参数键值 + - + - 读取指定地址的byte[]值 + 获取获取系统参数设置明细 - + - + - 读取指定地址的bool值 + 获取获取系统参数设置明细 - + + /// - + - 读取指定地址的byte值 + 添加系统参数设置 - + - + - 读取指定地址的Int16值 + 更新系统参数设置 - - + - + - 读取指定地址的Int32值 + 删除系统参数设置 - - + - + - 读取指定地址的long值 + 设备运行 - - - + - 读取指定地址的Float值 + 获取所有点位信息 - - + - 读取指定地址的double值 + 获取控制器连接状态 - - + - 写入bool值 + 开始运行 - 写入地址 - - + - 写入byte值 + 停止运行 - 写入地址 - - + - 写入Int16值 + 控制器点位监控 - 写入地址 - - + - 写入Int32值 + PLC 点位改变触发 - 写入地址 - - + - 写入float值 + 获取错误相信 - 写入地址 - - + - 写入double值 + 控制器编号 - 写入地址 - - + - 写入long值 + 间隔时间 - 写入地址 - - + - 转换 result (将框架结果结构转换成当前程序结果结构) + 连接状态 - - - + - 转换 result (将框架结果结构转换成当前程序结果结构) + 监控是否运行 - + + + + 当前点位集合 + + + + + PLC地址与端口 + + + + + 获取PLC通信接口 + + + + + + 加载点位集合 + + + + + + 清理所有点位 + + + + + 开始监控 + + + + + 停止监控 + + + + + 获取PLC点位信息 + + - + - PLC通信接口 + 设备运行 + + + + + 获取所有点位信息 + + + + + 获取控制器连接状态 - + + + 开始运行 + + + + + 停止运行 + + + + + PLC通信服务 SiemensS7 smart200 实现 + + + 是否已连接 - + 连接PLC(长连接) - + 关闭连接PLC(长连接) - + 读取指定地址的byte[]值 - + 读取指定地址的bool值 - + 读取指定地址的byte值 - + 读取指定地址的Int16值 - + 读取指定地址的Int32值 - + 读取指定地址的long值 - + 读取指定地址的Float值 - + 读取指定地址的double值 - + 写入bool值 写入地址 - + 写入byte值 写入地址 - + 写入Int16值 写入地址 - + 写入Int32值 写入地址 - + 写入float值 写入地址 - + 写入double值 写入地址 - + 写入long值 写入地址 - + 连接PLC(长连接) - + 关闭连接PLC(长连接) - + 读取指定地址的byte[]值 - + 读取指定地址的bool值 - + 读取指定地址的byte值 - + 读取指定地址的Int16值 - + 读取指定地址的Int32值 - + 读取指定地址的long值 - + 读取指定地址的Float值 - + 读取指定地址的double值 - + 写入bool值 写入地址 - + 写入byte值 写入地址 - + 写入Int16值 写入地址 - + 写入Int32值 写入地址 - + 写入float值 写入地址 - + 写入double值 写入地址 - + 写入long值 写入地址 - + - 自定义扩展 Autofac 方法 + 转换 result (将框架结果结构转换成当前程序结果结构) + + - + - 依赖注入接口,表示该接口的实现类将自动注册到IoC容器中 + 转换 result (将框架结果结构转换成当前程序结果结构) + + - + - PLC控制器 + PLC通信接口 - + - 获取PLC控制器分页列表 + 是否已连接 - 控制器编号 - 控制器名称 - 当前页 - 页大小 - - + - 获取PLC控制器列表 + 连接PLC(长连接) - 控制器编号 - 控制器名称 + + + + + + 关闭连接PLC(长连接) + + + + + 读取指定地址的byte[]值 + + - + - 获取PLC控制器明细 + 读取指定地址的bool值 - 主键Id + - + - 添加PLC控制器 + 读取指定地址的byte值 - + - + - 更新PLC控制器 + 读取指定地址的Int16值 - + + - + - 删除PLC控制器 + 读取指定地址的Int32值 - + + - + - 获取PLC控制器点位分页列表 + 读取指定地址的long值 - 控制器编号 - 控制器名称 - 设备名称 - 设备编号 - 设备类型 - 点位编号 - 点位列表 - 当前页 - 页大小 + - + - 获取PLC控制器点位列表 + 读取指定地址的Float值 - 控制器编号 - 控制器名称 - 设备名称 - 设备编号 - 设备类型 - 点位编号 - 点位列表 - + - 获取PLC控制器点位明细 + 读取指定地址的double值 - Id - + - 添加PLC控制器点位 + 写入bool值 - - + 写入地址 + - + - 更新PLC控制器点位 + 写入byte值 - - + 写入地址 + - + - 删除PLC控制器点位 + 写入Int16值 - - + 写入地址 + - + - 设备管理 + 写入Int32值 + 写入地址 + - + - 获取设备分页列表 + 写入float值 - 设备名称 - 设备编号 - 设备类型 - 是否启用 - 当前页 - 页大小 - + 写入地址 + - + - 获取设备列表 + 写入double值 - 设备名称 - 设备编号 - 是否启用 + 写入地址 + - + - 获取设备明显 + 写入long值 - - + 写入地址 + - + - 添加设备信息 + 连接PLC(长连接) - - + + - + - 更新设备信息 + 关闭连接PLC(长连接) - - - + - 删除设备信息 + 读取指定地址的byte[]值 - + - + - 设备数据记录与统计 + 读取指定地址的bool值 + + - + - 获取设备状态记录分页列表 + 读取指定地址的byte值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 - 当前页 - 页大小 + - + - 获取设备状态记录列表 + 读取指定地址的Int16值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 + - + - 添加或更新设备状态记录 - 1.如果设备最新记录状态没有改变则更新结束时间 - 2.如果没有记录则添加记录 + 读取指定地址的Int32值 - 设备Id - 设备状态,运行:Run,待机:Stop,报警:Alarm - 记录时间 + - + - 获取设备状态记录统计分页列表 + 读取指定地址的long值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 - 当前页 - 页大小 + + - + - 获取设备状态记录统计列表 + 读取指定地址的Float值 - 设备名称 - 设备编号 - 设备类型 - 开始时间 - 结束时间 + - + - 系统参数设置 + 读取指定地址的double值 + - + - 获取系统参数设置分页列表 + 写入bool值 - 参数名称 - 参数键值 - 当前页 - 页大小 - + 写入地址 + - + - 获取系统参数设置列表 + 写入byte值 - 参数名称 - 参数键值 - + 写入地址 + - + - 获取获取系统参数设置明细 + 写入Int16值 - - + 写入地址 + - + - 获取获取系统参数设置明细 + 写入Int32值 - - /// - + 写入地址 + - + - 添加系统参数设置 + 写入float值 - - + 写入地址 + - + - 更新系统参数设置 + 写入double值 - + 写入地址 + - + - 删除系统参数设置 + 写入long值 - + 写入地址 + @@ -1305,6 +1382,12 @@ 设备编号 是否启用 + + + 获取设备状态 + + + 获取设备明显 @@ -1475,6 +1558,11 @@ 备注 + + + 设备连接状态 + + PLC点位 @@ -1515,6 +1603,11 @@ 设备类型:Ionbond,Balzers,Cemecon + + + 点位所属动作,启动停止:start_stop;故障:fault + + 点位编号 @@ -1671,6 +1764,31 @@ 日期 + + + 设备状态总览 + + + + + 设备类型:ALL(所有),Ionbond,Balzers,Cemecon + + + + + 运行数量 + + + + + 待机数量 + + + + + 报警数量 + + 参数配置表 diff --git a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/ref/PVDEMCS.dll b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/ref/PVDEMCS.dll index 17df09a..1598524 100644 Binary files a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/ref/PVDEMCS.dll and b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/ref/PVDEMCS.dll differ diff --git a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/refint/PVDEMCS.dll b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/refint/PVDEMCS.dll index 17df09a..1598524 100644 Binary files a/PVDEMCS/PVDEMCS/obj/Debug/net6.0/refint/PVDEMCS.dll and b/PVDEMCS/PVDEMCS/obj/Debug/net6.0/refint/PVDEMCS.dll differ