diff --git a/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs b/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs index ab099a3..5b384b2 100644 --- a/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs @@ -158,7 +158,7 @@ namespace Rs.MotionPlat.Flow List masticSlots = new List(); bool bTakeFlag = false; bool hasUnloadFlag = false; - + int turnoverTrayToTestTrayNum = 1; /// /// 可以下料到周转盘 /// @@ -516,6 +516,10 @@ namespace Rs.MotionPlat.Flow } logInfo = GetClassName() + $"到测试放料位上方"; MessageQueue.Instance.Insert(logInfo); + if(turnoverTrayToTestTrayNum==1) + { + TestTrayHasProduct();//异步检测 + } Step = ETurnoverFlowStep.等待运动到测试放料位上方; } else @@ -534,6 +538,26 @@ namespace Rs.MotionPlat.Flow { if(Ops.IsArrived(AxisControl.TurnoverX, AxisControl.TurnoverY) || GlobalVar.VirtualAxis) { + if (turnoverTrayToTestTrayNum == 1) + { + testTrayHasProductCheckEvent.WaitOne(); + if(testTrayHasProductList!=null && testTrayHasProductList.Count>0) + { + while (true) + { + alarmInfo = $"测试穴位{testTrayHasProductList.ToJoinString()}中有产品,请取出后点击确定"; + MsgBox.ShowDialog(1, alarmInfo, ETipButton.Ok); + //再次检测 + TestTrayHasProduct(); + testTrayHasProductCheckEvent.WaitOne(); + if (testTrayHasProductList ==null || testTrayHasProductList.Count == 0) + { + break; + } + } + } + } + turnoverTrayToTestTrayNum++; if (turnoverTakeFinishe == false && TurnoverTrayManager.Instance.GetSlots(ETurnoverTraySlotType.WaitTest, ETurnoverTraySlotStatus.Have).Count() == 0) { turnoverTakeFinishe = true; @@ -997,6 +1021,7 @@ namespace Rs.MotionPlat.Flow errCode = AxisControl.TurnoverY.MovePos(targetPos, GlobalVar.WholeSpeed); if (errCode == Motion.ErrorCode.Ok || GlobalVar.VirtualAxis) { + turnoverTrayToTestTrayNum = 1; if (GlobalVar.VirtualAxis) { Thread.Sleep(GlobalVar.VirtualAxisMoveTime); @@ -2125,5 +2150,26 @@ namespace Rs.MotionPlat.Flow return false; return true; } + + ManualResetEvent testTrayHasProductCheckEvent=new ManualResetEvent(false); + private List testTrayHasProductList = new List(); + private void TestTrayHasProduct() + { + Task.Run(() => { + testTrayHasProductCheckEvent.Reset(); + testTrayHasProductList.Clear(); + //打开所有的真空 + VacManager.TestTrayVacSuction(EVacOperator.Open, true, TestTrayManager.Instance.Slots.Select(s => s.Index).ToArray()); + foreach (TestTraySlot slot in TestTrayManager.Instance.Slots) + { + if (Ops.IsOn($"测试{slot.Index}号穴位真空吸检测")) + { + testTrayHasProductList.Add(slot.Index); + } + } + VacManager.TestTrayVacSuction(EVacOperator.Close, true, TestTrayManager.Instance.Slots.Select(s => s.Index).ToArray()); + testTrayHasProductCheckEvent.Set(); + }); + } } }