diff --git a/SlnMesnac.Repository/service/IDmsRealtimeStatusService.cs b/SlnMesnac.Repository/service/IDmsRealtimeStatusService.cs
new file mode 100644
index 0000000..cfe5f82
--- /dev/null
+++ b/SlnMesnac.Repository/service/IDmsRealtimeStatusService.cs
@@ -0,0 +1,19 @@
+using SlnMesnac.Model.domain;
+using SlnMesnac.Repository.service.@base;
+using System.Collections.Generic;
+
+namespace SlnMesnac.Repository.service
+{
+ ///
+ /// 设备参数实时状态表服务接口
+ ///
+ public interface IDmsRealtimeStatusService : IBaseService
+ {
+ ///
+ /// 获取生产控制系统监听的所有设备参数状态列表
+ ///
+ ///
+ public List GetAllList();
+
+ }
+}
\ No newline at end of file
diff --git a/SlnMesnac.Repository/service/Impl/DmsRealtimeStatusServiceImpl.cs b/SlnMesnac.Repository/service/Impl/DmsRealtimeStatusServiceImpl.cs
new file mode 100644
index 0000000..c01a1c6
--- /dev/null
+++ b/SlnMesnac.Repository/service/Impl/DmsRealtimeStatusServiceImpl.cs
@@ -0,0 +1,56 @@
+using Microsoft.Extensions.DependencyInjection;
+using SlnMesnac.Model.domain;
+using SlnMesnac.Repository.service.@base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+#region << 版 本 注 释 >>
+/*--------------------------------------------------------------------
+* 版权所有 (c) 2024 WenJY 保留所有权利。
+* CLR版本:4.0.30319.42000
+* 机器名称:LAPTOP-E0N2L34V
+* 命名空间:SlnMesnac.Repository.service.Impl
+* 唯一标识:50d84911-9088-4fd3-b85a-151411028afc
+*
+* 创建者:WenJY
+* 电子邮箱:wenjy@mesnac.com
+* 创建时间:2024-04-08 16:47:57
+* 版本:V1.0.0
+* 描述:
+*
+*--------------------------------------------------------------------
+* 修改人:
+* 时间:
+* 修改说明:
+*
+* 版本:V1.0.0
+*--------------------------------------------------------------------*/
+#endregion << 版 本 注 释 >>
+namespace SlnMesnac.Repository.service.Impl
+{
+ public class DmsRealtimeStatusServiceImpl : BaseServiceImpl, IDmsRealtimeStatusService
+ {
+
+ public DmsRealtimeStatusServiceImpl(Repository rep) : base(rep)
+ {
+
+ }
+
+ ///
+ /// 获取生产控制系统监听的所有设备参数状态列表
+ ///
+ ///
+ public List GetAllList()
+ {
+ List list = null;
+
+ var deviceIds = new List { 1016, 1017, 1018, 1019 };
+ list = _rep.GetList(x=> deviceIds.Contains((long)x.DeviceId));
+ return list;
+ }
+
+
+ }
+}
diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
index f1c111d..8a147e7 100644
--- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
+++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
@@ -38,19 +38,23 @@ namespace SlnMesnac.WPF.Page
public partial class DevMonitorPage : UserControl
{
// 设备OEE采集缓存
- private List DmsList = null;
+ private List? DmsList = null;
// 设备报警采集缓存
- private List WarningList = null;
+ private List? WarningList = null;
+ // 设备参数实时状态
+ private List? realtimeStatusList= null;
private ISqlSugarClient? sqlClient = null;
- private BaseBusiness baseBusiness = null;
- private readonly ConfigInfoBusiness _configInfoBusiness;
- private readonly IDmsRecordShutDownService dmsRecordShutDownService;
- private readonly IDmsRecordAlarmTimeService dmsRecordAlarmTimeService;
+ private BaseBusiness? baseBusiness = null;
+ private readonly ConfigInfoBusiness? _configInfoBusiness;
+ private readonly IDmsRecordShutDownService? dmsRecordShutDownService;
+ private readonly IDmsRecordAlarmTimeService? dmsRecordAlarmTimeService;
+ private readonly IDmsRealtimeStatusService? dmsRealtimeStatusService;
+
PlcAbsractFactory plc = null;
int MachineSleep = 1000;
- private readonly ILogger _logger;
+ private readonly ILogger? _logger;
System.Timers.Timer systemRunTimer = new System.Timers.Timer(1000 * 60);
//系统频率配方
@@ -62,6 +66,8 @@ namespace SlnMesnac.WPF.Page
sqlClient = App.ServiceProvider.GetService();
dmsRecordShutDownService = App.ServiceProvider.GetService();
dmsRecordAlarmTimeService = App.ServiceProvider.GetService();
+ dmsRealtimeStatusService = App.ServiceProvider.GetService();
+
RecipeModeSetWindow.ManualChangeRecipeEvent += ManualChangeRecipe;
_logger = App.ServiceProvider.GetService>();
_configInfoBusiness = App.ServiceProvider.GetService();
@@ -76,7 +82,7 @@ namespace SlnMesnac.WPF.Page
StartAdjustRecipe();
}
-
+
private void Init()
{
@@ -133,31 +139,35 @@ namespace SlnMesnac.WPF.Page
{
Task.Run(() =>
{
-
+ List machineStatusDtos = new List();
DmsList = dmsRecordShutDownService.GetAllMachineFirst();
WarningList = dmsRecordAlarmTimeService.GetMachineWarnList();
+ realtimeStatusList = dmsRealtimeStatusService.GetAllList();
while (true)
{
try
{
- List machineStatusDtos = new List();
+ machineStatusDtos.Clear();
Thread.Sleep(2000);
if (plc != null)
{
lock (string.Empty)
{
- RefreshMagNet(machineStatusDtos);
- RefreshSpiral(machineStatusDtos);
- RefreshHot(machineStatusDtos);
- RefreshUnPack(machineStatusDtos);
+ RefreshMagNet(machineStatusDtos, realtimeStatusList);
+ RefreshSpiral(machineStatusDtos, realtimeStatusList);
+ RefreshHot(machineStatusDtos, realtimeStatusList);
+ RefreshUnPack(machineStatusDtos, realtimeStatusList);
- RefreshWeight();
+ RefreshWeight(realtimeStatusList);
//开关机时间采集
machineStatusDtos.ForEach(x => OeeCollection(x));
//报警采集
machineStatusDtos.ForEach(x => MachineWarnCollection(x));
-
+
+
+ dmsRealtimeStatusService.Update(realtimeStatusList);
+
}
}
else
@@ -180,36 +190,43 @@ namespace SlnMesnac.WPF.Page
///
/// 设备缓存区重量监听及停机控制,监听包装袋余量
///
- private void RefreshWeight()
+ private void RefreshWeight(List realtimeStatusList)
{
try
{
+ string Bags_Amount = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
App.Current.Dispatcher.BeginInvoke((Action)(() =>
- {
- BagsAmountTxt.Text = _configInfoBusiness.GetConfigInfos().FirstOrDefault(x => x.ConfigKey == "包装袋余量").ConfigValue;
+ {
+ BagsAmountTxt.Text = Bags_Amount;
BufferWeightTxt.Text = recipeManageCache.BufferWeight.ToString("F2");
}));
// 判断缓存区重量是否达到设定最大值,如果达到并且设备开机中,停机
- double maxWeight = recipeManageCache.MaxBufferWeight;
- double weight = recipeManageCache.BufferWeight;
+ double Cache_MaxWeight = recipeManageCache.MaxBufferWeight;
+ double Cache_Weight = recipeManageCache.BufferWeight;
bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
- if (unPackStatus && (maxWeight <= weight))
+ if (unPackStatus && (Cache_MaxWeight <= Cache_Weight))
{
// 所有机器停机
Task.Run(() =>
{
StopMachine(99);
- MessageBox.Show($"设备缓存区当前重量:{weight},预设最大重量值:{maxWeight},已经超重并且拆包机运行,系统下发停机命令!");
- _logger.LogError($"设备缓存区当前重量:{weight},预设最大重量值:{maxWeight},已经超重并且拆包机运行,系统下发停机命令!");
+ MessageBox.Show($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
+ _logger.LogError($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
});
Thread.Sleep(2000);
-
}
- }catch (Exception ex)
+
+ realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
+ realtimeStatusList.First(x => x.StatusCode == "Cache_MaxWeight").StatusValue = Cache_MaxWeight.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Cache_Weight").StatusValue = Cache_Weight.ToString();
+
+
+ }
+ catch (Exception ex)
{
_logger.LogError($"RefreshWeight出现异常:{ex.Message}");
}
@@ -1558,12 +1575,12 @@ namespace SlnMesnac.WPF.Page
///
/// 拆包机参数监控
///
- private void RefreshUnPack(List machineStatusDtos)
+ private void RefreshUnPack(List machineStatusDtos,List realtimeStatusList)
{
try
{
- bool unPackStatus0 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程"));
- bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
+ bool UnPack_MesUse_Flag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程"));
+ bool UnPack_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
bool unPackStatus2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("设备叫料"));
bool unPackStatus3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("物料到位"));
@@ -1573,17 +1590,17 @@ namespace SlnMesnac.WPF.Page
bool unPackStatus7 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机连接状态"));
bool unPackStatus8 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
- float unPackStatus9 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率反馈"));
- float unPackStatus10 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率反馈"));
- float unPackStatus11 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率反馈"));
- float unPackStatus12 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率反馈"));
- float unPackStatus13 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈"));
+ float UnPack_Flip_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机翻转机频率反馈"));
+ float UnPack_Roll_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机滚筒筛频率反馈"));
+ float UnPack_Spiral1_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋1频率反馈"));
+ float UnPack_Spiral2_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率反馈"));
+ float UnPack_Waste_HZ = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈"));
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
- UnpackStatus0.Fill = unPackStatus0 ? Brushes.Green : Brushes.Red;
- UnpackStatus1.Fill = unPackStatus1 ? Brushes.Green : Brushes.Red;
+ UnpackStatus0.Fill = UnPack_MesUse_Flag ? Brushes.Green : Brushes.Red;
+ UnpackStatus1.Fill = UnPack_Status ? Brushes.Green : Brushes.Red;
UnpackStatus2.Text = unPackStatus2.ToString();
UnpackStatus3.Text = unPackStatus3.ToString();
@@ -1593,11 +1610,11 @@ namespace SlnMesnac.WPF.Page
UnpackStatus7.Fill = unPackStatus7 ? Brushes.Green : Brushes.Red;
UnpackStatus8.Fill = unPackStatus8 ? Brushes.Red : Brushes.Green;
- UnpackStatus9.Text = unPackStatus9.ToString("F2");
- UnpackStatus10.Text = unPackStatus10.ToString("F2");
- UnpackStatus11.Text = unPackStatus11.ToString("F2");
- UnpackStatus12.Text = unPackStatus12.ToString("F2");
- UnpackStatus13.Text = unPackStatus13.ToString("F2");
+ UnpackStatus9.Text = UnPack_Flip_HZ.ToString("F2");
+ UnpackStatus10.Text = UnPack_Roll_HZ.ToString("F2");
+ UnpackStatus11.Text = UnPack_Spiral1_HZ.ToString("F2");
+ UnpackStatus12.Text = UnPack_Spiral2_HZ.ToString("F2");
+ UnpackStatus13.Text = UnPack_Waste_HZ.ToString("F2");
}));
@@ -1605,7 +1622,7 @@ namespace SlnMesnac.WPF.Page
//数据采集部分
MachineStatusDto machineStatusDto = new MachineStatusDto();
machineStatusDto.deviceId = 1016;
- machineStatusDto.status = unPackStatus1;
+ machineStatusDto.status = UnPack_Status;
if (unPackStatus8)
{
machineStatusDto.warnStatus = WarnStatusEnum.拆包机堵料停螺旋;
@@ -1615,8 +1632,15 @@ namespace SlnMesnac.WPF.Page
machineStatusDto.warnStatus = WarnStatusEnum.无报警;
}
machineStatusDtos.Add(machineStatusDto);
+ //设备参数实时更新
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_MesUse_Flag").StatusValue = UnPack_MesUse_Flag.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_Status").StatusValue = UnPack_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_Flip_HZ").StatusValue = UnPack_Flip_HZ.ToString("F2");
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_Roll_HZ").StatusValue = UnPack_Roll_HZ.ToString("F2");
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_Spiral1_HZ").StatusValue = UnPack_Spiral1_HZ.ToString("F2");
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_Spiral2_HZ").StatusValue = UnPack_Spiral2_HZ.ToString("F2");
+ realtimeStatusList.First(x => x.StatusCode == "UnPack_Waste_HZ").StatusValue = UnPack_Waste_HZ.ToString("F2");
-
}
catch (Exception ex)
{
@@ -1630,27 +1654,26 @@ namespace SlnMesnac.WPF.Page
///
/// 磁选机参数监控
///
- private void RefreshMagNet(List machineStatusDtos)
+ private void RefreshMagNet(List machineStatusDtos, List realtimeStatusList)
{
try
{
- bool signal0 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机震动启动"));
- bool signal1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机磁选启动"));
- bool signal2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程"));
+ bool MagNet_Shake_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机震动启动"));
+ bool MagNet_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机磁选启动"));
+ bool MagNet_MesUse_Flag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程"));
bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机设备故障反馈"));
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
- MagNetStatus1.Fill = signal0 ? Brushes.Green : Brushes.Red;
- MagNetStatus2.Fill = signal1 ? Brushes.Green : Brushes.Red;
- MagNetStatus3.Fill = signal2 ? Brushes.Green : Brushes.Red;
+ MagNetStatus1.Fill = MagNet_Shake_Status ? Brushes.Green : Brushes.Red;
+ MagNetStatus2.Fill = MagNet_Status ? Brushes.Green : Brushes.Red;
+ MagNetStatus3.Fill = MagNet_MesUse_Flag ? Brushes.Green : Brushes.Red;
MagNetStatus4.Fill = signal3 ? Brushes.Red : Brushes.Green;
-
}));
MachineStatusDto machineStatusDto = new MachineStatusDto();
machineStatusDto.deviceId = 1017;
- machineStatusDto.status = signal0 && signal1;
+ machineStatusDto.status = MagNet_Shake_Status && MagNet_Status;
if (signal3)
{
machineStatusDto.warnStatus = WarnStatusEnum.磁选机设备故障报警;
@@ -1660,15 +1683,10 @@ namespace SlnMesnac.WPF.Page
machineStatusDto.warnStatus = WarnStatusEnum.无报警;
}
machineStatusDtos.Add(machineStatusDto);
-
- //if (signal3)
- //{
- // Task.Run(() =>
- // {
- // StopMachine(5);
- // _logger.LogError("磁选机设备故障,自动关闭磁选机及以前的设备");
- // });
- //}
+ //设备参数实时更新
+ realtimeStatusList.First(x => x.StatusCode == "MagNet_Shake_Status").StatusValue = MagNet_Shake_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "MagNet_Status").StatusValue = MagNet_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "MagNet_MesUse_Flag").StatusValue = MagNet_MesUse_Flag.ToString();
}
@@ -1682,50 +1700,50 @@ namespace SlnMesnac.WPF.Page
///
/// 螺旋机参数监控
///
- private void RefreshSpiral(List machineStatusDtos)
+ private void RefreshSpiral(List machineStatusDtos, List realtimeStatusList)
{
try
{
- bool signal0 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程"));
- bool signal1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程"));
- bool signal2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1状态"));
- bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2状态"));
+ bool Spiral1_MesUse_Flag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程"));
+ bool Spiral2_MesUse_Flag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程"));
+ bool Spiral1_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1状态"));
+ bool Spiral2_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2状态"));
- bool signal4 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1变频器状态"));
- bool signal5 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2变频器状态"));
+ bool Spiral1_Inverter_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1变频器状态"));
+ bool Spiral2_Inverter_Status = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2变频器状态"));
- double speed1 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度反馈")) / 100;
- double speed2 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度反馈")) / 100;
+ double Spiral1_Speed = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度反馈")) / 100;
+ double Spiral2_Speed = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度反馈")) / 100;
// 螺旋速度预设值
- int speed1Set = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
- int speed2Set = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值"));
+ int Spiral1_Set_Speed = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
+ int Spiral2_Set_Speed = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值"));
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
- SpiralSignal0.Fill = signal0 ? Brushes.Green : Brushes.Red;
- SpiralSignal1.Fill = signal1 ? Brushes.Green : Brushes.Red;
- SpiralSignal2.Fill = signal2 ? Brushes.Green : Brushes.Red;
- SpiralSignal3.Fill = signal3 ? Brushes.Green : Brushes.Red;
+ SpiralSignal0.Fill = Spiral1_MesUse_Flag ? Brushes.Green : Brushes.Red;
+ SpiralSignal1.Fill = Spiral2_MesUse_Flag ? Brushes.Green : Brushes.Red;
+ SpiralSignal2.Fill = Spiral1_Status ? Brushes.Green : Brushes.Red;
+ SpiralSignal3.Fill = Spiral2_Status ? Brushes.Green : Brushes.Red;
//变频器状态 0正常1故障
- SpiralSignal4.Fill = signal4 ? Brushes.Red : Brushes.Green;
- SpiralSignal5.Fill = signal5 ? Brushes.Red : Brushes.Green;
+ SpiralSignal4.Fill = Spiral1_Inverter_Status ? Brushes.Red : Brushes.Green;
+ SpiralSignal5.Fill = Spiral2_Inverter_Status ? Brushes.Red : Brushes.Green;
//螺旋1 速度低于80%预警
- SpiralSignal6.Fill = speed1 < speed1Set * 0.8 ? Brushes.Red : Brushes.Green;
- SpiralSignal6_Value.Text = speed1.ToString();
+ SpiralSignal6.Fill = Spiral1_Speed < Spiral1_Set_Speed * 0.8 ? Brushes.Red : Brushes.Green;
+ SpiralSignal6_Value.Text = Spiral1_Speed.ToString();
//螺旋2 速度低于80%预警
- SpiralSignal7.Fill = speed2 < speed2Set * 0.8 ? Brushes.Red : Brushes.Green;
- SpiralSignal7_Value.Text = speed2.ToString();
+ SpiralSignal7.Fill = Spiral2_Speed < Spiral2_Set_Speed * 0.8 ? Brushes.Red : Brushes.Green;
+ SpiralSignal7_Value.Text = Spiral2_Speed.ToString();
}));
MachineStatusDto machineStatusDto = new MachineStatusDto();
machineStatusDto.deviceId = 1018;
- machineStatusDto.status = signal2 && signal3;
- if (signal4 || signal5)
+ machineStatusDto.status = Spiral1_Status && Spiral2_Status;
+ if (Spiral1_Inverter_Status || Spiral2_Inverter_Status)
{
- machineStatusDto.warnStatus = signal4 ? WarnStatusEnum.螺旋机螺旋1变频器报警 : WarnStatusEnum.螺旋机螺旋2变频器报警;
+ machineStatusDto.warnStatus = Spiral1_Inverter_Status ? WarnStatusEnum.螺旋机螺旋1变频器报警 : WarnStatusEnum.螺旋机螺旋2变频器报警;
}
else
{
@@ -1733,22 +1751,17 @@ namespace SlnMesnac.WPF.Page
}
machineStatusDtos.Add(machineStatusDto);
-
- //if (signal5)
- //{
- // Task.Run(() =>
- // {
- // StopMachine(6);
- // _logger.LogError("螺旋2设备故障,自动关闭螺旋2及以前的设备");
- // });
- //}else if (signal4)
- //{
- // Task.Run(() =>
- // {
- // StopMachine(4);
- // _logger.LogError("螺旋1设备故障,自动关闭螺旋1及以前的设备");
- // });
- //}
+ //设备参数实时更新
+ realtimeStatusList.First(x => x.StatusCode == "Spiral1_MesUse_Flag").StatusValue = Spiral1_MesUse_Flag.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral2_MesUse_Flag").StatusValue = Spiral2_MesUse_Flag.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral1_Status").StatusValue = Spiral1_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral2_Status").StatusValue = Spiral2_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral1_Inverter_Status").StatusValue = Spiral1_Inverter_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral2_Inverter_Status").StatusValue = Spiral2_Inverter_Status.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral1_Speed").StatusValue = Spiral1_Speed.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral2_Speed").StatusValue = Spiral2_Speed.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral1_Set_Speed").StatusValue = Spiral1_Set_Speed.ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Spiral2_Set_Speed").StatusValue = Spiral2_Set_Speed.ToString();
}
catch (Exception ex)
@@ -1764,13 +1777,13 @@ namespace SlnMesnac.WPF.Page
///
/// 烘干机参数监控
///
- private void RefreshHot(List machineStatusDtos)
+ private void RefreshHot(List machineStatusDtos, List realtimeStatusList)
{
try
{
- int signal1_1 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋状态"));
- int signal2_1 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机风机状态"));
- int signal3_1 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机燃烧机状态"));
+ int Hot_Spiral_Status = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机螺旋状态"));
+ int Hot_Fan_Status = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机风机状态"));
+ int Hot_Burn_Status = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机燃烧机状态"));
bool signal1_2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机反馈传动启动"));
@@ -1780,10 +1793,10 @@ namespace SlnMesnac.WPF.Page
bool signal4_1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机燃烧机运行"));
bool signal14_2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机存在报警"));
- int signal8 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机烘干温度"));
- int signal9 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机加热温度"));
- int signal10 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机出气温度"));
- int signal11 = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机输出百分比"));
+ int Hot_Drying_Temperature = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机烘干温度"));
+ int Hot_Heat_Temperature = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机加热温度"));
+ int Hot_OutAir_Temperature = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机出气温度"));
+ int Hot_OutPut_Rate = plc.readInt16ByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机输出百分比"));
bool signal7_1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机堵料报警"));
int signal7_2 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机报警"));
@@ -1791,12 +1804,12 @@ namespace SlnMesnac.WPF.Page
App.Current.Dispatcher.BeginInvoke((Action)(() =>
{
- HotSignal1_1.Fill = signal1_1 == 1 ? Brushes.Green : Brushes.Red;
- HotSignal1_1_Value.Text = ChangeHotStatus(signal1_1);
- HotSignal2_1.Fill = signal2_1 == 1 ? Brushes.Green : Brushes.Red;
- HotSignal2_1_Value.Text = ChangeHotStatus(signal2_1);
- HotSignal3_1.Fill = signal3_1 == 1 ? Brushes.Green : Brushes.Red;
- HotSignal3_1_Value.Text = ChangeHotStatus(signal3_1);
+ HotSignal1_1.Fill = Hot_Spiral_Status == 1 ? Brushes.Green : Brushes.Red;
+ HotSignal1_1_Value.Text = ChangeHotStatus(Hot_Spiral_Status);
+ HotSignal2_1.Fill = Hot_Fan_Status == 1 ? Brushes.Green : Brushes.Red;
+ HotSignal2_1_Value.Text = ChangeHotStatus(Hot_Fan_Status);
+ HotSignal3_1.Fill = Hot_Burn_Status == 1 ? Brushes.Green : Brushes.Red;
+ HotSignal3_1_Value.Text = ChangeHotStatus(Hot_Burn_Status);
HotSignal1_2.Fill = signal1_2 ? Brushes.Green : Brushes.Red;
HotSignal2_2.Fill = signal2_2 ? Brushes.Green : Brushes.Red;
@@ -1806,10 +1819,10 @@ namespace SlnMesnac.WPF.Page
HotSignal4_2.Fill = signal14_2 ? Brushes.Red : Brushes.Green;
- HotSignal5_1_Value.Text = ((double)signal8 / 10).ToString();
- HotSignal5_2_Value.Text = ((double)signal9 / 10).ToString();
- HotSignal6_1_Value.Text = ((double)signal10 / 10).ToString();
- HotSignal6_2_Value.Text = signal11.ToString();
+ HotSignal5_1_Value.Text = ((double)Hot_Drying_Temperature / 10).ToString();
+ HotSignal5_2_Value.Text = ((double)Hot_Heat_Temperature / 10).ToString();
+ HotSignal6_1_Value.Text = ((double)Hot_OutAir_Temperature / 10).ToString();
+ HotSignal6_2_Value.Text = ((double)Hot_OutPut_Rate / 10).ToString();
HotSignal7_1.Fill = signal7_1 ? Brushes.Red : Brushes.Green;
HotSignal7_2.Fill = signal7_2 == 0 ? Brushes.Green : Brushes.Red;
@@ -1845,14 +1858,18 @@ namespace SlnMesnac.WPF.Page
}
machineStatusDtos.Add(machineStatusDto);
- //if (signal7_1 || signal7_2 > 0 && signal7_2 <= 4)
- //{
- // Task.Run(() =>
- // {
- // StopMachine(3);
- // _logger.LogError($"烘干机设备故障:{machineStatusDto.warnStatus.ToString()},自动关闭烘干机及以前的设备");
- // });
- //}
+ //设备参数实时更新
+ realtimeStatusList.First(x => x.StatusCode == "Hot_Spiral_Status").StatusValue = (Hot_Spiral_Status==1).ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Hot_Fan_Status").StatusValue = (Hot_Fan_Status==1).ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Hot_Burn_Status").StatusValue = (Hot_Burn_Status==1).ToString();
+
+ realtimeStatusList.First(x => x.StatusCode == "Hot_Drying_Temperature").StatusValue = ((double)Hot_Drying_Temperature / 10).ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Hot_Heat_Temperature").StatusValue = ((double)Hot_Heat_Temperature / 10).ToString();;
+ realtimeStatusList.First(x => x.StatusCode == "Hot_OutAir_Temperature").StatusValue = ((double)Hot_OutAir_Temperature / 10).ToString();
+ realtimeStatusList.First(x => x.StatusCode == "Hot_OutPut_Rate").StatusValue = ((double)Hot_OutPut_Rate / 10).ToString();
+
+
+
}
catch (Exception ex)
{
diff --git a/SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml b/SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml
index 6e20dbc..ad19c1a 100644
--- a/SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml
+++ b/SlnMesnac.WPF/Page/Window/BagsAmountSetWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
mc:Ignorable="d"
- Title="数量修改" Height="350" Width="600" WindowStartupLocation="CenterScreen" Topmost="True" Background="Blue">
+ Title="数量修改" Height="350" Width="600" WindowStartupLocation="CenterScreen" Background="Blue">
diff --git a/SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml b/SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml
index 55903fa..fe3a6c8 100644
--- a/SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml
+++ b/SlnMesnac.WPF/Page/Window/InputDialogWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
mc:Ignorable="d"
- Title="重量设置" Height="300" Width="700" WindowStartupLocation="CenterScreen" Topmost="True" Background="#73B0F5">
+ Title="重量设置" Height="300" Width="700" WindowStartupLocation="CenterScreen" Background="#73B0F5">
diff --git a/SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml b/SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml
index 84c6322..2bfafb0 100644
--- a/SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml
+++ b/SlnMesnac.WPF/Page/Window/RecipeManageSetWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
mc:Ignorable="d"
- Title="配方设置" Height="550" Width="600" WindowStartupLocation="CenterScreen" Topmost="True" Background="#73B0F5">
+ Title="配方设置" Height="550" Width="600" WindowStartupLocation="CenterScreen" Background="#73B0F5">
diff --git a/SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml b/SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml
index 2a9d061..072a1a8 100644
--- a/SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml
+++ b/SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml
@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SlnMesnac.WPF.Page"
mc:Ignorable="d"
- Title="模式设置" Height="300" Width="700" WindowStartupLocation="CenterScreen" Topmost="True" Background="#73B0F5">
+ Title="模式设置" Height="300" Width="700" WindowStartupLocation="CenterScreen" Background="#73B0F5">