From d2f472e9569e4a7ac2b2913108426cf669294fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Tue, 9 Jan 2024 17:27:47 +0800 Subject: [PATCH] DryPauseOrReplyColoer --- .../AutoControl/AutoControl.cs | 7 +- .../Entity/GelerWeterControlsEntity.cs | 2 + .../AutoControl/InitAction.cs | 50 ++++++++++++- .../AutoControl/PlcAutoWriteHelper.cs | 70 +++++++++++++++++++ .../DBHelpers/DB2107WriteHelper.cs | 26 +++++++ .../Data/MCProject/nodeForm/AutoControlC.xml | 38 ++++++++-- 6 files changed, 184 insertions(+), 9 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs index d912ed6..f0e66c5 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs @@ -479,9 +479,14 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl DryStartOrStop(ButtonE, RadioE); } + //DryPauseOrReply + if (ButtonE.DryPauseOrReply == runtime.Sender) + { + DryPauseOrReply(ButtonE, RadioE); + } - if (ButtonE.ZeroClean == runtime.Sender) + if (ButtonE.ZeroClean == runtime.Sender) { if (MessageBox.Show("是否车次清零?", "清零确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs index 01ba38a..86cc896 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs @@ -86,6 +86,8 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity public Button DryStartOrStop { get; set; } + public Button DryPauseOrReply { 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 404968b..7efdfc2 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs @@ -169,15 +169,44 @@ 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); + + + DB2107Helper dB2107=new DB2107Helper(); + bool spare = false; + switch (dryIndex) + { + case 1: + spare = dB2107.NormalStatus.RdyRpt_V1; + break; + case 2: + spare = dB2107.NormalStatus.RdyRpt_V2; + break; + case 3: + spare = dB2107.NormalStatus.RdyRpt_V3; + break; + case 4: + spare = dB2107.NormalStatus.RdyRpt_V4; + break; + } + + DryPauseOrReplyColoer(dryIndex, spare); + + } - + //DryPauseOrReply + + + + } @@ -212,6 +241,25 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } } + private void DryPauseOrReplyColoer(int no, bool b) + { + + //暂停 0 恢复 1 + + + if (b) + { + buttonE.DryPauseOrReply.BackColor = Color.Transparent; + buttonE.DryPauseOrReply.Text = $"干混机{no}(恢复)"; + + } + else + { + buttonE.DryPauseOrReply.BackColor = Color.Green; + buttonE.DryPauseOrReply.Text = $"干混机{no}(暂停)"; + } + } + private string ConvertOnOff(bool state) { diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs index 461b5ce..047de19 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs @@ -1213,6 +1213,76 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } + public static void DryPauseOrReply(ButtonEntity buttonEntity, MCRadioButtonEntity RadioE) + { + + var index = ControlsHelper.DrySelect(RadioE); + + if (index <= 0) + { + MessageBox.Show("请选择机台"); + return; + } + + if (buttonEntity.DryPauseOrReply.Text.Contains("暂停")) + { + if (MessageBox.Show($"是否恢复干混机{index}?", "干混机确认", + MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + + + + switch (index) + { + case 1: + DB2107WriteHelper.Spare1(true); + break; + case 2: + DB2107WriteHelper.Spare2(true); + break; + case 3: + DB2107WriteHelper.Spare3(true); + break; + case 4: + DB2107WriteHelper.Spare4(true); + break; + + + } + } + else + { + if (buttonEntity.DryPauseOrReply.Text.Contains("恢复")) + { + if (MessageBox.Show($"是否暂停干混机{index}?", "干混机确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + } + + switch (index) + { + case 1: + DB2107WriteHelper.Spare1(false); + break; + case 2: + DB2107WriteHelper.Spare2(false); + break; + case 3: + DB2107WriteHelper.Spare3(false); + break; + case 4: + DB2107WriteHelper.Spare4(false); + break; + + + } + + } + } + #endregion #region 湿混机物料封装 diff --git a/DataBlockHelper/DBHelpers/DB2107WriteHelper.cs b/DataBlockHelper/DBHelpers/DB2107WriteHelper.cs index 6aec78c..c7ea709 100644 --- a/DataBlockHelper/DBHelpers/DB2107WriteHelper.cs +++ b/DataBlockHelper/DBHelpers/DB2107WriteHelper.cs @@ -25,5 +25,31 @@ namespace DataBlockHelper.DBHelpers var siemensS7Net = PlcConnect.Instance; siemensS7Net.Write($"{DbName}.5.{dian}", false); } + + + public static void Spare1(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.4.5", b); + } + + public static void Spare2(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.4.6", b); + } + + public static void Spare3(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.4.7", b); + } + + + public static void Spare4(bool b) + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}.5.0", b); + } } } diff --git a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml index a06dcd1..9f60372 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml @@ -1000,6 +1000,30 @@ 63 + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAEAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2BgcAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2Cw== + + + + False + + + + None + True + True + False + + + Red + DarkGray + 干混机暂停 + 6, 404 + DryPauseOrReply + 158, 40 + 151 + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAEAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2BgcAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2Cw== @@ -1019,9 +1043,9 @@ Red DarkGray 干混机 - 6, 405 + 6, 361 DryStartOrStop - 158, 42 + 158, 37 151 @@ -1043,9 +1067,9 @@ Red DarkGray 粘贴配方 - 6, 345 + 6, 317 PasteDry - 158, 42 + 158, 34 149 @@ -1064,7 +1088,7 @@ True 产线选择 宋体, 9pt - 10, 322 + 11, 295 MCLabel109 53, 12 @@ -1090,7 +1114,7 @@ Query True True - 69, 315 + 70, 288 PasteChooseDry 82, 24 147 @@ -1117,7 +1141,7 @@ 宋体, 12pt 6, 255 DryDownload - 158, 54 + 158, 30 62