diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs index 55bb8aa..7c4826f 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/InitAction.cs @@ -153,6 +153,24 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HslSwitch HslSwitch14; HslSwitch HslSwitch15; + + HslSwitch HslSwitchz1; + HslSwitch HslSwitchz2; + HslSwitch HslSwitchz3; + HslSwitch HslSwitchz4; + HslSwitch HslSwitchz5; + HslSwitch HslSwitchz6; + HslSwitch HslSwitchz7; + HslSwitch HslSwitchz8; + HslSwitch HslSwitchz9; + HslSwitch HslSwitchz10; + HslSwitch HslSwitchz11; + HslSwitch HslSwitchz12; + HslSwitch HslSwitchz13; + HslSwitch HslSwitchz14; + HslSwitch HslSwitchz15; + + HslSwitch HslSwitch16; HslSwitch HslSwitch17; @@ -162,6 +180,23 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HslLanternSimple HslKq1; HslLanternSimple HslKq2; + HslLanternSimple H1; + HslLanternSimple H2; + HslLanternSimple H3; + HslLanternSimple H4; + HslLanternSimple H5; + HslLanternSimple H6; + HslLanternSimple H7; + HslLanternSimple H8; + HslLanternSimple H9; + HslLanternSimple H10; + HslLanternSimple H11; + HslLanternSimple H12; + HslLanternSimple H13; + HslLanternSimple H14; + HslLanternSimple H15; + + public void Run(RuntimeParameter runtime) { @@ -420,6 +455,91 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HslSwitch17.Text = "回收仓振动电机启停"; + + HslSwitchz1 = controls.FirstOrDefault(x => x.Name == "HslSwitchz1") as HslSwitch; + HslSwitchz1.Text = "大仓A"; + HslSwitchz1.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz2 = controls.FirstOrDefault(x => x.Name == "HslSwitchz2") as HslSwitch; + HslSwitchz2.Text = "大仓B"; + HslSwitchz2.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz3 = controls.FirstOrDefault(x => x.Name == "HslSwitchz3") as HslSwitch; + HslSwitchz3.Text = "大仓C"; + HslSwitchz3.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz4 = controls.FirstOrDefault(x => x.Name == "HslSwitchz4") as HslSwitch; + HslSwitchz4.Text = "大仓D"; + HslSwitchz4.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz5 = controls.FirstOrDefault(x => x.Name == "HslSwitchz5") as HslSwitch; + HslSwitchz5.Text = "大仓E"; + HslSwitchz5.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz6 = controls.FirstOrDefault(x => x.Name == "HslSwitchz6") as HslSwitch; + HslSwitchz6.Text = "大仓F"; + HslSwitchz6.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz7 = controls.FirstOrDefault(x => x.Name == "HslSwitchz7") as HslSwitch; + HslSwitchz7.Text = "大仓G"; + HslSwitchz7.SwitchStatusDescription = "正常;暂停中"; + + + HslSwitchz8 = controls.FirstOrDefault(x => x.Name == "HslSwitchz8") as HslSwitch; + HslSwitchz8.Text = "大仓H"; + HslSwitchz8.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz9 = controls.FirstOrDefault(x => x.Name == "HslSwitchz9") as HslSwitch; + HslSwitchz9.Text = "大仓I"; + HslSwitchz9.SwitchStatusDescription = "正常;暂停中"; + + + HslSwitchz10 = controls.FirstOrDefault(x => x.Name == "HslSwitchz10") as HslSwitch; + HslSwitchz10.Text = "大仓J"; + HslSwitchz10.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz11 = controls.FirstOrDefault(x => x.Name == "HslSwitchz11") as HslSwitch; + HslSwitchz11.Text = "大仓K"; + HslSwitchz11.SwitchStatusDescription = "正常;暂停中"; + + + HslSwitchz12 = controls.FirstOrDefault(x => x.Name == "HslSwitchz12") as HslSwitch; + HslSwitchz12.Text = "大仓L"; + HslSwitchz12.SwitchStatusDescription = "正常;暂停中"; + + + HslSwitchz13 = controls.FirstOrDefault(x => x.Name == "HslSwitchz13") as HslSwitch; + HslSwitchz13.Text = "大仓M"; + HslSwitchz13.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz14 = controls.FirstOrDefault(x => x.Name == "HslSwitchz14") as HslSwitch; + HslSwitchz14.Text = "大仓N"; + HslSwitchz14.SwitchStatusDescription = "正常;暂停中"; + + HslSwitchz15 = controls.FirstOrDefault(x => x.Name == "HslSwitchz15") as HslSwitch; + HslSwitchz15.Text = "大仓O"; + HslSwitchz15.SwitchStatusDescription = "正常;暂停中"; + + + H1 = controls.FirstOrDefault(x => x.Name == "H1") as HslLanternSimple; + H2 = controls.FirstOrDefault(x => x.Name == "H2") as HslLanternSimple; + H3 = controls.FirstOrDefault(x => x.Name == "H3") as HslLanternSimple; + H4 = controls.FirstOrDefault(x => x.Name == "H4") as HslLanternSimple; + H5 = controls.FirstOrDefault(x => x.Name == "H5") as HslLanternSimple; + H6 = controls.FirstOrDefault(x => x.Name == "H6") as HslLanternSimple; + H7 = controls.FirstOrDefault(x => x.Name == "H7") as HslLanternSimple; + H8 = controls.FirstOrDefault(x => x.Name == "H8") as HslLanternSimple; + H9 = controls.FirstOrDefault(x => x.Name == "H9") as HslLanternSimple; + H10 = controls.FirstOrDefault(x => x.Name == "H10") as HslLanternSimple; + H11 = controls.FirstOrDefault(x => x.Name == "H11") as HslLanternSimple; + H12 = controls.FirstOrDefault(x => x.Name == "H12") as HslLanternSimple; + H13 = controls.FirstOrDefault(x => x.Name == "H13") as HslLanternSimple; + H14 = controls.FirstOrDefault(x => x.Name == "H14") as HslLanternSimple; + H15 = controls.FirstOrDefault(x => x.Name == "H15") as HslLanternSimple; + + + + HslSwitch1.OnSwitchChanged += HslSwitch1_OnSwitchChanged; HslSwitch2.OnSwitchChanged += HslSwitch1_OnSwitchChanged; HslSwitch3.OnSwitchChanged += HslSwitch1_OnSwitchChanged; @@ -438,9 +558,30 @@ namespace Mesnac.Action.ChemicalWeighing.Qu HslSwitch16.OnSwitchChanged += HslSwitch16_OnSwitchChanged; + HslSwitchz1.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz2.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz3.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz4.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz5.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz6.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz7.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz8.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz9.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz10.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz11.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz12.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz13.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz14.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + HslSwitchz15.OnSwitchChanged += HslSwitchz1_OnSwitchChanged; + + + + HslSwitch17.OnSwitchChanged += HslSwitch17_OnSwitchChanged; MCButton2147483644_Click(new object(), new EventArgs()); + + AAA(); } private void HslSwitch17_OnSwitchChanged(object arg1, bool arg2) @@ -534,6 +675,81 @@ namespace Mesnac.Action.ChemicalWeighing.Qu PlcConnect.Instance.Write(add, !val); } + + private void HslSwitchz1_OnSwitchChanged(object arg1, bool arg2) + { + var hsl = arg1 as HslSwitch; + string add = ""; + if (hsl.Name == "HslSwitchz1") + { + add = "DB2119.17.1"; + } + if (hsl.Name == "HslSwitchz2") + { + add = "DB2119.17.2"; + } + if (hsl.Name == "HslSwitchz3") + { + add = "DB2119.17.3"; + } + if (hsl.Name == "HslSwitchz4") + { + add = "DB2119.17.4"; + } + if (hsl.Name == "HslSwitchz5") + { + add = "DB2119.17.5"; + + } + if (hsl.Name == "HslSwitchz6") + { + add = "DB2119.17.6"; + } + if (hsl.Name == "HslSwitchz7") + { + add = "DB2119.17.7"; + } + if (hsl.Name == "HslSwitchz8") + { + add = "DB2119.18.0"; + } + if (hsl.Name == "HslSwitchz9") + { + add = "DB2119.18.1"; + } + if (hsl.Name == "HslSwitchz10") + { + add = "DB2119.18.2"; + } + if (hsl.Name == "HslSwitchz11") + { + add = "DB2119.18.3"; + } + if (hsl.Name == "HslSwitchz12") + { + add = "DB2119.18.4"; + } + if (hsl.Name == "HslSwitchz13") + { + add = "DB2119.18.5"; + } + + if (hsl.Name == "HslSwitchz14") + { + add = "DB2119.18.6"; + } + if (hsl.Name == "HslSwitchz15") + { + add = "DB2119.18.7"; + } + + + + 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"; @@ -1226,10 +1442,31 @@ namespace Mesnac.Action.ChemicalWeighing.Qu + + } + + + public void Set(HslLanternSimple hsl,bool dq) + { + + if (dq) + { + hsl.LanternBackground = System.Drawing.Color.Green; + } + else + { + hsl.LanternBackground = System.Drawing.Color.Gray; + } + } + + + public void AAA() + { + var plc=PlcConnect.Instance; var byt = plc.Read("DB2119.15.0", 2).Content; var at = byt[0]; - this.HslSwitch1.SwitchStatus=at.GetBit(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); @@ -1257,8 +1494,58 @@ namespace Mesnac.Action.ChemicalWeighing.Qu sss = plc.ReadBool("DB2119.17.0").Content; this.HslSwitch17.SwitchStatus = sss; + + + byt = plc.Read("DB2119.17.0", 2).Content; + + at = byt[0]; + this.HslSwitchz1.SwitchStatus = at.GetBit(1); + this.HslSwitchz2.SwitchStatus = at.GetBit(2); + this.HslSwitchz3.SwitchStatus = at.GetBit(3); + this.HslSwitchz4.SwitchStatus = at.GetBit(4); + this.HslSwitchz5.SwitchStatus = at.GetBit(5); + this.HslSwitchz6.SwitchStatus = at.GetBit(6); + this.HslSwitchz7.SwitchStatus = at.GetBit(7); + at = byt[1]; + this.HslSwitchz8.SwitchStatus = at.GetBit(0); + + + + this.HslSwitchz9.SwitchStatus = at.GetBit(1); + this.HslSwitchz10.SwitchStatus = at.GetBit(2); + this.HslSwitchz11.SwitchStatus = at.GetBit(3); + this.HslSwitchz12.SwitchStatus = at.GetBit(4); + this.HslSwitchz13.SwitchStatus = at.GetBit(5); + this.HslSwitchz14.SwitchStatus = at.GetBit(6); + this.HslSwitchz15.SwitchStatus = at.GetBit(7); + + + byt = plc.Read("DB2119.19.0", 2).Content; + at = byt[0]; + Set(H1, at.GetBit(0)); + Set(H2, at.GetBit(1)); + Set(H3, at.GetBit(2)); + Set(H4, at.GetBit(3)); + Set(H5, at.GetBit(4)); + Set(H6, at.GetBit(5)); + Set(H7, at.GetBit(6)); + Set(H8, at.GetBit(7)); + at = byt[1]; + + Set(H9, at.GetBit(0)); + Set(H10, at.GetBit(1)); + Set(H11, at.GetBit(2)); + Set(H12, at.GetBit(3)); + Set(H13, at.GetBit(4)); + Set(H14, at.GetBit(5)); + Set(H15, at.GetBit(6)); + } + + + + } } diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml index 8136c00..5bc28a3 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FrmQu.xml @@ -1,5 +1,163 @@ + + + 415, 576 + H15 + 39, 32 + + + 415, 490 + H14 + 39, 32 + + + 415, 400 + H13 + 39, 32 + + + 415, 311 + H12 + 39, 32 + + + 415, 221 + H11 + 39, 32 + + + 415, 128 + H10 + 39, 32 + + + 415, 36 + H9 + 39, 32 + + + 130, 670 + H8 + 39, 32 + + + 130, 576 + H7 + 39, 32 + + + 130, 490 + H6 + 39, 32 + + + 130, 400 + H5 + 39, 32 + + + 130, 311 + H4 + 39, 32 + + + 130, 221 + H3 + 39, 32 + + + 130, 128 + H2 + 39, 32 + + + 130, 36 + H1 + 39, 32 + + + 300, 560 + HslSwitchz15 + 70, 90 + + + 300, 470 + HslSwitchz14 + 70, 90 + + + 300, 380 + HslSwitchz13 + 70, 90 + + + 300, 290 + HslSwitchz12 + 70, 90 + + + 300, 200 + HslSwitchz11 + 70, 90 + + + 300, 110 + HslSwitchz10 + 70, 90 + + + 300, 20 + HslSwitchz9 + 70, 90 + + + 28, 651 + HslSwitchz8 + 70, 90 + + + 28, 471 + HslSwitchz7 + 70, 90 + + + 28, 561 + HslSwitchz6 + 70, 90 + + + 28, 380 + HslSwitchz5 + 73, 91 + + + 28, 290 + HslSwitchz4 + 70, 90 + + + 28, 200 + HslSwitchz3 + 70, 90 + + + 28, 110 + HslSwitchz2 + 70, 90 + + + 28, 20 + HslSwitchz1 + 70, 90 + + False + 大仓侧吹使能 + 1317, 23 + GroupBox11 + 585, 1061 + 22 + 206, 20 @@ -2440,7 +2598,7 @@ False False Control - 1402, 1200 + 2021, 1200 WindowsDefaultLocation 缓存队列取消 Normal