From 2d7f1dcfb0cd3d6a6eb116590d3b09e59d6bcc33 Mon Sep 17 00:00:00 2001 From: lhiven Date: Tue, 10 Jun 2025 09:01:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=96=99=E5=A4=B1=E8=B4=A5=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=9B=9E=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Flow/NormalFlow/DischargeFlow.cs | 3 +- .../Flow/SubFlow/FixtureTakeFlow.cs | 73 ++++++++---- Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs | 110 +++++++++++------- 3 files changed, 119 insertions(+), 67 deletions(-) diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index 1a9d31c..a4d4ebe 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -452,7 +452,8 @@ namespace Rs.MotionPlat.Flow else if (fixtureret != null && fixtureret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail) { Nozzle idleNozzle = NozzleManager.GetIdelNozzle(); - if (!GlobalVar.ScanFailToTest) + //if (!GlobalVar.ScanFailToTest) + if(false) { StockTakeFlow.Instance.Take(ETrayType.Input, ret.SlotIndex, idleNozzle.NozzleIndex); //放料 diff --git a/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs index e75302e..3842175 100644 --- a/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs @@ -1,5 +1,6 @@ using Rs.Controls; using Rs.Framework; +using Rs.Motion.Base; using Rs.MotionPlat.Commom; using Rs.MotionPlat.Entitys; using Rs.MotionPlat.Flow.Common; @@ -32,6 +33,7 @@ namespace Rs.MotionPlat.Flow.SubFlow } public class FixtureTakeFlow { + int takeNum = 1; bool finished = true; EFixtureTakeFlowStep flowStep = EFixtureTakeFlowStep.待触发; public FixtureTakeFlow() @@ -58,6 +60,7 @@ namespace Rs.MotionPlat.Flow.SubFlow AlarmEntity alarmEntity = new AlarmEntity(); public void Take(int fixtureIndex,int nozzleIndex=-1,bool btest=false, bool needStop = true) { + takeNum = 1; if (finished) finished = false; else @@ -246,38 +249,60 @@ namespace Rs.MotionPlat.Flow.SubFlow } else { - alarmEntity = AlarmCollection.Get(AlarmConstID.治具取料失败真空报警).Transform(curNozzle.NozzleIndex, curFixture.Index); - if(alarmEntity!=null) + if (takeNum < 2) { - logInfo = alarmEntity.CN; - MessageQueue.Instance.Warn(logInfo); - EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Recheck | EButtonType.Skip | EButtonType.Retry, true); - if (buttonSelect == EButtonType.Skip) + takeNum++; + IAxis homeAxis = AxisControl.GetAxis($"NozzleZ{curNozzle.NozzleIndex}"); + if (homeAxis != null) { - MessageQueue.Instance.Insert($"{GetClassName()}选择了跳过"); - curNozzle.VacSuction(EIoOperate.Close, GetClassName()); - curNozzle.Product = null; - curNozzle.Status = ENozzleStatus.IDLE; - curFixture.Clear(); - GlobalTray.NozzleTray.ChangeStatus(curNozzle.NozzleIndex, ESlotStatus.NotHave); - finished = true; - flowStep = EFixtureTakeFlowStep.待触发; + homeAxis.Home(); + Thread.Sleep(500); + while (true) + { + if (homeAxis.HomeStatus == Motion.EHomeStatus.Finished) + { + break; + } + Thread.Sleep(100); + } } - else if (buttonSelect == EButtonType.Retry) + flowStep = EFixtureTakeFlowStep.到治具取料位上方; + } + else + { + alarmEntity = AlarmCollection.Get(AlarmConstID.治具取料失败真空报警).Transform(curNozzle.NozzleIndex, curFixture.Index); + if (alarmEntity != null) { - MessageQueue.Instance.Insert($"{GetClassName()}选择了重试"); - curNozzle.VacSuction(EIoOperate.Close, GetClassName()); - flowStep = EFixtureTakeFlowStep.到治具取料位下方1; + logInfo = alarmEntity.CN; + MessageQueue.Instance.Warn(logInfo); + EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Recheck | EButtonType.Skip | EButtonType.Retry, true); + if (buttonSelect == EButtonType.Skip) + { + MessageQueue.Instance.Insert($"{GetClassName()}选择了跳过"); + curNozzle.VacSuction(EIoOperate.Close, GetClassName()); + curNozzle.Product = null; + curNozzle.Status = ENozzleStatus.IDLE; + curFixture.Clear(); + GlobalTray.NozzleTray.ChangeStatus(curNozzle.NozzleIndex, ESlotStatus.NotHave); + finished = true; + flowStep = EFixtureTakeFlowStep.待触发; + } + else if (buttonSelect == EButtonType.Retry) + { + MessageQueue.Instance.Insert($"{GetClassName()}选择了重试"); + curNozzle.VacSuction(EIoOperate.Close, GetClassName()); + flowStep = EFixtureTakeFlowStep.到治具取料位下方1; + } + else if (buttonSelect == EButtonType.Retry) + { + MessageQueue.Instance.Insert($"{GetClassName()}选择了重新检测真空"); + } } - else if (buttonSelect == EButtonType.Retry) + else { - MessageQueue.Instance.Insert($"{GetClassName()}选择了重新检测真空"); + Msg.ShowError("Translated document cann't find item 治具取料失败真空报警"); } } - else - { - Msg.ShowError("Translated document cann't find item 治具取料失败真空报警"); - } } break; diff --git a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs index 14cd1f7..e652111 100644 --- a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs @@ -1,5 +1,6 @@ using Rs.Controls; using Rs.Framework; +using Rs.Motion.Base; using Rs.MotionPlat.Commom; using Rs.MotionPlat.Entitys; using Rs.MotionPlat.Flow.Common; @@ -36,6 +37,7 @@ namespace Rs.MotionPlat.Flow.SubFlow /// public class StockTakeFlow { + int takeNum = 1; bool finished = true; Nozzle curNozzle = null; TraySlot waitTakeProductSlot = null; @@ -68,7 +70,7 @@ namespace Rs.MotionPlat.Flow.SubFlow /// public void Take(ETrayType trayType, int slotIndex,int nozzleIndex, EStockScanBarcodeMode scanBarCodeMode= EStockScanBarcodeMode.Multi, ProductLocationResult locaResult=null,bool needStop=true) { - + takeNum = 1; if (finished) finished = false; else @@ -252,56 +254,80 @@ namespace Rs.MotionPlat.Flow.SubFlow } else { - if(GlobalVar.BinTakeFailSkip && trayType== ETrayType.Input) + if(takeNum<2) { - logInfo = GetClassName() + $"{trayType} bin {waitTakeProductSlot.Index} take fail auto skip"; - MessageQueue.Instance.Insert(logInfo); - curNozzle.VacBreak(EIoOperate.Close, GetClassName()); - curNozzle.VacSuction(EIoOperate.Close, GetClassName()); - finished = true; - flowStep = EStockTakeFlowStep.待触发; + takeNum++; + IAxis homeAxis = AxisControl.GetAxis($"NozzleZ{curNozzle.NozzleIndex}"); + if (homeAxis != null) + { + homeAxis.Home(); + Thread.Sleep(500); + while (true) + { + if (homeAxis.HomeStatus == Motion.EHomeStatus.Finished) + { + break; + } + Thread.Sleep(100); + } + } + flowStep = EStockTakeFlowStep.到料仓取料位上方; } else { - AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.排料吸嘴取料失败报警).Transform($"{curNozzle.NozzleIndex}", $"{waitTakeProductSlot.Row}", $"{waitTakeProductSlot.Column}", $"{waitTakeProductSlot.Index}"); - EButtonType btnSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.EndInput | EButtonType.Retry | EButtonType.Skip | EButtonType.Recheck, true); - switch (btnSelect) + + if (GlobalVar.BinTakeFailSkip && trayType == ETrayType.Input) { - case EButtonType.EndInput: - logInfo = GetClassName() + $"选择了结束上料"; - MessageQueue.Instance.Insert(logInfo); - GlobalVar.Clear = true; - finished = true; - flowStep = EStockTakeFlowStep.待触发; - break; - case EButtonType.Retry: - logInfo = GetClassName() + $"选择了重试"; - MessageQueue.Instance.Insert(logInfo); - curNozzle.VacBreak(EIoOperate.Close, GetClassName()); - curNozzle.VacSuction(EIoOperate.Close, GetClassName()); - //先把产品放下 - //StockPlaceFlow.Instance.Place(ETrayType.Input, waitTakeProductSlot.Index, curNozzle.NozzleIndex); - flowStep = EStockTakeFlowStep.到料仓取料位下方; - break; - case EButtonType.Recheck: - logInfo = GetClassName() + $"选择了重新检查真空"; - MessageQueue.Instance.Insert(logInfo); - flowStep = EStockTakeFlowStep.料仓取料真空吸检测; - break; - case EButtonType.Skip: - logInfo = GetClassName() + $"选择了跳过"; - curNozzle.VacBreak(EIoOperate.Close, GetClassName()); - curNozzle.VacSuction(EIoOperate.Close, GetClassName()); - MessageQueue.Instance.Insert(logInfo); - finished = true; - flowStep = EStockTakeFlowStep.待触发; - break; + logInfo = GetClassName() + $"{trayType} bin {waitTakeProductSlot.Index} take fail auto skip"; + MessageQueue.Instance.Insert(logInfo); + curNozzle.VacBreak(EIoOperate.Close, GetClassName()); + curNozzle.VacSuction(EIoOperate.Close, GetClassName()); + finished = true; + flowStep = EStockTakeFlowStep.待触发; + } + else + { + AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.排料吸嘴取料失败报警).Transform($"{curNozzle.NozzleIndex}", $"{waitTakeProductSlot.Row}", $"{waitTakeProductSlot.Column}", $"{waitTakeProductSlot.Index}"); + EButtonType btnSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.EndInput | EButtonType.Retry | EButtonType.Skip | EButtonType.Recheck, true); + switch (btnSelect) + { + case EButtonType.EndInput: + logInfo = GetClassName() + $"选择了结束上料"; + MessageQueue.Instance.Insert(logInfo); + GlobalVar.Clear = true; + finished = true; + flowStep = EStockTakeFlowStep.待触发; + break; + case EButtonType.Retry: + logInfo = GetClassName() + $"选择了重试"; + MessageQueue.Instance.Insert(logInfo); + curNozzle.VacBreak(EIoOperate.Close, GetClassName()); + curNozzle.VacSuction(EIoOperate.Close, GetClassName()); + //先把产品放下 + //StockPlaceFlow.Instance.Place(ETrayType.Input, waitTakeProductSlot.Index, curNozzle.NozzleIndex); + flowStep = EStockTakeFlowStep.到料仓取料位下方; + break; + case EButtonType.Recheck: + logInfo = GetClassName() + $"选择了重新检查真空"; + MessageQueue.Instance.Insert(logInfo); + flowStep = EStockTakeFlowStep.料仓取料真空吸检测; + break; + case EButtonType.Skip: + logInfo = GetClassName() + $"选择了跳过"; + curNozzle.VacBreak(EIoOperate.Close, GetClassName()); + curNozzle.VacSuction(EIoOperate.Close, GetClassName()); + MessageQueue.Instance.Insert(logInfo); + finished = true; + flowStep = EStockTakeFlowStep.待触发; + break; - default: - break; + default: + break; + } } } + } break; }