From 25c6794d2dbf136593b7df7b4f88ac4dc1205099 Mon Sep 17 00:00:00 2001 From: lhiven Date: Sat, 11 Jan 2025 17:06:15 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=A2=9E=E5=8A=A0=E5=92=8C=E8=A7=86?= =?UTF-8?q?=E8=A7=89=E8=BD=AF=E4=BB=B6=E9=80=9A=E4=BF=A1=E7=9A=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Flow/SubFlow/FixturePlaceFlow.cs | 38 ++++++----- Rs.DeweyTester/Flow/SubFlow/StockPlaceFlow.cs | 64 ++++++++++--------- Rs.DeweyTester/Properties/AssemblyInfo.cs | 2 +- .../Vision/FixtureDumpProductVision.cs | 3 +- 4 files changed, 59 insertions(+), 48 deletions(-) diff --git a/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs b/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs index 2d49ae0..5ad1d64 100644 --- a/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/FixturePlaceFlow.cs @@ -115,35 +115,41 @@ namespace Rs.MotionPlat.Flow.SubFlow logInfo = $"{GetClassName()} 通知相机拍照"; MessageQueue.Instance.Insert(logInfo); Thread.Sleep(GlobalVar.FixtureTakePicDelaytime); - VisionHelper.fixtureDumpProductVision.ClearQueue(); - UpCameraHelper.Grab(); - //AxisControl.LoadY2.ComparePulse(1, false);//开始拍照 - if(GlobalVar.RunSpace) + if(VisionHelper.fixtureDumpProductVision.ClearQueue()) { - flowStep = EFixturePlaceFlowStep.到治具放料位上方; - } - else - { - vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct,$"M{curFixture.Index};"); - if(vr!=null && vr.Result) + UpCameraHelper.Grab(); + //AxisControl.LoadY2.ComparePulse(1, false);//开始拍照 + if (GlobalVar.RunSpace) { - curFixture.PlaceProductOffsetX = vr.OffsetX; - curFixture.PlaceProductOffsetY = vr.OffsetY; flowStep = EFixturePlaceFlowStep.到治具放料位上方; } else { - AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.治具放料定位失败).Transform(curFixture.Index); - if(alarmEntity!=null) + vr = VisionHelper.Grab(EVisionScene.FixtureDumpProduct, $"M{curFixture.Index};"); + if (vr != null && vr.Result) { - Msgbox.ShowDialog(alarmEntity, EButtonType.Retry,true); + curFixture.PlaceProductOffsetX = vr.OffsetX; + curFixture.PlaceProductOffsetY = vr.OffsetY; + flowStep = EFixturePlaceFlowStep.到治具放料位上方; } else { - Msg.ShowError("翻译文件中未找到 治具放料定位失败"); + AlarmEntity alarmEntity = AlarmCollection.Get(AlarmConstID.治具放料定位失败).Transform(curFixture.Index); + if (alarmEntity != null) + { + Msgbox.ShowDialog(alarmEntity, EButtonType.Retry, true); + } + else + { + Msg.ShowError("翻译文件中未找到 治具放料定位失败"); + } } } } + else + { + Msgbox.Show("send C to vision fail", EButtonType.Recheck); + } break; case EFixturePlaceFlowStep.到治具放料位上方: if (curNozzle != null) diff --git a/Rs.DeweyTester/Flow/SubFlow/StockPlaceFlow.cs b/Rs.DeweyTester/Flow/SubFlow/StockPlaceFlow.cs index 18a4c28..534ec8f 100644 --- a/Rs.DeweyTester/Flow/SubFlow/StockPlaceFlow.cs +++ b/Rs.DeweyTester/Flow/SubFlow/StockPlaceFlow.cs @@ -159,44 +159,50 @@ namespace Rs.MotionPlat.Flow.SubFlow } break; case EStockPlaceFlowStep.料仓穴位拍照: - VisionHelper.trayLocationVision.ClearQueue(); - UpCameraHelper.Grab(); - VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation); - if((vr!=null && vr.Result) || GlobalVar.RunSpace) + if(VisionHelper.trayLocationVision.ClearQueue()) { - if(GlobalVar.RunSpace) + UpCameraHelper.Grab(); + VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation); + if ((vr != null && vr.Result) || GlobalVar.RunSpace) { - flowStep = EStockPlaceFlowStep.到料仓放料位上方; - } - else - { - curNozzle = NozzleManager.GetNozzle(nozzleIndex); - slotOffsetX = vr.OffsetX; - slotOffsetY = vr.OffsetY; - string sn = ""; - if (curNozzle != null && curNozzle.Product != null && !string.IsNullOrEmpty(curNozzle.Product.SN)) - { - sn = curNozzle.Product.SN; - } - string title = "index,sn,offsetx,offsety,time\r\n"; - string content = $"{slotIndex},{sn},{slotOffsetX},{slotOffsetY},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")}\r\n"; - string dataDir = $"d://data/placestock//{DateTime.Now.ToString("yyyy-MM-dd")}"; - if (!Directory.Exists(dataDir)) + if (GlobalVar.RunSpace) { - Directory.CreateDirectory(dataDir); + flowStep = EStockPlaceFlowStep.到料仓放料位上方; } - string dataFilePath = $"{dataDir}//{GlobalVar.LotName}_{trayType}.csv"; - if (!File.Exists(dataFilePath)) + else { - File.AppendAllText(dataFilePath, title); + curNozzle = NozzleManager.GetNozzle(nozzleIndex); + slotOffsetX = vr.OffsetX; + slotOffsetY = vr.OffsetY; + string sn = ""; + if (curNozzle != null && curNozzle.Product != null && !string.IsNullOrEmpty(curNozzle.Product.SN)) + { + sn = curNozzle.Product.SN; + } + string title = "index,sn,offsetx,offsety,time\r\n"; + string content = $"{slotIndex},{sn},{slotOffsetX},{slotOffsetY},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")}\r\n"; + string dataDir = $"d://data/placestock//{DateTime.Now.ToString("yyyy-MM-dd")}"; + if (!Directory.Exists(dataDir)) + { + Directory.CreateDirectory(dataDir); + } + string dataFilePath = $"{dataDir}//{GlobalVar.LotName}_{trayType}.csv"; + if (!File.Exists(dataFilePath)) + { + File.AppendAllText(dataFilePath, title); + } + File.AppendAllText(dataFilePath, content); + flowStep = EStockPlaceFlowStep.到料仓放料位上方; } - File.AppendAllText(dataFilePath, content); - flowStep = EStockPlaceFlowStep.到料仓放料位上方; - } + } + else + { + Msgbox.ShowTipDialog(EButtonType.Retry, "stock slot location fail", "", true); + } } else { - Msgbox.ShowTipDialog(EButtonType.Retry, "stock slot location fail", "", true); + Msgbox.Show("send C to vision fail", EButtonType.Recheck); } break; case EStockPlaceFlowStep.到料仓放料位上方: diff --git a/Rs.DeweyTester/Properties/AssemblyInfo.cs b/Rs.DeweyTester/Properties/AssemblyInfo.cs index 5cfef91..2741b17 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.33")] + [assembly: AssemblyVersion("1.20.25.01")] //[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Rs.DeweyTester/Vision/FixtureDumpProductVision.cs b/Rs.DeweyTester/Vision/FixtureDumpProductVision.cs index df8831d..fe988db 100644 --- a/Rs.DeweyTester/Vision/FixtureDumpProductVision.cs +++ b/Rs.DeweyTester/Vision/FixtureDumpProductVision.cs @@ -23,7 +23,7 @@ namespace Rs.MotionPlat.Vision else { string data = Encoding.ASCII.GetString(reciveBuffer.ToArray()); - MessageQueue.Instance.Insert(data); + MessageQueue.Instance.Insert($" >>> {data}"); if (data == "M,0") { MessageQueue.Instance.Insert("视觉收到拍照指令"); @@ -31,7 +31,6 @@ namespace Rs.MotionPlat.Vision else if (data == "C,0") { visionGrabEvent.Set(); - MessageQueue.Instance.Insert($" >>> {data}"); } else {