From 971f70a8ed43b84d1bd665d739f34ac4b1710279 Mon Sep 17 00:00:00 2001 From: lhiven Date: Tue, 9 Jul 2024 17:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=A9=BA=E8=B7=91=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20=E4=BC=98=E5=8C=96=E5=88=86BIN=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entitys/OneGrabSixteenManager.cs | 2 +- Rs.DeweyTester/Flow/HomeFlow.cs | 32 ++--- .../Flow/NormalFlow/DischargeFlow.cs | 123 ++++++++++-------- .../Flow/SubFlow/FixturePlaceFlow.cs | 9 +- Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs | 11 +- 5 files changed, 96 insertions(+), 81 deletions(-) diff --git a/Rs.DeweyTester/Entitys/OneGrabSixteenManager.cs b/Rs.DeweyTester/Entitys/OneGrabSixteenManager.cs index c57f2dc..7223843 100644 --- a/Rs.DeweyTester/Entitys/OneGrabSixteenManager.cs +++ b/Rs.DeweyTester/Entitys/OneGrabSixteenManager.cs @@ -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(); } diff --git a/Rs.DeweyTester/Flow/HomeFlow.cs b/Rs.DeweyTester/Flow/HomeFlow.cs index aaec29d..1c0e755 100644 --- a/Rs.DeweyTester/Flow/HomeFlow.cs +++ b/Rs.DeweyTester/Flow/HomeFlow.cs @@ -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) { diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index c6efc81..fc2dff7 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -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++; diff --git a/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs index 81c5590..c6f7c06 100644 --- a/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs @@ -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()); diff --git a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs index 97c5181..c7eed36 100644 --- a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs @@ -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)) {