|
|
@ -126,75 +126,80 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <param name="e"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void StartButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
private void StartButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
try
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("拆包机MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("磁选机MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MessageBox.Show("螺旋1MES允许远程,未切换远程");
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
MessageBox.Show("拆包机MES允许远程,未切换远程");
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
MessageBox.Show("螺旋2MES允许远程,未切换远程");
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
|
|
|
|
return;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
MessageBox.Show("磁选机MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("螺旋1MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("螺旋2MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//StartButton.IsEnabled = false;
|
|
|
|
//StartButton.IsEnabled = false;
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
//StopUrgentButton.IsEnabled = true;
|
|
|
|
//StopUrgentButton.IsEnabled = true;
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false);
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false);
|
|
|
|
|
|
|
|
|
|
|
|
#region 按顺序依次启动设备
|
|
|
|
#region 按顺序依次启动设备
|
|
|
|
|
|
|
|
|
|
|
|
//1.螺旋2
|
|
|
|
//1.螺旋2
|
|
|
|
bool Spiral2Status = StartSpiral2();
|
|
|
|
bool Spiral2Status = StartSpiral2();
|
|
|
|
if (!Spiral2Status) return;
|
|
|
|
if (!Spiral2Status) return;
|
|
|
|
|
|
|
|
|
|
|
|
//2.磁选机
|
|
|
|
//2.磁选机
|
|
|
|
bool MagNetStatus = StartMagNet();
|
|
|
|
bool MagNetStatus = StartMagNet();
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
|
|
|
|
|
|
|
|
//3.螺旋1
|
|
|
|
//3.螺旋1
|
|
|
|
bool Spiral1Status = StartSpiral1();
|
|
|
|
bool Spiral1Status = StartSpiral1();
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
|
|
|
|
|
|
|
|
//4.烘干机:烘干螺旋、烘干风机、烘干燃烧
|
|
|
|
//4.烘干机:烘干螺旋、烘干风机、烘干燃烧
|
|
|
|
|
|
|
|
|
|
|
|
bool DryerStatus1 = StartDryerMagNet();
|
|
|
|
bool DryerStatus1 = StartDryerMagNet();
|
|
|
|
if (!DryerStatus1) return;
|
|
|
|
if (!DryerStatus1) return;
|
|
|
|
bool DryerStatus2 = StartDryerFan();
|
|
|
|
bool DryerStatus2 = StartDryerFan();
|
|
|
|
if (!DryerStatus2) return;
|
|
|
|
if (!DryerStatus2) return;
|
|
|
|
bool DryerStatus3 = StartDryerHot();
|
|
|
|
bool DryerStatus3 = StartDryerHot();
|
|
|
|
if (!DryerStatus3) return;
|
|
|
|
if (!DryerStatus3) return;
|
|
|
|
|
|
|
|
|
|
|
|
//5.拆包机
|
|
|
|
//5.拆包机
|
|
|
|
bool unpackStatus = StartUnPack();
|
|
|
|
bool unpackStatus = StartUnPack();
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
if (unpackStatus)
|
|
|
|
if (unpackStatus)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MessageBoxAndLog("一键启动所有机器成功!");
|
|
|
|
MessageBoxAndLog("一键启动所有机器成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"一键启动:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"一键启动:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -205,46 +210,50 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <param name="e"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void StopButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
private void StopButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
var result = MessageBox.Show("是否确认停止?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String address = baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程");
|
|
|
|
try
|
|
|
|
|
|
|
|
|
|
|
|
#region 依次按序停止
|
|
|
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
|
|
|
|
String address = baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程");
|
|
|
|
SendPulseSignal("拆包机远程停止");
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
#region 依次按序停止
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
Task.Run(() =>
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MessageBox.Show("一键停止失败,拆包机未停止,请先检查原因");
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
|
|
|
|
return;
|
|
|
|
SendPulseSignal("拆包机远程停止");
|
|
|
|
}
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("一键停止失败,拆包机未停止,请先检查原因");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 烘干机
|
|
|
|
#region 烘干机
|
|
|
|
SendPulseSignal("烘干机螺旋停止");
|
|
|
|
SendPulseSignal("烘干机螺旋停止");
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
SendPulseSignal("烘干机燃烧停止");
|
|
|
|
SendPulseSignal("烘干机燃烧停止");
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
SendPulseSignal("烘干机风机停止");
|
|
|
|
SendPulseSignal("烘干机风机停止");
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
SendPulseSignal("磁选机一键停止");
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
|
|
|
|
});
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1启动"), false);
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
//StopUrgentButton.IsEnabled = false;
|
|
|
|
SendPulseSignal("磁选机一键停止");
|
|
|
|
//StartButton.IsEnabled = true;
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
}
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2启动"), false);
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
_logger.LogError($"一键停止:{ex.Message}");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
|
|
|
|
//StopUrgentButton.IsEnabled = false;
|
|
|
|
|
|
|
|
//StartButton.IsEnabled = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"一键停止:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -255,27 +264,31 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
/// <param name="e"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void StopUrgentButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
private void StopUrgentButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
var result = MessageBox.Show("是否确认急停?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (StopUrgentButton.Content.ToString() == "急停")
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
if (StopUrgentButton.Content.ToString() == "急停")
|
|
|
|
//StopUrgentButton.Content = "复位";
|
|
|
|
{
|
|
|
|
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
|
|
|
|
//StopUrgentButton.Content = "复位";
|
|
|
|
|
|
|
|
|
|
|
|
SendPulseSignal("拆包机远程急停");
|
|
|
|
SendPulseSignal("拆包机远程急停");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (StopUrgentButton.Content.ToString() == "复位")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
|
|
|
|
//StopUrgentButton.Content = "急停";
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (StopUrgentButton.Content.ToString() == "复位")
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
_logger.LogError($"拆包机远程急停:{ex.Message}");
|
|
|
|
//StopUrgentButton.Content = "急停";
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"拆包机远程急停:{ex.Message}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region 拆包机
|
|
|
|
#region 拆包机
|
|
|
|