diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs index 9782f5f..12ea738 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs @@ -474,6 +474,13 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl GRepairOnOff(ButtonE, RadioE); } + if (ButtonE.DryStartOrStop == runtime.Sender) + { + DryStartOrStop(ButtonE, RadioE); + } + + + #endregion #region 粘贴数据 diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs index 5570715..7d63010 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs @@ -81,6 +81,9 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity public Button RepairMode { get; set; } public Button GRepairMode { get; set; } + + public Button DryStartOrStop { get; set; } + public Button DryDownload { get; set; } public Button WaterDownload { get; set; } public Button PasteDry { get; set; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs index f5b651c..404968b 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs @@ -169,6 +169,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl ConvertBackColor(dB2105Helper.FeededPdG8); break; } + int dryIndex = ControlsHelper.DrySelect(RadioE); + if (dryIndex > 0) + { + var startOrStop = dB2105Helper.GetDryStartOrStop(); + bool b = startOrStop[dryIndex - 1]; + DryStartOrStopColoer(dryIndex,b); + } + + + } @@ -187,6 +197,22 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } } + + private void DryStartOrStopColoer(int no,bool b) + { + if (b) + { + buttonE.DryStartOrStop.BackColor = Color.Green; + buttonE.DryStartOrStop.Text = $"干混机{no}(开)"; + } + else + { + buttonE.DryStartOrStop.BackColor = Color.Transparent; + buttonE.DryStartOrStop.Text = $"干混机{no}(关)"; + } + } + + private string ConvertOnOff(bool state) { if (state) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs index a550225..461b5ce 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs @@ -1139,6 +1139,80 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } } + + + + public static void DryStartOrStop(ButtonEntity buttonEntity, MCRadioButtonEntity RadioE) + { + + var index = ControlsHelper.DrySelect(RadioE); + + if (index <= 0) + { + MessageBox.Show("请选择机台"); + return; + } + + if (buttonEntity.DryStartOrStop.Text.Contains("关")) + { + if (MessageBox.Show($"是否启动干混机{index}?", "干混机确认", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + + + + switch (index) + { + case 1: + DB2105WriteHelper.WriteStartOrStop(1,true); + break; + case 2: + DB2105WriteHelper.WriteStartOrStop(2,true); + break; + case 3: + DB2105WriteHelper.WriteStartOrStop(3,true); + break; + case 4: + DB2105WriteHelper.WriteStartOrStop(4,true); + break; + + + } + } + else + { + if (buttonEntity.DryStartOrStop.Text.Contains("开")) + { + if (MessageBox.Show($"是否关闭干混机{index}?", "干混机确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + } + + switch (index) + { + case 1: + DB2105WriteHelper.WriteStartOrStop(1, false); + break; + case 2: + DB2105WriteHelper.WriteStartOrStop(2, false); + break; + case 3: + DB2105WriteHelper.WriteStartOrStop(3, false); + break; + case 4: + DB2105WriteHelper.WriteStartOrStop(4, false); + break; + + + } + + } + } + + #endregion #region 湿混机物料封装 diff --git a/DataBlockHelper/DBHelpers/DB2105Helper.cs b/DataBlockHelper/DBHelpers/DB2105Helper.cs index c263c72..ca08659 100644 --- a/DataBlockHelper/DBHelpers/DB2105Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2105Helper.cs @@ -19,6 +19,24 @@ namespace DataBlockHelper.DBHelpers public bool[] End => new FourBoolArrayManager(50, bytes).GetList(); + + + /// + /// 干混机开始停止 + /// + /// + + public List GetDryStartOrStop() + { + List ls = new List(); + var b = bytes.Skip(48).Take(1).First(); + for (int i = 0; i < 4; i++) { + ls.Add(b.GetBit(i)); + } + return ls; + } + + /// /// 设置启动运行 /// diff --git a/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs b/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs index 65bfa18..609497f 100644 --- a/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs +++ b/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs @@ -719,6 +719,21 @@ namespace DataBlockHelper.DBHelpers } + /// + /// 写入干混机 1 2 3 4 + /// + /// + /// + /// + public static void WriteStartOrStop(int no, bool value) + { + var siemensS7Net = PlcConnect.Instance; + + var b = siemensS7Net.Write($"{DbName}.48.{no-1}",value); + + } + + public static void AddFeededPd(int start,bool b) { diff --git a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml index 29443d7..351d7a4 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml @@ -975,6 +975,30 @@ 63 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAEAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2BgcAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2Cw== + + + + False + + + + None + True + True + False + + + Red + DarkGray + 干混机 + 6, 405 + DryStartOrStop + 158, 42 + 151 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAEAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2BgcAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2Cw== @@ -994,9 +1018,9 @@ Red DarkGray 粘贴配方 - 28, 390 + 6, 345 PasteDry - 114, 42 + 158, 42 149 @@ -1015,7 +1039,7 @@ True 产线选择 宋体, 9pt - 13, 349 + 10, 322 MCLabel109 53, 12 @@ -1041,7 +1065,7 @@ Query True True - 72, 342 + 69, 315 PasteChooseDry 82, 24 147