From d3053e5fdea2489a6721e2be30da040a349b6226 Mon Sep 17 00:00:00 2001 From: lhiven Date: Wed, 31 Jul 2024 10:43:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=A3=85=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.DeweyTester/Commom/GroupAxisMove.cs | 6 +- .../Flow/NormalFlow/DischargeFlow.cs | 56 +++++++++++-------- .../Flow/SubFlow/FixtureTakeFlow.cs | 39 +++++++++---- Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs | 38 +++++++++---- Rs.DeweyTester/Module/NozzleCollection.cs | 18 ++++++ Rs.DeweyTester/Properties/AssemblyInfo.cs | 2 +- 6 files changed, 113 insertions(+), 46 deletions(-) diff --git a/Rs.DeweyTester/Commom/GroupAxisMove.cs b/Rs.DeweyTester/Commom/GroupAxisMove.cs index f28d444..b7d7318 100644 --- a/Rs.DeweyTester/Commom/GroupAxisMove.cs +++ b/Rs.DeweyTester/Commom/GroupAxisMove.cs @@ -30,19 +30,19 @@ namespace Rs.MotionPlat.Commom } else { - alarmEntity = AlarmCollection.Get(AlarmConstID.LoadY2运动异常报警); + alarmEntity = AlarmCollection.Get(AlarmConstID.LoadY2运动异常报警).Transform(errCode.ToString()); Msgbox.ShowDialog(alarmEntity, EButtonType.Retry); } } else { - alarmEntity = AlarmCollection.Get(AlarmConstID.LoadY1运动异常报警); + alarmEntity = AlarmCollection.Get(AlarmConstID.LoadY1运动异常报警).Transform(errCode.ToString()); Msgbox.ShowDialog(alarmEntity, EButtonType.Retry); } } else { - alarmEntity = AlarmCollection.Get(AlarmConstID.LoadX运动异常报警); + alarmEntity = AlarmCollection.Get(AlarmConstID.LoadX运动异常报警).Transform(errCode.ToString()); Msgbox.ShowDialog(alarmEntity, EButtonType.Retry); } return false; diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index 5c2dbbf..cb184a0 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -552,9 +552,9 @@ namespace Rs.MotionPlat.Flow // || (num==0) // ||(NozzleManager.GetToTestNozzle() == null))) if(tounloadNum == 3 - || num == 0 + || (num == 0 && NozzleManager.GetToTestNozzle() == null) //|| NozzleManager.GetToTestNozzle() == null - ) + )//吸嘴上有3个待下的料开始下料,治具中没有料同时吸嘴上没有待测的料开始下料 { logInfo =GetClassName()+ $"clear:{GlobalVar.Clear},tounloadnum:{tounloadNum},num:{num}"; MessageQueue.Instance.Insert(logInfo); @@ -692,6 +692,11 @@ namespace Rs.MotionPlat.Flow else { //料盘放满了,更换料盘 + double curLoadX = Ops.GetCurPosition(AxisControl.LoadX); + if (curLoadX - GlobalVar.FixtureSafePosX > 50) + { + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToStock); + } DischargeModuleGoSafePosFlow.Instance.GoSafePostion(); TakeTrayFlow.Instance.Take(ETrayType.Empty, ETrayType.Ok, true, true); GlobalTray.OkTary.ChangeStatus(ESlotStatus.NotHave); @@ -755,7 +760,13 @@ namespace Rs.MotionPlat.Flow { if(TestFixtureManager.Instance.GetHaveProductFixtureList().Count()==0) { - flowStep = EDischargeFlowStep.工作完成到安全位; + double curLoadX = Ops.GetCurPosition(AxisControl.LoadX); + if (curLoadX - GlobalVar.FixtureSafePosX > 50) + { + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.PlaceToStock); + } + DischargeModuleGoSafePosFlow.Instance.GoSafePostion(ESafePosSide.Stock); + flowStep = EDischargeFlowStep.工作完成收料; } else { @@ -773,25 +784,26 @@ namespace Rs.MotionPlat.Flow #endregion - case EDischargeFlowStep.工作完成到安全位: - targetPosition.X = GlobalVar.DischargeSafePostionX; - targetPosition.Y1 = GlobalVar.StockSideY1; - targetPosition.Y2 = GlobalVar.DischargeSafePostionY2; - if(GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed)) - { - flowStep = EDischargeFlowStep.等待工作完成到安全位; - } - break; - case EDischargeFlowStep.等待工作完成到安全位: - if(Ops.IsStop("LoadX", "LoadY1", "LoadY2")) - { - AxisPosPrint.PrintXY1Y2CurrentPos("运动已停止,",GetClassName()); - if(AxisArrived.LoadXY1Y2IsArrived(targetPosition.X,targetPosition.Y1,targetPosition.Y2)) - { - flowStep = EDischargeFlowStep.工作完成收料; - } - } - break; + //case EDischargeFlowStep.工作完成到安全位: + // targetPosition.X = GlobalVar.DischargeSafePostionX; + // targetPosition.Y1 = GlobalVar.StockSideY1; + // targetPosition.Y2 = GlobalVar.DischargeSafePostionY2; + + // if(GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed)) + // { + // flowStep = EDischargeFlowStep.等待工作完成到安全位; + // } + // break; + //case EDischargeFlowStep.等待工作完成到安全位: + // if(Ops.IsStop("LoadX", "LoadY1", "LoadY2")) + // { + // AxisPosPrint.PrintXY1Y2CurrentPos("运动已停止,",GetClassName()); + // if(AxisArrived.LoadXY1Y2IsArrived(targetPosition.X,targetPosition.Y1,targetPosition.Y2)) + // { + // flowStep = EDischargeFlowStep.工作完成收料; + // } + // } + // break; case EDischargeFlowStep.工作完成收料: TakeTrayFlow.Instance.Take(ETrayType.Empty, ETrayType.Ok,true,true); TakeTrayFlow.Instance.Take(ETrayType.Empty, ETrayType.Input); diff --git a/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs index 9e39f72..cfd588c 100644 --- a/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/FixtureTakeFlow.cs @@ -234,18 +234,37 @@ namespace Rs.MotionPlat.Flow.SubFlow else { alarmEntity = AlarmCollection.Get(AlarmConstID.治具取料失败真空报警).Transform(curNozzle.NozzleIndex, curFixture.Index); - EButtonType buttonSelect = Msgbox.ShowDialog(alarmEntity, EButtonType.Recheck | EButtonType.Skip, true); - if(buttonSelect== EButtonType.Skip) + if(alarmEntity!=null) { - 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.待触发; + 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 + { + Msg.ShowError("Translated document cann't find item 治具取料失败真空报警"); } - //Msgbox.ShowTipDialog(EButtonType.Recheck, $"吸嘴{curNozzle.NozzleIndex}从治具{curFixture.Index}取料时真空检测异常,请处理","vac error",true); } break; diff --git a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs index cd9475c..4095d53 100644 --- a/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/StockTakeFlow.cs @@ -31,6 +31,8 @@ namespace Rs.MotionPlat.Flow.SubFlow public class StockTakeFlow { bool finished = true; + Nozzle curNozzle = null; + TraySlot waitTakeProductSlot = null; EStockTakeFlowStep flowStep = EStockTakeFlowStep.待触发; private StockTakeFlow() { @@ -67,8 +69,6 @@ namespace Rs.MotionPlat.Flow.SubFlow flowStep = EStockTakeFlowStep.待触发; string logInfo = string.Empty; TargetPosition targetPosition = new TargetPosition(); - Nozzle curNozzle = null; - TraySlot waitTakeProductSlot = null; while (!finished) { if (MachineManage.Instance.MachineStatus== EMachineStatus.Stop) @@ -118,7 +118,7 @@ namespace Rs.MotionPlat.Flow.SubFlow } if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed)) { - AxisPosPrint.PrintXY1Y2TargetPos($"到料仓{waitTakeProductSlot.Index}号穴位取料位上方,", targetPosition, GetClassName()); + AxisPosPrint.PrintXY1Y2TargetPos($"{WhatNozzleIndex()}到料仓{WhatTraySlot()}取料位上方,", targetPosition, GetClassName()); flowStep = EStockTakeFlowStep.等待到料仓取料位上方; } } @@ -130,7 +130,7 @@ namespace Rs.MotionPlat.Flow.SubFlow AxisPosPrint.PrintXY1Y2CurrentPos("轴XY1Y2已停止运动,", GetClassName()); if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2)) { - AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓取料位上方,", GetClassName()); + AxisPosPrint.PrintXY1Y2CurrentPos($"{WhatNozzleIndex()}已运动到料仓{WhatTraySlot()}取料位上方,", GetClassName()); flowStep = EStockTakeFlowStep.到料仓取料位下方; } else @@ -143,7 +143,7 @@ namespace Rs.MotionPlat.Flow.SubFlow targetPosition.StockZ = NozzleManager.GetNozzleToTrayTakeProductPos(ETrayType.Input, curNozzle.NozzleIndex); if (NozzleManager.Go(curNozzle, targetPosition.StockZ, GlobalVar.WholeSpeed)) { - logInfo = $"{GetClassName()}到料仓取料位下方,tz:{targetPosition.StockZ}"; + logInfo = $"{GetClassName()}{WhatNozzleIndex()}到料仓{WhatTraySlot()}取料位下方,tz:{targetPosition.StockZ}"; MessageQueue.Instance.Insert(logInfo); flowStep = EStockTakeFlowStep.等待到料仓取料位下方; } @@ -151,8 +151,8 @@ namespace Rs.MotionPlat.Flow.SubFlow case EStockTakeFlowStep.等待到料仓取料位下方: if (Ops.IsStop($"NozzleZ{curNozzle.NozzleIndex}")) { - Thread.Sleep(200); - logInfo = $"{GetClassName()} 已运动到料仓取料位下方"; + Thread.Sleep(100); + logInfo = $"{GetClassName()}{WhatNozzleIndex()}已运动到料仓{WhatTraySlot()}取料位下方:{curNozzle.GetCurrentPos()}"; MessageQueue.Instance.Insert(logInfo); if (!GlobalVar.RunSpace) { @@ -173,7 +173,7 @@ namespace Rs.MotionPlat.Flow.SubFlow case EStockTakeFlowStep.等待料仓取料完成抬起: if (Ops.IsStop($"NozzleZ{curNozzle.NozzleIndex}")) { - logInfo =$"{GetClassName()} 料仓取料完成已抬起"; + logInfo =$"{GetClassName()} 料仓取料完成已抬起:{curNozzle.GetCurrentPos()}"; MessageQueue.Instance.Insert(logInfo); flowStep = EStockTakeFlowStep.料仓取料真空吸检测; } @@ -195,11 +195,11 @@ namespace Rs.MotionPlat.Flow.SubFlow } curNozzle.Status = ENozzleStatus.ToTest; //curNozzle.Status = ENozzleStatus.ToUnload; - GlobalTray.NozzleTray.ChangeStatus(curNozzle.NozzleIndex, ESlotStatus.Have); + curNozzle.ChangeStatus(ESlotStatus.Have); GlobalTray.InputTray.ChangeStatus(waitTakeProductSlot.Index, ESlotStatus.NotHave); if(curNozzle.Product!=null) { - logInfo = $"{GetClassName()} from r{waitTakeProductSlot.Row + 1}c{waitTakeProductSlot.Column + 1} 穴位索引:{waitTakeProductSlot.Index} 产品:{curNozzle.Product.SN}被吸嘴{curNozzle.NozzleIndex}取料完成,"; + logInfo = $"{GetClassName()} from r{waitTakeProductSlot.Row + 1}c{waitTakeProductSlot.Column + 1} 穴位索引:{WhatTraySlot()} 产品:{curNozzle.Product.SN}被{WhatNozzleIndex()}取料完成,"; MessageQueue.Instance.Insert(logInfo); } @@ -252,5 +252,23 @@ namespace Rs.MotionPlat.Flow.SubFlow { return $"{nameof(StockTakeFlow)}-"; } + + /// + /// 获取几号吸嘴 + /// + /// + private string WhatNozzleIndex() + { + return $"{curNozzle.NozzleIndex}号吸嘴"; + } + + /// + /// 获取料仓的几号穴位 + /// + /// + private string WhatTraySlot() + { + return $"{waitTakeProductSlot.Index}号穴位"; + } } } diff --git a/Rs.DeweyTester/Module/NozzleCollection.cs b/Rs.DeweyTester/Module/NozzleCollection.cs index c1d115d..52a7e40 100644 --- a/Rs.DeweyTester/Module/NozzleCollection.cs +++ b/Rs.DeweyTester/Module/NozzleCollection.cs @@ -129,6 +129,24 @@ namespace Rs.MotionPlat.Commom { return Ops.IsOn($"吸料真空{NozzleIndex}检测"); } + + /// + /// 获取当前吸嘴的位置 + /// + /// + public double GetCurrentPos() + { + return Ops.GetCurPosition(NozzleName); + } + + /// + /// 切换吸嘴的状态 + /// + /// + public void ChangeStatus(ESlotStatus status) + { + GlobalTray.NozzleTray.ChangeStatus(NozzleIndex, status); + } } public static class NozzleManager diff --git a/Rs.DeweyTester/Properties/AssemblyInfo.cs b/Rs.DeweyTester/Properties/AssemblyInfo.cs index 3557bd2..bc696e0 100644 --- a/Rs.DeweyTester/Properties/AssemblyInfo.cs +++ b/Rs.DeweyTester/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ using System.Runtime.InteropServices; // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: - [assembly: AssemblyVersion("1.20.24.03")] + [assembly: AssemblyVersion("1.20.24.06")] //[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]