增加放料到测试治具前检测穴位中是否有产品

master
lhiven 1 year ago
parent 0b46395e6f
commit 9ac66e349d

@ -158,7 +158,7 @@ namespace Rs.MotionPlat.Flow
List<int> masticSlots = new List<int>();
bool bTakeFlag = false;
bool hasUnloadFlag = false;
int turnoverTrayToTestTrayNum = 1;
/// <summary>
/// 可以下料到周转盘
/// </summary>
@ -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<int> testTrayHasProductList = new List<int>();
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();
});
}
}
}

Loading…
Cancel
Save