From a5f3550a5c2c0ce513d8c6a4a13efa291f6d6a4f Mon Sep 17 00:00:00 2001 From: gongxh Date: Mon, 27 Dec 2021 21:39:45 +0800 Subject: [PATCH] 1 --- CleanMachine.Control/LSwitchButton.cs | 4 +- CleanMachineHMI/CleanMachineHMI.csproj | 3 +- .../FrmUserControl/frmMainDetail.Designer.cs | 71 ++++++++----------- .../FrmUserControl/frmMainDetail.cs | 29 ++++---- CleanMachineHMI/Utils/PlcOperationHelper.cs | 26 ++++--- CleanMachineHMI/packages.config | 1 + 6 files changed, 68 insertions(+), 66 deletions(-) diff --git a/CleanMachine.Control/LSwitchButton.cs b/CleanMachine.Control/LSwitchButton.cs index 849ca4d..aee6bf4 100644 --- a/CleanMachine.Control/LSwitchButton.cs +++ b/CleanMachine.Control/LSwitchButton.cs @@ -186,6 +186,8 @@ namespace CleanMachineHMI private void TTimer_Tick(object sender, EventArgs e) { + + bool b = (_IsOpen?(iNow>=0):(iNow<=iDuration)); if (b) { @@ -251,7 +253,7 @@ namespace CleanMachineHMI protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); - e.Graphics.SmoothingMode = SmoothingMode.HighQuality; + // e.Graphics.SmoothingMode = SmoothingMode.HighQuality; Pen penBarBack = new Pen(_CloseColor, _BarHight); Pen penBarFore = new Pen(_OpenColor, _BarHight); diff --git a/CleanMachineHMI/CleanMachineHMI.csproj b/CleanMachineHMI/CleanMachineHMI.csproj index 4eb748d..01507df 100644 --- a/CleanMachineHMI/CleanMachineHMI.csproj +++ b/CleanMachineHMI/CleanMachineHMI.csproj @@ -121,8 +121,7 @@ ..\packages\Krypton.Toolkit.5.550.2108.1\lib\net45\Krypton.Toolkit.dll - False - ..\public\NModbus4.dll + ..\packages\NModbus4.2.1.0\lib\net40\NModbus4.dll diff --git a/CleanMachineHMI/FrmUserControl/frmMainDetail.Designer.cs b/CleanMachineHMI/FrmUserControl/frmMainDetail.Designer.cs index e1c259a..73a1f2c 100644 --- a/CleanMachineHMI/FrmUserControl/frmMainDetail.Designer.cs +++ b/CleanMachineHMI/FrmUserControl/frmMainDetail.Designer.cs @@ -558,7 +558,7 @@ namespace CleanMachineHMI.FrmUserControl this.swtbtn_fullPalletMod.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(225))))); this.swtbtn_fullPalletMod.L_AnimateType = LEase.LEaseType.Quartic; this.swtbtn_fullPalletMod.L_BarHight = 24; - this.swtbtn_fullPalletMod.L_CloseColor = System.Drawing.Color.Red; + this.swtbtn_fullPalletMod.L_CloseColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.swtbtn_fullPalletMod.L_DotColor = System.Drawing.Color.White; this.swtbtn_fullPalletMod.L_DotHight = 20; this.swtbtn_fullPalletMod.L_IsOpen = false; @@ -577,7 +577,7 @@ namespace CleanMachineHMI.FrmUserControl this.swtbtn_staticBar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(225))))); this.swtbtn_staticBar.L_AnimateType = LEase.LEaseType.Quartic; this.swtbtn_staticBar.L_BarHight = 24; - this.swtbtn_staticBar.L_CloseColor = System.Drawing.Color.Red; + this.swtbtn_staticBar.L_CloseColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.swtbtn_staticBar.L_DotColor = System.Drawing.Color.White; this.swtbtn_staticBar.L_DotHight = 20; this.swtbtn_staticBar.L_IsOpen = false; @@ -628,7 +628,7 @@ namespace CleanMachineHMI.FrmUserControl this.swtbtn_nozzle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(225))))); this.swtbtn_nozzle1.L_AnimateType = LEase.LEaseType.Quartic; this.swtbtn_nozzle1.L_BarHight = 24; - this.swtbtn_nozzle1.L_CloseColor = System.Drawing.Color.Red; + this.swtbtn_nozzle1.L_CloseColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.swtbtn_nozzle1.L_DotColor = System.Drawing.Color.White; this.swtbtn_nozzle1.L_DotHight = 20; this.swtbtn_nozzle1.L_IsOpen = false; @@ -663,7 +663,7 @@ namespace CleanMachineHMI.FrmUserControl // // cbt_ResetSys // - this.cbt_ResetSys.BackColor = System.Drawing.Color.DarkOrange; + this.cbt_ResetSys.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(153)))), ((int)(((byte)(0))))); this.cbt_ResetSys.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cbt_ResetSys.ForeColor = System.Drawing.Color.White; this.cbt_ResetSys.Location = new System.Drawing.Point(173, 41); @@ -685,7 +685,7 @@ namespace CleanMachineHMI.FrmUserControl // // cbt_StopTran // - this.cbt_StopTran.BackColor = System.Drawing.Color.Red; + this.cbt_StopTran.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.cbt_StopTran.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cbt_StopTran.ForeColor = System.Drawing.Color.White; this.cbt_StopTran.Location = new System.Drawing.Point(98, 41); @@ -702,7 +702,7 @@ namespace CleanMachineHMI.FrmUserControl this.swtbtn_brush3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(225))))); this.swtbtn_brush3.L_AnimateType = LEase.LEaseType.Quartic; this.swtbtn_brush3.L_BarHight = 24; - this.swtbtn_brush3.L_CloseColor = System.Drawing.Color.Red; + this.swtbtn_brush3.L_CloseColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.swtbtn_brush3.L_DotColor = System.Drawing.Color.White; this.swtbtn_brush3.L_DotHight = 20; this.swtbtn_brush3.L_IsOpen = false; @@ -717,7 +717,7 @@ namespace CleanMachineHMI.FrmUserControl // // cbt_StartTran // - this.cbt_StartTran.BackColor = System.Drawing.Color.Lime; + this.cbt_StartTran.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(190)))), ((int)(((byte)(107))))); this.cbt_StartTran.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.cbt_StartTran.Location = new System.Drawing.Point(23, 41); this.cbt_StartTran.Name = "cbt_StartTran"; @@ -743,7 +743,7 @@ namespace CleanMachineHMI.FrmUserControl this.swtbtn_brush1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(225))))); this.swtbtn_brush1.L_AnimateType = LEase.LEaseType.Quartic; this.swtbtn_brush1.L_BarHight = 24; - this.swtbtn_brush1.L_CloseColor = System.Drawing.Color.Red; + this.swtbtn_brush1.L_CloseColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.swtbtn_brush1.L_DotColor = System.Drawing.Color.White; this.swtbtn_brush1.L_DotHight = 20; this.swtbtn_brush1.L_IsOpen = false; @@ -786,7 +786,7 @@ namespace CleanMachineHMI.FrmUserControl this.swtbtn_brush2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(191)))), ((int)(((byte)(219)))), ((int)(((byte)(225))))); this.swtbtn_brush2.L_AnimateType = LEase.LEaseType.Quartic; this.swtbtn_brush2.L_BarHight = 24; - this.swtbtn_brush2.L_CloseColor = System.Drawing.Color.Red; + this.swtbtn_brush2.L_CloseColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.swtbtn_brush2.L_DotColor = System.Drawing.Color.White; this.swtbtn_brush2.L_DotHight = 20; this.swtbtn_brush2.L_IsOpen = false; @@ -896,8 +896,8 @@ namespace CleanMachineHMI.FrmUserControl this.kbtn_Scrap_1.Location = new System.Drawing.Point(261, 263); this.kbtn_Scrap_1.Name = "kbtn_Scrap_1"; this.kbtn_Scrap_1.Size = new System.Drawing.Size(60, 60); - this.kbtn_Scrap_1.StateCommon.Back.Color1 = System.Drawing.Color.Red; - this.kbtn_Scrap_1.StateCommon.Back.Color2 = System.Drawing.Color.Red; + this.kbtn_Scrap_1.StateCommon.Back.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); + this.kbtn_Scrap_1.StateCommon.Back.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.kbtn_Scrap_1.StateCommon.Back.ColorStyle = Krypton.Toolkit.PaletteColorStyle.Solid; this.kbtn_Scrap_1.StateCommon.Content.ShortText.Color1 = System.Drawing.Color.White; this.kbtn_Scrap_1.StateCommon.Content.ShortText.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -911,8 +911,8 @@ namespace CleanMachineHMI.FrmUserControl this.kbtn_Scrap.Location = new System.Drawing.Point(45, 263); this.kbtn_Scrap.Name = "kbtn_Scrap"; this.kbtn_Scrap.Size = new System.Drawing.Size(60, 60); - this.kbtn_Scrap.StateCommon.Back.Color1 = System.Drawing.Color.Red; - this.kbtn_Scrap.StateCommon.Back.Color2 = System.Drawing.Color.Red; + this.kbtn_Scrap.StateCommon.Back.Color1 = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); + this.kbtn_Scrap.StateCommon.Back.Color2 = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(64)))), ((int)(((byte)(20))))); this.kbtn_Scrap.StateCommon.Back.ColorStyle = Krypton.Toolkit.PaletteColorStyle.Solid; this.kbtn_Scrap.StateCommon.Content.ShortText.Color1 = System.Drawing.Color.White; this.kbtn_Scrap.StateCommon.Content.ShortText.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); @@ -1183,7 +1183,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel13.AutoSize = false; this.kryptonWrapLabel13.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel13.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel13.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel13.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel13.Name = "kryptonWrapLabel13"; @@ -1256,7 +1256,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel12.AutoSize = false; this.kryptonWrapLabel12.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel12.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel12.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel12.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel12.Name = "kryptonWrapLabel12"; @@ -1329,7 +1329,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel11.AutoSize = false; this.kryptonWrapLabel11.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel11.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel11.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel11.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel11.Name = "kryptonWrapLabel11"; @@ -1402,7 +1402,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel10.AutoSize = false; this.kryptonWrapLabel10.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel10.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel10.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel10.Name = "kryptonWrapLabel10"; @@ -1464,7 +1464,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel3.AutoSize = false; this.kryptonWrapLabel3.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel3.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel3.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel3.Name = "kryptonWrapLabel3"; @@ -1575,7 +1575,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel21.AutoSize = false; this.kryptonWrapLabel21.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel21.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel21.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel21.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel21.Name = "kryptonWrapLabel21"; @@ -1648,7 +1648,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel9.AutoSize = false; this.kryptonWrapLabel9.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel9.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel9.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel9.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel9.Name = "kryptonWrapLabel9"; @@ -1721,7 +1721,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel8.AutoSize = false; this.kryptonWrapLabel8.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel8.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel8.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel8.Name = "kryptonWrapLabel8"; @@ -1794,7 +1794,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel7.AutoSize = false; this.kryptonWrapLabel7.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel7.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel7.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel7.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel7.Name = "kryptonWrapLabel7"; @@ -1867,7 +1867,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel6.AutoSize = false; this.kryptonWrapLabel6.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel6.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel6.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel6.Name = "kryptonWrapLabel6"; @@ -1929,7 +1929,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel2.AutoSize = false; this.kryptonWrapLabel2.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel2.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel2.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel2.Name = "kryptonWrapLabel2"; @@ -1980,7 +1980,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel19.AutoSize = false; this.kryptonWrapLabel19.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel19.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel19.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel19.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel19.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel19.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel19.Name = "kryptonWrapLabel19"; @@ -2042,7 +2042,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel5.AutoSize = false; this.kryptonWrapLabel5.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel5.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel5.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel5.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel5.Name = "kryptonWrapLabel5"; @@ -2099,7 +2099,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel17.AutoSize = false; this.kryptonWrapLabel17.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel17.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel17.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel17.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel17.Name = "kryptonWrapLabel17"; @@ -2172,7 +2172,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel16.AutoSize = false; this.kryptonWrapLabel16.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel16.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel16.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel16.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel16.Name = "kryptonWrapLabel16"; @@ -2245,7 +2245,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel15.AutoSize = false; this.kryptonWrapLabel15.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel15.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel15.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel15.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel15.Name = "kryptonWrapLabel15"; @@ -2318,7 +2318,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel14.AutoSize = false; this.kryptonWrapLabel14.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel14.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel14.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel14.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel14.Name = "kryptonWrapLabel14"; @@ -2380,7 +2380,7 @@ namespace CleanMachineHMI.FrmUserControl this.kryptonWrapLabel4.AutoSize = false; this.kryptonWrapLabel4.Dock = System.Windows.Forms.DockStyle.Fill; this.kryptonWrapLabel4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.kryptonWrapLabel4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(66)))), ((int)(((byte)(139))))); + this.kryptonWrapLabel4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.kryptonWrapLabel4.LabelStyle = Krypton.Toolkit.LabelStyle.NormalControl; this.kryptonWrapLabel4.Location = new System.Drawing.Point(0, 0); this.kryptonWrapLabel4.Name = "kryptonWrapLabel4"; @@ -2414,7 +2414,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnParamater.Name = "btnParamater"; this.btnParamater.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnParamater.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnParamater.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnParamater.Size = new System.Drawing.Size(124, 47); this.btnParamater.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnParamater.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2454,7 +2453,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnLogin.Name = "btnLogin"; this.btnLogin.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnLogin.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnLogin.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnLogin.Size = new System.Drawing.Size(64, 47); this.btnLogin.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnLogin.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2494,7 +2492,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnBase.Name = "btnBase"; this.btnBase.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnBase.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnBase.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnBase.Size = new System.Drawing.Size(116, 47); this.btnBase.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnBase.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2534,7 +2531,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnWarningLog.Name = "btnWarningLog"; this.btnWarningLog.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnWarningLog.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnWarningLog.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnWarningLog.Size = new System.Drawing.Size(68, 47); this.btnWarningLog.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnWarningLog.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2574,7 +2570,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnPrinter.Name = "btnPrinter"; this.btnPrinter.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnPrinter.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnPrinter.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnPrinter.Size = new System.Drawing.Size(154, 47); this.btnPrinter.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnPrinter.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2614,7 +2609,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnIR.Name = "btnIR"; this.btnIR.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnIR.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnIR.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnIR.Size = new System.Drawing.Size(105, 47); this.btnIR.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnIR.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2654,7 +2648,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnPLCConfig.Name = "btnPLCConfig"; this.btnPLCConfig.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnPLCConfig.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnPLCConfig.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnPLCConfig.Size = new System.Drawing.Size(120, 47); this.btnPLCConfig.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnPLCConfig.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2694,7 +2687,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnIO.Name = "btnIO"; this.btnIO.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnIO.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnIO.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnIO.Size = new System.Drawing.Size(60, 47); this.btnIO.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnIO.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; @@ -2734,7 +2726,6 @@ namespace CleanMachineHMI.FrmUserControl this.btnManual.Name = "btnManual"; this.btnManual.OverrideDefault.Back.Color1 = System.Drawing.Color.WhiteSmoke; this.btnManual.OverrideDefault.Back.Color2 = System.Drawing.Color.LightSteelBlue; - this.btnManual.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem; this.btnManual.Size = new System.Drawing.Size(71, 47); this.btnManual.StateCommon.Content.ShortText.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnManual.StateNormal.Back.Color1 = System.Drawing.Color.WhiteSmoke; diff --git a/CleanMachineHMI/FrmUserControl/frmMainDetail.cs b/CleanMachineHMI/FrmUserControl/frmMainDetail.cs index 2decc4e..823893f 100644 --- a/CleanMachineHMI/FrmUserControl/frmMainDetail.cs +++ b/CleanMachineHMI/FrmUserControl/frmMainDetail.cs @@ -1319,6 +1319,7 @@ namespace CleanMachineHMI.FrmUserControl } else { + BeginInvoke(new Action(() => { cbt_Brush3StatusTran.BackColor = Color.Gray; @@ -2079,20 +2080,20 @@ namespace CleanMachineHMI.FrmUserControl private void btnIO_Click(object sender, EventArgs e) { - //GlobalHelper.MainForm.navigatorMain.SetNavPage(Domain.Enums.EnumFormType.IoMonitor); - //frmMainNew.SwitchFrmMenu(EnumFormType.IoMonitor, false); - if (GlobalHelper.IoMonitor_2 == null) - { - frmIoMonitorNew frm = new frmIoMonitorNew(); - GlobalHelper.IoMonitor_2 = frm; - GlobalHelper.IoMonitor_2.Activate(); - GlobalHelper.IoMonitor_2.ShowDialog(); - } - else - { - GlobalHelper.IoMonitor_2.Activate(); - GlobalHelper.IoMonitor_2.ShowDialog(); - } + //GlobalHelper.MainFormNew.navigatorMain.SetNavPage(Domain.Enums.EnumFormType.IoMonitor); + frmMainNew.SwitchFrmMenu(EnumFormType.IoMonitor, false); + //if (GlobalHelper.IoMonitor_2 == null) + //{ + // frmIoMonitorNew frm = new frmIoMonitorNew(); + // GlobalHelper.IoMonitor_2 = frm; + // GlobalHelper.IoMonitor_2.Activate(); + // GlobalHelper.IoMonitor_2.ShowDialog(); + //} + //else + //{ + // GlobalHelper.IoMonitor_2.Activate(); + // GlobalHelper.IoMonitor_2.ShowDialog(); + //} } private void btnParamater_Click(object sender, EventArgs e) diff --git a/CleanMachineHMI/Utils/PlcOperationHelper.cs b/CleanMachineHMI/Utils/PlcOperationHelper.cs index 691ac4e..e2565d8 100644 --- a/CleanMachineHMI/Utils/PlcOperationHelper.cs +++ b/CleanMachineHMI/Utils/PlcOperationHelper.cs @@ -46,6 +46,10 @@ namespace CleanMachineHMI #endregion + + private byte slaveAddress = 1; + + private bool _isConn = false; @@ -124,8 +128,8 @@ namespace CleanMachineHMI { try { - bool[] readBytArr_M = master.ReadCoils(1, 2248, 50); - bool[] readBytArr_M1 = master.ReadCoils(1, 2048, 50); + bool[] readBytArr_M = master.ReadCoils(slaveAddress, 2248, 50); + bool[] readBytArr_M1 = master.ReadCoils(slaveAddress, 2048, 50); if (readBytArr_M.Length > 0 && readBytArr_M1.Length > 0) { if (GlobalHelper.PlcItemMd_M_List != null && GlobalHelper.PlcItemMd_M_List.Count > 0) @@ -167,8 +171,8 @@ namespace CleanMachineHMI { try { - ushort[] tmpReadAlarmBytArr_D = master.ReadHoldingRegisters(1, 4106, 50); - ushort[] readBytArr_D = master.ReadHoldingRegisters(1, 4505, 50); + ushort[] tmpReadAlarmBytArr_D = master.ReadHoldingRegisters(slaveAddress, 4106, 50); + ushort[] readBytArr_D = master.ReadHoldingRegisters(slaveAddress, 4505, 50); if (readBytArr_D.Length > 0 && tmpReadAlarmBytArr_D.Length > 0) { if (GlobalHelper.PlcItemMd_D_List != null && GlobalHelper.PlcItemMd_D_List.Count > 0) @@ -563,7 +567,7 @@ namespace CleanMachineHMI { try { - bool[] readBytArr_X = master.ReadInputs(1, 1024, 50); + bool[] readBytArr_X = master.ReadInputs(slaveAddress, 1024, 50); if (readBytArr_X.Length > 0) //if(true) { @@ -598,7 +602,7 @@ namespace CleanMachineHMI { try { - bool[] readBytArr_Y = master.ReadCoils(1, 1280, 50); + bool[] readBytArr_Y = master.ReadCoils(slaveAddress, 1280, 50); if (readBytArr_Y.Length > 0) //if(true) { @@ -722,7 +726,7 @@ namespace CleanMachineHMI { return false; } - master.WriteSingleCoil(1, Convert.ToUInt16(item_M.PlcItemModbusAddress), bool.Parse(writeValue)); + master.WriteSingleCoil(slaveAddress, Convert.ToUInt16(item_M.PlcItemModbusAddress), bool.Parse(writeValue)); return true; case PlcItemTypeDesc.Y: BasPlcItemMd item_Y = GlobalHelper.PlcItemMd_Y_List.Find(x => x.PlcItemCode == plcItemCode); @@ -730,7 +734,7 @@ namespace CleanMachineHMI { return false; } - master.WriteSingleCoil(1, Convert.ToUInt16(item_Y.PlcItemModbusAddress), bool.Parse(writeValue)); + master.WriteSingleCoil(slaveAddress, Convert.ToUInt16(item_Y.PlcItemModbusAddress), bool.Parse(writeValue)); return true; case PlcItemTypeDesc.D: BasPlcItemMd item_D = GlobalHelper.PlcItemMd_D_List.Find(x => x.PlcItemCode == plcItemCode); @@ -738,7 +742,7 @@ namespace CleanMachineHMI { return false; } - master.WriteSingleRegister(1, Convert.ToUInt16(item_D.PlcItemModbusAddress), ushort.Parse(writeValue)); + master.WriteSingleRegister(slaveAddress, Convert.ToUInt16(item_D.PlcItemModbusAddress), ushort.Parse(writeValue)); return true; case PlcItemTypeDesc.X: return false; @@ -755,6 +759,10 @@ namespace CleanMachineHMI private int wcsToPlcHeartDataNew = 0; private DateTime HeartbeatTime = new DateTime(); private int ReConnNum = 1; + + /// + /// 心跳处理 + /// public void HeartbeatDetection() { try diff --git a/CleanMachineHMI/packages.config b/CleanMachineHMI/packages.config index 812b8ca..23b4411 100644 --- a/CleanMachineHMI/packages.config +++ b/CleanMachineHMI/packages.config @@ -4,4 +4,5 @@ + \ No newline at end of file