|
|
@ -158,6 +158,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
RefreshHot(machineStatusDtos, realtimeStatusList);
|
|
|
|
RefreshHot(machineStatusDtos, realtimeStatusList);
|
|
|
|
RefreshUnPack(machineStatusDtos, realtimeStatusList);
|
|
|
|
RefreshUnPack(machineStatusDtos, realtimeStatusList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设备缓存区重量监听及启停机控制,监听包装袋余量
|
|
|
|
RefreshWeight(realtimeStatusList);
|
|
|
|
RefreshWeight(realtimeStatusList);
|
|
|
|
|
|
|
|
|
|
|
|
//开关机时间采集
|
|
|
|
//开关机时间采集
|
|
|
@ -202,8 +203,9 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
// 判断缓存区重量是否达到设定最大值,如果达到并且设备开机中,停机
|
|
|
|
// 判断缓存区重量是否达到设定最大值,如果达到并且设备开机中,那么执行停机;如果达到最小阈值,并且设备处于运行状态,那么自动启动机器
|
|
|
|
double Cache_MaxWeight = recipeManageCache.MaxBufferWeight;
|
|
|
|
double Cache_MaxWeight = recipeManageCache.MaxBufferWeight;
|
|
|
|
|
|
|
|
double Cache_MinWeight = recipeManageCache.MinBufferWeight;
|
|
|
|
double Cache_Weight = recipeManageCache.BufferWeight;
|
|
|
|
double Cache_Weight = recipeManageCache.BufferWeight;
|
|
|
|
bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
bool unPackStatus = plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机系统运行状态"));
|
|
|
|
if (unPackStatus && (Cache_MaxWeight <= Cache_Weight))
|
|
|
|
if (unPackStatus && (Cache_MaxWeight <= Cache_Weight))
|
|
|
@ -218,6 +220,9 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
|
|
|
|
}else if(recipeManageCache.SystemStatus=="1" && (Cache_MinWeight >= Cache_Weight) && unPackStatus == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
StartAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
|
|
|
|
realtimeStatusList.First(x => x.StatusCode == "Bags_Amount").StatusValue = Bags_Amount;
|
|
|
@ -707,84 +712,88 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
var result = MessageBox.Show("是否确认启动?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
if (result == MessageBoxResult.Yes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
StartAll();
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
|
|
|
|
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允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("螺旋2MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//StartButton.IsEnabled = false;
|
|
|
|
/// <summary>
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
/// 一键启动所有机器
|
|
|
|
//StopUrgentButton.IsEnabled = true;
|
|
|
|
/// </summary>
|
|
|
|
Task.Run(() =>
|
|
|
|
private void StartAll()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
try
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false);
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
#region 按顺序依次启动设备
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plc.readBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("螺旋2MES允许远程")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBox.Show("螺旋2MES允许远程,未切换远程");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
StartButton.IsEnabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
//1.螺旋2
|
|
|
|
Task.Run(() =>
|
|
|
|
bool Spiral2Status = StartSpiral2();
|
|
|
|
{
|
|
|
|
if (!Spiral2Status) return;
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程停止"), false);
|
|
|
|
|
|
|
|
|
|
|
|
//2.磁选机
|
|
|
|
#region 按顺序依次启动设备
|
|
|
|
bool MagNetStatus = StartMagNet();
|
|
|
|
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3.螺旋1
|
|
|
|
//1.螺旋2
|
|
|
|
bool Spiral1Status = StartSpiral1();
|
|
|
|
bool Spiral2Status = StartSpiral2();
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
if (!Spiral2Status) return;
|
|
|
|
|
|
|
|
|
|
|
|
//4.烘干机:烘干螺旋、烘干风机、烘干燃烧
|
|
|
|
//2.磁选机
|
|
|
|
|
|
|
|
bool MagNetStatus = StartMagNet();
|
|
|
|
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
|
|
|
|
|
|
|
|
bool DryerStatus1 = StartDryerMagNet();
|
|
|
|
//3.螺旋1
|
|
|
|
if (!DryerStatus1) return;
|
|
|
|
bool Spiral1Status = StartSpiral1();
|
|
|
|
bool DryerStatus2 = StartDryerFan();
|
|
|
|
if (!MagNetStatus) return;
|
|
|
|
if (!DryerStatus2) return;
|
|
|
|
|
|
|
|
bool DryerStatus3 = StartDryerHot();
|
|
|
|
|
|
|
|
if (!DryerStatus3) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//5.拆包机
|
|
|
|
//4.烘干机:烘干螺旋、烘干风机、烘干燃烧
|
|
|
|
bool unpackStatus = StartUnPack();
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
if (unpackStatus)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBoxAndLog("一键启动所有机器成功!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
bool DryerStatus1 = StartDryerMagNet();
|
|
|
|
}
|
|
|
|
if (!DryerStatus1) return;
|
|
|
|
catch (Exception ex)
|
|
|
|
bool DryerStatus2 = StartDryerFan();
|
|
|
|
{
|
|
|
|
if (!DryerStatus2) return;
|
|
|
|
_logger.LogError($"一键启动异常:{ex.Message}");
|
|
|
|
bool DryerStatus3 = StartDryerHot();
|
|
|
|
}
|
|
|
|
if (!DryerStatus3) return;
|
|
|
|
finally
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
//5.拆包机
|
|
|
|
}
|
|
|
|
bool unpackStatus = StartUnPack();
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
if (unpackStatus)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
MessageBoxAndLog("一键启动所有机器成功!");
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "1";
|
|
|
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError($"一键启动异常:{ex.Message}");
|
|
|
|
|
|
|
|
StartButton.IsEnabled = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 一键停止
|
|
|
|
/// 一键停止
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -797,8 +806,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
String address = baseBusiness.GetPlcAddressByConfigKey("拆包机MES允许远程");
|
|
|
|
StopButton.IsEnabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
#region 依次按序停止
|
|
|
|
#region 依次按序停止
|
|
|
|
Task.Run(() =>
|
|
|
|
Task.Run(() =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -806,17 +814,18 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
if (result)
|
|
|
|
if (result)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
MessageBoxAndLog("一键停止所有机器成功!");
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "0";
|
|
|
|
|
|
|
|
StopButton.IsEnabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
//StopButton.IsEnabled = false;
|
|
|
|
|
|
|
|
//StopUrgentButton.IsEnabled = false;
|
|
|
|
|
|
|
|
//StartButton.IsEnabled = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogError($"一键停止:{ex.Message}");
|
|
|
|
_logger.LogError($"一键停止:{ex.Message}");
|
|
|
|
|
|
|
|
StopButton.IsEnabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -894,6 +903,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
//StopUrgentButton.Content = "复位";
|
|
|
|
//StopUrgentButton.Content = "复位";
|
|
|
|
|
|
|
|
|
|
|
|
SendPulseSignal("拆包机远程急停");
|
|
|
|
SendPulseSignal("拆包机远程急停");
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "0";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (StopUrgentButton.Content.ToString() == "复位")
|
|
|
|
else if (StopUrgentButton.Content.ToString() == "复位")
|
|
|
@ -901,6 +911,7 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
//StopButton.IsEnabled = true;
|
|
|
|
//StopUrgentButton.Content = "急停";
|
|
|
|
//StopUrgentButton.Content = "急停";
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
plc.writeBoolByAddress(baseBusiness.GetPlcAddressByConfigKey("拆包机远程急停"), false);
|
|
|
|
|
|
|
|
recipeManageCache.SystemStatus = "1";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
@ -1616,6 +1627,17 @@ namespace SlnMesnac.WPF.Page
|
|
|
|
UnpackStatus12.Text = UnPack_Spiral2_HZ.ToString("F2");
|
|
|
|
UnpackStatus12.Text = UnPack_Spiral2_HZ.ToString("F2");
|
|
|
|
UnpackStatus13.Text = UnPack_Waste_HZ.ToString("F2");
|
|
|
|
UnpackStatus13.Text = UnPack_Waste_HZ.ToString("F2");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (recipeManageCache.SystemStatus == "1")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SystemStatusTxt.Text = "系统运行中";
|
|
|
|
|
|
|
|
SystemStatusColor.Fill = Brushes.Green;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SystemStatusTxt.Text = "系统停机中";
|
|
|
|
|
|
|
|
SystemStatusColor.Fill = Brushes.Red;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|