From 4fe160c30d19317693dc4000f260827d007dcd64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=84=E5=A4=B4?= Date: Wed, 12 Jun 2024 13:29:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B2=E6=B7=B7=E6=9C=BA=E4=BD=BF=E8=83=BD?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Qu/InitAction.cs | 131 +++++++++++++++++ .../DBHelpers/DB2108HelperWriteNew.cs | 23 +++ Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml | 136 +++++++++++++++++- 3 files changed, 284 insertions(+), 6 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs index 95a615c..f5209c6 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs @@ -63,12 +63,41 @@ namespace Mesnac.Action.ChemicalWeighing.Qu MCButton BtnCoolWaterB; MCButton BtnHotWaterA; MCButton BtnHotWaterB; + + + HslLanternSimple HslDa; + HslLanternSimple HslDb; + HslLanternSimple HslDc; + HslLanternSimple HslDd; + + MCButton BtnDa; + MCButton BtnDb; + MCButton BtnDc; + MCButton BtnDd; + + + public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 var controls = GetAllControls(); + HslDa=controls.FirstOrDefault(x => x.Name == "HslDa") as HslLanternSimple; + HslDb = controls.FirstOrDefault(x => x.Name == "HslDb") as HslLanternSimple; + HslDc = controls.FirstOrDefault(x => x.Name == "HslDc") as HslLanternSimple; + HslDd = controls.FirstOrDefault(x => x.Name == "HslDd") as HslLanternSimple; + + BtnDa=controls.FirstOrDefault(x => x.Name == "BtnDa") as MCButton; + BtnDb = controls.FirstOrDefault(x => x.Name == "BtnDb") as MCButton; + BtnDc = controls.FirstOrDefault(x => x.Name == "BtnDc") as MCButton; + BtnDd = controls.FirstOrDefault(x => x.Name == "BtnDd") as MCButton; + + BtnDa.Click += BtnDa_Click; + BtnDb.Click += BtnDb_Click; + BtnDc.Click += BtnDc_Click; + BtnDd.Click += BtnDd_Click; + BtnCoolWaterA = controls.FirstOrDefault(x => x.Name == "BtnCoolWaterA") as MCButton; @@ -163,6 +192,57 @@ namespace Mesnac.Action.ChemicalWeighing.Qu timer.Enabled = true; timer.Tick += new EventHandler(StateRefresh);//添加事件 + + + + } + + private void BtnDd_Click(object sender, EventArgs e) + { + if (BtnDd.MCValue.ToString().Contains("开")) + { + DB2108HelperWriteNew.WriteD(true); + } + else + { + DB2108HelperWriteNew.WriteD(false); + } + } + + private void BtnDc_Click(object sender, EventArgs e) + { + if (BtnDc.MCValue.ToString().Contains("开")) + { + DB2108HelperWriteNew.WriteC(true); + } + else + { + DB2108HelperWriteNew.WriteC(false); + } + } + + private void BtnDb_Click(object sender, EventArgs e) + { + if (BtnDb.MCValue.ToString().Contains("开")) + { + DB2108HelperWriteNew.WriteB(true); + } + else + { + DB2108HelperWriteNew.WriteB(false); + } + } + + private void BtnDa_Click(object sender, EventArgs e) + { + if (BtnDd.MCValue.ToString().Contains("开")) + { + DB2108HelperWriteNew.WriteA(true); + } + else + { + DB2108HelperWriteNew.WriteA(false); + } } private void BtnHotWaterB_Click(object sender, EventArgs e) @@ -476,6 +556,57 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HotWaterB.LanternBackground = System.Drawing.Color.Gray; } + //干混机 + ab = dB2108.DryA; + if (ab.enable) + { + BtnDa.MCValue = "干混A使能关"; + HslDa.LanternBackground = System.Drawing.Color.Green; + } + else + { + BtnDa.MCValue = "干混A使能开"; + HslDa.LanternBackground = System.Drawing.Color.Gray; + } + + ab = dB2108.DryB; + if (ab.enable) + { + BtnDb.MCValue = "干混B使能关"; + HslDb.LanternBackground = System.Drawing.Color.Green; + } + else + { + BtnDb.MCValue = "干混B使能开"; + HslDb.LanternBackground = System.Drawing.Color.Gray; + } + + + ab = dB2108.DryC; + if (ab.enable) + { + BtnDc.MCValue = "干混C使能关"; + HslDc.LanternBackground = System.Drawing.Color.Green; + } + else + { + BtnDc.MCValue = "干混C使能开"; + HslDc.LanternBackground = System.Drawing.Color.Gray; + } + + + ab = dB2108.DryD; + if (ab.enable) + { + BtnDd.MCValue = "干混D使能关"; + HslDd.LanternBackground = System.Drawing.Color.Green; + } + else + { + BtnDd.MCValue = "干混D使能开"; + HslDd.LanternBackground = System.Drawing.Color.Gray; + } + } } } diff --git a/DataBlockHelper/DBHelpers/DB2108HelperWriteNew.cs b/DataBlockHelper/DBHelpers/DB2108HelperWriteNew.cs index e89b366..4a10688 100644 --- a/DataBlockHelper/DBHelpers/DB2108HelperWriteNew.cs +++ b/DataBlockHelper/DBHelpers/DB2108HelperWriteNew.cs @@ -52,5 +52,28 @@ namespace DataBlockHelper.DBHelpers siemensS7Net.Write($"{DbName}.{start}.0", time.PlsHopperOff); } + + + + public static void WriteA(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.72.0", b); + } + public static void WriteB(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.74.0", b); + } + public static void WriteC(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.76.0", b); + } + public static void WriteD(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.78.0", b); + } } } diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml index 6bb43aa..3558e6d 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml @@ -1,5 +1,129 @@ + + + 221, 193 + HslDd + 39, 32 + + + 38, 193 + HslDc + 39, 32 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 启动 + 178, 260 + BtnDd + 120, 31 + 23 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 使能 + 12, 260 + BtnDc + 120, 31 + 22 + + + 220, 26 + HslDb + 39, 32 + + + 37, 26 + HslDa + 39, 32 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 启动 + 177, 93 + BtnDb + 120, 31 + 19 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + 使能 + 11, 93 + BtnDa + 120, 31 + 18 + + False + 干混机 + 30, 12 + GroupBox5 + 316, 312 + 16 + 221, 193 @@ -119,7 +243,7 @@ False 水秤 - 371, 12 + 364, 12 GroupBox4 316, 312 15 @@ -185,7 +309,7 @@ False 主风机 - 25, 12 + 364, 364 GroupBox3 316, 145 14 @@ -747,7 +871,7 @@ 取消时间 731, 23 GroupBox2 - 475, 486 + 556, 486 13 @@ -839,9 +963,9 @@ False 取消队列 - 25, 358 + 731, 528 GroupBox1 - 662, 151 + 556, 151 12 @@ -860,7 +984,7 @@ False False Control - 1246, 717 + 1370, 805 WindowsDefaultLocation 缓存队列取消 Normal