优化空跑逻辑

优化分BIN功能
master
lhiven 11 months ago
parent bcca9f21e8
commit 971f70a8ed

@ -117,7 +117,7 @@ namespace Rs.MotionPlat.Entitys
public ProductLocationResult GetResultBySlotIndex(int slotIndex)
{
return _Items.Where(i => i.SlotIndex == slotIndex).First();
return _Items.Where(i => i.SlotIndex == slotIndex).FirstOrDefault();
}

@ -162,22 +162,22 @@ namespace Rs.MotionPlat.Flow
//{
// StockManager.OpenTray(i);
//}
while (true)
{
if (Ops.IsOn($"满料{i}对射光电"))
{
Msgbox.ShowDialog(AlarmCollection.Get(AlarmConstID.).Transform(i), EButtonType.Ok);
//打开料仓jia'ci
Ops.Off($"料仓夹磁气缸{i}夹");
Ops.On($"料仓夹磁气缸{i}开");
Thread.Sleep(200);
Msgbox.ShowDialog(AlarmCollection.Get(AlarmConstID.).Transform(i), EButtonType.Ok);
}
else
{
break;
}
}
//while (true)
//{
// if (Ops.IsOn($"满料{i}对射光电"))
// {
// Msgbox.ShowDialog(AlarmCollection.Get(AlarmConstID.料仓有料报警).Transform(i), EButtonType.Ok);
// //打开料仓jia'ci
// Ops.Off($"料仓夹磁气缸{i}夹");
// Ops.On($"料仓夹磁气缸{i}开");
// Thread.Sleep(200);
// Msgbox.ShowDialog(AlarmCollection.Get(AlarmConstID.取走顶层料盘报警).Transform(i), EButtonType.Ok);
// }
// else
// {
// break;
// }
//}
while (true)
{

@ -283,70 +283,79 @@ namespace Rs.MotionPlat.Flow
}
break;
case EDischargeFlowStep.:
ProductLocationFlow.Instance.Grab( ETrayType.Input, takeSlotIndex);
productLocationResult = OneGrabSixteenManager.Instance.GetResults();
if(productLocationResult != null)
if(GlobalVar.RunSpace)
{
//foreach (ProductLocationResult item in results)
//{
// if(item.Result== EOneGrabSixteenResult.Slant || item.Result== EOneGrabSixteenResult.LocationOkScanBarcodeFail)
// {
// bool exit = false;
// while (!exit)
// {
// //凡是定位失败的,需要定位重拍
// ProductLocationResult vr = FixedGrabProductFlow.Instance.Grab(ETrayType.Input, item.SlotIndex);
// if (vr.Result == EOneGrabSixteenResult.Ok)//拍照OK
// {
// item.Change(vr.SN, vr.OffsetX, vr.OffsetY);
// exit = true;
// }
// else if (vr.Result == EOneGrabSixteenResult.Slant)//拍照失败
// {
// //报警弹框
// EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip| EButtonType.Retry, $"穴位{item.SlotIndex}定位失败,请把产品手动取走后点击跳过");
// if (buttonSelect == EButtonType.Skip)
// {
// GlobalTray.InputTray.ChangeStatus(item.SlotIndex, ESlotStatus.NotHave);
// exit = true;
// }
// }
// else if (vr.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)//定位成功,拍照失败
// {
// //这里需要把产品取到拍照NG料盘中
// //取料
// Nozzle idleNozzle = NozzleManager.GetIdelNozzle();
// StockTakeFlow.Instance.Take(item.SlotIndex, idleNozzle.NozzleIndex);
// //放料
// TraySlot noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
// if (noProductSlot != null)
// {
// StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
// }
// else
// {
// Msgbox.ShowDialog(EButtonType.Ok, "Retest料盘已放满请更换料盘更换完成后点击确定");
// GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave);
// ThreePointLocationFlow.Instance.Location(ETrayType.ReTest);
// //放料
// noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
// StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
// }
// exit = true;
// }
// }
// }
//}
//对结果进行处理
flowStep = EDischargeFlowStep.;
productLocationResult = OneGrabSixteenManager.Instance.GetResults();
}
else
{
ProductLocationFlow.Instance.Grab(ETrayType.Input, takeSlotIndex);
productLocationResult = OneGrabSixteenManager.Instance.GetResults();
if (productLocationResult != null)
{
//foreach (ProductLocationResult item in results)
//{
// if(item.Result== EOneGrabSixteenResult.Slant || item.Result== EOneGrabSixteenResult.LocationOkScanBarcodeFail)
// {
// bool exit = false;
// while (!exit)
// {
// //凡是定位失败的,需要定位重拍
// ProductLocationResult vr = FixedGrabProductFlow.Instance.Grab(ETrayType.Input, item.SlotIndex);
// if (vr.Result == EOneGrabSixteenResult.Ok)//拍照OK
// {
// item.Change(vr.SN, vr.OffsetX, vr.OffsetY);
// exit = true;
// }
// else if (vr.Result == EOneGrabSixteenResult.Slant)//拍照失败
// {
// //报警弹框
// EButtonType buttonSelect = Msgbox.ShowDialog(EButtonType.Skip| EButtonType.Retry, $"穴位{item.SlotIndex}定位失败,请把产品手动取走后点击跳过");
// if (buttonSelect == EButtonType.Skip)
// {
// GlobalTray.InputTray.ChangeStatus(item.SlotIndex, ESlotStatus.NotHave);
// exit = true;
// }
// }
// else if (vr.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)//定位成功,拍照失败
// {
// //这里需要把产品取到拍照NG料盘中
// //取料
// Nozzle idleNozzle = NozzleManager.GetIdelNozzle();
// StockTakeFlow.Instance.Take(item.SlotIndex, idleNozzle.NozzleIndex);
// //放料
// TraySlot noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
// if (noProductSlot != null)
// {
// StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
// }
// else
// {
// Msgbox.ShowDialog(EButtonType.Ok, "Retest料盘已放满请更换料盘更换完成后点击确定");
// GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave);
// ThreePointLocationFlow.Instance.Location(ETrayType.ReTest);
// //放料
// noProductSlot = GlobalTray.RetestTray.GetSlot(ESlotStatus.NotHave);
// StockPlaceFlow.Instance.Place(ETrayType.ReTest, noProductSlot.Index, idleNozzle.NozzleIndex);
// }
// exit = true;
// }
// }
// }
//}
//对结果进行处理
flowStep = EDischargeFlowStep.;
}
}
break;
case EDischargeFlowStep.:
ProductLocationResult ret = productLocationResult.Where(r => r.SlotIndex == takeSlotIndex).First();
ProductLocationResult ret = productLocationResult.Where(r => r.SlotIndex == takeSlotIndex).FirstOrDefault();
if(ret != null || GlobalVar.RunSpace)
{
if(ret.Result== EOneGrabSixteenResult.Ok || GlobalVar.RunSpace)
if((ret!= null && ret.Result== EOneGrabSixteenResult.Ok) || GlobalVar.RunSpace)
{
StockTakeFlow.Instance.Take( ETrayType.Input, takeSlotIndex, NozzleManager.GetIdelNozzle().NozzleIndex);
takeSlotIndex++;

@ -139,9 +139,12 @@ namespace Rs.MotionPlat.Flow.SubFlow
if (curNozzle != null)
{
targetPosition = NozzleManager.GetNozzleToFixturePos(curFixture.Index, curNozzle.NozzleIndex);
targetPosition.X += vr.OffsetX;
targetPosition.Y2 += vr.OffsetY;
MessageQueue.Instance.Insert($"相机偏移X:{vr.OffsetX},相机偏移y:{vr.OffsetY}");
if(!GlobalVar.RunSpace)
{
targetPosition.X += vr.OffsetX;
targetPosition.Y2 += vr.OffsetY;
MessageQueue.Instance.Insert($"相机偏移X:{vr.OffsetX},相机偏移y:{vr.OffsetY}");
}
if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed))
{
AxisPosPrint.PrintXY1Y2TargetPos($"到治具{curFixture.Index}放料位上方", targetPosition, GetClassName());

@ -95,11 +95,14 @@ namespace Rs.MotionPlat.Flow.SubFlow
}
targetPosition = NozzleManager.GetToTraySlot(trayType, waitTakeProductSlot.Index, curNozzle.NozzleIndex);
ProductLocationResult result = OneGrabSixteenManager.Instance.GetResultBySlotIndex(waitTakeProductSlot.Index);
if (result!=null)
if (result!=null || GlobalVar.RunSpace)
{
MessageQueue.Instance.Insert($"拍照偏移量 x:{result.OffsetX},y:{result.OffsetY}");
targetPosition.X += result.OffsetX;
targetPosition.Y2 += result.OffsetY;
if(!GlobalVar.RunSpace)
{
MessageQueue.Instance.Insert($"拍照偏移量 x:{result.OffsetX},y:{result.OffsetY}");
targetPosition.X += result.OffsetX;
targetPosition.Y2 += result.OffsetY;
}
}
if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed))
{

Loading…
Cancel
Save