diff --git a/SlnMesnac.Config/DebugConfig.cs b/SlnMesnac.Config/DebugConfig.cs
index 613e006..6f3bdfd 100644
--- a/SlnMesnac.Config/DebugConfig.cs
+++ b/SlnMesnac.Config/DebugConfig.cs
@@ -26,6 +26,16 @@ namespace SlnMesnac.Config
}
+ ///
+ //系统运行状态;点击一键启动按钮和急停复位,改1,点击一键停止和急停改0;1的状态下根据缓存区自动启动设备
+ ///
+ public string SystemStatus
+ {
+ get { return iniHelper.IniReadValue("system", "SystemStatus"); }
+ set { iniHelper.IniWriteValue("system", "SystemStatus", value); }
+ }
+
+
///
///缓存区重量
///
diff --git a/SlnMesnac.WPF/Model/RecipeManageCache.cs b/SlnMesnac.WPF/Model/RecipeManageCache.cs
index 874c428..338b272 100644
--- a/SlnMesnac.WPF/Model/RecipeManageCache.cs
+++ b/SlnMesnac.WPF/Model/RecipeManageCache.cs
@@ -81,6 +81,15 @@ namespace SlnMesnac.WPF.Model
}
+ ///
+ /// 系统运行状态;点击一键启动按钮和急停复位,改1,点击一键停止和急停改0;1的状态下根据缓存区自动启动设备
+ ///
+ public string SystemStatus
+ {
+ get { return config.SystemStatus; }
+ set { config.SystemStatus = value; }
+ }
+
///
/// 当前缓存区监测重量
///
diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml b/SlnMesnac.WPF/Page/DevMonitorPage.xaml
index 0e016c7..3f5fd37 100644
--- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml
+++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml
@@ -18,17 +18,21 @@
-
-
-
-
-
+
+
+
-
+
+
+
+
+
+
+
-
+
diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
index 5cdb82b..7729012 100644
--- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
+++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs
@@ -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);
+ ///
+ /// 一键启动所有机器
+ ///
+ 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;
+ }
}
-
///
/// 一键停止
///
@@ -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;
}
}
}
@@ -892,8 +901,9 @@ namespace SlnMesnac.WPF.Page
{
//StopButton.IsEnabled = false;
//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)
@@ -1601,7 +1612,7 @@ namespace SlnMesnac.WPF.Page
{
UnpackStatus0.Fill = UnPack_MesUse_Flag ? Brushes.Green : Brushes.Red;
UnpackStatus1.Fill = UnPack_Status ? Brushes.Green : Brushes.Red;
-
+
UnpackStatus2.Text = unPackStatus2.ToString();
UnpackStatus3.Text = unPackStatus3.ToString();
UnpackStatus4.Text = unPackStatus4.ToString();
@@ -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;
+ }
+
}));