From 0eed3babc28fcf1a3045a0c513fec62243dcc02a Mon Sep 17 00:00:00 2001 From: taoye Date: Fri, 8 Jul 2022 18:10:08 +0800 Subject: [PATCH] =?UTF-8?q?Agv=E8=A7=86=E5=9B=BE=E8=BF=90=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FryPot_DosingSystem/AGV/WhichCart.cs | 1 + .../Control/DosingLogicControl.cs | 370 +++++++++++------- FryPot_DosingSystem/Control/GlobalVariable.cs | 9 + FryPot_DosingSystem/View/AgvView.xaml | 2 + FryPot_DosingSystem/View/AgvView.xaml.cs | 4 +- FryPot_DosingSystem/ViewModel/AgvViewModel.cs | 2 +- 6 files changed, 248 insertions(+), 140 deletions(-) diff --git a/FryPot_DosingSystem/AGV/WhichCart.cs b/FryPot_DosingSystem/AGV/WhichCart.cs index 6e84b46a..b3c6a33e 100644 --- a/FryPot_DosingSystem/AGV/WhichCart.cs +++ b/FryPot_DosingSystem/AGV/WhichCart.cs @@ -49,6 +49,7 @@ namespace FryPot_DosingSystem.AGV hs_2,//2号炒锅-运输空碗到-空碗流水线 hs_3,//3号炒锅-运输空碗到-空碗流水线 hs_4,//4号炒锅-运输空碗到-空碗流水线 + hs_5,//5号炒锅-运输空碗到-空碗流水线 hj,//空碗流水线-回到充电桩或者停车桩 } diff --git a/FryPot_DosingSystem/Control/DosingLogicControl.cs b/FryPot_DosingSystem/Control/DosingLogicControl.cs index 3fb9957f..34321a81 100644 --- a/FryPot_DosingSystem/Control/DosingLogicControl.cs +++ b/FryPot_DosingSystem/Control/DosingLogicControl.cs @@ -17,6 +17,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Media; using System.Windows; +using FryPot_DosingSystem.AGV; namespace FryPot_DosingSystem.Control { @@ -224,7 +225,7 @@ namespace FryPot_DosingSystem.Control ActionManage.GetInstance.Register(new Action(() => { globalVar.ExitMainTask = true; }), "FryPotDosingMainTaskExit"); HubHelper.GetInstance.Report = new Action(AgvTaskUpReportDataAnalysis); HubHelper.GetInstance.Upstreamrequest = new Action(AgvFeedBackUpReportDataAnalysis); - // ResetProgram(); + // ResetProgram(); ReadPlcData(); MainTask(); CommandRegist(); @@ -296,7 +297,7 @@ namespace FryPot_DosingSystem.Control //线体1任务上报 if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料 { - //日志 + } //线体2任务上报 if (objData.state == "ROLLER_LOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")// AGV正在上料,指线体上料 @@ -312,17 +313,21 @@ namespace FryPot_DosingSystem.Control //线体1任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LOnerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料 { + AgvViewModel.GetInstance().Set滚筒线上数量(1, (globalVar.LOneMaterialNum - 1).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.Yes); } //线体2任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LTworobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料 { - + AgvViewModel.GetInstance().Set滚筒线上数量(2, (globalVar.LTwoMaterialNum - 1).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.Yes); } //线体3任务上报 if (objData.state == "ROLLER_LOAD_FINISH" && objData.robotJobId == LThreerobotJobId && objData.jobData.startPointCode == "")//指定上料点上料完成,这里指线体上料 { - + AgvViewModel.GetInstance().Set滚筒线上数量(3, (globalVar.LThreeMaterialNum - 1).ToString()); + AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.Yes); } //线体1任务上报 if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指线体下料 @@ -391,34 +396,69 @@ namespace FryPot_DosingSystem.Control //线体1任务上报 if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料 { - + AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start); + AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No); + if (globalVar.LFourRollerNum >= 8) + { + AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); + } + else + { + AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + } } //线体2任务上报 if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料 { - + AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start); + AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No); + if (globalVar.LFourRollerNum >= 8) + { + AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); + } + else + { + AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + } } //线体3任务上报 if (objData.state == "ROLLER_UNLOAD_DOING" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料点正在下料,指空桶下料 { - + AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start); + AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No); + if (globalVar.LFourRollerNum >= 8) + { + AgvViewModel.GetInstance().Set滚筒线上数量(4, "8"); + } + else + { + AgvViewModel.GetInstance().Set滚筒线上数量(4, (globalVar.LFourRollerNum + 1).ToString()); + } } //线体1任务上报 if (objData.state == "DONE" && objData.robotJobId == LOnerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料 { - + AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(1); + AgvViewModel.GetInstance().Set停车桩(1, IsBool.Yes); } //线体2任务上报 if (objData.state == "DONE" && objData.robotJobId == LTworobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料 { - + AgvViewModel.GetInstance().Set小车运动(2, AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(2); + AgvViewModel.GetInstance().Set停车桩(2, IsBool.Yes); } //线体3任务上报 if (objData.state == "DONE" && objData.robotJobId == LThreerobotJobId && objData.jobData.targetPointCode == "")//指定下料位置下料完成,指空桶下料 { - + AgvViewModel.GetInstance().Set小车运动(3, AgvViewModel.GetInstance().GetCommandValue("hj")); + AgvViewModel.GetInstance().Set小车停止(3); + AgvViewModel.GetInstance().Set停车桩(3, IsBool.Yes); } #endregion + + } } @@ -467,123 +507,123 @@ namespace FryPot_DosingSystem.Control /// public void ReadPlcData() { - //ThreadManage.GetInstance().StartLong(new Action(() => - //{ - // GetAddressData("D2001", new Action((data) => - // { - // globalVar.rollerLineOne.StationOne = data[0]; - // globalVar.rollerLineOne.StationTwo = data[1]; - // globalVar.rollerLineOne.StationThree = data[2]; - // globalVar.rollerLineOne.StationFour = data[3]; - // globalVar.rollerLineOne.StationFive = data[4]; - // globalVar.rollerLineOne.StationSix = data[5]; - // globalVar.rollerLineOne.StationSeven = data[6]; - // globalVar.rollerLineOne.StationEight = data[7]; - // })); - // GetAddressData("D2011", new Action((data) => - // { - // globalVar.rollerLineTwo.StationOne = data[0]; - // globalVar.rollerLineTwo.StationTwo = data[1]; - // globalVar.rollerLineTwo.StationThree = data[2]; - // globalVar.rollerLineTwo.StationFour = data[3]; - // globalVar.rollerLineTwo.StationFive = data[4]; - // globalVar.rollerLineTwo.StationSix = data[5]; - // globalVar.rollerLineTwo.StationSeven = data[6]; - // globalVar.rollerLineTwo.StationEight = data[7]; - // })); - // GetAddressData("D2021", new Action((data) => - // { - // globalVar.rollerLineThree.StationOne = data[0]; - // globalVar.rollerLineThree.StationTwo = data[1]; - // globalVar.rollerLineThree.StationThree = data[2]; - // globalVar.rollerLineThree.StationFour = data[3]; - // globalVar.rollerLineThree.StationFive = data[4]; - // globalVar.rollerLineThree.StationSix = data[5]; - // globalVar.rollerLineThree.StationSeven = data[6]; - // globalVar.rollerLineThree.StationEight = data[7]; - // })); - // GetAddressData("D2031", new Action((data) => - // { - // 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]; - // AlarmHelper.Alarm.LOneRollerTrouble = data[6]; - // AlarmHelper.Alarm.LTwoRollerTrouble = data[7]; - // AlarmHelper.Alarm.LThreeRollerTrouble = data[8]; - - // })); - // GetAddressData("D2040", new Action((data) => - // { - // globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0]; - // globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1]; - // globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2]; - // globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3]; - // globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4]; - // })); - // GetAddressData("D2045", new Action((data) => - // { - // globalVar.fryPotOne.InputMaterialArrivedSingle = data[0]; - // globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1]; - // globalVar.fryPotThree.InputMaterialArrivedSingle = data[2]; - // globalVar.fryPotFour.InputMaterialArrivedSingle = data[3]; - // globalVar.fryPotFive.InputMaterialArrivedSingle = data[4]; - // })); - // GetAddressData("D2050", new Action((data) => - // { - // globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0]; - // globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1]; - // globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2]; - // globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3]; - // globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4]; - // })); - // GetAddressData("D2065", new Action((data) => - // { - // globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0]; - // globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1]; - // globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2]; - // globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3]; - // globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4]; - // })); - // 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]; - // AlarmHelper.Alarm.FryPotOneRollerTrouble = data[0]; - // AlarmHelper.Alarm.FryPotTwoRollerTrouble = data[1]; - // AlarmHelper.Alarm.FryPotThreeRollerTrouble = data[2]; - // AlarmHelper.Alarm.FryPotFourRollerTrouble = data[3]; - // AlarmHelper.Alarm.FryPotFiveRollerTrouble = data[4]; - // })); - // GetAddressData("D2078", new Action(data => - // { - // globalVar.rollerLineOne.RecipeCompleteSingle = data[0]; - // globalVar.rollerLineTwo.RecipeCompleteSingle = data[1]; - // globalVar.rollerLineThree.RecipeCompleteSingle = data[2]; - // })); - // GetAddressData("D2075", new Action(data => - // { + ThreadManage.GetInstance().StartLong(new Action(() => + { + GetAddressData("D2001", new Action((data) => + { + globalVar.rollerLineOne.StationOne = data[0]; + globalVar.rollerLineOne.StationTwo = data[1]; + globalVar.rollerLineOne.StationThree = data[2]; + globalVar.rollerLineOne.StationFour = data[3]; + globalVar.rollerLineOne.StationFive = data[4]; + globalVar.rollerLineOne.StationSix = data[5]; + globalVar.rollerLineOne.StationSeven = data[6]; + globalVar.rollerLineOne.StationEight = data[7]; + })); + GetAddressData("D2011", new Action((data) => + { + globalVar.rollerLineTwo.StationOne = data[0]; + globalVar.rollerLineTwo.StationTwo = data[1]; + globalVar.rollerLineTwo.StationThree = data[2]; + globalVar.rollerLineTwo.StationFour = data[3]; + globalVar.rollerLineTwo.StationFive = data[4]; + globalVar.rollerLineTwo.StationSix = data[5]; + globalVar.rollerLineTwo.StationSeven = data[6]; + globalVar.rollerLineTwo.StationEight = data[7]; + })); + GetAddressData("D2021", new Action((data) => + { + globalVar.rollerLineThree.StationOne = data[0]; + globalVar.rollerLineThree.StationTwo = data[1]; + globalVar.rollerLineThree.StationThree = data[2]; + globalVar.rollerLineThree.StationFour = data[3]; + globalVar.rollerLineThree.StationFive = data[4]; + globalVar.rollerLineThree.StationSix = data[5]; + globalVar.rollerLineThree.StationSeven = data[6]; + globalVar.rollerLineThree.StationEight = data[7]; + })); + GetAddressData("D2031", new Action((data) => + { + 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]; + AlarmHelper.Alarm.LOneRollerTrouble = data[6]; + AlarmHelper.Alarm.LTwoRollerTrouble = data[7]; + AlarmHelper.Alarm.LThreeRollerTrouble = data[8]; + + })); + GetAddressData("D2040", new Action((data) => + { + globalVar.fryPotOne.InputMaterialRollerRunningSingle = data[0]; + globalVar.fryPotTwo.InputMaterialRollerRunningSingle = data[1]; + globalVar.fryPotThree.InputMaterialRollerRunningSingle = data[2]; + globalVar.fryPotFour.InputMaterialRollerRunningSingle = data[3]; + globalVar.fryPotFive.InputMaterialRollerRunningSingle = data[4]; + })); + GetAddressData("D2045", new Action((data) => + { + globalVar.fryPotOne.InputMaterialArrivedSingle = data[0]; + globalVar.fryPotTwo.InputMaterialArrivedSingle = data[1]; + globalVar.fryPotThree.InputMaterialArrivedSingle = data[2]; + globalVar.fryPotFour.InputMaterialArrivedSingle = data[3]; + globalVar.fryPotFive.InputMaterialArrivedSingle = data[4]; + })); + GetAddressData("D2050", new Action((data) => + { + globalVar.fryPotOne.EmptyBarrelArrivedSingle = data[0]; + globalVar.fryPotTwo.EmptyBarrelArrivedSingle = data[1]; + globalVar.fryPotThree.EmptyBarrelArrivedSingle = data[2]; + globalVar.fryPotFour.EmptyBarrelArrivedSingle = data[3]; + globalVar.fryPotFive.EmptyBarrelArrivedSingle = data[4]; + })); + GetAddressData("D2065", new Action((data) => + { + globalVar.fryPotOne.EmptyBarrelRollerRunningSingle = data[0]; + globalVar.fryPotTwo.EmptyBarrelRollerRunningSingle = data[1]; + globalVar.fryPotThree.EmptyBarrelRollerRunningSingle = data[2]; + globalVar.fryPotFour.EmptyBarrelRollerRunningSingle = data[3]; + globalVar.fryPotFive.EmptyBarrelRollerRunningSingle = data[4]; + })); + 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]; + AlarmHelper.Alarm.FryPotOneRollerTrouble = data[0]; + AlarmHelper.Alarm.FryPotTwoRollerTrouble = data[1]; + AlarmHelper.Alarm.FryPotThreeRollerTrouble = data[2]; + AlarmHelper.Alarm.FryPotFourRollerTrouble = data[3]; + AlarmHelper.Alarm.FryPotFiveRollerTrouble = data[4]; + })); + GetAddressData("D2078", new Action(data => + { + globalVar.rollerLineOne.RecipeCompleteSingle = data[0]; + globalVar.rollerLineTwo.RecipeCompleteSingle = data[1]; + globalVar.rollerLineThree.RecipeCompleteSingle = data[2]; + })); + GetAddressData("D2075", new Action(data => + { - // globalVar.CleadBarrelEnterSingle = data[0]; - // })); - // GetAddressData("D2077", new Action(data => - // { + globalVar.CleadBarrelEnterSingle = data[0]; + })); + GetAddressData("D2077", new Action(data => + { - // globalVar.CleadBarrelExitSingle = data[0]; - // })); - // //globalVar.rollerLineOne.OutMaterialingSingle = 0; - // //globalVar.rollerLineOne.StationOne = 401; - // //globalVar.rollerLineOne.StationTwo = 402; - // //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1; - // // AlarmHelper.Alarm.LOneRollerTrouble =1; - // RollerLineStatusDisplay(); - // Thread.Sleep(10); - //}), "MainViewReadPlcData"); + globalVar.CleadBarrelExitSingle = data[0]; + })); + //globalVar.rollerLineOne.OutMaterialingSingle = 0; + //globalVar.rollerLineOne.StationOne = 401; + //globalVar.rollerLineOne.StationTwo = 402; + //globalVar.rollerLineOne.OutMaterialingTroubleSingle = 1; + // AlarmHelper.Alarm.LOneRollerTrouble =1; + RollerLineStatusDisplay(); + Thread.Sleep(10); + }), "MainViewReadPlcData"); } /// @@ -756,7 +796,8 @@ namespace FryPot_DosingSystem.Control //LOneFryPotOutputMaterial(); //LTwoFryPotOutputMaterial(); //LThreeFryPotOutputMaterial(); - ThreadManage.GetInstance().StartLong(new Action(() => { LineOneProcessExecute();Thread.Sleep(10); }) , "滚筒线1任务线程"); + + 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任务线程"); @@ -841,6 +882,8 @@ namespace FryPot_DosingSystem.Control { LThreeErrorRecipe = false; int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LThreeMaterialNum = result.materialCollection.Count; + globalVar.LThreeFryPotSerial = headNum; globalVar.LThreeCurrentRecipeName = result.RecipeName; MessageLog.GetInstance.ShowUserLog($"【3】号滚筒线开始制作【{result.RecipeName}】 配方"); for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 @@ -893,6 +936,8 @@ namespace FryPot_DosingSystem.Control { LTwoErrorRecipe = false; int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LTwoMaterialNum = result.materialCollection.Count; + globalVar.LTwoFryPotSerial = headNum; globalVar.LTwoCurrentRecipeName = result.RecipeName; MessageLog.GetInstance.ShowUserLog($"【2】号滚筒线开始制作【{result.RecipeName}】 配方"); for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 @@ -941,7 +986,9 @@ namespace FryPot_DosingSystem.Control if (RecipeQuene.TryDequeue(out NewRecipeModel result)) { ErrorRecipe = false; - int headNum = result.materialCollection[0].MaterialLoc / 100; ; + int headNum = result.materialCollection[0].MaterialLoc / 100; + globalVar.LOneMaterialNum = result.materialCollection.Count; + globalVar.LOneFryPotSerial = headNum; globalVar.LOneCurrentRecipeName = result.RecipeName; MessageLog.GetInstance.ShowUserLog($"【1】号滚筒线开始制作【{result.RecipeName}】 配方"); for (int i = 0; i < result.materialCollection.Count; i++) //遍历单个配方中所有物料 @@ -1119,9 +1166,17 @@ namespace FryPot_DosingSystem.Control /// public void LOneFryPotInputMaterial() { - if (OutputMaterialQuene.Count > 0 && agvArriveUnLoad && globalVar.AgvToFryPot&&!globalVar.PotOneInputMaterialArrive) + if (OutputMaterialQuene.Count > 0 && agvArriveUnLoad && globalVar.AgvToFryPot && !globalVar.PotOneInputMaterialArrive) { - MessageLog.GetInstance.ShowRunLog("AGV到达【1】号线体指定炒锅下料位置"); + if (globalVar.LOneFryPotSerial == 1) + { + AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("yc_1_1")); + } + else if (globalVar.LOneFryPotSerial == 4) + { + AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("yc_1-4")); + } + MessageLog.GetInstance.ShowRunLog($"AGV到达【{globalVar.LOneFryPotSerial}】号炒锅下料位置"); AgvArriveFryPotOneOrFourSingleSetDown(); agvArriveUnLoad = false; globalVar.PotOneInputMaterialArrive = true; @@ -1130,11 +1185,12 @@ namespace FryPot_DosingSystem.Control public void LOneFallMaterial() { - if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive&&OutputMaterialQuene.Count>0&&!globalVar.PotOneOutputRollerArrive) + if (!globalVar.InOrOutputLock && (globalVar.fryPotOne.InputMaterialArrivedSingle == 1 || globalVar.fryPotFour.InputMaterialArrivedSingle == 1) && globalVar.PotOneInputMaterialArrive && OutputMaterialQuene.Count > 0 && !globalVar.PotOneOutputRollerArrive) { FryPotOneRollerTroubleCheck(); if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//炒锅滚筒无故障 { + AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.No); //炒锅滚筒进料运行到位处理 FryPotOneOrFourInputMaterialRollerOperate(); AgvFromFryPotOneOrFourToClean();//上游下发搬运任务给AGV @@ -1150,6 +1206,14 @@ namespace FryPot_DosingSystem.Control { if (LTwoOutputMaterialQuene.Count > 0 && LTwoagvArriveUnLoad && globalVar.LTwoAgvToFryPot && !globalVar.LTwoPotInputMaterialArrive) { + if (globalVar.LTwoFryPotSerial == 2) + { + AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_2); + } + else if (globalVar.LTwoFryPotSerial == 5) + { + AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.yc_2_5); + } MessageLog.GetInstance.ShowRunLog("AGV到达【2】号线体指定炒锅下料位置"); AgvArriveFryPotTwoOrFiveSingleSetDown(); LTwoagvArriveUnLoad = false; @@ -1163,6 +1227,7 @@ namespace FryPot_DosingSystem.Control FryPotTwoRollerTroubleCheck(); if (FryPotTwoAlarm == 1 || FryPotFiveAlarm == 1)//炒锅滚筒无故障 { + AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.No); //炒锅滚筒进料运行到位处理 FryPotTwoOrFiveInputMaterialRollerOperate(); AgvFromFryPotTwoOrFiveToClean();//上游下发搬运任务给AGV @@ -1178,6 +1243,7 @@ namespace FryPot_DosingSystem.Control { if (LThreeOutputMaterialQuene.Count > 0 && LThreeagvArriveUnLoad && globalVar.LThreeAgvToFryPot && !globalVar.LThreePotInputMaterialArrive) { + AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.yc_3_3); MessageLog.GetInstance.ShowRunLog("AGV到达【3】号线体指定炒锅下料位置"); AgvArriveFryPotThreeSingleSetDown(); LThreeagvArriveUnLoad = false; @@ -1187,11 +1253,12 @@ namespace FryPot_DosingSystem.Control public void LThreeFallMaterial() { - if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive) + if (!globalVar.LThreeInOrOutputLock && globalVar.fryPotThree.InputMaterialArrivedSingle == 1 && globalVar.LThreePotInputMaterialArrive && LThreeOutputMaterialQuene.Count > 0 && !globalVar.LThreePotOutputRollerArrive) { FryPotThreeRollerTroubleCheck(); if (FryPotThreeAlarm == 1)//炒锅滚筒无故障 { + AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.No); //炒锅滚筒进料运行到位处理 FryPotThreeInputMaterialRollerOperate(); AgvFromFryPotThreeToClean();//上游下发搬运任务给AGV @@ -1241,7 +1308,7 @@ namespace FryPot_DosingSystem.Control /// public void LOneFryPotOutputMaterial() { - if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && agvArriveUpLoad && globalVar.PotOneOutputRollerArrive&& !globalVar.AgvArrivePot) + if (OutputMaterialQuene.Count > 0 && globalVar.InOrOutputLock && agvArriveUpLoad && globalVar.PotOneOutputRollerArrive && !globalVar.AgvArrivePot) { MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线对应炒锅空桶上料位置"); @@ -1252,14 +1319,24 @@ namespace FryPot_DosingSystem.Control } public void LOneEmptyOperate() { - if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1) && agvFryPotEmptyRollerArrive&&OutputMaterialQuene.Count>0&& globalVar.AgvArrivePot) + if ((globalVar.fryPotOne.EmptyBarrelArrivedSingle == 1 || globalVar.fryPotTwo.EmptyBarrelArrivedSingle == 1) && agvFryPotEmptyRollerArrive && OutputMaterialQuene.Count > 0 && globalVar.AgvArrivePot) { + FryPotOneRollerTroubleCheck(); if (FryPotAlarm == 1 || FryPotFourAlarm == 1)//无故障 { FryPotOneOrFourOutEmpetyRollerOperate(); if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { + AgvViewModel.GetInstance().Set小车是否承载物品(1, IsBool.OnllYes); + if (globalVar.LOneFryPotSerial == 1) + { + AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hs_1")); + } + else if (globalVar.LOneFryPotSerial == 4) + { + AgvViewModel.GetInstance().Set小车运动(1, AgvViewModel.GetInstance().GetCommandValue("hs_4")); + } agvFryPotEmptyRollerArrive = false; agvArriveUpLoad = false; MessageLog.GetInstance.ShowRunLog("AGV在【1】号滚筒线对应炒锅空桶上料完成,将进行空桶回收"); @@ -1271,12 +1348,13 @@ namespace FryPot_DosingSystem.Control globalVar.PotOneInputMaterialArrive = false; globalVar.PotOneOutputRollerArrive = false; globalVar.AgvArrivePot = false; + globalVar.LOneMaterialNum--; } } } } - + /// /// 线体2对应炒锅出桶 /// @@ -1302,6 +1380,15 @@ namespace FryPot_DosingSystem.Control FryPotTwoOrFiveOutEmpetyRollerOperate(); if (LTwoOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { + AgvViewModel.GetInstance().Set小车是否承载物品(2, IsBool.OnllYes); + if (globalVar.LOneFryPotSerial == 2) + { + AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_2); + } + else if (globalVar.LOneFryPotSerial == 5) + { + AgvViewModel.GetInstance().Set小车运动(2, CartMotionTrajectory.hs_5); + } LTwoagvFryPotEmptyRollerArrive = false; agvArriveLTwoUpLoad = false; MessageLog.GetInstance.ShowRunLog("AGV在【2】号滚筒线对应炒锅空桶上料完成,将进行空桶回收"); @@ -1338,11 +1425,13 @@ namespace FryPot_DosingSystem.Control if (globalVar.fryPotThree.EmptyBarrelArrivedSingle == 1 && LThreeagvFryPotEmptyRollerArrive && LThreeOutputMaterialQuene.Count > 0 && globalVar.LThreeAgvArrivePot) { FryPotThreeRollerTroubleCheck(); - if (FryPotThreeAlarm == 1 )//无故障 + if (FryPotThreeAlarm == 1)//无故障 { FryPotThreeOutEmpetyRollerOperate(); if (LThreeOutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料 { + AgvViewModel.GetInstance().Set小车是否承载物品(3, IsBool.OnllYes); + AgvViewModel.GetInstance().Set小车运动(3, CartMotionTrajectory.hs_3); LThreeagvFryPotEmptyRollerArrive = false; agvArriveLThreeUpLoad = false; MessageLog.GetInstance.ShowRunLog("AGV在【3】号滚筒线对应炒锅空桶上料完成,将进行空桶回收"); @@ -1773,15 +1862,17 @@ namespace FryPot_DosingSystem.Control /// public void AgvFromLineOneToFryPot() { - erp: if (AlarmHelper.Alarm.LOneRollerTrouble ==0) + erp: if (AlarmHelper.Alarm.LOneRollerTrouble == 0) { if (agvArriveUpLoad && globalVar.LoadRoller && globalVar.rollerLineOne.StationEight == InputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.AgvToFryPot)//无故障 { + MessageLog.GetInstance.ShowRunLog("AGV到达【1】号滚筒线装桶位置"); AgvArriveLineSingelSetDown(InputMaterialQuene); if (InputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); + AgvViewModel.GetInstance().Set滚筒线状态(1, IsRun.Start); OutputMaterialQuene.Enqueue(materialInfo); agvArriveUpLoad = false; globalVar.AgvToFryPot = true; @@ -1819,6 +1910,7 @@ namespace FryPot_DosingSystem.Control if (LTwoInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); + AgvViewModel.GetInstance().Set滚筒线状态(2, IsRun.Start); LTwoOutputMaterialQuene.Enqueue(materialInfo); agvArriveLTwoUpLoad = false; globalVar.LTwoAgvToFryPot = true; @@ -1857,6 +1949,7 @@ namespace FryPot_DosingSystem.Control if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo)) { MessageLog.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶"); + AgvViewModel.GetInstance().Set滚筒线状态(3, IsRun.Start); LThreeOutputMaterialQuene.Enqueue(materialInfo); agvArriveLThreeUpLoad = false; globalVar.LThreeAgvToFryPot = true; @@ -1889,6 +1982,9 @@ namespace FryPot_DosingSystem.Control { if (errorCode == "SUCCESS") { + AgvViewModel.GetInstance().Set停车桩(num, IsBool.No); + AgvViewModel.GetInstance().Set小车是否承载物品(num, IsBool.No); + AgvViewModel.GetInstance().Set小车运动(num, AgvViewModel.GetInstance().GetCommandValue($"qc_{num}")); MessageLog.GetInstance.ShowRunLog($"AGV去{num}号滚筒线装桶"); globalVar.AllowAgvToLineLoadRoller = false; } @@ -2010,7 +2106,7 @@ namespace FryPot_DosingSystem.Control // MessageLog.GetInstance.ShowRunLog("警告:滚筒输送线体【3】故障!!!"); // // lineAlarm = -1; //} - + } /// /// 1号线体数据下发 diff --git a/FryPot_DosingSystem/Control/GlobalVariable.cs b/FryPot_DosingSystem/Control/GlobalVariable.cs index 9975503e..0b127dd1 100644 --- a/FryPot_DosingSystem/Control/GlobalVariable.cs +++ b/FryPot_DosingSystem/Control/GlobalVariable.cs @@ -145,6 +145,15 @@ namespace FryPot_DosingSystem.Control public bool LThreePotOutputRollerArrive { get; set; } public bool LThreeAgvArrivePot { get; set; } #endregion + #region AGV视图显示变量 + public int LOneMaterialNum = 0; + public int LOneFryPotSerial = 1; + public int LTwoMaterialNum = 0; + public int LTwoFryPotSerial = 2; + public int LThreeMaterialNum = 0; + public int LThreeFryPotSerial = 3; + public int LFourRollerNum = 0; + #endregion } /// /// 滚筒线1相关变量 diff --git a/FryPot_DosingSystem/View/AgvView.xaml b/FryPot_DosingSystem/View/AgvView.xaml index d0911b4d..bbabf0c2 100644 --- a/FryPot_DosingSystem/View/AgvView.xaml +++ b/FryPot_DosingSystem/View/AgvView.xaml @@ -1116,6 +1116,7 @@ + @@ -1476,4 +1477,5 @@ + diff --git a/FryPot_DosingSystem/View/AgvView.xaml.cs b/FryPot_DosingSystem/View/AgvView.xaml.cs index 9aa2b5e0..d438a8b7 100644 --- a/FryPot_DosingSystem/View/AgvView.xaml.cs +++ b/FryPot_DosingSystem/View/AgvView.xaml.cs @@ -74,7 +74,7 @@ namespace FryPot_DosingSystem.View } catch (Exception ex) { - MessageBox.Show("只能输入 1-5 的数字!"); + MessageBox.Show("只能输入 1-4 的数字!"); return; } AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start); @@ -86,7 +86,7 @@ namespace FryPot_DosingSystem.View } catch (Exception ex) { - MessageBox.Show("只能输入 1-5 的数字!"); + MessageBox.Show("只能输入 1-4 的数字!"); return; } AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop); diff --git a/FryPot_DosingSystem/ViewModel/AgvViewModel.cs b/FryPot_DosingSystem/ViewModel/AgvViewModel.cs index 1dcf5691..05f55717 100644 --- a/FryPot_DosingSystem/ViewModel/AgvViewModel.cs +++ b/FryPot_DosingSystem/ViewModel/AgvViewModel.cs @@ -51,7 +51,7 @@ namespace FryPot_DosingSystem.ViewModel wokModel_3 = new WokModel(); wokModel_4 = new WokModel(); wokModel_5 = new WokModel(); - Test(); + // Test(); } #endregion