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 {