diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs index 1091269..a8e229a 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs @@ -9,7 +9,9 @@ using System.Threading.Tasks; using DataBlockHelper.DBHelpers; using Mesnac.Controls.ChemicalWeighing; using DataBlockHelper; -using DevExpress.Utils.Extensions; + +using System.Threading; +using Timer = System.Windows.Forms.Timer; namespace Mesnac.Action.ChemicalWeighing.Qu { @@ -129,6 +131,31 @@ namespace Mesnac.Action.ChemicalWeighing.Qu MCButton McD; + MCButton MCButtonA1; + MCButton MCButtonA2; + + MCButton MCButtonB1; + MCButton MCButtonB2; + + HslSwitch HslSwitch1; + HslSwitch HslSwitch2; + HslSwitch HslSwitch3; + HslSwitch HslSwitch4; + HslSwitch HslSwitch5; + HslSwitch HslSwitch6; + HslSwitch HslSwitch7; + HslSwitch HslSwitch8; + HslSwitch HslSwitch9; + HslSwitch HslSwitch10; + HslSwitch HslSwitch11; + HslSwitch HslSwitch12; + HslSwitch HslSwitch13; + HslSwitch HslSwitch14; + HslSwitch HslSwitch15; + + + + public void Run(RuntimeParameter runtime) { @@ -147,6 +174,17 @@ namespace Mesnac.Action.ChemicalWeighing.Qu McD = controls.FirstOrDefault(x => x.Name == "McD") as MCButton; + MCButtonA1 = controls.FirstOrDefault(x => x.Name == "MCButtonA1") as MCButton; + MCButtonA2 = controls.FirstOrDefault(x => x.Name == "MCButtonA2") as MCButton; + MCButtonB1 = controls.FirstOrDefault(x => x.Name == "MCButtonB1") as MCButton; + MCButtonB2 = controls.FirstOrDefault(x => x.Name == "MCButtonB2") as MCButton; + + MCButtonA1.Click += MCButtonA1_Click; + MCButtonA2.Click += MCButtonA2_Click; + + MCButtonB1.Click += MCButtonB1_Click; + MCButtonB2.Click += MCButtonB2_Click; + MCButton2147483645 = controls.FirstOrDefault(x => x.Name == "MCButton2147483645") as MCButton; MCButton2147483645.Click += MCButton2147483644_Click; @@ -312,11 +350,196 @@ namespace Mesnac.Action.ChemicalWeighing.Qu txtOClose = controls.FirstOrDefault(x => x.Name == "txtOClose") as MCTextBox; + HslSwitch1 = controls.FirstOrDefault(x => x.Name == "HslSwitch1") as HslSwitch; + HslSwitch1.Text = "大仓A"; + + HslSwitch2 = controls.FirstOrDefault(x => x.Name == "HslSwitch2") as HslSwitch; + HslSwitch2.Text = "大仓B"; + + HslSwitch3 = controls.FirstOrDefault(x => x.Name == "HslSwitch3") as HslSwitch; + HslSwitch3.Text = "大仓C"; + + HslSwitch4 = controls.FirstOrDefault(x => x.Name == "HslSwitch4") as HslSwitch; + HslSwitch4.Text = "大仓D"; + + HslSwitch5 = controls.FirstOrDefault(x => x.Name == "HslSwitch5") as HslSwitch; + HslSwitch5.Text = "大仓E"; + + HslSwitch6 = controls.FirstOrDefault(x => x.Name == "HslSwitch6") as HslSwitch; + HslSwitch6.Text = "大仓F"; + + HslSwitch7 = controls.FirstOrDefault(x => x.Name == "HslSwitch7") as HslSwitch; + HslSwitch7.Text = "大仓G"; + + + HslSwitch8 = controls.FirstOrDefault(x => x.Name == "HslSwitch8") as HslSwitch; + HslSwitch8.Text = "大仓H"; + + HslSwitch9 = controls.FirstOrDefault(x => x.Name == "HslSwitch9") as HslSwitch; + HslSwitch9.Text = "大仓I"; + + + HslSwitch10= controls.FirstOrDefault(x => x.Name == "HslSwitch10") as HslSwitch; + HslSwitch10.Text = "大仓J"; + + HslSwitch11 = controls.FirstOrDefault(x => x.Name == "HslSwitch11") as HslSwitch; + HslSwitch11.Text = "大仓K"; + + + HslSwitch12 = controls.FirstOrDefault(x => x.Name == "HslSwitch12") as HslSwitch; + HslSwitch12.Text = "大仓L"; + + + HslSwitch13 = controls.FirstOrDefault(x => x.Name == "HslSwitch13") as HslSwitch; + HslSwitch13.Text = "大仓M"; + + HslSwitch14 = controls.FirstOrDefault(x => x.Name == "HslSwitch14") as HslSwitch; + HslSwitch14.Text = "大仓N"; + + HslSwitch15 = controls.FirstOrDefault(x => x.Name == "HslSwitch15") as HslSwitch; + HslSwitch15.Text = "大仓O"; + + + + HslSwitch1.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch2.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch3.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch4.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch5.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch6.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch7.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch8.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch9.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch10.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch11.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch12.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch13.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch14.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch15.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + + MCButton2147483644_Click(new object(), new EventArgs()); } + private void HslSwitch1_OnSwitchChanged(object arg1, bool arg2) + { + var hsl = arg1 as HslSwitch; + string add = "DB2119.15.0"; + if (hsl.Name == "HslSwitch1") + { + add = "DB2119.15.0"; + } + if (hsl.Name == "HslSwitch2") + { + add = "DB2119.15.1"; + } + if (hsl.Name == "HslSwitch3") + { + add = "DB2119.15.2"; + } + if (hsl.Name == "HslSwitch4") + { + add = "DB2119.15.3"; + } + if (hsl.Name == "HslSwitch5") + { + add = "DB2119.15.4"; + + } + if (hsl.Name == "HslSwitch6") + { + add = "DB2119.15.5"; + } + if (hsl.Name == "HslSwitch7") + { + add = "DB2119.15.6"; + } + if (hsl.Name == "HslSwitch8") + { + add = "DB2119.15.7"; + } + if (hsl.Name == "HslSwitch9") + { + add = "DB2119.16.0"; + } + if (hsl.Name == "HslSwitch10") + { + add = "DB2119.16.1"; + } + if (hsl.Name == "HslSwitch11") + { + add = "DB2119.16.2"; + } + if (hsl.Name == "HslSwitch12") + { + add = "DB2119.16.3"; + } + if (hsl.Name == "HslSwitch13") + { + add = "DB2119.16.4"; + } + + if (hsl.Name == "HslSwitch14") + { + add = "DB2119.16.5"; + } + if (hsl.Name == "HslSwitch15") + { + add = "DB2119.16.6"; + } + + + + var val = PlcConnect.Instance.ReadBool(add).Content; + PlcConnect.Instance.Write(add, !val); + } + + private void MCButtonB2_Click(object sender, EventArgs e) + { + string address = "DB2119.14.7"; + var plc = PlcConnect.Instance; + plc.Write(address, true); + Thread.Sleep(500); + plc.Write(address, false); + + MessageBox.Show("复位成功"); + } + + private void MCButtonB1_Click(object sender, EventArgs e) + { + string address = "DB2119.14.6"; + var plc = PlcConnect.Instance; + plc.Write(address, true); + Thread.Sleep(500); + plc.Write(address, false); + + MessageBox.Show("复位成功"); + } + + private void MCButtonA2_Click(object sender, EventArgs e) + { + string address = "DB2119.14.5"; + var plc = PlcConnect.Instance; + plc.Write(address, true); + Thread.Sleep(500); + plc.Write(address, false); + + MessageBox.Show("复位成功"); + } + + private void MCButtonA1_Click(object sender, EventArgs e) + { + string address = "DB2119.14.4"; + var plc = PlcConnect.Instance; + plc.Write(address, true); + Thread.Sleep(500); + plc.Write(address, false); + + MessageBox.Show("复位成功"); + } + private void McD_Click(object sender, EventArgs e) { var sss = "DB2119.28.3"; @@ -917,6 +1140,32 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HD.LanternBackground = System.Drawing.Color.Gray; } + + + var plc=PlcConnect.Instance; + var byt = plc.Read("DB2119.15.0", 2).Content; + + var at = byt[0]; + this.HslSwitch1.SwitchStatus=at.GetBit(0); + this.HslSwitch2.SwitchStatus = at.GetBit(1); + this.HslSwitch3.SwitchStatus = at.GetBit(2); + this.HslSwitch4.SwitchStatus = at.GetBit(3); + this.HslSwitch5.SwitchStatus = at.GetBit(4); + this.HslSwitch6.SwitchStatus = at.GetBit(5); + this.HslSwitch7.SwitchStatus = at.GetBit(6); + this.HslSwitch8.SwitchStatus = at.GetBit(7); + + at = byt[1]; + + this.HslSwitch9.SwitchStatus = at.GetBit(0); + this.HslSwitch10.SwitchStatus = at.GetBit(1); + this.HslSwitch11.SwitchStatus = at.GetBit(2); + this.HslSwitch12.SwitchStatus = at.GetBit(3); + this.HslSwitch13.SwitchStatus = at.GetBit(4); + this.HslSwitch14.SwitchStatus = at.GetBit(5); + this.HslSwitch15.SwitchStatus = at.GetBit(6); + + } } diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml index 8f8207f..a78518b 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml @@ -1,5 +1,192 @@ + + + 1175, 39 + HslSwitch15 + 73, 91 + + + 1096, 39 + HslSwitch14 + 73, 91 + + + 1017, 39 + HslSwitch13 + 73, 91 + + + 938, 39 + HslSwitch12 + 73, 91 + + + 859, 39 + HslSwitch11 + 73, 91 + + + 780, 39 + HslSwitch10 + 73, 91 + + + 701, 39 + HslSwitch9 + 73, 91 + + + 631, 39 + HslSwitch8 + 73, 91 + + + 552, 39 + HslSwitch7 + 73, 91 + + + 473, 39 + HslSwitch6 + 73, 91 + + + 394, 39 + HslSwitch5 + 73, 91 + + + 308, 39 + HslSwitch4 + 73, 91 + + + 221, 39 + HslSwitch3 + 73, 91 + + + 131, 39 + HslSwitch2 + 73, 91 + + + 38, 39 + HslSwitch1 + 73, 91 + + False + 缓存仓上位机 + 30, 806 + GroupBox9 + 1257, 146 + 20 + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 二期主气源切压缩空气 + 188, 91 + MCButtonB2 + 147, 36 + 9 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 二期主气源切氮气 + 23, 91 + MCButtonB1 + 147, 36 + 8 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 一期主气源切压缩空气 + 188, 33 + MCButtonA2 + 147, 36 + 7 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 一期主气源切氮气 + 23, 33 + MCButtonA1 + 147, 36 + 6 + + False + 自复位按钮 + 661, 562 + GroupBox8 + 626, 189 + 19 + @@ -15,8 +202,7 @@ True True False - - + Red DarkGray @@ -40,8 +226,7 @@ True True False - - + Red DarkGray @@ -65,8 +250,7 @@ True True False - - + Red DarkGray @@ -90,8 +274,7 @@ True True False - - + Red DarkGray @@ -123,9 +306,9 @@ False 缓存仓上位机 - 30, 621 + 30, 562 GroupBox7 - 1257, 209 + 584, 189 18 @@ -2181,7 +2364,7 @@ False False Control - 1370, 1057 + 1402, 1141 WindowsDefaultLocation 缓存队列取消 Normal