From 0b46395e6f0b0f2d7ec8058f4988526c36ef2c5b Mon Sep 17 00:00:00 2001 From: lhiven Date: Sun, 21 Jan 2024 15:41:16 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E7=9B=B8=E6=9C=BA?= =?UTF-8?q?=E5=8D=95=E6=8B=8D=E6=97=B6=E4=B8=8D=E5=BC=80=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs | 16 ++++----- Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs | 8 ++--- .../Flow/SubFlow/UpCameraScanBarCodeFlow.cs | 34 +++++++++---------- .../Recipe/TurnoverTrayProductLocate.cs | 4 +-- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs index 72283cb..2c86733 100644 --- a/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/DischargeFlow.cs @@ -1473,8 +1473,8 @@ namespace Rs.MotionPlat.Flow else { //如果没有粘料,说明产品放下去了,这个时候用相机检测产品是否在穴位种 - UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true,true,false); - VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); + VisionResult vr = UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true,true,false); + //VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); if (UpCameraScanBarCodeFlow.Instance.CheckResult(vr)) { logInfo = GetClassName() + $"排料吸嘴{curNozzle.NozzleIndex}号SN={curNozzle.SN}放{WitchTrayWitchSlot(curNozzle.ToType, curNozzle.ToIndex)}"; @@ -1506,8 +1506,8 @@ namespace Rs.MotionPlat.Flow case ETipButton.Retry://重拍 logInfo = GetClassName() + $"选择了重拍"; MessageQueue.Instance.Insert(logInfo); - UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true,true,true); - vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); + vr = UpCameraScanBarCodeFlow.Instance.ScanSingle(curNozzle.ToIndex + 1, true,true,true); + //vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); if (UpCameraScanBarCodeFlow.Instance.CheckResult(vr)) { logInfo = GetClassName() + $"排料吸嘴{curNozzle.NozzleIndex}号SN={curNozzle.SN}放{WitchTrayWitchSlot(curNozzle.ToType, curNozzle.ToIndex)}"; @@ -1874,8 +1874,8 @@ namespace Rs.MotionPlat.Flow if (failNum < 4) { //如果扫码失败再重扫一次 - UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true,false,true); - VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle(); + VisionResult vrsigle =UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true,false,true); + //VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle(); if (vrsigle.ScanBarCodeOK) { OnShowGrabResult?.Invoke(vrsigle, true); @@ -1976,8 +1976,8 @@ namespace Rs.MotionPlat.Flow { //如果扫码失败再重扫一次 - UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true,false,true); - VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle(); + VisionResult vrsigle =UpCameraScanBarCodeFlow.Instance.ScanSingle(vr.SlotIndex, true,false,true); + //VisionResult vrsigle = UpCameraScanBarCodeFlow.Instance.WaitSingle(); if (vrsigle.ScanBarCodeOK) { OnShowGrabResult?.Invoke(vrsigle, true); diff --git a/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs b/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs index 955820f..ab099a3 100644 --- a/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs +++ b/Rs.SkyLine/Flow/NormalFlow/TurnoverFlow.cs @@ -1919,8 +1919,8 @@ namespace Rs.MotionPlat.Flow TransitModuleSafePosFlow.Instance.GoSafePostion( EExceptionSafePos.Socket); //2 排料轴上相机过来检测 DischargeFlow.Instance.WaitCanMove(); - UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true,true,false); - VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); + VisionResult vr = UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true,true,false); + //VisionResult vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); needGoSafePos = true; if (!UpCameraScanBarCodeFlow.Instance.CheckResult(vr))//如果不在穴位中,就弹框报警 { @@ -1935,8 +1935,8 @@ namespace Rs.MotionPlat.Flow case ETipButton.Retry: logInfo = GetClassName() + "选择了重试"; MessageQueue.Instance.Insert(logInfo); - UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true,true,false); - vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); + vr = UpCameraScanBarCodeFlow.Instance.ScanSingle(slot.Index, true,true,false); + //vr = UpCameraScanBarCodeFlow.Instance.WaitSingle(); if(UpCameraScanBarCodeFlow.Instance.CheckResult(vr)) { slot.AddProduct(nozzle); diff --git a/Rs.SkyLine/Flow/SubFlow/UpCameraScanBarCodeFlow.cs b/Rs.SkyLine/Flow/SubFlow/UpCameraScanBarCodeFlow.cs index e4adc49..cd7425e 100644 --- a/Rs.SkyLine/Flow/SubFlow/UpCameraScanBarCodeFlow.cs +++ b/Rs.SkyLine/Flow/SubFlow/UpCameraScanBarCodeFlow.cs @@ -61,9 +61,9 @@ namespace Rs.MotionPlat.Flow.SubFlow Stopwatch timeout = new Stopwatch(); string logInfo = string.Empty; - VisionResult singleResult; + bool exit = true; - ManualResetEvent grabFinishedEvent = new ManualResetEvent(true); + //ManualResetEvent grabFinishedEvent = new ManualResetEvent(true); /// /// /// 开始扫码,先把所有的穴位全部扫一遍,扫不到的最后再定点扫码, /// 如果定位失败的穴位,即便没有扫到码,也不再扫码 @@ -75,7 +75,7 @@ namespace Rs.MotionPlat.Flow.SubFlow { List vReslutList = new List(); if (exit == false) return null; - grabFinishedEvent.Reset(); + //grabFinishedEvent.Reset(); SlotPoint startPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, startSlotIndex); SlotPoint endPoint = new SlotPoint(); @@ -252,7 +252,7 @@ namespace Rs.MotionPlat.Flow.SubFlow slotIndex++; } exit = true; - grabFinishedEvent.Set(); + //grabFinishedEvent.Set(); break; } } @@ -262,10 +262,11 @@ namespace Rs.MotionPlat.Flow.SubFlow } - public void ScanSingle(int SlotIndex,bool needGo=true,bool bNeedLocate=true,bool bNeedScanBarcode=true) + public VisionResult ScanSingle(int SlotIndex,bool needGo=true,bool bNeedLocate=true,bool bNeedScanBarcode=true) { - if (exit == false) return; - grabFinishedEvent.Reset(); + VisionResult singleResult = null; + if (exit == false) return null; + //grabFinishedEvent.Reset(); HObject imageSingle = new HObject(); exit = false; if(!needGo) @@ -281,7 +282,7 @@ namespace Rs.MotionPlat.Flow.SubFlow { fixedStep = EUpCameraFixedScanBarCodeFlowStep.到扫码位上方; } - Task.Run(() => { + //Task.Run(() => { while (!exit) { if (MachineManage.Instance.MachineStatus == EMachineStatus.Stop) @@ -291,7 +292,6 @@ namespace Rs.MotionPlat.Flow.SubFlow } switch (fixedStep) { - case EUpCameraFixedScanBarCodeFlowStep.到扫码位上方: SlotPoint targetPoint = TrayPointManager.GetSlotPoint(ETrayType.Turnover, SlotIndex); errCode = AxisControl.LoadX.MovePos(targetPoint.X, GlobalVar.FlyCameraSpeed); @@ -340,13 +340,13 @@ namespace Rs.MotionPlat.Flow.SubFlow singleResult = VisionManager.TurnoverTrayDumpProductOK(imageSingle, bNeedLocate, bNeedScanBarcode, SlotIndex); singleResult.SlotIndex = SlotIndex; exit = true; - grabFinishedEvent.Set(); + //grabFinishedEvent.Set(); break; } } - }); - + //}); + return singleResult; } public string GetClassName() @@ -359,11 +359,11 @@ namespace Rs.MotionPlat.Flow.SubFlow // return vReslutList; //} - public VisionResult WaitSingle() - { - grabFinishedEvent.WaitOne(); - return singleResult; - } + //public VisionResult WaitSingle() + //{ + // grabFinishedEvent.WaitOne(); + // return singleResult; + //} public bool CheckResult(VisionResult vr) { diff --git a/Rs.SkyLine/Recipe/TurnoverTrayProductLocate.cs b/Rs.SkyLine/Recipe/TurnoverTrayProductLocate.cs index c223044..3512be2 100644 --- a/Rs.SkyLine/Recipe/TurnoverTrayProductLocate.cs +++ b/Rs.SkyLine/Recipe/TurnoverTrayProductLocate.cs @@ -118,8 +118,8 @@ namespace Rs.MotionPlat.Recipe btnLocateCheck.Enabled = false; })); - UpCameraScanBarCodeFlow.Instance.ScanSingle(1,false,true,false); - VisionResult vr= UpCameraScanBarCodeFlow.Instance.WaitSingle(); + VisionResult vr = UpCameraScanBarCodeFlow.Instance.ScanSingle(1,false,true,false); + //VisionResult vr= UpCameraScanBarCodeFlow.Instance.WaitSingle(); if(vr != null) { bool result = UpCameraScanBarCodeFlow.Instance.CheckResult(vr);