|
|
@ -23,6 +23,7 @@ using System.Windows.Controls;
|
|
|
|
using System.Windows.Data;
|
|
|
|
using System.Windows.Data;
|
|
|
|
using System.Windows.Documents;
|
|
|
|
using System.Windows.Documents;
|
|
|
|
using System.Windows.Input;
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
|
|
|
using System.Windows.Interop;
|
|
|
|
using System.Windows.Media;
|
|
|
|
using System.Windows.Media;
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
using System.Windows.Navigation;
|
|
|
@ -132,9 +133,9 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
DmsList = dmsRecordShutDownService.GetAllMachineFirst();
|
|
|
|
DmsList = dmsRecordShutDownService.GetAllMachineFirst();
|
|
|
|
WarningList = dmsRecordAlarmTimeService.GetMachineWarnList();
|
|
|
|
WarningList = dmsRecordAlarmTimeService.GetMachineWarnList();
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
@ -154,6 +155,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
machineStatusDtos.ForEach(x => OeeCollection(x));
|
|
|
|
machineStatusDtos.ForEach(x => OeeCollection(x));
|
|
|
|
//报警采集
|
|
|
|
//报警采集
|
|
|
|
machineStatusDtos.ForEach(x => MachineWarnCollection(x));
|
|
|
|
machineStatusDtos.ForEach(x => MachineWarnCollection(x));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -241,10 +243,10 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
if (dmsRecordAlarmTime != null)
|
|
|
|
if (dmsRecordAlarmTime != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sqlClient.AsTenant().BeginTran();
|
|
|
|
sqlClient.AsTenant().BeginTran();
|
|
|
|
DmsRecordAlarmInfo dmsRecordAlarmInfo = sqlClient.AsTenant().GetConnection("mes").Queryable<DmsRecordAlarmInfo>().First(x => x.AlarmRuleId == dmsRecordAlarmTime.AlarmRuleId && x.AlarmStatus=="0");
|
|
|
|
DmsRecordAlarmInfo dmsRecordAlarmInfo = sqlClient.AsTenant().GetConnection("mes").Queryable<DmsRecordAlarmInfo>().First(x => x.AlarmRuleId == dmsRecordAlarmTime.AlarmRuleId && x.AlarmStatus == "0");
|
|
|
|
if (dmsRecordAlarmInfo != null)
|
|
|
|
if (dmsRecordAlarmInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dmsRecordAlarmInfo.AlarmEndTime = DateTime.Now;
|
|
|
|
dmsRecordAlarmInfo.AlarmEndTime = DateTime.Now;
|
|
|
|
dmsRecordAlarmInfo.AlarmStatus = "2";
|
|
|
|
dmsRecordAlarmInfo.AlarmStatus = "2";
|
|
|
|
dmsRecordAlarmInfo.UpdateTime = DateTime.Now;
|
|
|
|
dmsRecordAlarmInfo.UpdateTime = DateTime.Now;
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmInfo).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmInfo).ExecuteCommand();
|
|
|
@ -294,13 +296,17 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Insertable(dmsRecordAlarmInfo).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Insertable(dmsRecordAlarmInfo).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().CommitTran();
|
|
|
|
sqlClient.AsTenant().CommitTran();
|
|
|
|
WarningList = dmsRecordAlarmTimeService.GetMachineWarnList();
|
|
|
|
WarningList = dmsRecordAlarmTimeService.GetMachineWarnList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 停止当前设备
|
|
|
|
|
|
|
|
StopAndMessageWarn(machineStatusDto.warnStatus);
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
sqlClient.AsTenant().BeginTran();
|
|
|
|
sqlClient.AsTenant().BeginTran();
|
|
|
|
dmsRecordAlarmTime.UpdateTime = DateTime.Now;
|
|
|
|
dmsRecordAlarmTime.UpdateTime = DateTime.Now;
|
|
|
|
dmsRecordAlarmTime.UpdateBy = "SlnMesnac";
|
|
|
|
dmsRecordAlarmTime.UpdateBy = "SlnMesnac";
|
|
|
|
DmsRecordAlarmInfo dmsRecordAlarmInfo = sqlClient.AsTenant().GetConnection("mes").Queryable<DmsRecordAlarmInfo>().First(x=>x.AlarmRuleId==warnRuleId);
|
|
|
|
DmsRecordAlarmInfo dmsRecordAlarmInfo = sqlClient.AsTenant().GetConnection("mes").Queryable<DmsRecordAlarmInfo>().First(x => x.AlarmRuleId == warnRuleId);
|
|
|
|
if (dmsRecordAlarmInfo != null)
|
|
|
|
if (dmsRecordAlarmInfo != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
dmsRecordAlarmInfo.UpdateTime = DateTime.Now;
|
|
|
|
dmsRecordAlarmInfo.UpdateTime = DateTime.Now;
|
|
|
@ -309,11 +315,12 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmTime).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmTime).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmInfo).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().GetConnection("mes").Updateable(dmsRecordAlarmInfo).ExecuteCommand();
|
|
|
|
sqlClient.AsTenant().CommitTran();
|
|
|
|
sqlClient.AsTenant().CommitTran();
|
|
|
|
|
|
|
|
WarningList = dmsRecordAlarmTimeService.GetMachineWarnList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -322,6 +329,73 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 停止该报警对应的机器及之前的机器,并弹框提醒
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
private void StopAndMessageWarn(WarnStatusEnum warnStatusEnum)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int status = getStopLevelByWarnStatus(warnStatusEnum);
|
|
|
|
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var alarmWindow = new SystemAlarmWindow();
|
|
|
|
|
|
|
|
var viewModel = new SystemAlarmViewModel();
|
|
|
|
|
|
|
|
viewModel.AlarmMsg = warnStatusEnum.ToString();
|
|
|
|
|
|
|
|
viewModel.AlarmConfirmed += (sender, isConfirmed) =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
alarmWindow.Close();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alarmWindow.DataContext = viewModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alarmWindow.ShowDialog();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
if(status >= 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
StopMachine(status);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 根据报警状态获取停止等级
|
|
|
|
|
|
|
|
/// -1不停止机器,只弹框报警
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="warnStatusEnum"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
private int getStopLevelByWarnStatus(WarnStatusEnum warnStatusEnum)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (warnStatusEnum == WarnStatusEnum.拆包机堵料停螺旋)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (warnStatusEnum.ToString().Contains("烘干机"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 3;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(warnStatusEnum == WarnStatusEnum.螺旋机螺旋1变频器报警)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 4;
|
|
|
|
|
|
|
|
}else if (warnStatusEnum == WarnStatusEnum.螺旋机螺旋2变频器报警)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
}else if (warnStatusEnum.ToString().Contains("磁选机"))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return 5;
|
|
|
|
|
|
|
|
}else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 监测缓存区重量,动态调整配方频率
|
|
|
|
#region 监测缓存区重量,动态调整配方频率
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -390,7 +464,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 判断缓存区重量是否满足配方要求
|
|
|
|
/// 判断缓存区重量是否满足配方要求
|
|
|
@ -671,30 +745,12 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
#region 依次按序停止
|
|
|
|
#region 依次按序停止
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
|
|
|
|
bool result =StopMachine(99);
|
|
|
|
SendPulseSignal("拆包机远程停止");
|
|
|
|
if (result)
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MessageBox.Show("一键停止失败,拆包机未停止,请先检查");
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 烘干机
|
|
|
|
|
|
|
|
SendPulseSignal("烘干机螺旋停止");
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("烘干机燃烧停止");
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("烘干机风机停止");
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("磁选机一键停止");
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
@ -708,6 +764,60 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 停止机器分级,不同级别停不同机器
|
|
|
|
|
|
|
|
/// 0:停止拆包机
|
|
|
|
|
|
|
|
/// 1:停止拆包机,烘干机螺旋
|
|
|
|
|
|
|
|
/// 2:停止拆包机,烘干机螺旋,`烘干机燃烧
|
|
|
|
|
|
|
|
/// 3:停止拆包机,烘干机螺旋,`烘干机燃烧,烘干机风机
|
|
|
|
|
|
|
|
/// 4:停止拆包机,烘干机螺旋,`烘干机燃烧,烘干机风机,螺旋1
|
|
|
|
|
|
|
|
/// 5:停止拆包机,烘干机螺旋,`烘干机燃烧,烘干机风机,螺旋1,磁选机
|
|
|
|
|
|
|
|
/// 6:停止拆包机,烘干机螺旋,`烘干机燃烧,烘干机风机,螺旋1,磁选机,螺旋2
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="stopLevel"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
private bool StopMachine(int stopLevel = 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
bool result = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
|
|
|
|
|
|
|
|
SendPulseSignal("拆包机远程停止");
|
|
|
|
|
|
|
|
if (stopLevel < 1) return result;
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("拆包机未成功停止,请先检查");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 烘干机
|
|
|
|
|
|
|
|
SendPulseSignal("烘干机螺旋停止");
|
|
|
|
|
|
|
|
if(stopLevel < 2) return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("烘干机燃烧停止");
|
|
|
|
|
|
|
|
if (stopLevel < 3) return result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("烘干机风机停止");
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stopLevel < 4) return result;
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
|
|
|
|
|
|
|
|
if(stopLevel < 5) return result;
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("磁选机一键停止");
|
|
|
|
|
|
|
|
if(stopLevel < 6) return result;
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
|
|
|
|
|
|
|
|
result = true;
|
|
|
|
|
|
|
|
// MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 急停
|
|
|
|
/// 急停
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -1407,7 +1517,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 拆包机参数监控
|
|
|
|
/// 拆包机参数监控
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private async void RefreshUnPack(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
private void RefreshUnPack(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1429,7 +1539,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
float unPackStatus13 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈"));
|
|
|
|
float unPackStatus13 = plc.readFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率反馈"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UnpackStatus0.Fill = unPackStatus0 ? Brushes.Green : Brushes.Red;
|
|
|
|
UnpackStatus0.Fill = unPackStatus0 ? Brushes.Green : Brushes.Red;
|
|
|
|
UnpackStatus1.Fill = unPackStatus1 ? Brushes.Green : Brushes.Red;
|
|
|
|
UnpackStatus1.Fill = unPackStatus1 ? Brushes.Green : Brushes.Red;
|
|
|
@ -1448,21 +1558,42 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
UnpackStatus12.Text = unPackStatus12.ToString("F2");
|
|
|
|
UnpackStatus12.Text = unPackStatus12.ToString("F2");
|
|
|
|
UnpackStatus13.Text = unPackStatus13.ToString("F2");
|
|
|
|
UnpackStatus13.Text = unPackStatus13.ToString("F2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
MachineStatusDto machineStatusDto = new MachineStatusDto();
|
|
|
|
MachineStatusDto machineStatusDto = new MachineStatusDto();
|
|
|
|
machineStatusDto.deviceId = 1016;
|
|
|
|
machineStatusDto.deviceId = 1016;
|
|
|
|
machineStatusDto.status = unPackStatus1;
|
|
|
|
machineStatusDto.status = unPackStatus1;
|
|
|
|
if (unPackStatus8)
|
|
|
|
if (unPackStatus8)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.拆包机堵料停螺旋;
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.拆包机堵料停螺旋;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.无报警;
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.无报警;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
//if (unPackStatus8)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// StopMachine(0);
|
|
|
|
|
|
|
|
// string msg = $"拆包机设备故障:{WarnStatusEnum.拆包机堵料停螺旋.ToString()},自动关闭拆包机";
|
|
|
|
|
|
|
|
// _logger.LogError(msg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// var alarmWindow = new SystemAlarmWindow();
|
|
|
|
|
|
|
|
// var viewModel = new SystemAlarmViewModel();
|
|
|
|
|
|
|
|
// viewModel.AlarmMsg = msg;
|
|
|
|
|
|
|
|
// viewModel.AlarmConfirmed += (sender, isConfirmed) =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// alarmWindow.Close();
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alarmWindow.DataContext = viewModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// alarmWindow.ShowDialog();
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1476,7 +1607,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 磁选机参数监控
|
|
|
|
/// 磁选机参数监控
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private async void RefreshMagNet(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
private void RefreshMagNet(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1485,7 +1616,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
bool signal2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程"));
|
|
|
|
bool signal2 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程"));
|
|
|
|
bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机设备故障反馈"));
|
|
|
|
bool signal3 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机设备故障反馈"));
|
|
|
|
|
|
|
|
|
|
|
|
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MagNetStatus1.Fill = signal0 ? Brushes.Green : Brushes.Red;
|
|
|
|
MagNetStatus1.Fill = signal0 ? Brushes.Green : Brushes.Red;
|
|
|
|
MagNetStatus2.Fill = signal1 ? Brushes.Green : Brushes.Red;
|
|
|
|
MagNetStatus2.Fill = signal1 ? Brushes.Green : Brushes.Red;
|
|
|
@ -1507,8 +1638,15 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
}
|
|
|
|
}
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (signal3)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// Task.Run(() =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// StopMachine(5);
|
|
|
|
|
|
|
|
// _logger.LogError("磁选机设备故障,自动关闭磁选机及以前的设备");
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
@ -1521,7 +1659,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 螺旋机参数监控
|
|
|
|
/// 螺旋机参数监控
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private async void RefreshSpiral(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
private void RefreshSpiral(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1540,7 +1678,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
int speed1Set = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
|
|
|
|
int speed1Set = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋1速度设定值"));
|
|
|
|
int speed2Set = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值"));
|
|
|
|
int speed2Set = int.Parse(baseBusiness.GetPlcAddressByConfigKey("螺旋2速度设定值"));
|
|
|
|
|
|
|
|
|
|
|
|
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SpiralSignal0.Fill = signal0 ? Brushes.Green : Brushes.Red;
|
|
|
|
SpiralSignal0.Fill = signal0 ? Brushes.Green : Brushes.Red;
|
|
|
|
SpiralSignal1.Fill = signal1 ? Brushes.Green : Brushes.Red;
|
|
|
|
SpiralSignal1.Fill = signal1 ? Brushes.Green : Brushes.Red;
|
|
|
@ -1573,6 +1711,22 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (signal5)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// Task.Run(() =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// StopMachine(6);
|
|
|
|
|
|
|
|
// _logger.LogError("螺旋2设备故障,自动关闭螺旋2及以前的设备");
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//}else if (signal4)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// Task.Run(() =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// StopMachine(4);
|
|
|
|
|
|
|
|
// _logger.LogError("螺旋1设备故障,自动关闭螺旋1及以前的设备");
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1587,7 +1741,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 烘干机参数监控
|
|
|
|
/// 烘干机参数监控
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private async void RefreshHot(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
private void RefreshHot(List<MachineStatusDto> machineStatusDtos)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1612,7 +1766,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
int signal7_2 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机报警"));
|
|
|
|
int signal7_2 = plc.readByteByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机报警"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
HotSignal1_1.Fill = signal1_1 == 1 ? Brushes.Green : Brushes.Red;
|
|
|
|
HotSignal1_1.Fill = signal1_1 == 1 ? Brushes.Green : Brushes.Red;
|
|
|
|
HotSignal1_1_Value.Text = ChangeHotStatus(signal1_1);
|
|
|
|
HotSignal1_1_Value.Text = ChangeHotStatus(signal1_1);
|
|
|
@ -1638,34 +1792,44 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
HotSignal7_2.Fill = signal7_2 == 0 ? Brushes.Green : Brushes.Red;
|
|
|
|
HotSignal7_2.Fill = signal7_2 == 0 ? Brushes.Green : Brushes.Red;
|
|
|
|
HotSignal7_2_Value.Text = ChangeHotWarn(signal7_2);
|
|
|
|
HotSignal7_2_Value.Text = ChangeHotWarn(signal7_2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
MachineStatusDto machineStatusDto = new MachineStatusDto();
|
|
|
|
|
|
|
|
machineStatusDto.deviceId = 1019;
|
|
|
|
|
|
|
|
machineStatusDto.status = signal1_2 && signal2_2;
|
|
|
|
|
|
|
|
if (signal7_1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.烘干机堵料报警;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (signal7_2 > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (signal7_2)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 1: machineStatusDto.warnStatus = WarnStatusEnum.烘干机风机故障; break;
|
|
|
|
|
|
|
|
case 2: machineStatusDto.warnStatus = WarnStatusEnum.烘干机燃烧机故障; break;
|
|
|
|
MachineStatusDto machineStatusDto = new MachineStatusDto();
|
|
|
|
case 4: machineStatusDto.warnStatus = WarnStatusEnum.烘干机传动故障; break;
|
|
|
|
machineStatusDto.deviceId = 1019;
|
|
|
|
case 16: machineStatusDto.warnStatus = WarnStatusEnum.烘干机烘干温度超温; break;
|
|
|
|
machineStatusDto.status = signal1_2 && signal2_2;
|
|
|
|
case 32: machineStatusDto.warnStatus = WarnStatusEnum.烘干机温控模块通讯超时; break;
|
|
|
|
if (signal7_1)
|
|
|
|
default: break;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.烘干机堵料报警;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else if (signal7_2 > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (signal7_2)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.无报警;
|
|
|
|
|
|
|
|
|
|
|
|
case 1: machineStatusDto.warnStatus = WarnStatusEnum.烘干机风机故障; break;
|
|
|
|
|
|
|
|
case 2: machineStatusDto.warnStatus = WarnStatusEnum.烘干机燃烧机故障; break;
|
|
|
|
|
|
|
|
case 4: machineStatusDto.warnStatus = WarnStatusEnum.烘干机传动故障; break;
|
|
|
|
|
|
|
|
case 16: machineStatusDto.warnStatus = WarnStatusEnum.烘干机烘干温度超温; break;
|
|
|
|
|
|
|
|
case 32: machineStatusDto.warnStatus = WarnStatusEnum.烘干机温控模块通讯超时; break;
|
|
|
|
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
machineStatusDto.warnStatus = WarnStatusEnum.无报警;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
machineStatusDtos.Add(machineStatusDto);
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
//if (signal7_1 || signal7_2 > 0 && signal7_2 <= 4)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// Task.Run(() =>
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// StopMachine(3);
|
|
|
|
|
|
|
|
// _logger.LogError($"烘干机设备故障:{machineStatusDto.warnStatus.ToString()},自动关闭烘干机及以前的设备");
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|