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