|
|
|
@ -208,21 +208,21 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
double Cache_MinWeight = recipeManageCache.MinBufferWeight;
|
|
|
|
|
double Cache_Weight = recipeManageCache.BufferWeight;
|
|
|
|
|
bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
if (unPackStatus && (Cache_MaxWeight <= Cache_Weight))
|
|
|
|
|
if (recipeManageCache.SystemStatus == "1" && unPackStatus && (Cache_MaxWeight <= Cache_Weight))
|
|
|
|
|
{
|
|
|
|
|
// 停拆包机
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
|
StopMachine(0);
|
|
|
|
|
MessageBox.Show($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
|
|
|
|
|
_logger.LogError($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
|
|
|
|
|
_logger.LogWarning($"设备缓存区当前重量:{Cache_Weight},预设最大重量值:{Cache_MaxWeight},已经超重并且拆包机运行,系统下发停机命令!");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else if (recipeManageCache.SystemStatus == "1" && (Cache_MinWeight >= Cache_Weight) && unPackStatus == false)
|
|
|
|
|
{
|
|
|
|
|
bool unPackWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
|
}else if(recipeManageCache.SystemStatus=="1" && (Cache_MinWeight >= Cache_Weight) && unPackStatus == false)
|
|
|
|
|
if (!unPackWarn && plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == true)
|
|
|
|
|
{
|
|
|
|
|
StartAll();
|
|
|
|
|
StartUnPack();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
|
|
|
|
@ -430,7 +430,8 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
if (warnStatusEnum == WarnStatusEnum.拆包机堵料停螺旋)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}else if(warnStatusEnum == WarnStatusEnum.烘干机烘干温度超温 || warnStatusEnum == WarnStatusEnum.烘干机温控模块通讯超时)
|
|
|
|
|
}
|
|
|
|
|
else if (warnStatusEnum == WarnStatusEnum.烘干机烘干温度超温 || warnStatusEnum == WarnStatusEnum.烘干机温控模块通讯超时)
|
|
|
|
|
{ // 不停
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -441,13 +442,16 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
else if (warnStatusEnum == WarnStatusEnum.螺旋机螺旋1变频器报警)
|
|
|
|
|
{
|
|
|
|
|
return 4;
|
|
|
|
|
}else if (warnStatusEnum == WarnStatusEnum.螺旋机螺旋2变频器报警)
|
|
|
|
|
}
|
|
|
|
|
else if (warnStatusEnum == WarnStatusEnum.螺旋机螺旋2变频器报警)
|
|
|
|
|
{
|
|
|
|
|
return 6;
|
|
|
|
|
}else if (warnStatusEnum.ToString().Contains("磁选机"))
|
|
|
|
|
}
|
|
|
|
|
else if (warnStatusEnum.ToString().Contains("磁选机"))
|
|
|
|
|
{
|
|
|
|
|
return 5;
|
|
|
|
|
}else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
@ -727,22 +731,22 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("拆包机MES允许远程,未切换远程");
|
|
|
|
|
MessageBox.Show("拆包机MES屏蔽");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("磁选机MES允许远程,未切换远程");
|
|
|
|
|
MessageBox.Show("磁选机MES屏蔽");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋1MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("螺旋1MES允许远程,未切换远程");
|
|
|
|
|
MessageBox.Show("螺旋1MES屏蔽");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("螺旋2MES允许远程,未切换远程");
|
|
|
|
|
MessageBox.Show("螺旋2MES屏蔽");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
@ -784,7 +788,6 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
#endregion
|
|
|
|
|
if (unpackStatus)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "1";
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
@ -819,7 +822,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
StopButton.IsEnabled = false;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "0";
|
|
|
|
|
#region 依次按序停止
|
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
|
|
|
@ -827,7 +830,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
|
recipeManageCache.SystemStatus = "0";
|
|
|
|
|
|
|
|
|
|
App.Current.Dispatcher.BeginInvoke((Action)(() =>
|
|
|
|
|
{
|
|
|
|
|
StopButton.IsEnabled = true;
|
|
|
|
@ -865,15 +868,15 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程启动"), false);
|
|
|
|
|
SendPulseSignal("拆包机远程停止");
|
|
|
|
|
if (stopLevel < 1) return result;
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
|
|
|
|
|
bool unPackStatus1 = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
|
if (unPackStatus1)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("拆包机未成功停止,请先检查");
|
|
|
|
|
Console.WriteLine("拆包机未成功停止,请检查");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (stopLevel < 1) return true;
|
|
|
|
|
#region 烘干机
|
|
|
|
|
SendPulseSignal("烘干机燃烧停止");
|
|
|
|
|
if (stopLevel < 3) return result;
|
|
|
|
@ -907,35 +910,43 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void StopUrgentButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var result = MessageBox.Show("是否确认急停?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
private async void StopUrgentButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (StopUrgentButton.Content.ToString() == "急停")
|
|
|
|
|
{
|
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
|
//StopUrgentButton.Content = "复位";
|
|
|
|
|
var result = MessageBox.Show("是否确认急停?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
StopUrgentButton.Background = Brushes.Red;
|
|
|
|
|
StopUrgentButton.Content = "复位";
|
|
|
|
|
|
|
|
|
|
SendPulseSignal("拆包机远程急停");
|
|
|
|
|
recipeManageCache.SystemStatus = "0";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (StopUrgentButton.Content.ToString() == "复位")
|
|
|
|
|
{
|
|
|
|
|
var result = MessageBox.Show("是否确认复位?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Warning);
|
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
// StopButton.IsEnabled = true;
|
|
|
|
|
//StopUrgentButton.Content = "急停";
|
|
|
|
|
StopUrgentButton.Content = "急停";
|
|
|
|
|
StopUrgentButton.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E4B74C"));
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
|
recipeManageCache.SystemStatus = "1";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError($"拆包机远程急停:{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 拆包机
|
|
|
|
@ -948,9 +959,14 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if(StopUrgentButton.Content.ToString() == "复位")
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("请先点击复位按钮");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("拆包机MES允许远程,未切换远程");
|
|
|
|
|
MessageBox.Show("拆包机MES屏蔽");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool unPackWarn = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机堵料停螺旋"));
|
|
|
|
@ -1031,7 +1047,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
{
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("磁选机MES允许远程")) == false)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("磁选机MES允许远程,未切换远程");
|
|
|
|
|
MessageBox.Show("磁选机MES屏蔽");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//判断报警---
|
|
|
|
@ -1565,7 +1581,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
bool startFlag = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("烘干机反馈燃烧启动"));
|
|
|
|
|
if (!startFlag)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show($"拆包机启动失败:前提条件烘干机燃烧未成功启动,请检查后重新启动");
|
|
|
|
|
_logger.LogError($"拆包机启动失败:前提条件烘干机燃烧未成功启动,请检查后重新启动");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1580,7 +1596,6 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机螺旋2频率设定"), recipeManageCache.useRecipeManage.UnpackSpiral2);
|
|
|
|
|
// plc.writeFloatByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定"), int.Parse(baseBusiness.GetPlcAddressByConfigKey("拆包机废袋机频率设定值")));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(MachineSleep);
|
|
|
|
|
// return plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机运行状态系统"));
|
|
|
|
|
return true;
|
|
|
|
|