From 65381775dc3046a0c04eec2c0f699b56534ae9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=84=E5=A4=B4?= Date: Fri, 26 Jul 2024 14:35:05 +0800 Subject: [PATCH] 2 --- .../Qu/InitAction.cs | 68 ++++++++++++++++++- Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml | 62 ++++++++++++++++- 2 files changed, 127 insertions(+), 3 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs index 8f830db..20f8974 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs @@ -156,6 +156,12 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HslSwitch HslSwitch16; + HslLanternSimple Hsldq1; + HslLanternSimple Hsldq2; + HslLanternSimple HslKq1; + HslLanternSimple HslKq2; + + public void Run(RuntimeParameter runtime) { @@ -168,6 +174,12 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HC = controls.FirstOrDefault(x => x.Name == "HC") as HslLanternSimple; HD = controls.FirstOrDefault(x => x.Name == "HD") as HslLanternSimple; + + Hsldq1 = controls.FirstOrDefault(x => x.Name == "Hsldq1") as HslLanternSimple; + Hsldq2 = controls.FirstOrDefault(x => x.Name == "Hsldq2") as HslLanternSimple; + HslKq1 = controls.FirstOrDefault(x => x.Name == "Hslkq1") as HslLanternSimple; + HslKq2 = controls.FirstOrDefault(x => x.Name == "Hslkq2") as HslLanternSimple; + McA = controls.FirstOrDefault(x => x.Name == "McA") as MCButton; McB = controls.FirstOrDefault(x => x.Name == "McB") as MCButton; McC = controls.FirstOrDefault(x => x.Name == "McC") as MCButton; @@ -418,13 +430,20 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HslSwitch13.OnSwitchChanged += HslSwitch1_OnSwitchChanged; HslSwitch14.OnSwitchChanged += HslSwitch1_OnSwitchChanged; HslSwitch15.OnSwitchChanged += HslSwitch1_OnSwitchChanged; - HslSwitch16.OnSwitchChanged += HslSwitch1_OnSwitchChanged; + HslSwitch16.OnSwitchChanged += HslSwitch16_OnSwitchChanged; MCButton2147483644_Click(new object(), new EventArgs()); } + private void HslSwitch16_OnSwitchChanged(object arg1, bool arg2) + { + string add = "DB2119.16.7"; + var val = PlcConnect.Instance.ReadBool(add).Content; + PlcConnect.Instance.Write(add, !val); + } + private void HslSwitch1_OnSwitchChanged(object arg1, bool arg2) { var hsl = arg1 as HslSwitch; @@ -1145,9 +1164,54 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HD.LanternBackground = System.Drawing.Color.Gray; } + var plc = PlcConnect.Instance; + + //Hsldq1 + + + var dq = plc.ReadBool("DB2102.245.0").Content; + if (dq) + { + Hsldq1.LanternBackground = System.Drawing.Color.Green; + } + else + { + Hsldq1.LanternBackground = System.Drawing.Color.Gray; + } + + dq = plc.ReadBool("DB2102.247.0").Content; + if (dq) + { + Hsldq2.LanternBackground = System.Drawing.Color.Green; + } + else + { + Hsldq2.LanternBackground = System.Drawing.Color.Gray; + } + + + dq = plc.ReadBool("DB2102.244.7").Content; + if (dq) + { + HslKq1.LanternBackground = System.Drawing.Color.Green; + } + else + { + HslKq1.LanternBackground = System.Drawing.Color.Gray; + } + + dq = plc.ReadBool("DB2102.246.7").Content; + if (dq) + { + HslKq2.LanternBackground = System.Drawing.Color.Green; + } + else + { + HslKq2.LanternBackground = System.Drawing.Color.Gray; + } + - var plc=PlcConnect.Instance; var byt = plc.Read("DB2119.15.0", 2).Content; var at = byt[0]; diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml index ee2a3f2..e3e30a2 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml @@ -90,13 +90,73 @@ 73, 91 False - 缓存仓上位机 + 大仓底部氮气 30, 757 GroupBox9 1257, 139 20 + + 497, 91 + Hslkq2 + 39, 32 + + + 386, 91 + Hsldq2 + 39, 32 + + + 497, 37 + Hslkq1 + 39, 32 + + + 388, 37 + Hsldq1 + 39, 32 + + + + + + Red + DarkGray + + + False + + + + None + True + True + 空气 + 497, 17 + MCLabel2147483614 + 29, 12 + + + + + + Red + DarkGray + + + False + + + + None + True + True + 氮气 + 388, 17 + MCLabel2147483615 + 29, 12 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL