From 1a2fdec3e22ce9116fa78cd36a08cd449c675bfa Mon Sep 17 00:00:00 2001 From: lhiven Date: Tue, 12 Aug 2025 08:07:33 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96IO=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=8F=AA=E6=9C=89=E7=AE=A1=E7=90=86=E5=91=98=E6=88=96?= =?UTF-8?q?=E8=80=85Vender=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=EF=BC=8C?= =?UTF-8?q?=E6=89=8D=E5=8F=AF=E4=BB=A5=E6=93=8D=E4=BD=9C=E3=80=82=202?= =?UTF-8?q?=E3=80=81IO=E5=90=8D=E7=A7=B0=E5=A2=9E=E5=8A=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=8B=B1=E6=96=87=E5=90=8D=E7=A7=B0=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rs.SkyLine/Commom/GlobalVar.cs | 14 ++++ Rs.SkyLine/Commom/Ops.cs | 75 +++++++++--------- Rs.SkyLine/FormIO2.cs | 27 ++++++- Rs.SkyLine/Home.cs | 40 ++++++---- Rs.SkyLine/Home.designer.cs | 31 -------- Rs.SkyLine/Home.resx | 106 ++++++-------------------- Rs.SkyLine/Properties/AssemblyInfo.cs | 2 +- Rs.SkyLine/TestFrm.Designer.cs | 21 +++++ 8 files changed, 148 insertions(+), 168 deletions(-) diff --git a/Rs.SkyLine/Commom/GlobalVar.cs b/Rs.SkyLine/Commom/GlobalVar.cs index 71e36c1..5103687 100644 --- a/Rs.SkyLine/Commom/GlobalVar.cs +++ b/Rs.SkyLine/Commom/GlobalVar.cs @@ -15,6 +15,7 @@ namespace Rs.Framework { public static class GlobalVar { + /// /// 是否是第一次排料任务 /// @@ -2125,5 +2126,18 @@ namespace Rs.Framework return SysConfigParam.GetValue(nameof(TurnoverNozzleAdhereOpenVacDelay)); } } + + /// + /// 检测是否加载相机 + /// + [ParameterInit("bool", "True", "system", "检测是否加载相机")] + public static bool CheckLoadVision + { + get + { + return SysConfigParam.GetValue(nameof(CheckLoadVision)); + } + } + } } diff --git a/Rs.SkyLine/Commom/Ops.cs b/Rs.SkyLine/Commom/Ops.cs index a137df4..64201bf 100644 --- a/Rs.SkyLine/Commom/Ops.cs +++ b/Rs.SkyLine/Commom/Ops.cs @@ -70,48 +70,51 @@ namespace Rs.MotionPlat.Commom #endregion #region 链接相机 - //链接相机 - ECameraErrorCode ceCode = HikCamera.Instance.Init(); - if (ceCode > ECameraErrorCode.Ok) + if(GlobalVar.CheckLoadVision) { - errNum++; - //MessageQueue.Instance.Warn(ceCode.ToString()); - Msg.ShowError("Camera open fail!!!Please try again in 30 seconds"); - System.Environment.Exit(0); - } - else - { - MessageQueue.Instance.Insert("Camera load ok!"); - - int ret = HikCamera.Instance.SetReverseX("upCamera", EDir.Y, false); - ret += HikCamera.Instance.SetReverseX("upCamera", EDir.X, false); - if (ret != 0) + //链接相机 + ECameraErrorCode ceCode = HikCamera.Instance.Init(); + if (ceCode > ECameraErrorCode.Ok) { - MessageQueue.Instance.Warn("Camera init error"); + errNum++; + //MessageQueue.Instance.Warn(ceCode.ToString()); + Msg.ShowError("Camera open fail!!!Please try again in 30 seconds"); + System.Environment.Exit(0); } - ret = 0; - ret = HikCamera.Instance.SetReverseX("downCamera", EDir.X, true); - ret += HikCamera.Instance.SetReverseX("downCamera", EDir.Y, false); - if (ret != 0) + else { - MessageQueue.Instance.Warn("Camera init error"); - } + MessageQueue.Instance.Insert("Camera load ok!"); - ret = HikCamera.Instance.StartGrab("upCamera"); - if (ret != 0) - { - MessageQueue.Instance.Warn("Camera init error"); - } - ret = HikCamera.Instance.StartGrab("locationCamera"); - if (ret != 0) - { - MessageQueue.Instance.Warn("Camera init error"); - } + int ret = HikCamera.Instance.SetReverseX("upCamera", EDir.Y, false); + ret += HikCamera.Instance.SetReverseX("upCamera", EDir.X, false); + if (ret != 0) + { + MessageQueue.Instance.Warn("Camera init error"); + } + ret = 0; + ret = HikCamera.Instance.SetReverseX("downCamera", EDir.X, true); + ret += HikCamera.Instance.SetReverseX("downCamera", EDir.Y, false); + if (ret != 0) + { + MessageQueue.Instance.Warn("Camera init error"); + } - ret = HikCamera.Instance.StartGrab("scanCamera"); - if (ret != 0) - { - MessageQueue.Instance.Warn("Camera init error"); + ret = HikCamera.Instance.StartGrab("upCamera"); + if (ret != 0) + { + MessageQueue.Instance.Warn("Camera init error"); + } + ret = HikCamera.Instance.StartGrab("locationCamera"); + if (ret != 0) + { + MessageQueue.Instance.Warn("Camera init error"); + } + + ret = HikCamera.Instance.StartGrab("scanCamera"); + if (ret != 0) + { + MessageQueue.Instance.Warn("Camera init error"); + } } } #endregion diff --git a/Rs.SkyLine/FormIO2.cs b/Rs.SkyLine/FormIO2.cs index ea4d632..31638a2 100644 --- a/Rs.SkyLine/FormIO2.cs +++ b/Rs.SkyLine/FormIO2.cs @@ -3,6 +3,7 @@ using Rs.DataAccess; using Rs.Motion; using Rs.Motion.Base; using Rs.MotionPlat.Commom; +using Rs.MotionPlat.Properties; using System; using System.Collections.Generic; using System.ComponentModel; @@ -175,8 +176,32 @@ namespace Rs.MotionPlat ClearSelect(); ((ButtonEx)sender).Selected = true; IIOCard card = (IIOCard)(((ButtonEx)sender).Tag); + bool needSave = false; + foreach(IIO io in card.DIn) + { + if(string.IsNullOrEmpty(io.ShowEnName)) + { + io.ShowEnName = io.Name; + needSave = true; + } + + } + foreach (IIO io in card.DOut) + { + if (string.IsNullOrEmpty(io.ShowEnName)) + { + io.ShowEnName = io.Name; + needSave = true; + } + + } + if(needSave) + { + card.Save(); + } if (card == null) return; - inout.LoadIO(card, btnWidth - 10, GlobalUser.UserName); + string lang=Properties.Settings.Default.DefaultLanguage=="en-US"?"EN":"CN"; + inout.LoadIO(card, btnWidth - 10, GlobalUser.UserName,lang); } } } diff --git a/Rs.SkyLine/Home.cs b/Rs.SkyLine/Home.cs index b2942e9..96c2cce 100644 --- a/Rs.SkyLine/Home.cs +++ b/Rs.SkyLine/Home.cs @@ -157,15 +157,15 @@ namespace Rs.MotionPlat } } - else if (button == btnQuit) - { - selectedButton = null; - button.Selected = false; - if(WindowsClose()) - { - System.Environment.Exit(-1); - } - } + //else if (button == btnQuit) + //{ + // selectedButton = null; + // button.Selected = false; + // if(WindowsClose()) + // { + // System.Environment.Exit(-1); + // } + //} else if (button == btnRecipe) { selectedButton = btnRecipe; @@ -267,7 +267,7 @@ namespace Rs.MotionPlat btnAbout.Selected = false; btnPermission.Selected = false; btnLanguage.Selected = false; - btnQuit.Selected = false; + //btnQuit.Selected = false; } private void Home2_Load(object sender, EventArgs e) @@ -284,7 +284,7 @@ namespace Rs.MotionPlat btnData.ShowText = "English"; btnLanguage.ShowText = "标定"; btnPermission.ShowText = "用户"; - btnQuit.ShowText = "退出"; + //btnQuit.ShowText = "退出"; } else { @@ -294,7 +294,7 @@ namespace Rs.MotionPlat btnAbout.ShowText = "Debuger"; btnLanguage.ShowText = "Vision calibration"; btnPermission.ShowText = "User"; - btnQuit.ShowText = "Quit"; + //btnQuit.ShowText = "Quit"; btnData.ShowText = "中文"; } timer1.Enabled = false; @@ -387,9 +387,13 @@ namespace Rs.MotionPlat btnLanguage.ShowText = "标定"; btnLanguage.Invalidate(); btnPermission.ShowText = "用户"; + if(!string.IsNullOrEmpty(GlobalUser.UserName)) + { + btnPermission.ShowText += $"-({GlobalUser.UserName})"; + } btnPermission.Invalidate(); - btnQuit.ShowText = "退出"; - btnQuit.Invalidate(); + //btnQuit.ShowText = "退出"; + //btnQuit.Invalidate(); } else { @@ -404,9 +408,13 @@ namespace Rs.MotionPlat btnLanguage.ShowText = "Vision calibration"; btnLanguage.Invalidate(); btnPermission.ShowText = "User"; + if (!string.IsNullOrEmpty(GlobalUser.UserName)) + { + btnPermission.ShowText += $"-({GlobalUser.UserName})"; + } btnPermission.Invalidate(); - btnQuit.ShowText = "Quit"; - btnQuit.Invalidate(); + //btnQuit.ShowText = "Quit"; + // btnQuit.Invalidate(); btnData.ShowText = "中文"; btnData.Invalidate(); } diff --git a/Rs.SkyLine/Home.designer.cs b/Rs.SkyLine/Home.designer.cs index 33daae1..c2551fb 100644 --- a/Rs.SkyLine/Home.designer.cs +++ b/Rs.SkyLine/Home.designer.cs @@ -46,8 +46,6 @@ this.btnLanguage = new Rs.Controls.ButtonEx(); this.panel14 = new System.Windows.Forms.Panel(); this.btnPermission = new Rs.Controls.ButtonEx(); - this.panel15 = new System.Windows.Forms.Panel(); - this.btnQuit = new Rs.Controls.ButtonEx(); this.panel1 = new System.Windows.Forms.Panel(); this.panel7 = new System.Windows.Forms.Panel(); this.lblMonitorFlow = new System.Windows.Forms.Label(); @@ -78,7 +76,6 @@ this.panel12.SuspendLayout(); this.panel13.SuspendLayout(); this.panel14.SuspendLayout(); - this.panel15.SuspendLayout(); this.panel1.SuspendLayout(); this.panel7.SuspendLayout(); this.panel6.SuspendLayout(); @@ -106,7 +103,6 @@ this.tableLayoutPanel2.Controls.Add(this.panel12, 4, 0); this.tableLayoutPanel2.Controls.Add(this.panel13, 5, 0); this.tableLayoutPanel2.Controls.Add(this.panel14, 6, 0); - this.tableLayoutPanel2.Controls.Add(this.panel15, 7, 0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; // // panel8 @@ -233,7 +229,6 @@ // btnLanguage // this.btnLanguage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104))))); - this.btnLanguage.ButtonType = Rs.Controls.EButtonType.Calib; this.btnLanguage.Cursor = System.Windows.Forms.Cursors.Hand; resources.ApplyResources(this.btnLanguage, "btnLanguage"); this.btnLanguage.FlatAppearance.BorderColor = System.Drawing.Color.White; @@ -270,29 +265,6 @@ this.btnPermission.UseVisualStyleBackColor = false; this.btnPermission.Click += new System.EventHandler(this.Menu_Clicked); // - // panel15 - // - this.panel15.Controls.Add(this.btnQuit); - resources.ApplyResources(this.panel15, "panel15"); - this.panel15.Name = "panel15"; - // - // btnQuit - // - this.btnQuit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104))))); - this.btnQuit.ButtonType = Rs.Controls.EButtonType.Quit; - this.btnQuit.Cursor = System.Windows.Forms.Cursors.Hand; - resources.ApplyResources(this.btnQuit, "btnQuit"); - this.btnQuit.FlatAppearance.BorderColor = System.Drawing.Color.White; - this.btnQuit.ForeColor = System.Drawing.Color.White; - this.btnQuit.Name = "btnQuit"; - this.btnQuit.Selected = false; - this.btnQuit.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(57)))), ((int)(((byte)(136)))), ((int)(((byte)(203))))); - this.btnQuit.ShowIcon = null; - this.btnQuit.ShowText = "退出"; - this.btnQuit.UnSelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(19)))), ((int)(((byte)(52)))), ((int)(((byte)(104))))); - this.btnQuit.UseVisualStyleBackColor = false; - this.btnQuit.Click += new System.EventHandler(this.Menu_Clicked); - // // panel1 // this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(46)))), ((int)(((byte)(46)))), ((int)(((byte)(46))))); @@ -452,7 +424,6 @@ this.panel12.ResumeLayout(false); this.panel13.ResumeLayout(false); this.panel14.ResumeLayout(false); - this.panel15.ResumeLayout(false); this.panel1.ResumeLayout(false); this.panel7.ResumeLayout(false); this.panel6.ResumeLayout(false); @@ -473,7 +444,6 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private Controls.ButtonEx btnPermission; private Controls.ButtonEx btnAbout; - private Controls.ButtonEx btnQuit; private Controls.ButtonEx btnLanguage; private Controls.ButtonEx btnData; private Controls.ButtonEx btnMain; @@ -508,6 +478,5 @@ private System.Windows.Forms.Panel panel12; private System.Windows.Forms.Panel panel13; private System.Windows.Forms.Panel panel14; - private System.Windows.Forms.Panel panel15; } } \ No newline at end of file diff --git a/Rs.SkyLine/Home.resx b/Rs.SkyLine/Home.resx index 454ede3..13cae64 100644 --- a/Rs.SkyLine/Home.resx +++ b/Rs.SkyLine/Home.resx @@ -145,7 +145,7 @@ 0 - 8 + 7 Fill @@ -166,7 +166,7 @@ 0, 0, 30, 0 - 199, 53 + 227, 53 2 @@ -193,7 +193,7 @@ 0, 0, 0, 0 - 199, 53 + 227, 53 0 @@ -226,7 +226,7 @@ 0, 0, 0, 0 - 199, 53 + 227, 53 0 @@ -247,13 +247,13 @@ Fill - 199, 0 + 227, 0 0, 0, 0, 0 - 199, 53 + 227, 53 1 @@ -286,7 +286,7 @@ 0, 0, 0, 0 - 199, 53 + 227, 53 1 @@ -307,13 +307,13 @@ Fill - 398, 0 + 454, 0 0, 0, 0, 0 - 199, 53 + 227, 53 2 @@ -346,7 +346,7 @@ 0, 0, 0, 0 - 199, 53 + 227, 53 6 @@ -367,13 +367,13 @@ Fill - 597, 0 + 681, 0 0, 0, 0, 0 - 199, 53 + 227, 53 3 @@ -406,7 +406,7 @@ 0, 0, 0, 0 - 199, 53 + 227, 53 3 @@ -427,13 +427,13 @@ Fill - 796, 0 + 908, 0 0, 0, 0, 0 - 199, 53 + 227, 53 4 @@ -469,7 +469,7 @@ 0, 0, 0, 0 - 199, 53 + 227, 53 4 @@ -490,13 +490,13 @@ Fill - 995, 0 + 1135, 0 0, 0, 0, 0 - 199, 53 + 227, 53 5 @@ -529,7 +529,7 @@ 0, 0, 0, 0 - 199, 53 + 232, 53 7 @@ -550,13 +550,13 @@ Fill - 1194, 0 + 1362, 0 0, 0, 0, 0 - 199, 53 + 232, 53 6 @@ -573,66 +573,6 @@ 6 - - Fill - - - Flat - - - 宋体, 14pt - - - 0, 0 - - - 0, 0, 0, 0 - - - 201, 53 - - - 5 - - - btnQuit - - - Rs.Controls.ButtonEx, Rs.Controls, Version=2.20.24.4, Culture=neutral, PublicKeyToken=null - - - panel15 - - - 0 - - - Fill - - - 1393, 0 - - - 0, 0, 0, 0 - - - 201, 53 - - - 7 - - - panel15 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel2 - - - 7 - Top @@ -664,7 +604,7 @@ 1 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="panel8" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel9" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="panel10" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="panel11" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="panel12" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="panel13" Row="0" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="panel14" Row="0" RowSpan="1" Column="6" ColumnSpan="1" /><Control Name="panel15" Row="0" RowSpan="1" Column="7" ColumnSpan="1" /></Controls><Columns Styles="Percent,12.5,Percent,12.5,Percent,12.5,Percent,12.5,Percent,12.5,Percent,12.5,Percent,12.5,Percent,12.5" /><Rows Styles="Percent,100" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="panel8" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="panel9" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="panel10" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="panel11" Row="0" RowSpan="1" Column="3" ColumnSpan="1" /><Control Name="panel12" Row="0" RowSpan="1" Column="4" ColumnSpan="1" /><Control Name="panel13" Row="0" RowSpan="1" Column="5" ColumnSpan="1" /><Control Name="panel14" Row="0" RowSpan="1" Column="6" ColumnSpan="1" /></Controls><Columns Styles="Percent,14.28571,Percent,14.28571,Percent,14.28571,Percent,14.28571,Percent,14.28571,Percent,14.28571,Percent,14.28571,Absolute,20" /><Rows Styles="Percent,100" /></TableLayoutSettings> Fill @@ -1225,6 +1165,6 @@ Home - Rs.MotionPlat.BaseFormHeader, Rs.MotionPlat, Version=3.20.24.14, Culture=neutral, PublicKeyToken=null + Rs.MotionPlat.BaseFormHeader, Rs.MotionPlat, Version=20.25.11.1, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/Rs.SkyLine/Properties/AssemblyInfo.cs b/Rs.SkyLine/Properties/AssemblyInfo.cs index 7a55711..1a03a59 100644 --- a/Rs.SkyLine/Properties/AssemblyInfo.cs +++ b/Rs.SkyLine/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ using System.Runtime.InteropServices; // //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //通过使用 "*",如下所示: - [assembly: AssemblyVersion("20.25.11.01")] + [assembly: AssemblyVersion("20.25.12.01")] //[assembly: AssemblyVersion("1.0.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Rs.SkyLine/TestFrm.Designer.cs b/Rs.SkyLine/TestFrm.Designer.cs index 5c1c1c6..f292de3 100644 --- a/Rs.SkyLine/TestFrm.Designer.cs +++ b/Rs.SkyLine/TestFrm.Designer.cs @@ -66,6 +66,7 @@ this.button30 = new System.Windows.Forms.Button(); this.button31 = new System.Windows.Forms.Button(); this.button32 = new System.Windows.Forms.Button(); + this.ioStatus1 = new Rs.Controls.IOStatus(); this.SuspendLayout(); // // btnTurnoverSlotException @@ -449,11 +450,30 @@ this.button32.UseVisualStyleBackColor = true; this.button32.Click += new System.EventHandler(this.button32_Click); // + // ioStatus1 + // + this.ioStatus1.Disabled = false; + this.ioStatus1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.ioStatus1.IoID = ((ushort)(0)); + this.ioStatus1.IoNO = ((ushort)(0)); + this.ioStatus1.Location = new System.Drawing.Point(447, 169); + this.ioStatus1.Name = "ioStatus1"; + this.ioStatus1.Passed = false; + this.ioStatus1.Radius = 5; + this.ioStatus1.Reverse = false; + this.ioStatus1.ShowNo = true; + this.ioStatus1.Size = new System.Drawing.Size(168, 36); + this.ioStatus1.Status = 1; + this.ioStatus1.TabIndex = 11; + this.ioStatus1.Text = "fsdfad"; + this.ioStatus1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // TestFrm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1336, 854); + this.Controls.Add(this.ioStatus1); this.Controls.Add(this.button32); this.Controls.Add(this.button31); this.Controls.Add(this.button30); @@ -538,5 +558,6 @@ private System.Windows.Forms.Button button30; private System.Windows.Forms.Button button31; private System.Windows.Forms.Button button32; + private Controls.IOStatus ioStatus1; } } \ No newline at end of file