From 40cbd6eb54b77430475d3464912b3f382e997b0a Mon Sep 17 00:00:00 2001 From: Mr_z <1047577696@qqcom> Date: Mon, 19 Jun 2023 10:16:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Control/DosingLogicControl.cs | 504 +++++++++--------- 1 file changed, 248 insertions(+), 256 deletions(-) diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index f7737588..928ea85f 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -455,7 +455,7 @@ namespace FryPot_DosingSystem.Control HubHelper.GetInstance.Upstreamrequest = new Action(AgvFeedBackUpReportDataAnalysis); //ResetProgram(); ReadPlcData(); - HeatBeatToPlc(); + // HeatBeatToPlc(); SaveFryPotData(); MainTask(); CommandRegist(); @@ -1623,260 +1623,260 @@ namespace FryPot_DosingSystem.Control /// public void ReadPlcData() { - ThreadManage.GetInstance().StartLong(new Action(() => - { - GetAddressData("D0000", new Action((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 - { + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetAddressData("D0000", new Action((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("滚筒线心跳心跳异常"); - } + // 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((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((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((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) + // { - //不允许下单 - } - } - } - catch (Exception) - { + // // throw; + // } + // })); + // Thread.Sleep(500); + //}), "滚筒线心跳检测"); + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetFryOneData("D0000", new Action((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); - }), "炒锅3心跳检测"); - ThreadManage.GetInstance().StartLong(new Action(() => - { - GetFryFourData("D0000", new Action((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号炒锅心跳异常"); - } + // // throw; + // } + // })); + // Thread.Sleep(500); + //}), "炒锅1心跳检测"); - //不允许下单 - } - } - } - catch (Exception) - { + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetFryTwoData("D0000", new Action((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); - }), "炒锅4心跳检测"); - ThreadManage.GetInstance().StartLong(new Action(() => - { - GetFryFiveData("D0000", new Action((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 - { + // // throw; + // } + // })); + // Thread.Sleep(500); + //}), "炒锅2心跳检测"); + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetFryThreeData("D0000", new Action((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) + // { - globalVar.PFiveBeatStopTimes++; - if (globalVar.PFiveBeatStopTimes >= 10) - { - ActionManage.GetInstance.Send("HeartBeatCheck", true); - if (globalVar.PFiveBeatStopTimes >= 10 && globalVar.PFiveBeatStopTimes < 13) - MessageNotify.GetInstance.ShowRunLog("5号炒锅心跳异常"); - } + // // throw; + // } + // })); + // Thread.Sleep(500); + //}), "炒锅3心跳检测"); + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetFryFourData("D0000", new Action((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) + // { - //不允许下单 - } - } - } - catch (Exception) - { + // // throw; + // } + // })); + // Thread.Sleep(500); + //}), "炒锅4心跳检测"); + //ThreadManage.GetInstance().StartLong(new Action(() => + //{ + // GetFryFiveData("D0000", new Action((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心跳检测"); + // // throw; + // } + // })); + // Thread.Sleep(500); + //}), "炒锅5心跳检测"); //PLC数据读取 ThreadManage.GetInstance().StartLong(new Action(() => { @@ -4025,10 +4025,7 @@ namespace FryPot_DosingSystem.Control materialType = result.materialCollection[i], materialId = result.RecipeId }); - RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发 - - - + RollerThreeDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset * 10);//3号滚筒线桶号以及重量数据、偏差量下发 } else { @@ -4231,7 +4228,7 @@ namespace FryPot_DosingSystem.Control materialType = result.materialCollection[i], materialId = result.RecipeId }); - RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发 + RollerTwoDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset*10);//2号滚筒线桶号以及重量、偏差量数据下发 @@ -4457,12 +4454,7 @@ namespace FryPot_DosingSystem.Control materialType = result.materialCollection[i], materialId = result.RecipeId }); - RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight + RollerNetweight), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发 - - - - - + RollerOneDataWrite(i, result.materialCollection[i].MaterialLoc, (ushort)(result.materialCollection[i].MaterialWeight*10 + RollerNetweight*10), result.materialCollection[i].MaterialOffset*10);//1号滚筒线桶号以及重量、偏差量数据下发 } else { From df56727d0044a7d2429959cb5d8f492bbf5ca8b2 Mon Sep 17 00:00:00 2001 From: Mr_z <1047577696@qqcom> Date: Wed, 21 Jun 2023 17:57:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=86=B2=E7=AA=81=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Model/AlarmHelper.cs | 14 ++++++++++++-- DosingSystem/Model/DeviceInquire.cs | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs index e504cf29..7390621a 100644 --- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs +++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs @@ -107,8 +107,18 @@ namespace BPASmartClient.CustomResource.Pages.Model Time = DateTime.Now.ToString("HH:mm:ss"), }; - var res = Sqlite.GetInstance.Base.Add(tempAlarm); - Sqlite.GetInstance.Save(); + var res = Sqlite.GetInstance.Base.Add(tempAlarm); + try + { + + Sqlite.GetInstance.Save(); + + } + catch (Exception) + { + + //throw; + } if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) { diff --git a/DosingSystem/Model/DeviceInquire.cs b/DosingSystem/Model/DeviceInquire.cs index ecb4eeea..dcc4df90 100644 --- a/DosingSystem/Model/DeviceInquire.cs +++ b/DosingSystem/Model/DeviceInquire.cs @@ -197,9 +197,9 @@ namespace BPASmartClient.DosingSystem } } }*/ - for (int i = 0; i < 15; i++) + for (int i = 0; i < 6; i++) { - IPLists.Add($"{IPSegment}{(i + 1) * 10}"); + IPLists.Add($"{IPSegment}{(i + 1) * 10}"); } IPLists.ForEach((item) => From e25bae1e4363d60ad213ad117895137500b4a3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Sat, 24 Jun 2023 11:11:28 +0800 Subject: [PATCH 3/3] 1 --- DosingSystem/BPASmartClient.DosingSystem.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/DosingSystem/BPASmartClient.DosingSystem.csproj b/DosingSystem/BPASmartClient.DosingSystem.csproj index 897021d5..b23cbc9f 100644 --- a/DosingSystem/BPASmartClient.DosingSystem.csproj +++ b/DosingSystem/BPASmartClient.DosingSystem.csproj @@ -21,7 +21,6 @@ -