From 315532395c5921c93079578b7bed9f44ba5f926e Mon Sep 17 00:00:00 2001 From: lhiven Date: Sat, 20 Jul 2024 07:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=9B=BE=E7=89=87UI=E7=9A=84=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.SkyLine/Commom/GlobalVar.cs | 11 ++ Rs.SkyLine/FormMain.cs | 183 +++++++++--------- Rs.SkyLine/SysConfig/CommonConfig.Designer.cs | 10 + Rs.SkyLine/SysConfig/CommonConfig.en-US.resx | 9 + Rs.SkyLine/SysConfig/CommonConfig.resx | 86 +++++--- 5 files changed, 182 insertions(+), 117 deletions(-) diff --git a/Rs.SkyLine/Commom/GlobalVar.cs b/Rs.SkyLine/Commom/GlobalVar.cs index f53fbe1..84d76c2 100644 --- a/Rs.SkyLine/Commom/GlobalVar.cs +++ b/Rs.SkyLine/Commom/GlobalVar.cs @@ -1992,5 +1992,16 @@ namespace Rs.Framework } } + /// + /// 启用刷新图片UI + /// + [ParameterInit("bool", "True", "system", "启用刷新图片UI")] + public static bool EnableRefreshImageUI + { + get + { + return SysConfigParam.GetValue(nameof(EnableRefreshImageUI)); + } + } } } diff --git a/Rs.SkyLine/FormMain.cs b/Rs.SkyLine/FormMain.cs index 997dcf6..ced4c86 100644 --- a/Rs.SkyLine/FormMain.cs +++ b/Rs.SkyLine/FormMain.cs @@ -41,43 +41,46 @@ namespace Rs.MotionPlat private void Instance_OnMatchResult(List obj) { - int i = 1; - foreach (MatchResult matchResult in obj) + if(GlobalVar.EnableRefreshImageUI) { - HWindow_Final hwin = null; - if (i == 9) return; - switch (i) + int i = 1; + foreach (MatchResult matchResult in obj) { - case 1: hwin = himgNozzle1; break; - case 2: hwin = himgNozzle2; break; - case 3: hwin = himgNozzle3; break; - case 4: hwin = himgNozzle4; break; - case 5: hwin = himgNozzle5; break; - case 6: hwin = himgNozzle6; break; - case 7: hwin = himgNozzle7; break; - case 8: hwin = himgNozzle8; break; - default: - break; - } - if (hwin != null) - { - hwin.ClearWindow(); - hwin.HobjectToHimage(matchResult.Himage); - if (matchResult.IsOK) + HWindow_Final hwin = null; + if (i == 9) return; + switch (i) { - hwin.DispObj(matchResult.ContourXld, "green"); - string OffsetCol = matchResult.OffsetCol.ToString("0.000"); - string OffsetRow = matchResult.OffsetRow.ToString("0.000"); - string OffsetA = matchResult.OffsetA.ToString("0.000"); - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"X:{OffsetCol}", 200, 20, "green"); - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"Y:{OffsetRow}", 400, 20, "green"); - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"R:{OffsetA}", 600, 20, "green"); + case 1: hwin = himgNozzle1; break; + case 2: hwin = himgNozzle2; break; + case 3: hwin = himgNozzle3; break; + case 4: hwin = himgNozzle4; break; + case 5: hwin = himgNozzle5; break; + case 6: hwin = himgNozzle6; break; + case 7: hwin = himgNozzle7; break; + case 8: hwin = himgNozzle8; break; + default: + break; } - else + if (hwin != null) { - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "NG", 20, 20, "red"); + hwin.ClearWindow(); + hwin.HobjectToHimage(matchResult.Himage); + if (matchResult.IsOK) + { + hwin.DispObj(matchResult.ContourXld, "green"); + string OffsetCol = matchResult.OffsetCol.ToString("0.000"); + string OffsetRow = matchResult.OffsetRow.ToString("0.000"); + string OffsetA = matchResult.OffsetA.ToString("0.000"); + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"X:{OffsetCol}", 200, 20, "green"); + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"Y:{OffsetRow}", 400, 20, "green"); + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"R:{OffsetA}", 600, 20, "green"); + } + else + { + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "NG", 20, 20, "red"); + } + i++; } - i++; } } } @@ -344,72 +347,74 @@ namespace Rs.MotionPlat private void Instance_OnShowGrabResult(VisionResult matchResult, bool arg2) { - HWindow_Final hwin = null; - switch (matchResult.SlotIndex) - { - case 1: hwin = hwin_turnoverSlot1; break; - case 2: hwin = hwin_turnoverSlot2; break; - case 3: hwin = hwin_turnoverSlot3; break; - case 4: hwin = hwin_turnoverSlot4; break; - case 5: hwin = hwin_turnoverSlot5; break; - case 6: hwin = hwin_turnoverSlot6; break; - case 7: hwin = hwin_turnoverSlot7; break; - case 8: hwin = hwin_turnoverSlot8; break; - case 9: hwin = hwin_turnoverSlot9; break; - case 10: hwin = hwin_turnoverSlot10; break; - case 11: hwin = hwin_turnoverSlot11; break; - case 12: hwin = hwin_turnoverSlot12; break; - case 13: hwin = hwin_turnoverSlot13; break; - case 14: hwin = hwin_turnoverSlot14; break; - case 15: hwin = hwin_turnoverSlot15; break; - case 16: hwin = hwin_turnoverSlot16; break; - case 17: hwin = hwin_turnoverSlot17; break; - case 18: hwin = hwin_turnoverSlot18; break; - case 19: hwin = hwin_turnoverSlot19; break; - case 20: hwin = hwin_turnoverSlot20; break; - case 21: hwin = hwin_turnoverSlot21; break; - case 22: hwin = hwin_turnoverSlot22; break; - case 23: hwin = hwin_turnoverSlot23; break; - case 24: hwin = hwin_turnoverSlot24; break; - case 25: hwin = hwin_turnoverSlot25; break; - case 26: hwin = hwin_turnoverSlot26; break; - case 27: hwin = hwin_turnoverSlot27; break; - case 28: hwin = hwin_turnoverSlot28; break; - case 29: hwin = hwin_turnoverSlot29; break; - case 30: hwin = hwin_turnoverSlot30; break; - case 31: hwin = hwin_turnoverSlot31; break; - case 32: hwin = hwin_turnoverSlot32; break; - default: - break; - } - if (hwin != null) - { - hwin.ClearWindow(); - if (arg2) + if (GlobalVar.EnableRefreshImageUI) + { + HWindow_Final hwin = null; + switch (matchResult.SlotIndex) + { + case 1: hwin = hwin_turnoverSlot1; break; + case 2: hwin = hwin_turnoverSlot2; break; + case 3: hwin = hwin_turnoverSlot3; break; + case 4: hwin = hwin_turnoverSlot4; break; + case 5: hwin = hwin_turnoverSlot5; break; + case 6: hwin = hwin_turnoverSlot6; break; + case 7: hwin = hwin_turnoverSlot7; break; + case 8: hwin = hwin_turnoverSlot8; break; + case 9: hwin = hwin_turnoverSlot9; break; + case 10: hwin = hwin_turnoverSlot10; break; + case 11: hwin = hwin_turnoverSlot11; break; + case 12: hwin = hwin_turnoverSlot12; break; + case 13: hwin = hwin_turnoverSlot13; break; + case 14: hwin = hwin_turnoverSlot14; break; + case 15: hwin = hwin_turnoverSlot15; break; + case 16: hwin = hwin_turnoverSlot16; break; + case 17: hwin = hwin_turnoverSlot17; break; + case 18: hwin = hwin_turnoverSlot18; break; + case 19: hwin = hwin_turnoverSlot19; break; + case 20: hwin = hwin_turnoverSlot20; break; + case 21: hwin = hwin_turnoverSlot21; break; + case 22: hwin = hwin_turnoverSlot22; break; + case 23: hwin = hwin_turnoverSlot23; break; + case 24: hwin = hwin_turnoverSlot24; break; + case 25: hwin = hwin_turnoverSlot25; break; + case 26: hwin = hwin_turnoverSlot26; break; + case 27: hwin = hwin_turnoverSlot27; break; + case 28: hwin = hwin_turnoverSlot28; break; + case 29: hwin = hwin_turnoverSlot29; break; + case 30: hwin = hwin_turnoverSlot30; break; + case 31: hwin = hwin_turnoverSlot31; break; + case 32: hwin = hwin_turnoverSlot32; break; + default: + break; + } + if (hwin != null) { - if (matchResult.ScanBarCodeOK) + hwin.ClearWindow(); + if (arg2) { - string SN = matchResult.SN; - hwin.HobjectToHimage(matchResult.SourceImage); - HOperatorSet.GetImageSize(matchResult.SourceImage, out HTuple w, out HTuple h); - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"sn:{SN}", h-200, 20, "green"); + if (matchResult.ScanBarCodeOK) + { + string SN = matchResult.SN; + hwin.HobjectToHimage(matchResult.SourceImage); + HOperatorSet.GetImageSize(matchResult.SourceImage, out HTuple w, out HTuple h); + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, $"sn:{SN}", h - 200, 20, "green"); + } + else + { + hwin.HobjectToHimage(matchResult.SourceImage); + HOperatorSet.GetImageSize(matchResult.SourceImage, out HTuple w, out HTuple h); + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "NG", h - 200, 20, "red"); + } } else { - hwin.HobjectToHimage(matchResult.SourceImage); - HOperatorSet.GetImageSize(matchResult.SourceImage, out HTuple w, out HTuple h); - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "NG", h-200, 20, "red"); + //加载默认图片 + hwin.HobjectToHimage(defaultImage); + HOperatorSet.GetImageSize(defaultImage, out HTuple w, out HTuple h); + HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "no product", h - 200, 20, "red"); } } - else - { - //加载默认图片 - hwin.HobjectToHimage(defaultImage); - HOperatorSet.GetImageSize(defaultImage, out HTuple w, out HTuple h); - HalconTool.DispMessage(hwin.hWindowControl.HalconWindow, "no product", h-200, 20, "red"); - } } - } private void btnWholeHome_Load(object sender, EventArgs e) diff --git a/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs b/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs index 667504c..3a8be37 100644 --- a/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs +++ b/Rs.SkyLine/SysConfig/CommonConfig.Designer.cs @@ -55,6 +55,7 @@ this.cboxDisableIonFanCheck = new System.Windows.Forms.CheckBox(); this.cboxDisablePPressCheck = new System.Windows.Forms.CheckBox(); this.cboxSocketHasProductCheck = new System.Windows.Forms.CheckBox(); + this.cboxEnableRefreshImageUI = new System.Windows.Forms.CheckBox(); this.cboxEnableWorkEnviromentCheck = new System.Windows.Forms.CheckBox(); this.cboxDisableNPressCheck = new System.Windows.Forms.CheckBox(); this.cboxEnableTestFixtureFiberCheck = new System.Windows.Forms.CheckBox(); @@ -174,6 +175,7 @@ this.groupBox8.Controls.Add(this.cboxDisableIonFanCheck); this.groupBox8.Controls.Add(this.cboxDisablePPressCheck); this.groupBox8.Controls.Add(this.cboxSocketHasProductCheck); + this.groupBox8.Controls.Add(this.cboxEnableRefreshImageUI); this.groupBox8.Controls.Add(this.cboxEnableWorkEnviromentCheck); this.groupBox8.Controls.Add(this.cboxDisableNPressCheck); this.groupBox8.Controls.Add(this.cboxEnableTestFixtureFiberCheck); @@ -349,6 +351,13 @@ this.cboxSocketHasProductCheck.UseVisualStyleBackColor = true; this.cboxSocketHasProductCheck.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged); // + // cboxEnableRefreshImageUI + // + resources.ApplyResources(this.cboxEnableRefreshImageUI, "cboxEnableRefreshImageUI"); + this.cboxEnableRefreshImageUI.Name = "cboxEnableRefreshImageUI"; + this.cboxEnableRefreshImageUI.UseVisualStyleBackColor = true; + this.cboxEnableRefreshImageUI.CheckedChanged += new System.EventHandler(this.cbox_CheckedChanged); + // // cboxEnableWorkEnviromentCheck // resources.ApplyResources(this.cboxEnableWorkEnviromentCheck, "cboxEnableWorkEnviromentCheck"); @@ -1003,5 +1012,6 @@ private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label10; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + private System.Windows.Forms.CheckBox cboxEnableRefreshImageUI; } } \ No newline at end of file diff --git a/Rs.SkyLine/SysConfig/CommonConfig.en-US.resx b/Rs.SkyLine/SysConfig/CommonConfig.en-US.resx index d68ec36..59c495a 100644 --- a/Rs.SkyLine/SysConfig/CommonConfig.en-US.resx +++ b/Rs.SkyLine/SysConfig/CommonConfig.en-US.resx @@ -253,6 +253,15 @@ Socket piggy back check + + 614, 166 + + + 144, 16 + + + Enable refresh image + 30, 170 diff --git a/Rs.SkyLine/SysConfig/CommonConfig.resx b/Rs.SkyLine/SysConfig/CommonConfig.resx index bc75b76..2eeb0d9 100644 --- a/Rs.SkyLine/SysConfig/CommonConfig.resx +++ b/Rs.SkyLine/SysConfig/CommonConfig.resx @@ -189,6 +189,9 @@ Default + + 52, 325 + ID @@ -387,8 +390,8 @@ 83, 12 - - 52, 325 + + groupBox1 35, 12 @@ -412,7 +415,7 @@ 59, 12 - Rs.MotionPlat.BaseForm, Rs.MotionPlat, Version=3.20.24.22, Culture=neutral, PublicKeyToken=null + Rs.MotionPlat.BaseForm, Rs.MotionPlat, Version=3.20.24.35, Culture=neutral, PublicKeyToken=null False @@ -492,8 +495,8 @@ 保存 - - groupBox1 + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100, 21 @@ -507,6 +510,9 @@ lblWholeSpeed + + groupBox8 + groupBox1 @@ -603,9 +609,6 @@ Fill - - NoControl - False @@ -661,7 +664,7 @@ 43 - 23 + 24 39, 70 @@ -735,6 +738,9 @@ 35, 12 + + True + 8 @@ -756,6 +762,9 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + NoControl + groupBox1 @@ -789,8 +798,8 @@ 是否显示 - - NoControl + + 重拍次数: NoControl @@ -861,9 +870,6 @@ NoControl - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - True @@ -894,6 +900,9 @@ 0 + + 8 + False @@ -955,7 +964,7 @@ NoControl - 21 + 22 53 @@ -1020,6 +1029,9 @@ groupBox4 + + 35, 12 + True @@ -1060,7 +1072,7 @@ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 24 + 25 System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1152,6 +1164,9 @@ 1 + + 96, 16 + 72, 16 @@ -1206,6 +1221,9 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 20 + 83, 12 @@ -1213,7 +1231,7 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 22 + 23 Menu @@ -1377,9 +1395,6 @@ cboxCurRecipe - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - False @@ -1491,6 +1506,9 @@ True + + NoControl + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1515,6 +1533,9 @@ 0 + + True + 0 @@ -1707,6 +1728,9 @@ 1 + + 启用刷新图片 + NoControl @@ -1965,6 +1989,9 @@ 73, 24 + + 174, 137 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 @@ -1977,8 +2004,8 @@ True - - True + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 2 @@ -1999,7 +2026,7 @@ 1 - 20 + 21 禁用检测治具是否锁定 @@ -2079,8 +2106,8 @@ System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 35, 12 + + NoControl txtDischargeRetakeNum @@ -2166,6 +2193,9 @@ groupBox8 + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + groupBox8 @@ -2394,9 +2424,6 @@ System.Windows.Forms.DataGridViewTextBoxColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 重拍次数: - NoControl @@ -2601,6 +2628,9 @@ groupBox4 + + cboxEnableRefreshImageUI + 0