From 07a357d1bc4a18885da08929267701d4728f8ca1 Mon Sep 17 00:00:00 2001 From: taoye Date: Wed, 10 Aug 2022 15:46:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?180=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Model/MessageLog.cs | 6 +- .../Pages/View/AlarmView.xaml | 4 +- .../Pages/View/RunLogView.xaml | 7 +- .../Pages/View/UserLogView.xaml | 4 +- .../Control/DosingLogicControl.cs | 246 ++++++++++++++---- FryPot_DosingSystem/Control/GlobalVariable.cs | 23 +- FryPot_DosingSystem/View/DebugView.xaml | 18 +- .../View/RecipeSendDownView.xaml | 5 +- .../ViewModel/DebugViewModel.cs | 41 ++- 9 files changed, 282 insertions(+), 72 deletions(-) diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs index b82a7dca..251fa976 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs +++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using BPASmartClient.Model; +using System.Windows.Media; namespace BPASmartClient.CustomResource.Pages.Model { @@ -72,8 +73,9 @@ namespace BPASmartClient.CustomResource.Pages.Model RunLog?.Invoke(info); } } + int AlarmID; - public void ShowAlarmLog(string info, string AlarmNumber="_", AlarmLevel level= AlarmLevel.一般报警) + public void ShowAlarmLog(string info, string AlarmNumber = "_", AlarmLevel level = AlarmLevel.一般报警) { lock (alarmlock) { @@ -85,7 +87,7 @@ namespace BPASmartClient.CustomResource.Pages.Model Time = DateTime.Now.ToString("HH:mm:ss"), Info = info, Value = AlarmNumber, - Grade = (level)+"" + Grade = (level) + "" }; Sqlite.GetInstance.Base.Add(alarmLog); Application.Current.Dispatcher.Invoke(new Action(() => { alarmLogs.Insert(0, alarmLog); })); diff --git a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml index 9e780547..504777d0 100644 --- a/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/AlarmView.xaml @@ -25,7 +25,7 @@ --> - + @@ -157,7 +157,7 @@ - + diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml index 8a0f69a5..ec8e79db 100644 --- a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml @@ -25,7 +25,7 @@ --> - + @@ -158,7 +158,7 @@ - + @@ -261,7 +261,8 @@ + Text="{Binding RunLogInfo}" + /> - + @@ -240,7 +240,7 @@ - + diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 753df165..8d1d2f76 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -189,15 +189,21 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLineFour = true; }), "AgvArriveLineFourLoc"); - + + ActionManage.GetInstance.Register(new Action(() => + { + EmptyRollerCleanTaskRestart(); + + }), "EmptyRollerCleanTaskRestart"); + #endregion //接口调试 ActionManage.GetInstance.Register(new Action(() => { string id = Guid.NewGuid().ToString(); - string errorCode=AGVHelper._Instance.AgvToLineOneLoadRoller(id); + string errorCode = AGVHelper._Instance.AgvToLineOneLoadRoller(id); if (errorCode == "SUCCESS") - { + { MessageLog.GetInstance.ShowRunLog($"AGV任务下发成功"); } else if (errorCode == "Analysis Error") @@ -209,6 +215,31 @@ namespace FryPot_DosingSystem.Control MessageLog.GetInstance.ShowRunLog($"提示:AGV任务下发失败,错误码:{errorCode}"); } }), "AgvDebug"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.agvArriveLineOneLoadCom = true; + }), "AgvLineOneLoadEmptyCom"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.agvArriveLineTwoLoadCom = true; + }), "AgvLineTwoLoadEmptyCom"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.agvArriveLineThreeLoadCom = true; + }), "AgvLineThreeLoadEmptyCom"); + + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.rollerLineOne.CanRun = true; + }), "AGVLineOneLoadCom"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.rollerLineTwo.CanRun = true; + }), "AGVLineTwoLoadCom"); + ActionManage.GetInstance.Register(new Action(() => + { + globalVar.rollerLineThree.CanRun = true; + }), "AGVLineThreeLoadCom"); ActionManage.GetInstance.Register(new Action(() => { @@ -812,6 +843,7 @@ namespace FryPot_DosingSystem.Control //线体1任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LSevenrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体1空桶上料 { + globalVar.agvArriveLineOneLoadCom = true; AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString()); AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); //到清洗处 @@ -819,6 +851,7 @@ namespace FryPot_DosingSystem.Control //线体2任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LEightrobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体2空桶上料 { + globalVar.agvArriveLineTwoLoadCom = true; AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString()); AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); @@ -828,6 +861,7 @@ namespace FryPot_DosingSystem.Control //线体3任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "" && objData.jobData.targetPointCode == "")//指定上料点上料完成,这里指线体3空桶上料 { + globalVar.agvArriveLineThreeLoadCom = true; AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString()); AgvViewModel.GetInstance().Set小车是否承载物品(4, IsBool.OnllYes); //到清洗处 @@ -918,7 +952,7 @@ namespace FryPot_DosingSystem.Control AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3); } - + //线体1任务上报 if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LFourrobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指炒锅空桶下料 { @@ -1053,9 +1087,9 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StopTask("MainViewReadPlcData", new Action(() => { - //ActionManage.GetInstance.CancelRegister("RecipeSetDown"); - //ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); - // ActionManage.GetInstance.Send("ClearRecipes"); + //ActionManage.GetInstance.CancelRegister("RecipeSetDown"); + //ActionManage.GetInstance.Register(new Action(RecipeDataParse), "RecipeSetDown"); + // ActionManage.GetInstance.Send("ClearRecipes"); ThreadManage.GetInstance().StopTask("滚筒线1任务线程", new Action(() => { ThreadManage.GetInstance().StopTask("滚筒线2任务线程", new Action(() => @@ -1105,7 +1139,8 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveUpLoad = false; globalVar.agvArriveUnLoad = false; globalVar.agvFryPotEmptyRollerArrive = false; - globalVar.EmptyRollerUnLoadcCom = false; + globalVar.agvLineOneLoadCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程"); MessageLog.GetInstance.ShowUserLog("滚筒线【1】任务重启成功"); })); @@ -1136,7 +1171,8 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLTwoUpLoad = false; globalVar.LTwoagvArriveUnLoad = false; globalVar.LTwoagvFryPotEmptyRollerArrive = false; - globalVar.LTwoEmptyRollerUnLoadcCom = false; + globalVar.agvLineTwoLoadCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程"); MessageLog.GetInstance.ShowUserLog("滚筒线【2】任务重启成功"); })); @@ -1165,11 +1201,41 @@ namespace FryPot_DosingSystem.Control globalVar.agvArriveLThreeUpLoad = false; globalVar.LThreeagvArriveUnLoad = false; globalVar.LThreeagvFryPotEmptyRollerArrive = false; - globalVar.LThreeEmptyRollerUnLoadcCom = false; + globalVar.agvLineThreeLoadCom = false; ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程"); MessageLog.GetInstance.ShowUserLog("滚筒线【3】任务重启成功"); })); } + + public void EmptyRollerCleanTaskRestart() + { + ThreadManage.GetInstance().StopTask("空桶清洗任务线程", new Action(() => + { + globalVar.rollerLineOne.EmptyRollerNums.Clear(); + globalVar.rollerLineOne.IsEpmtyBefore = false; + // globalVar.rollerLineOne.CanRun = true; + + globalVar.rollerLineTwo.EmptyRollerNums.Clear(); + globalVar.rollerLineTwo.IsEpmtyBefore = false; + //globalVar.rollerLineTwo.CanRun = true; + + globalVar.rollerLineThree.EmptyRollerNums.Clear(); + globalVar.rollerLineThree.IsEpmtyBefore = false; + //globalVar.rollerLineThree.CanRun = true; + + globalVar.agvArriveLineFour = false; + globalVar.agvArriveCleanLoad = false; + globalVar.agvArriveCleanUnLoad = false; + globalVar.agvArriveLineOneLoadEmptyRoller = false; + globalVar.agvArriveLineTwoLoadEmptyRoller = false; + globalVar.agvArriveLineThreeLoadEmptyRoller = false; + globalVar.agvArriveLineOneLoadCom = false; + globalVar.agvArriveLineTwoLoadCom = false; + globalVar.agvArriveLineThreeLoadCom = false; + ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程"); + MessageLog.GetInstance.ShowUserLog("空桶清洗任务重启成功"); + })); + } /// /// 实时获取plc数据 /// @@ -1215,9 +1281,9 @@ namespace FryPot_DosingSystem.Control globalVar.rollerLineOne.OutMaterialingSingle = data[3]; globalVar.rollerLineTwo.OutMaterialingSingle = data[4]; globalVar.rollerLineThree.OutMaterialingSingle = data[5]; - //globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6]; - //globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7]; - //globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8]; + //globalVar.rollerLineOne.OutMaterialingTroubleSingle = data[6]; + //globalVar.rollerLineTwo.OutMaterialingTroubleSingle = data[7]; + //globalVar.rollerLineThree.OutMaterialingTroubleSingle = data[8]; AlarmHelper.Alarm.LOneRollerTrouble = data[6]; AlarmHelper.Alarm.LTwoRollerTrouble = data[7]; AlarmHelper.Alarm.LThreeRollerTrouble = data[8]; @@ -1257,11 +1323,11 @@ namespace FryPot_DosingSystem.Control })); GetAddressData("D2070", new Action((data) => { - //globalVar.fryPotOne.RollerTroubleSingle = data[0]; - //globalVar.fryPotTwo.RollerTroubleSingle = data[1]; - //globalVar.fryPotThree.RollerTroubleSingle = data[2]; - //globalVar.fryPotFour.RollerTroubleSingle = data[3]; - //globalVar.fryPotFive.RollerTroubleSingle = data[4]; + //globalVar.fryPotOne.RollerTroubleSingle = data[0]; + //globalVar.fryPotTwo.RollerTroubleSingle = data[1]; + //globalVar.fryPotThree.RollerTroubleSingle = data[2]; + //globalVar.fryPotFour.RollerTroubleSingle = data[3]; + //globalVar.fryPotFive.RollerTroubleSingle = data[4]; AlarmHelper.Alarm.FryPotOneRollerTrouble = data[0]; AlarmHelper.Alarm.FryPotTwoRollerTrouble = data[1]; AlarmHelper.Alarm.FryPotThreeRollerTrouble = data[2]; @@ -1284,32 +1350,32 @@ namespace FryPot_DosingSystem.Control globalVar.CleadBarrelExitSingle = data[0]; })); - //炒锅1状态数据 + //炒锅1状态数据 GetFryOneData("D2001", new Action(data => { })); - //炒锅2状态数据 + //炒锅2状态数据 GetFryTwoData("D2001", new Action(data => { })); - //炒锅3状态数据 + //炒锅3状态数据 GetFryThreeData("D2001", new Action(data => { })); - //炒锅4状态数据 + //炒锅4状态数据 GetFryFourData("D2001", new Action(data => { })); - //炒锅5状态数据 + //炒锅5状态数据 GetFryFiveData("D2001", new Action(data => { })); - //线体上放空桶 + //线体上放空桶 if (globalVar.rollerLineOne.EmptyRollerConfirmSingle == 1 && globalVar.rollerLineOne.EmptyRollerNum != 0) { globalVar.rollerLineOne.EmptyRollerNums.Add(globalVar.rollerLineOne.EmptyRollerNum); @@ -1322,7 +1388,7 @@ namespace FryPot_DosingSystem.Control { globalVar.rollerLineThree.EmptyRollerNums.Add(globalVar.rollerLineThree.EmptyRollerNum); } - //炒锅状态数据 + //炒锅状态数据 if (globalVar.fryPotOne.OilConfirm == 1) { FryPotMonitorManage.GetInstance.fryOne.OilCapacity = globalVar.fryPotOne.OilCapacity; @@ -1348,7 +1414,7 @@ namespace FryPot_DosingSystem.Control FryPotMonitorManage.GetInstance.fryFive.OilCapacity = globalVar.fryPotFive.OilCapacity; FryPotMonitorManage.GetInstance.fryFive.TotalOilCapactiy += globalVar.fryPotFive.OilCapacity; } - //炒锅状态实时显示 + //炒锅状态实时显示 FryPotStatusDisplay(); RollerLineStatusDisplay(); Thread.Sleep(10); @@ -1807,7 +1873,7 @@ namespace FryPot_DosingSystem.Control ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute(); Thread.Sleep(10); }), "滚筒线1任务线程"); ThreadManage.GetInstance().StartLong(new Action(() => { LineTwoProcessExecute(); Thread.Sleep(10); }), "滚筒线2任务线程"); ThreadManage.GetInstance().StartLong(new Action(() => { LineThreeProcessExecute(); Thread.Sleep(10); }), "滚筒线3任务线程"); - ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "清洗台任务线程"); + ThreadManage.GetInstance().StartLong(new Action(() => { LineFourProcessExecute(); Thread.Sleep(10); }), "空桶清洗任务线程"); } @@ -1869,11 +1935,13 @@ namespace FryPot_DosingSystem.Control } private void LineFourProcessExecute() { + // AgvFromLineToCleanPlate(); + AgvArriveCleanPlate(); + + CallAgvToLineFour(); CleanPlateUpLoad(); EmptyRollerToLinFour(); - CallAgvToLineFour(); - AgvArriveCleanPlate(); } private void CleanPlateUpLoad() @@ -1893,11 +1961,12 @@ namespace FryPot_DosingSystem.Control if (AlarmHelper.Alarm.LOneRollerTrouble == 0)//输送线无故障 { //线体1到清洗台 - if (!globalVar.rollerLineOne.IsEpmtyBefore) + if (!globalVar.rollerLineOne.IsEpmtyBefore && globalVar.rollerLineOne.CanRun) { var res = InputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineOne.StationEight); - if (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶 + if ((globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0) && InputMaterialQuene.Count > 0 && globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineOne.StationEight != 0 && globalVar.rollerLineOne.EmptyRollerNums.Count > 0 && globalVar.rollerLineOne.StationEight == globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶且工位8的桶号和plc上报的桶号一致,即空桶 { + //下发AGV去空桶线洗桶任务 e: string id = Guid.NewGuid().ToString("N"); if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId) @@ -1908,6 +1977,7 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(500); LineToCleanCarryTaskErrorCodeAnalysis(info, 1); globalVar.rollerLineOne.IsEpmtyBefore = true; + //globalVar.rollerLineOne.CanRun = false; AgvFromLineOneToClean(globalVar.rollerLineOne.EmptyRollerNums.ElementAt(0));//AGV从线体1到清洗处 } } @@ -1919,10 +1989,10 @@ namespace FryPot_DosingSystem.Control // 线体2到清洗台 if (AlarmHelper.Alarm.LTwoRollerTrouble == 0)//输送线无故障 { - if (!globalVar.rollerLineTwo.IsEpmtyBefore) + if (!globalVar.rollerLineTwo.IsEpmtyBefore && globalVar.rollerLineTwo.CanRun) { var res = LTwoInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineTwo.StationEight); - if (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶 + if ((globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0) && LTwoInputMaterialQuene.Count > 0 && globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineTwo.StationEight != 0 && globalVar.rollerLineTwo.EmptyRollerNums.Count > 0 && globalVar.rollerLineTwo.StationEight == globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶 { //下发AGV去空桶线洗桶任务 e: string id = Guid.NewGuid().ToString("N"); @@ -1934,6 +2004,7 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(500); LineToCleanCarryTaskErrorCodeAnalysis(info, 2); globalVar.rollerLineTwo.IsEpmtyBefore = true; + // globalVar.rollerLineTwo.CanRun = false; AgvFromLineTwoToClean(globalVar.rollerLineTwo.EmptyRollerNums.ElementAt(0));//AGV从线体2到清洗处 } } @@ -1945,10 +2016,10 @@ namespace FryPot_DosingSystem.Control //线体3到清洗台 if (AlarmHelper.Alarm.LThreeRollerTrouble == 0)//输送线无故障 { - if (!globalVar.rollerLineThree.IsEpmtyBefore) + if (!globalVar.rollerLineThree.IsEpmtyBefore && globalVar.rollerLineThree.CanRun) { var res = LThreeInputMaterialQuene.FirstOrDefault(p => p.materialType.MaterialLoc == globalVar.rollerLineThree.StationEight); - if (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0))//工位8上面有桶且不是配方上的原料桶,即空桶 + if ((globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0) && LThreeInputMaterialQuene.Count > 0 && globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) || (res == null && globalVar.rollerLineThree.StationEight != 0 && globalVar.rollerLineThree.EmptyRollerNums.Count > 0 && globalVar.rollerLineThree.StationEight == globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0)))//工位8上面有桶且不是配方上的原料桶,即空桶 { //下发AGV去空桶线洗桶任务 e: string id = Guid.NewGuid().ToString("N"); @@ -1960,6 +2031,7 @@ namespace FryPot_DosingSystem.Control Thread.Sleep(500); LineToCleanCarryTaskErrorCodeAnalysis(info, 3); globalVar.rollerLineThree.IsEpmtyBefore = true; + //globalVar.rollerLineThree.CanRun = false; AgvFromLineThreeToClean(globalVar.rollerLineThree.EmptyRollerNums.ElementAt(0));//AGV从线体3到清洗处 } } @@ -1993,7 +2065,7 @@ namespace FryPot_DosingSystem.Control { //是否需要手动给PLC置位?? globalVar.CleanComplete = 0; - e: string id = Guid.NewGuid().ToString("N"); + e: string id = Guid.NewGuid().ToString("N"); if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId) goto e; @@ -2063,6 +2135,7 @@ namespace FryPot_DosingSystem.Control } else { + MessageLog.GetInstance.ShowRunLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); LThreeInputMaterialQuene.Clear(); LThreeErrorRecipe = true; @@ -2164,6 +2237,7 @@ namespace FryPot_DosingSystem.Control } else { + MessageLog.GetInstance.ShowRunLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); LTwoInputMaterialQuene.Clear(); LTwoErrorRecipe = true; @@ -2262,6 +2336,7 @@ namespace FryPot_DosingSystem.Control } else { + MessageLog.GetInstance.ShowRunLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线配方桶号配置错误,取消【{result.RecipeName}】配方制作"); InputMaterialQuene.Clear(); ErrorRecipe = true; @@ -2363,8 +2438,23 @@ namespace FryPot_DosingSystem.Control { AgvToLineOneLoadRoller(); AgvFromLineOneToFryPot();//AGV到1号线体装桶 + AgvLineOneLoadRollerCom(); + } + } + /// + /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件 + /// + /// + private void AgvLineOneLoadRollerCom() + { + if (globalVar.agvLineOneLoadCom) + { + globalVar.rollerLineOne.CanRun = true; + globalVar.agvLineOneLoadCom = false; + MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线装桶完成"); } } + /// /// AGV到配方线体2装桶以及出料到炒锅 /// @@ -2372,13 +2462,25 @@ namespace FryPot_DosingSystem.Control { if (LTwoInputMaterialQuene.Count > 0) { - AgvToLineTwoLoadRoller(); AgvFromLineTwoToFryPot();//AGV到2号线体装桶 + AgvLineTwoLoadRollerCom(); - } } + /// + /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件 + /// + private void AgvLineTwoLoadRollerCom() + { + if (globalVar.agvLineTwoLoadCom) + { + globalVar.rollerLineTwo.CanRun = true; + globalVar.agvLineTwoLoadCom = false; + MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线装桶完成"); + } + } + /// /// AGV到配方线体3装桶以及出料到炒锅 /// @@ -2389,8 +2491,19 @@ namespace FryPot_DosingSystem.Control AgvToLineThreeLoadRoller(); AgvFromLineThreeToFryPot();//AGV到2号线体装桶 - - + AgvLineThreeLoadRollerCom(); + } + } + /// + /// 判断agv在1号线体是否上料完成,作为线体空桶能否开始运输的条件 + /// + private void AgvLineThreeLoadRollerCom() + { + if (globalVar.agvLineThreeLoadCom) + { + globalVar.rollerLineThree.CanRun = true; + globalVar.agvLineThreeLoadCom = false; + MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线装桶完成"); } } /// @@ -2772,7 +2885,7 @@ namespace FryPot_DosingSystem.Control { globalVar.agvArriveLineFour = false; //线体四信号交互 - MessageLog.GetInstance.ShowRunLog("空桶到达空桶回收线体,准备卸桶"); + MessageLog.GetInstance.ShowRunLog("AGV到达【4】号回收线体,准备卸桶"); MessageLog.GetInstance.ShowRunLog("卸桶完成"); } } @@ -3265,14 +3378,19 @@ namespace FryPot_DosingSystem.Control { MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1052", 1);//agv到达线体1上料位置信号下发plc - MessageLog.GetInstance.ShowRunLog($"AGV正在装载{emptyRollerNum}号空料桶"); + MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶"); AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start); globalVar.LOneMaterialNum--; globalVar.agvArriveLineOneLoadEmptyRoller = false; - globalVar.rollerLineOne.IsEpmtyBefore = false; - globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0); //原料到位,agv到位,agv自行运料到清洗处 } + if (globalVar.agvArriveLineOneLoadCom)//上料完成 + { + globalVar.rollerLineOne.EmptyRollerNums.RemoveAt(0); + globalVar.agvArriveLineOneLoadCom = false; + globalVar.rollerLineOne.IsEpmtyBefore = false; + MessageLog.GetInstance.ShowRunLog($"AGV在【1】号线体完成{emptyRollerNum}号空料桶装载"); + } } else//有故障 { @@ -3339,14 +3457,20 @@ namespace FryPot_DosingSystem.Control { MessageLog.GetInstance.ShowRunLog("AGV到达【2】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1053", 1);//agv到达线体2上料位置信号下发plc - MessageLog.GetInstance.ShowRunLog($"AGV正在装载{emptyRollerNum}号空料桶"); + MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶"); AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start); globalVar.LTwoMaterialNum--; globalVar.agvArriveLineTwoLoadEmptyRoller = false; - globalVar.rollerLineTwo.IsEpmtyBefore = false; - globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0); + //原料到位,agv到位,agv自行运料到清洗处 } + if (globalVar.agvArriveLineTwoLoadCom)//上料完成 + { + globalVar.rollerLineTwo.EmptyRollerNums.RemoveAt(0); + globalVar.agvArriveLineTwoLoadCom = false; + globalVar.rollerLineTwo.IsEpmtyBefore = false; + MessageLog.GetInstance.ShowRunLog($"AGV在【2】号线体完成【{emptyRollerNum}】号空料桶装载"); + } } else//有故障 { @@ -3413,14 +3537,21 @@ namespace FryPot_DosingSystem.Control { MessageLog.GetInstance.ShowRunLog("AGV到达【3】号滚筒线装桶位置"); DeviceOperate.GetInstance.WritePlcData("D1054", 1);//agv到达线体3上料位置信号下发plc - MessageLog.GetInstance.ShowRunLog($"AGV正在装载{emptyRollerNum}号空料桶"); + MessageLog.GetInstance.ShowRunLog($"AGV正在装载【{emptyRollerNum}】号空料桶"); AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start); globalVar.LThreeMaterialNum--; globalVar.agvArriveLineThreeLoadEmptyRoller = false; - globalVar.rollerLineThree.IsEpmtyBefore = false; - globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0); + // globalVar.rollerLineThree.IsEpmtyBefore = false; + //原料到位,agv到位,agv自行运料到清洗处 } + if (globalVar.agvArriveLineThreeLoadCom)//上料完成 + { + globalVar.rollerLineThree.EmptyRollerNums.RemoveAt(0); + globalVar.agvArriveLineThreeLoadCom = false; + globalVar.rollerLineThree.IsEpmtyBefore = false; + MessageLog.GetInstance.ShowRunLog($"AGV在【3】号线体完成【{emptyRollerNum}】号空料桶装载"); + } } else//有故障 { @@ -3535,6 +3666,7 @@ namespace FryPot_DosingSystem.Control { if (globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineOne.IsEpmtyBefore)//工位8上面是配方料桶 { + globalVar.rollerLineOne.CanRun = false; e: string id = Guid.NewGuid().ToString("N"); if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId) goto e; @@ -3545,6 +3677,10 @@ namespace FryPot_DosingSystem.Control LineCarryTaskErrorCodeAnalysis(info, 1); globalVar.LoadRoller = true; } + //else if (globalVar.rollerLineOne.StationEight != InputMaterialQuene.ElementAt(0).materialType.MaterialLoc) + //{ + // globalVar.rollerLineOne.CanRun = true; + //} //else // 工位8上面不是配方料桶或没有桶时 //{ // if (!globalVar.rollerLineOne.IsEpmtyBefore) @@ -3588,6 +3724,7 @@ namespace FryPot_DosingSystem.Control { if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶 { + globalVar.rollerLineTwo.CanRun = false; e: string id = Guid.NewGuid().ToString("N"); if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId) goto e; @@ -3598,6 +3735,10 @@ namespace FryPot_DosingSystem.Control LineCarryTaskErrorCodeAnalysis(info, 2); globalVar.LTwoLoadRoller = true; } + //else if (globalVar.rollerLineTwo.StationEight != LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) + //{ + // globalVar.rollerLineTwo.CanRun = true; + //} } //else// 工位8上面不是配方料桶或没有桶时 //{ @@ -3634,6 +3775,7 @@ namespace FryPot_DosingSystem.Control { if (globalVar.rollerLineThree.StationEight == LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineThree.IsEpmtyBefore)//工位8上面是配方料桶 { + globalVar.rollerLineThree.CanRun = false; e: string id = Guid.NewGuid().ToString("N"); if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || id == LSevenrobotJobId || id == LEightrobotJobId || id == LNinerobotJobId || id == LTenrobotJobId) goto e; @@ -3644,6 +3786,10 @@ namespace FryPot_DosingSystem.Control LineCarryTaskErrorCodeAnalysis(info, 3); globalVar.LThreeLoadRoller = true; } + //else if (globalVar.rollerLineThree.StationEight != LThreeInputMaterialQuene.ElementAt(0).materialType.MaterialLoc) + //{ + // globalVar.rollerLineThree.CanRun = true; + //} //else // 工位8上面不是配方料桶或没有桶时 //{ // if (!globalVar.rollerLineThree.IsEpmtyBefore) diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index d1962539..99242997 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -165,6 +165,7 @@ namespace FryPot_DosingSystem.Control public bool agvArriveUnLoad { get; set; } public bool agvFryPotEmptyRollerArrive { get; set; } public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 + public bool agvLineOneLoadCom { get; set; }//线体1上料完成 public int LTwoMaterialNum { get; set; } = 0; public int LTwoFryPotSerial { get; set; } = 2; @@ -172,7 +173,7 @@ namespace FryPot_DosingSystem.Control public bool agvArriveLTwoUpLoad { get; set; } public bool LTwoagvArriveUnLoad { get; set; } public bool LTwoagvFryPotEmptyRollerArrive { get; set; } - public bool LTwoEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 + public bool agvLineTwoLoadCom { get; set; }//线体2上料完成 public int LThreeMaterialNum { get; set; } = 0; public int LThreeFryPotSerial { get; set; } = 3; @@ -180,11 +181,11 @@ namespace FryPot_DosingSystem.Control public bool agvArriveLThreeUpLoad { get; set; } public bool LThreeagvArriveUnLoad { get; set; } public bool LThreeagvFryPotEmptyRollerArrive { get; set; } - public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成 + public bool agvLineThreeLoadCom { get; set; }//线体1上料完成 public int LFourRollerNum { get; set; } = 0;//4号线体空桶数量 - //新增 - public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清戏台或炒锅 + //新增空桶清洗系列变量 + public bool agvArriveLineFour { get; set; }//agv到达线体4下料位置从清洗台或炒锅 public bool agvArriveCleanUnLoad { get; set; }//agv到达清洗台下料位置 public bool agvArriveCleanLoad { get; set; }//agv到达清洗台上料位置 @@ -192,6 +193,11 @@ namespace FryPot_DosingSystem.Control public bool agvArriveLineTwoLoadEmptyRoller { get; set; }//agv到达线体2空桶上料位置 public bool agvArriveLineThreeLoadEmptyRoller { get; set; }//agv到达线体3空桶上料位置 + + public bool agvArriveLineOneLoadCom { get; set; } //agv线体1空桶上料完成 + public bool agvArriveLineTwoLoadCom { get; set; } //agv线体2空桶上料完成 + public bool agvArriveLineThreeLoadCom { get; set; }//agv线体3空桶上料完成 + //空桶清洗流程锁 #endregion } /// @@ -255,7 +261,9 @@ namespace FryPot_DosingSystem.Control /// /// 上一个桶是否是空桶 /// - public bool IsEpmtyBefore { get; set; } + public bool IsEpmtyBefore { get; set; } //空桶上料结束后,配方料桶AGV才能去1号线装桶 + + public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶 /// /// 线体1上所有空桶的编号集合 /// @@ -324,10 +332,11 @@ namespace FryPot_DosingSystem.Control /// public bool IsEpmtyBefore { get; set; } + public bool CanRun { get; set; } = true; //配方料桶上料结束后,线体空桶AGV才能1号线装桶 /// /// 线体2上所有空桶的编号集合 /// - public List EmptyRollerNums { get; set; }=new List(); + public List EmptyRollerNums { get; set; }=new List() { 208}; } /// /// 滚筒线3相关变量 @@ -392,6 +401,8 @@ namespace FryPot_DosingSystem.Control /// public bool IsEpmtyBefore { get; set; } + public bool CanRun { get; set; } = true;//配方料桶上料结束后,线体空桶AGV才能1号线装桶 + /// /// 线体3上所有空桶的编号集合 /// diff --git a/FryPot_DosingSystem/View/DebugView.xaml b/FryPot_DosingSystem/View/DebugView.xaml index 05b34963..a4601294 100644 --- a/FryPot_DosingSystem/View/DebugView.xaml +++ b/FryPot_DosingSystem/View/DebugView.xaml @@ -39,10 +39,12 @@ @@ -87,6 +92,7 @@ @@ -118,6 +127,7 @@ - + diff --git a/FryPot_DosingSystem/ViewModel/DebugViewModel.cs b/FryPot_DosingSystem/ViewModel/DebugViewModel.cs index 46fdac14..afbcbdd8 100644 --- a/FryPot_DosingSystem/ViewModel/DebugViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/DebugViewModel.cs @@ -28,6 +28,7 @@ namespace FryPot_DosingSystem.ViewModel public RelayCommand AGVFryPotDownArrive { get; set; } public RelayCommand AGVFryPotUpArrive { get; set; } public RelayCommand AGVFryPotGetEmptyRoller { get; set; } + public RelayCommand AGVLineOneLoadCom { get; set; }//线体1上料完成 //滚筒线2绑定命令 public RelayCommand RollerLineTwoRunning { get; set; } @@ -41,6 +42,7 @@ namespace FryPot_DosingSystem.ViewModel public RelayCommand AGVFryPotTwoDownArrive { get; set; } public RelayCommand AGVFryPotTwoUpArrive { get; set; } public RelayCommand AGVFryPotTwoGetEmptyRoller { get; set; } + public RelayCommand AGVLineTwoLoadCom { get; set; }//线体2上料完成 //滚筒线3绑定命令 public RelayCommand RollerLineThreeRunning { get; set; } //public RelayCommand EightWorkLoc { get; set; } @@ -52,27 +54,62 @@ namespace FryPot_DosingSystem.ViewModel public RelayCommand AGVFryPotThreeDownArrive { get; set; } public RelayCommand AGVFryPotThreeUpArrive { get; set; } public RelayCommand AGVFryPotThreeGetEmptyRoller { get; set; } + public RelayCommand AGVLineThreeLoadCom { get; set; }//线体3上料完成 //AGV接口联调 public RelayCommand AgvDebug { get; set; } //线体123空桶清洗以及回收 public RelayCommand AgvArriveLineOneEmptyRollerLoc { get; set; } + + public RelayCommand AgvLineOneLoadEmptyCom { get; set; } public RelayCommand AgvArriveLineTwoEmptyRollerLoc { get; set; } + public RelayCommand AgvLineTwoLoadEmptyCom { get; set; } public RelayCommand AgvArriveLineThreeEmptyRollerLoc { get; set; } + public RelayCommand AgvLineThreeLoadEmptyCom { get; set; } public RelayCommand CleanPlateCallAgv { get; set; } public RelayCommand AgvArriveCleanPlateLoc { get; set; }//下料 public RelayCommand AgvArriveLineFourLoc { get; set; } public RelayCommand AgvArriveCleanPlateLocLoad { get; set; }//上料 + + public RelayCommand EmptyRollerCleanTaskRestart { get; set; } public DebugViewModel() { AgvDebug = new RelayCommand(new Action(() => { ActionManage.GetInstance.Send("AgvDebug"); - - })); + + EmptyRollerCleanTaskRestart = new RelayCommand(() => + { + + ActionManage.GetInstance.Send("EmptyRollerCleanTaskRestart"); + }); + AgvLineOneLoadEmptyCom = new RelayCommand(() => { + ActionManage.GetInstance.Send("AgvLineOneLoadEmptyCom"); + }); + AgvLineTwoLoadEmptyCom = new RelayCommand(() => { + ActionManage.GetInstance.Send("AgvLineTwoLoadEmptyCom"); + }); + AgvLineThreeLoadEmptyCom = new RelayCommand(() => { + ActionManage.GetInstance.Send("AgvLineThreeLoadEmptyCom"); + }); + AGVLineOneLoadCom = new RelayCommand(() => + { + ActionManage.GetInstance.Send("AGVLineOneLoadCom"); + + }); + AGVLineTwoLoadCom = new RelayCommand(() => + { + ActionManage.GetInstance.Send("AGVLineTwoLoadCom"); + + }); + AGVLineThreeLoadCom = new RelayCommand(() => + { + ActionManage.GetInstance.Send("AGVLineThreeLoadCom"); + + }); AgvArriveLineOneEmptyRollerLoc = new RelayCommand(new Action(() => { ActionManage.GetInstance.Send("AgvArriveLineOneEmptyRollerLoc"); From 1cb5d3fa5bfdd08b9131402333a28237fe6bcc32 Mon Sep 17 00:00:00 2001 From: taoye Date: Wed, 10 Aug 2022 16:05:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=B4=E6=97=B6=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Control/DosingLogicControl.cs | 8 +++++- FryPot_DosingSystem/Control/GlobalVariable.cs | 4 +-- FryPot_DosingSystem/View/DebugView.xaml | 27 ++++++++++--------- SmartClient.sln | 2 -- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 8d1d2f76..be36d8dc 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -1211,15 +1211,21 @@ namespace FryPot_DosingSystem.Control { ThreadManage.GetInstance().StopTask("空桶清洗任务线程", new Action(() => { + globalVar.rollerLineOne.StationEight = 0; globalVar.rollerLineOne.EmptyRollerNums.Clear(); + globalVar.rollerLineOne.EmptyRollerNums.Add(108); globalVar.rollerLineOne.IsEpmtyBefore = false; - // globalVar.rollerLineOne.CanRun = true; + // globalVar.rollerLineOne.CanRun = true; + globalVar.rollerLineTwo.StationEight = 0; globalVar.rollerLineTwo.EmptyRollerNums.Clear(); + globalVar.rollerLineTwo.EmptyRollerNums.Add(208); globalVar.rollerLineTwo.IsEpmtyBefore = false; //globalVar.rollerLineTwo.CanRun = true; + globalVar.rollerLineThree.StationEight = 0; globalVar.rollerLineThree.EmptyRollerNums.Clear(); + globalVar.rollerLineThree.EmptyRollerNums.Add(308); globalVar.rollerLineThree.IsEpmtyBefore = false; //globalVar.rollerLineThree.CanRun = true; diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 99242997..eb444f1e 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -267,7 +267,7 @@ namespace FryPot_DosingSystem.Control /// /// 线体1上所有空桶的编号集合 /// - public List EmptyRollerNums { get; set; } = new List() {108}; + public List EmptyRollerNums { get; set; } = new List(); } /// /// 滚筒线2相关变量 @@ -336,7 +336,7 @@ namespace FryPot_DosingSystem.Control /// /// 线体2上所有空桶的编号集合 /// - public List EmptyRollerNums { get; set; }=new List() { 208}; + public List EmptyRollerNums { get; set; } = new List(); } /// /// 滚筒线3相关变量 diff --git a/FryPot_DosingSystem/View/DebugView.xaml b/FryPot_DosingSystem/View/DebugView.xaml index a4601294..5e29cf2e 100644 --- a/FryPot_DosingSystem/View/DebugView.xaml +++ b/FryPot_DosingSystem/View/DebugView.xaml @@ -39,11 +39,11 @@ - + - +