@@ -21,7 +21,7 @@ | |||
</Window.DataContext> | |||
<Window.Resources> | |||
<!--#region 静态资源--> | |||
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" /> | |||
@@ -365,6 +365,70 @@ | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<Style x:Key="StatusBtnStyle告警" TargetType="ToggleButton"> | |||
<Style.Setters> | |||
<Setter Property="Width" Value="30" /> | |||
<Setter Property="Height" Value="19" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="IsChecked" Value="{Binding IsCheck, Mode=TwoWay}" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Grid Cursor="Hand"> | |||
<Border | |||
x:Name="bd1" | |||
Width="25" | |||
Height="13" | |||
Margin="0,-10,-5,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Panel.ZIndex="100" | |||
Background="#2600CAFF" | |||
CornerRadius="3" | |||
Cursor="Hand" | |||
Visibility="Collapsed"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
FontSize="8" | |||
Foreground="#FF00E6F7" | |||
Text="{Binding ListNum, Mode=TwoWay}" /> | |||
<!-- --> | |||
</Border> | |||
<Image | |||
x:Name="image1" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Panel.ZIndex="0" | |||
RenderOptions.BitmapScalingMode="HighQuality" | |||
SnapsToDevicePixels="True" | |||
Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" | |||
UseLayoutRounding="True" /> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" /> | |||
<Setter TargetName="bd1" Property="Visibility" Value="Visible" /> | |||
</Trigger> | |||
<Trigger Property="IsChecked" Value="False"> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" /> | |||
<Setter TargetName="bd1" Property="Visibility" Value="Collapsed" /> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
<Condition Binding="{Binding IsCheck}" Value="true" /> | |||
<Condition Binding="{Binding IsAlarm}" Value="true" /> | |||
</MultiDataTrigger.Conditions> | |||
<MultiDataTrigger.Setters> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" /> | |||
<Setter TargetName="bd1" Property="Visibility" Value="Visible" /> | |||
</MultiDataTrigger.Setters> | |||
</MultiDataTrigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
</Style.Setters> | |||
</Style> | |||
</Window.Resources> | |||
<Grid Background="#103153"> | |||
@@ -516,6 +580,13 @@ | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"> | |||
<ToggleButton | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Cursor="Hand" | |||
IsChecked="{Binding IsAlarm}" | |||
Style="{DynamicResource StatusBtnStyle告警}" | |||
ToolTip="心跳检测报警" Margin="0,0,8,0"/> | |||
<CheckBox | |||
Margin="5,0,8,0" | |||
Content="开机启动" | |||
@@ -3,6 +3,7 @@ using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Security.Cryptography.Xml; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
@@ -94,6 +95,12 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
PermissionChange(); | |||
}), "PermissionChange"); | |||
ActionManage.GetInstance.Register(new Action<object>((c) => | |||
{ | |||
if(c!=null) | |||
IsAlarm = Convert.ToBoolean(c); | |||
}),"HeartBeatCheck"); | |||
} | |||
private void PermissionChange() | |||
@@ -153,6 +160,15 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
OnPropertyChanged(); | |||
} | |||
} | |||
private bool _isAlarm=true; | |||
/// <summary> | |||
/// 心跳检测报警 | |||
/// </summary> | |||
public bool IsAlarm | |||
{ | |||
get { return _isAlarm; } | |||
set { _isAlarm = value;OnPropertyChanged(); } | |||
} | |||
/// <summary> | |||
/// 开机自启 | |||
/// </summary> | |||
@@ -140,7 +140,21 @@ namespace BPASmartClient.Modbus | |||
} | |||
} | |||
} | |||
else if (address.ToUpper().Contains("I") && address.Length >= 2) | |||
{ | |||
var res = address.Substring(1).Split('.'); | |||
if (res != null && res.Length == 2) | |||
{ | |||
if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress)) | |||
{ | |||
if (ExitAddress >= 0 && ExitAddress <= 7) | |||
{ | |||
return (firstAddress * 8) + ExitAddress; | |||
} | |||
} | |||
} | |||
} | |||
else if (address.ToUpper().Contains("GI") && address.Length >= 3) | |||
{ | |||
var res = address.Remove(0, 2); | |||
@@ -161,7 +161,7 @@ namespace BPASmartClient.MorkF | |||
/// <summary> | |||
/// 是否为本地炒菜模式,默认为联网的 | |||
/// </summary> | |||
private bool isLocalFryingMode { get; set; } = false; | |||
private bool isLocalFryingMode { get; set; } = true; | |||
/// <summary> | |||
/// 入口 | |||
@@ -201,7 +201,7 @@ namespace BPASmartClient.MorkF | |||
MaterialCoordinate.GetInstance().frying2 = materialCoordinate.frying2; | |||
MaterialCoordinate.GetInstance().materialHeight = materialCoordinate.materialHeight; | |||
MaterialCoordinate.GetInstance().MaterialOneX = materialCoordinate.MaterialOneX; | |||
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX; | |||
MaterialCoordinate.GetInstance().MaterialTwoX = materialCoordinate.MaterialTwoX; | |||
MaterialCoordinate.GetInstance().MaterialThreeX = materialCoordinate.MaterialThreeX; | |||
} | |||
////菜品库编号与坐标系对象存储 | |||
@@ -371,6 +371,17 @@ namespace BPASmartClient.MorkF | |||
} | |||
}), 2); | |||
//抓手初始化完成 | |||
GetStatus("I0.1", new Action<object>((objects) => | |||
{ | |||
if (objects is bool[] bools && bools.Length > 2) | |||
{ | |||
ml_morkf.PawPositon_1 = bools[0]; | |||
ml_morkf.PawPositon_2 = bools[1]; | |||
ml_morkf.PawPositon_3 = bools[2]; | |||
} | |||
}), 2); | |||
} | |||
public override void Stop() | |||
@@ -1041,8 +1052,9 @@ namespace BPASmartClient.MorkF | |||
return false; | |||
} | |||
//MessageLog.GetInstance.Show("爪子去到2号位"); | |||
MaterailLibrary_Write("M1.1", true); | |||
//MessageLog.GetInstance.Show("爪子去到2号位"); | |||
Thread.Sleep(500); | |||
@@ -1055,7 +1067,7 @@ namespace BPASmartClient.MorkF | |||
return false; | |||
} | |||
} | |||
Thread.Sleep(300); | |||
//MessageLog.GetInstance.Show("爪子去到2号位完成"); | |||
@@ -1084,7 +1096,11 @@ namespace BPASmartClient.MorkF | |||
return false; | |||
} | |||
} | |||
if (!ml_morkf.PawPositon_3) | |||
{ | |||
MaterailLibrary_Write("M1.2", true); | |||
Thread.Sleep(3000); | |||
} | |||
Thread.Sleep(300); | |||
//MessageLog.GetInstance.Show("爪子去到3号位完成"); | |||
@@ -1358,8 +1374,9 @@ namespace BPASmartClient.MorkF | |||
Thread.Sleep(1000); | |||
//获取传感器的距离,转换成坐标系的点 | |||
int laserHigh = ml_morkf.LaserDistance; | |||
//int laserHigh = ml_morkf.LaserDistance; | |||
int laserHigh = 400; | |||
//秦工要求读取后置0 | |||
WriteDistance(0); | |||
@@ -1379,7 +1396,7 @@ namespace BPASmartClient.MorkF | |||
} | |||
//设置到传感器感应的距离处 | |||
if (!SetArmPosition(x - moveX, y)) | |||
if (!SetArmPosition(x, y)) | |||
{ | |||
return false; | |||
} | |||
@@ -1436,6 +1453,7 @@ namespace BPASmartClient.MorkF | |||
MessageLog.GetInstance.ShowEx("错误:未设置当前菜品库出菜位置"); | |||
return false; | |||
} | |||
//爪子去2号位放菜 | |||
if (!PawToPoint2()) | |||
@@ -1444,12 +1462,12 @@ namespace BPASmartClient.MorkF | |||
} | |||
WriteSpeed(50000); | |||
ThreadManage.GetInstance().Start(new Action(() => | |||
{ | |||
//收缩爪子 | |||
PawShrink(); | |||
}), "GetMaterialPawShrink"); | |||
//ThreadManage.GetInstance().Start(new Action(() => | |||
//{ | |||
// //收缩爪子 | |||
// PawShrink(); | |||
//}), "GetMaterialPawShrink"); | |||
PawShrink(); | |||
//判断炒锅是否可以放盒 | |||
for (int i = 0; materialSleepCount > i && !morkFs[fryIndex].FryPot1_HOBTPut; i++) | |||
@@ -1465,7 +1483,7 @@ namespace BPASmartClient.MorkF | |||
//关闭启磁吸 | |||
MagnetOff(fryNum); | |||
Thread.Sleep(200); | |||
//Thread.Sleep(2000); | |||
//根据炒锅不同设置不同的出菜处 | |||
if (fryNum % 2 == 0) | |||
@@ -1494,7 +1512,7 @@ namespace BPASmartClient.MorkF | |||
//开启磁吸 | |||
MagnetOn(fryNum); | |||
Thread.Sleep(200); | |||
Thread.Sleep(500); | |||
//设置到炒锅1出菜处 | |||
if (!SetArmPosition(x, y)) | |||
@@ -1962,7 +1980,7 @@ namespace BPASmartClient.MorkF | |||
//搅拌设置为1档 | |||
SetStir(new List<int> { 1 }, i); | |||
//火力设置为2档 | |||
SetFire(new List<int> { 1 }, num); | |||
SetFire(new List<int> { 3 }, num); | |||
} | |||
Thread.Sleep(materialSleepTime); | |||
if (i >= materialSleepCount * 2 - 1) | |||
@@ -109,6 +109,10 @@ namespace BPASmartClient.MorkF | |||
_PawArrivePortThree = value; | |||
} | |||
} | |||
public bool PawPositon_1 { get; set; } | |||
public bool PawPositon_2 { get; set; } | |||
public bool PawPositon_3 { get; set; } | |||
#endregion | |||
#region | |||
@@ -18,7 +18,7 @@ namespace BPASmartClient.ScreenLib | |||
//启动Redis数据读取 | |||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; | |||
FSystemHelper.GetInstance.CreateDesktopShortcut(); | |||
// FSystemHelper.GetInstance.AutoStart(true); | |||
//FSystemHelper.GetInstance.AutoStart(true); | |||
WindowLargeScreen windowLarge = new WindowLargeScreen(); | |||
#region 设置显示页面与标题 | |||
string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}"; | |||
@@ -5,6 +5,7 @@ using IWshRuntimeLibrary; | |||
using Microsoft.Web.WebView2.Wpf; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Diagnostics; | |||
@@ -168,12 +169,35 @@ namespace BPASmartClient.ScreenLib | |||
/// </summary> | |||
public void StartServer() | |||
{ | |||
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString(); | |||
string processName = ""; | |||
try | |||
{ | |||
string path = System.Configuration.ConfigurationManager.AppSettings["StartServer"].ToString(); | |||
if (System.IO.File.Exists(path)) | |||
{ | |||
Process.Start(path); | |||
processName = System.IO.Path.GetFileNameWithoutExtension(path); | |||
if (!IsProcess(processName)) | |||
{ | |||
Process.Start(path); | |||
} | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
try | |||
{ | |||
if (!IsProcess(processName)) | |||
{ | |||
Process.Start(path); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}"); | |||
} | |||
Thread.Sleep(3000); | |||
}), $"{Name},进程监控"); | |||
} | |||
} | |||
catch (Exception ex) | |||
@@ -181,6 +205,46 @@ namespace BPASmartClient.ScreenLib | |||
} | |||
} | |||
public bool IsProcess(string procName) | |||
{ | |||
bool isProcess = false; | |||
Process[] ps = Process.GetProcessesByName(procName); | |||
if (ps.Length > 0) | |||
{ | |||
isProcess=true; | |||
} | |||
return isProcess; | |||
} | |||
/// <summary> | |||
/// 关闭进程 | |||
/// </summary> | |||
/// <param name="procName"></param> | |||
/// <returns></returns> | |||
public bool CloseProc(string procName) | |||
{ | |||
bool result = false; | |||
ArrayList procList = new ArrayList(); | |||
string tempName; | |||
int begpos; | |||
int endpos; | |||
foreach (Process thisProc in Process.GetProcesses()) | |||
{ | |||
tempName = thisProc.ToString(); | |||
begpos = tempName.IndexOf("(") + 1; | |||
endpos = tempName.IndexOf(")"); | |||
tempName = tempName[begpos..endpos]; | |||
procList.Add(tempName); | |||
if (tempName == procName) | |||
{ | |||
if (!thisProc.CloseMainWindow()) | |||
// 当发送关闭窗口命令无效时强行结束进程 | |||
thisProc.Kill(); | |||
result = true; | |||
} | |||
} | |||
return result; | |||
} | |||
/// <summary> | |||
/// 停止服务 | |||
/// </summary> | |||
@@ -9,7 +9,7 @@ | |||
<add key="SaasRoute" value="https://witt.black-pa.com/kitchen/api/StoreHelper/GeBasisGateList?StoreId=0c32b2e2-0dc9-4941-b73d-3dc91f7268ab"/> | |||
<!--显示窗体:0 广告 1 地球--> | |||
<add key="ShowForm" value="1"/> | |||
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\收银系统\Pos\bin\Debug\net6.0-windows\黑菠萝收银系统.exe"/> | |||
<add key="StartServer" value="D:\fengyoufu\代码\Code\C#项目\新上位机代码\BPASmart.MenuLoad\bin\Debug\net6.0-windows\可视化配置工具.exe"/> | |||
<!--<add key="一号屏" value="0"/> | |||
<add key="二号屏" value="1"/> | |||
<add key="三号屏" value="2"/>--> | |||
@@ -453,12 +453,57 @@ namespace FryPot_DosingSystem.Control | |||
HubHelper.GetInstance.Upstreamrequest = new Action<object>(AgvFeedBackUpReportDataAnalysis); | |||
//ResetProgram(); | |||
ReadPlcData(); | |||
HeatBeatToPlc(); | |||
SaveFryPotData(); | |||
MainTask(); | |||
CommandRegist(); | |||
} | |||
private void HeatBeatToPlc() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => { | |||
DeviceOperate.GetInstance.WritePlcData("D0001", 1); | |||
Thread.Sleep(500); | |||
DeviceOperate.GetInstance.WritePlcData("D0001", 0); | |||
Thread.Sleep(500); | |||
}), "上位机心跳下发滚筒线", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
DeviceOperate.GetInstance.WritePotOnePlcData("D0001", 1); | |||
Thread.Sleep(500); | |||
DeviceOperate.GetInstance.WritePotOnePlcData("D0001", 0); | |||
Thread.Sleep(500); | |||
}), "上位机心跳下发1号炒锅", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
DeviceOperate.GetInstance.WritePotTwoPlcData("D0001", 1); | |||
Thread.Sleep(500); | |||
DeviceOperate.GetInstance.WritePotTwoPlcData("D0001", 0); | |||
Thread.Sleep(500); | |||
}), "上位机心跳下发2号炒锅", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
DeviceOperate.GetInstance.WritePotThreePlcData("D0001", 1); | |||
Thread.Sleep(500); | |||
DeviceOperate.GetInstance.WritePotThreePlcData("D0001", 0); | |||
Thread.Sleep(500); | |||
}), "上位机心跳下发3号炒锅", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
DeviceOperate.GetInstance.WritePotFourPlcData("D0001", 1); | |||
Thread.Sleep(500); | |||
DeviceOperate.GetInstance.WritePotFourPlcData("D0001", 0); | |||
Thread.Sleep(500); | |||
}), "上位机心跳下发4号炒锅", true); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
DeviceOperate.GetInstance.WritePotFivePlcData("D0001", 1); | |||
Thread.Sleep(500); | |||
DeviceOperate.GetInstance.WritePotFivePlcData("D0001", 0); | |||
Thread.Sleep(500); | |||
}), "上位机心跳下发5号炒锅", true); | |||
} | |||
/// <summary> | |||
/// 文件数据定期清理 | |||
@@ -1576,6 +1621,261 @@ namespace FryPot_DosingSystem.Control | |||
/// </summary> | |||
public void ReadPlcData() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetAddressData("D0000", new Action<ushort[]>((data) => | |||
{ | |||
try | |||
{ | |||
if (data.Count() > 0) | |||
{ | |||
//globalVar.rollerLineOne.StationOne = data[0]; | |||
if (globalVar.LineHeartBeat!= data[0]) | |||
{ | |||
if (globalVar.LBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", false); | |||
MessageNotify.GetInstance.ShowRunLog("滚筒线心跳恢复"); | |||
} | |||
globalVar.CanPlaceOrder = true;//允许下单 | |||
globalVar.LBeatStopTimes = 0; | |||
globalVar.LineHeartBeat = data[0]; | |||
} | |||
else | |||
{ | |||
globalVar.LBeatStopTimes++; | |||
if (globalVar.LBeatStopTimes >= 10) | |||
{ | |||
globalVar.CanPlaceOrder = false;//不允许下单 | |||
ActionManage.GetInstance.Send("HeartBeatCheck", true); | |||
if(globalVar.LBeatStopTimes>=10&& globalVar.LBeatStopTimes<13) | |||
MessageNotify.GetInstance.ShowRunLog("滚筒线心跳心跳异常"); | |||
} | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
})); | |||
Thread.Sleep(500); | |||
}), "滚筒线心跳检测"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetFryOneData("D0000", new Action<ushort[]>((data) => | |||
{ | |||
try | |||
{ | |||
if (data.Count() > 0) | |||
{ | |||
//globalVar.rollerLineOne.StationOne = data[0]; | |||
if (globalVar.PotOneHeartBeat != data[0]) | |||
{ | |||
if (globalVar.POneBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", false); | |||
MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳恢复"); | |||
} | |||
globalVar.POneBeatStopTimes = 0; | |||
globalVar.PotOneHeartBeat = data[0]; | |||
} | |||
else | |||
{ | |||
globalVar.POneBeatStopTimes++; | |||
if (globalVar.POneBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", true); | |||
if (globalVar.POneBeatStopTimes >= 10 && globalVar.POneBeatStopTimes < 13) | |||
MessageNotify.GetInstance.ShowRunLog("1号炒锅心跳异常"); | |||
} | |||
//不允许下单 | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
})); | |||
Thread.Sleep(500); | |||
}), "炒锅1心跳检测"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetFryTwoData("D0000", new Action<ushort[]>((data) => | |||
{ | |||
try | |||
{ | |||
if (data.Count() > 0) | |||
{ | |||
//globalVar.rollerLineOne.StationOne = data[0]; | |||
if (globalVar.PotTwoHeartBeat != data[0]) | |||
{ | |||
if (globalVar.PTwoBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", false); | |||
MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳恢复"); | |||
} | |||
globalVar.PTwoBeatStopTimes = 0; | |||
globalVar.PotTwoHeartBeat = data[0]; | |||
} | |||
else | |||
{ | |||
globalVar.PTwoBeatStopTimes++; | |||
if (globalVar.PTwoBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", true); | |||
if (globalVar.PTwoBeatStopTimes >= 10 && globalVar.PTwoBeatStopTimes < 13) | |||
MessageNotify.GetInstance.ShowRunLog("2号炒锅心跳异常"); | |||
} | |||
//不允许下单 | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
})); | |||
Thread.Sleep(500); | |||
}), "炒锅2心跳检测"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetFryThreeData("D0000", new Action<ushort[]>((data) => | |||
{ | |||
try | |||
{ | |||
if (data.Count() > 0) | |||
{ | |||
//globalVar.rollerLineOne.StationOne = data[0]; | |||
if (globalVar.PotThreeHeartBeat != data[0]) | |||
{ | |||
if (globalVar.PThreeBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", false); | |||
MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳恢复"); | |||
} | |||
globalVar.PThreeBeatStopTimes = 0; | |||
globalVar.PotThreeHeartBeat = data[0]; | |||
} | |||
else | |||
{ | |||
globalVar.PThreeBeatStopTimes++; | |||
if (globalVar.PThreeBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", true); | |||
if (globalVar.PThreeBeatStopTimes >= 10 && globalVar.PThreeBeatStopTimes < 13) | |||
MessageNotify.GetInstance.ShowRunLog("3号炒锅心跳异常"); | |||
} | |||
//不允许下单 | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
})); | |||
Thread.Sleep(500); | |||
}), "炒锅3心跳检测"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetFryFourData("D0000", new Action<ushort[]>((data) => | |||
{ | |||
try | |||
{ | |||
if (data.Count() > 0) | |||
{ | |||
//globalVar.rollerLineOne.StationOne = data[0]; | |||
if (globalVar.PotFourHeartBeat != data[0]) | |||
{ | |||
if (globalVar.PFourBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", false); | |||
MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳恢复"); | |||
} | |||
globalVar.PFourBeatStopTimes = 0; | |||
globalVar.PotFourHeartBeat = data[0]; | |||
} | |||
else | |||
{ | |||
globalVar.PFourBeatStopTimes++; | |||
if (globalVar.PFourBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", true); | |||
if (globalVar.PFourBeatStopTimes >= 10 && globalVar.PFourBeatStopTimes < 13) | |||
MessageNotify.GetInstance.ShowRunLog("4号炒锅心跳异常"); | |||
} | |||
//不允许下单 | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
})); | |||
Thread.Sleep(500); | |||
}), "炒锅4心跳检测"); | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetFryFiveData("D0000", new Action<ushort[]>((data) => | |||
{ | |||
try | |||
{ | |||
if (data.Count() > 0) | |||
{ | |||
//globalVar.rollerLineOne.StationOne = data[0]; | |||
if (globalVar.PotFiveHeartBeat != data[0]) | |||
{ | |||
if (globalVar.PFiveBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", false); | |||
MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳恢复"); | |||
} | |||
globalVar.PFiveBeatStopTimes = 0; | |||
globalVar.PotFiveHeartBeat = data[0]; | |||
} | |||
else | |||
{ | |||
globalVar.PFiveBeatStopTimes++; | |||
if (globalVar.PFiveBeatStopTimes >= 10) | |||
{ | |||
ActionManage.GetInstance.Send("HeartBeatCheck", true); | |||
if (globalVar.PFiveBeatStopTimes >= 10 && globalVar.PFiveBeatStopTimes < 13) | |||
MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳异常"); | |||
} | |||
//不允许下单 | |||
} | |||
} | |||
} | |||
catch (Exception) | |||
{ | |||
// throw; | |||
} | |||
})); | |||
Thread.Sleep(500); | |||
}), "炒锅5心跳检测"); | |||
//PLC数据读取 | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
GetAddressData("D2001", new Action<ushort[]>((data) => | |||
@@ -11,8 +11,62 @@ namespace FryPot_DosingSystem.Control | |||
/// </summary> | |||
internal class GlobalVariable | |||
{ | |||
/// <summary> | |||
/// 滚筒线心跳 | |||
/// </summary> | |||
public ushort LineHeartBeat { get; set; } = 2; | |||
/// <summary> | |||
/// 滚筒线心跳异常次数 | |||
/// </summary> | |||
public int LBeatStopTimes { get; set; } | |||
/// <summary> | |||
/// 根据滚筒线心跳判断是否允许下单 | |||
/// </summary> | |||
public bool CanPlaceOrder { get; set; } | |||
/// <summary> | |||
/// 炒锅1心跳 | |||
/// </summary> | |||
public ushort PotOneHeartBeat { get; set; } = 2; | |||
/// <summary> | |||
/// 炒锅1心跳异常次数 | |||
/// </summary> | |||
public int POneBeatStopTimes { get; set; } | |||
/// <summary> | |||
/// 炒锅2心跳 | |||
/// </summary> | |||
public ushort PotTwoHeartBeat { get; set; } = 2; | |||
/// <summary> | |||
/// 炒锅2心跳异常次数 | |||
/// </summary> | |||
public int PTwoBeatStopTimes { get; set; } | |||
/// <summary> | |||
/// 炒锅3心跳 | |||
/// </summary> | |||
public ushort PotThreeHeartBeat { get; set; } = 2; | |||
/// <summary> | |||
/// 炒锅3心跳异常次数 | |||
/// </summary> | |||
public int PThreeBeatStopTimes { get; set; } | |||
/// <summary> | |||
/// 炒锅4心跳 | |||
/// </summary> | |||
public ushort PotFourHeartBeat { get; set; } = 2; | |||
/// <summary> | |||
/// 炒锅4心跳异常次数 | |||
/// </summary> | |||
public int PFourBeatStopTimes { get; set; } | |||
/// <summary> | |||
/// 炒锅5心跳 | |||
/// </summary> | |||
public ushort PotFiveHeartBeat { get; set; } = 2; | |||
/// <summary> | |||
/// 炒锅5心跳异常次数 | |||
/// </summary> | |||
public int PFiveBeatStopTimes { get; set; } | |||
/// <summary> | |||
/// 滚筒线1 | |||
/// </summary> | |||
@@ -25,6 +79,7 @@ namespace FryPot_DosingSystem.Control | |||
/// 滚筒线3 | |||
/// </summary> | |||
public RollerLineThree rollerLineThree = new RollerLineThree(); | |||
/// <summary> | |||
/// 炒锅1 | |||
/// </summary> | |||