From 03f886c447f88ba75accf7f827df3461b5c1d233 Mon Sep 17 00:00:00 2001 From: lhiven Date: Mon, 17 Mar 2025 10:51:37 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E6=96=99=E4=BB=93?= =?UTF-8?q?=E5=A4=B9=E7=88=AA=E6=9D=BE=E5=BC=80=E5=92=8C=E5=A4=B9=E7=B4=A7?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E5=87=BD=E6=95=B0=E5=90=8D=E7=A7=B0=202?= =?UTF-8?q?=E3=80=81=E5=8D=95=E6=8B=8D=E6=89=AB=E7=A0=81=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E6=97=B6=E5=A2=9E=E5=8A=A0=E4=BA=8C=E7=BB=B4=E7=A0=81=E9=95=BF?= =?UTF-8?q?=E5=BA=A6=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.DeweyTester/Entitys/TestFixtureManager.cs | 8 +++ .../Flow/NormalFlow/DischargeFlow.cs | 68 +++---------------- Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs | 10 ++- Rs.DeweyTester/Flow/NormalFlow/Stock1Flow.cs | 2 +- Rs.DeweyTester/Flow/NormalFlow/Stock2Flow.cs | 4 +- Rs.DeweyTester/Flow/NormalFlow/Stock3Flow.cs | 4 +- .../Flow/NormalFlow/StockFlowBase.cs | 24 +++---- .../Flow/NormalFlow/StockManager.cs | 28 ++++++-- Rs.DeweyTester/FrmDialog.cs | 6 +- Rs.DeweyTester/Properties/AssemblyInfo.cs | 2 +- 10 files changed, 72 insertions(+), 84 deletions(-) diff --git a/Rs.DeweyTester/Entitys/TestFixtureManager.cs b/Rs.DeweyTester/Entitys/TestFixtureManager.cs index 37a3864..a401db8 100644 --- a/Rs.DeweyTester/Entitys/TestFixtureManager.cs +++ b/Rs.DeweyTester/Entitys/TestFixtureManager.cs @@ -914,6 +914,14 @@ namespace Rs.MotionPlat.Entitys public class TestFixtureManager { TestFixture[] testFixtures=new TestFixture[6]; + + public void ClearDataAll() + { + foreach (var tf in testFixtures) + { + tf.ClearData(); + } + } private TestFixtureManager() { for (int i = 1; i <= 6; i++) diff --git a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs index ed29aba..4d3351e 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/DischargeFlow.cs @@ -185,7 +185,7 @@ namespace Rs.MotionPlat.Flow } } - button = Msgbox.ShowTipDialog(EButtonType.Ok | EButtonType.Cancel, "Are you sure clean data ?\r\n clean click OK\r\n no clean click Cancel"); + button = Msgbox.ShowTipDialog(EButtonType.Ok | EButtonType.Cancel, "Are you sure you want to clear the data ?\r\n clear click OK\r\n not clear click Cancel"); if (button == EButtonType.Ok) { logInfo = GetClassName() + "选择了OK"; @@ -194,12 +194,13 @@ namespace Rs.MotionPlat.Flow //lastFixtureIndex = TestFixtureManager.Instance.GetEnableFixtureList().Select(f => f.Index).Min() - 1; //lastFixtureIndex = checkFixtureList[0] - 1; - TestFixtureManager.Instance.GetTestFixture(1).ClearData(); - TestFixtureManager.Instance.GetTestFixture(2).ClearData(); - TestFixtureManager.Instance.GetTestFixture(3).ClearData(); - TestFixtureManager.Instance.GetTestFixture(4).ClearData(); - TestFixtureManager.Instance.GetTestFixture(5).ClearData(); - TestFixtureManager.Instance.GetTestFixture(6).ClearData(); + //TestFixtureManager.Instance.GetTestFixture(1).ClearData(); + //TestFixtureManager.Instance.GetTestFixture(2).ClearData(); + //TestFixtureManager.Instance.GetTestFixture(3).ClearData(); + //TestFixtureManager.Instance.GetTestFixture(4).ClearData(); + //TestFixtureManager.Instance.GetTestFixture(5).ClearData(); + //TestFixtureManager.Instance.GetTestFixture(6).ClearData(); + TestFixtureManager.Instance.ClearDataAll(); GlobalTray.NgTray.ChangeStatus(ESlotStatus.NotHave); GlobalTray.RetestTray.ChangeStatus(ESlotStatus.NotHave); GlobalTray.OkTary.ChangeStatus(ESlotStatus.NotHave); @@ -210,28 +211,7 @@ namespace Rs.MotionPlat.Flow } else { - var t1 = Task.Run(() => { - StockManager.CloseTray(1); - }); - var t2 = Task.Run(() => { - StockManager.CloseTray(2); - }); - var t3 = Task.Run(() => { - StockManager.CloseTray(3); - }); - Task.WaitAll(new[] { t1,t2,t3}); - - var t4 = Task.Run(() => { - StockManager.OpenTray(1); - }); - var t5 = Task.Run(() => { - StockManager.OpenTray(2); - }); - var t6 = Task.Run(() => { - StockManager.OpenTray(3); - }); - Task.WaitAll(new[] { t4,t5,t6}); - + StockManager.ClampAfterReleaseAll(); flowStep = EDischargeFlowStep.工作前准备; } @@ -240,35 +220,7 @@ namespace Rs.MotionPlat.Flow { logInfo = GetClassName() + "选择了Cancel"; MessageQueue.Instance.Insert(logInfo); - - var t1 = Task.Run(() => { - StockManager.CloseTray(1); - }); - var t2 = Task.Run(() => { - StockManager.CloseTray(2); - }); - var t3 = Task.Run(() => { - StockManager.CloseTray(3); - }); - Task.WaitAll(new[] { t1, t2, t3 }); - - var t4 = Task.Run(() => { - StockManager.OpenTray(1); - }); - var t5 = Task.Run(() => { - StockManager.OpenTray(2); - }); - var t6 = Task.Run(() => { - StockManager.OpenTray(3); - }); - Task.WaitAll(new[] { t4, t5, t6 }); - //StockManager.CloseTray(1); - //StockManager.CloseTray(2); - //StockManager.CloseTray(3); - - //StockManager.OpenTray(1); - //StockManager.OpenTray(2); - //StockManager.OpenTray(3); + StockManager.ClampAfterReleaseAll(); flowStep = EDischargeFlowStep.工作前准备; } } diff --git a/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs b/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs index d28479a..7635923 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/GrrFlow.cs @@ -277,7 +277,15 @@ namespace Rs.MotionPlat.Flow vProductResult.Parse(msg); if ((vProductResult != null && vProductResult.Result == EOneGrabSixteenResult.Ok) || GlobalVar.RunSpace) { - flowStep = EGrrFlowStep.到料仓取料位上方; + if(vProductResult.SN.Length==GlobalVar.BarcodeLength) + { + flowStep = EGrrFlowStep.到料仓取料位上方; + } + else + { + alarmEntity = AlarmCollection.Get(AlarmConstID.二维码长度异常报警); + Msgbox.ShowDialog(alarmEntity, EButtonType.Retry); + } } else if (vProductResult != null && vProductResult.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail) { diff --git a/Rs.DeweyTester/Flow/NormalFlow/Stock1Flow.cs b/Rs.DeweyTester/Flow/NormalFlow/Stock1Flow.cs index 9389d95..265de7b 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/Stock1Flow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/Stock1Flow.cs @@ -92,7 +92,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow //料盘准备就绪 Status = EStockStatus.Ready; //夹紧料盘 - HoldTray(); + ClampTray(); GlobalTray.OkTary.ChangeStatus(Controls.ESlotStatus.NotHave); MessageQueue.Instance.Insert("Ok料盘准备就绪"); return; diff --git a/Rs.DeweyTester/Flow/NormalFlow/Stock2Flow.cs b/Rs.DeweyTester/Flow/NormalFlow/Stock2Flow.cs index b455a77..4ddda0b 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/Stock2Flow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/Stock2Flow.cs @@ -79,7 +79,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow Status = EStockStatus.Ready; MessageQueue.Instance.Insert("ready"); //夹紧料盘 - HoldTray(); + ClampTray(); GlobalTray.InputTray.ChangeStatus(Controls.ESlotStatus.Have); return; } @@ -96,7 +96,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow { logInfo = GetClassName() + $"当前层:{GetCurrentLayer()}检测到料盘"; MessageQueue.Instance.Insert(logInfo); - HoldTray(); + ClampTray(); GlobalTray.InputTray.ChangeStatus(Controls.ESlotStatus.Have); Status = EStockStatus.Ready; MessageQueue.Instance.Insert("ready"); diff --git a/Rs.DeweyTester/Flow/NormalFlow/Stock3Flow.cs b/Rs.DeweyTester/Flow/NormalFlow/Stock3Flow.cs index fb8e210..fe25b98 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/Stock3Flow.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/Stock3Flow.cs @@ -83,8 +83,8 @@ namespace Rs.MotionPlat.Flow.NormalFlow { if (HasTray()) { - HoldTray(); - LooseTray(); + ClampTray(); + ReleaseTray(); Status = EStockStatus.Ready; MessageQueue.Instance.Insert("ready"); return; diff --git a/Rs.DeweyTester/Flow/NormalFlow/StockFlowBase.cs b/Rs.DeweyTester/Flow/NormalFlow/StockFlowBase.cs index 7f68860..bf54cf0 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/StockFlowBase.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/StockFlowBase.cs @@ -152,7 +152,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow { outStockStep = EOutStockFlowStep.出仓; } - else if (stopwatch.ElapsedMilliseconds > 5000) + else if (stopwatch.ElapsedMilliseconds > 20000) { Msg.ShowError(AlarmCollection.Get(AlarmConstID.抽屉锁原位异常报警).Transform(StockIndex).CN); outStockStep = EOutStockFlowStep.打开抽屉锁; @@ -169,7 +169,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow FlashLight(); outStockFinished = true; } - else if (stopwatch.ElapsedMilliseconds > 5000) + else if (stopwatch.ElapsedMilliseconds > 30000) { Msg.ShowError(AlarmCollection.Get(AlarmConstID.抽屉拉伸气缸动位异常).Transform(StockIndex).CN); outStockStep = EOutStockFlowStep.出仓; @@ -209,7 +209,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow { inStockStep = EInStockFlowStep.等待进仓信号; } - else if (stopwatch.ElapsedMilliseconds > 5000) + else if (stopwatch.ElapsedMilliseconds > 20000) { Msgbox.ShowTipDialog(EButtonType.Retry, "抽屉锁原位异常,请处理后点击重试","error",true); } @@ -258,7 +258,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow inStockFinished = true; } } - else if (stopwatch.ElapsedMilliseconds > 5000) + else if (stopwatch.ElapsedMilliseconds > 30000) { Msg.ShowError(AlarmCollection.Get(AlarmConstID.抽屉锁动位异常报警).Transform(StockIndex).CN); inStockStep = EInStockFlowStep.关闭开抽屉锁; @@ -293,7 +293,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow } if(Ops.IsOn($"料仓夹磁气缸{StockIndex}动位")) { - LooseTray(); + ReleaseTray(); } CurrentLayer--; targetPosition.StockZ = GetStockZPosByLayer(CurrentLayer); @@ -313,7 +313,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow MessageQueue.Instance.Insert(logInfo); if (HasTray()) { - HoldTray(); + ClampTray(); Thread.Sleep(GlobalVar.StepMotorMoveDelayTime); } break; @@ -334,7 +334,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow return; } //下降之前松开料盘 - LooseTray(); + ReleaseTray(); CurrentLayer++; targetPosition.StockZ = GetStockZPosByLayer(CurrentLayer); errCode = AxisControl.GetAxis($"StockZ{StockIndex}").MovePos(targetPosition.StockZ, GlobalVar.WholeSpeed); @@ -348,7 +348,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow Thread.Sleep(GlobalVar.StepMotorMoveDelayTime); break; } - else if (stopwatch.ElapsedMilliseconds > 5000) + else if (stopwatch.ElapsedMilliseconds > 30000) { //运动异常报警 errCode = AxisControl.GetAxis($"StockZ{StockIndex}").MovePos(targetPosition.StockZ, GlobalVar.WholeSpeed); @@ -360,7 +360,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow /// /// 松开料盘 /// - public void LooseTray() + public void ReleaseTray() { StockModule.ClampTrayCylinder(EIoOperate.Open, StockIndex,GetClassName()); stopwatch.Restart(); @@ -371,7 +371,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow Thread.Sleep(1000); break; } - else if(stopwatch.ElapsedMilliseconds>5000) + else if(stopwatch.ElapsedMilliseconds>30000) { AlarmEntity alarmEntity = AlarmCollection.Get($"料仓{StockIndex}夹磁气缸原位异常"); if(alarmEntity != null ) @@ -392,7 +392,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow /// /// 抓紧料盘 /// - public void HoldTray() + public void ClampTray() { StockModule.ClampTrayCylinder(EIoOperate.Close, StockIndex, GetClassName()); stopwatch.Restart(); @@ -405,7 +405,7 @@ namespace Rs.MotionPlat.Flow.NormalFlow Thread.Sleep(1000); return; } - else if (stopwatch.ElapsedMilliseconds > 5000) + else if (stopwatch.ElapsedMilliseconds > 30000) { AlarmEntity alarmEntity = AlarmCollection.Get($"料仓{StockIndex}夹磁气缸动位异常"); if(alarmEntity != null ) diff --git a/Rs.DeweyTester/Flow/NormalFlow/StockManager.cs b/Rs.DeweyTester/Flow/NormalFlow/StockManager.cs index 2050fb3..46db6ea 100644 --- a/Rs.DeweyTester/Flow/NormalFlow/StockManager.cs +++ b/Rs.DeweyTester/Flow/NormalFlow/StockManager.cs @@ -12,6 +12,22 @@ namespace Rs.MotionPlat.Flow.NormalFlow static Stock2Flow stock2 = new Stock2Flow(); static Stock3Flow stock3 = new Stock3Flow(); + /// + /// 夹紧后打开料盘夹,在第一次启动时使用 + /// + public static void ClampAfterReleaseAll() + { + Task[] tasks = new Task[3]; + tasks[0] = Task.Run(() => { stock1.ClampTray(); }); + tasks[1] = Task.Run(() => { stock2.ClampTray(); }); + tasks[2] = Task.Run(() => { stock3.ClampTray(); }); + Task.WaitAll(tasks); + tasks[0] = Task.Run(() => { stock1.ReleaseTray(); }); + tasks[1] = Task.Run(() => { stock2.ReleaseTray(); }); + tasks[2] = Task.Run(() => { stock3.ReleaseTray(); }); + Task.WaitAll(tasks); + } + /// /// 出仓 /// @@ -98,13 +114,13 @@ namespace Rs.MotionPlat.Flow.NormalFlow switch (stockIndex) { case 1: - stock1.LooseTray(); + stock1.ReleaseTray(); break; case 2: - stock2.LooseTray(); + stock2.ReleaseTray(); break; case 3: - stock3.LooseTray(); + stock3.ReleaseTray(); break; default: break; @@ -116,13 +132,13 @@ namespace Rs.MotionPlat.Flow.NormalFlow switch (stockIndex) { case 1: - stock1.HoldTray(); + stock1.ClampTray(); break; case 2: - stock2.HoldTray(); + stock2.ClampTray(); break; case 3: - stock3.HoldTray(); + stock3.ClampTray(); break; default: break; diff --git a/Rs.DeweyTester/FrmDialog.cs b/Rs.DeweyTester/FrmDialog.cs index 1baadb5..bff533d 100644 --- a/Rs.DeweyTester/FrmDialog.cs +++ b/Rs.DeweyTester/FrmDialog.cs @@ -105,7 +105,7 @@ namespace Rs.MotionPlat { this.HeadText= title; } - this.lblContent.Text= cnContent; + ReloadLanguage(); //遍历 string[] buttons = Enum.GetNames(typeof(EButtonType)); foreach (string button in buttons.Reverse()) @@ -232,6 +232,10 @@ namespace Rs.MotionPlat public void ReloadLanguage() { + if(string.IsNullOrEmpty(enContent)) + { + enContent = cnContent; + } string lang = Properties.Settings.Default.DefaultLanguage; if (lang == "zh-CN") { diff --git a/Rs.DeweyTester/Properties/AssemblyInfo.cs b/Rs.DeweyTester/Properties/AssemblyInfo.cs index 3e027a9..d9ad3b0 100644 --- a/Rs.DeweyTester/Properties/AssemblyInfo.cs +++ b/Rs.DeweyTester/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ using System.Runtime.InteropServices; // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: - [assembly: AssemblyVersion("20.25.14.1")] + [assembly: AssemblyVersion("20.25.14.3")] //[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")]