diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Dan/Class1.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Dan/Class1.cs index c6c3585..095bc8e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Dan/Class1.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Dan/Class1.cs @@ -1,12 +1,19 @@ -using Mesnac.Action.Base; +using DataBlockHelper; +using DataBlockHelper.DBHelpers; + +using Mesnac.Action.Base; using Mesnac.Controls.ChemicalWeighing; +using Mesnac.Controls.Default; + using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; + using System.Threading.Tasks; +using System.Windows.Forms; namespace Mesnac.Action.ChemicalWeighing.Dan { @@ -14,6 +21,10 @@ namespace Mesnac.Action.ChemicalWeighing.Dan { Que que; + public Timer timer; + MCButton BtnA; + MCButton BtnB; + MCButton BtnC; public void Run(RuntimeParameter runtime) { RunIni(runtime); @@ -29,6 +40,142 @@ namespace Mesnac.Action.ChemicalWeighing.Dan var pro = controller.FirstOrDefault(x => x.Name == name) as HslLanternSimple; sourceProperty.SetValue(que, pro); } + + BtnA = controller.FirstOrDefault(x => x.Name == "BtnA") as MCButton; + BtnB = controller.FirstOrDefault(x => x.Name == "BtnB") as MCButton; + BtnC = controller.FirstOrDefault(x => x.Name == "BtnC") as MCButton; + + +// M20.4 A线确认 +//M20.5 B线确认 +//M20.6 C线确认 + + BtnA.Click += (s, e) => + { + var a= PlcConnect.Instance.ReadBool("M20.4").Content; + if (a) + { + MessageBox.Show("A线已经确认"); + } + else + { + PlcConnect.Instance.Write("M20.4",true); + MessageBox.Show("A线确认成功"); + } + }; + + BtnB.Click += (s, e) => + { + var b = PlcConnect.Instance.ReadBool("M20.5").Content; + if (b) + { + MessageBox.Show("B线已经确认"); + } + else + { + PlcConnect.Instance.Write("M20.5", true); + MessageBox.Show("B线确认成功"); + } + }; + + BtnC.Click += (s, e) => + { + var c = PlcConnect.Instance.ReadBool("M20.6").Content; + if (c) + { + MessageBox.Show("C线已经确认"); + } + else + { + PlcConnect.Instance.Write("M20.6", true); + MessageBox.Show("C线确认成功"); + } + }; + + + timer = new Timer(); + timer.Interval = 1000; + timer.Enabled = true; + timer.Tick += new EventHandler(StateRefresh);//添加事件 + } + + private void StateRefresh(object sender, EventArgs e) + { + if (GetAllControls().Count == 0) + { + timer.Stop(); + timer.Dispose(); + } + + + Db92DengHelp dB92 = new Db92DengHelp(); + var a = dB92.DegA; + SetValue(que.HslAA,a.A); + SetValue(que.HslAB, a.B); + SetValue(que.HslAC, a.C); + SetValue(que.HslAD, a.D); + SetValue(que.HslAE, a.E); + SetValue(que.HslAF, a.F); + SetValue(que.HslAG, a.G); + SetValue(que.HslAH, a.H); + SetValue(que.HslAI, a.I); + SetValue(que.HslAJ, a.J); + SetValue(que.HslAK, a.K); + SetValue(que.HslAL, a.L); + SetValue(que.HslAM, a.M); + SetValue(que.HslAN, a.N); + SetValue(que.HslAO, a.O); + a = dB92.DegB; + + SetValue(que.HslBA, a.A); + SetValue(que.HslBB, a.B); + SetValue(que.HslBC, a.C); + SetValue(que.HslBD, a.D); + SetValue(que.HslBE, a.E); + SetValue(que.HslBF, a.F); + SetValue(que.HslBG, a.G); + SetValue(que.HslBH, a.H); + SetValue(que.HslBI, a.I); + SetValue(que.HslBJ, a.J); + SetValue(que.HslBK, a.K); + SetValue(que.HslBL, a.L); + SetValue(que.HslBM, a.M); + SetValue(que.HslBN, a.N); + SetValue(que.HslBO, a.O); + + + a = dB92.DegC; + + SetValue(que.HslCA, a.A); + SetValue(que.HslCB, a.B); + SetValue(que.HslCC, a.C); + SetValue(que.HslCD, a.D); + SetValue(que.HslCE, a.E); + SetValue(que.HslCF, a.F); + SetValue(que.HslCG, a.G); + SetValue(que.HslCH, a.H); + SetValue(que.HslCI, a.I); + SetValue(que.HslCJ, a.J); + SetValue(que.HslCK, a.K); + SetValue(que.HslCL, a.L); + SetValue(que.HslCM, a.M); + SetValue(que.HslCN, a.N); + SetValue(que.HslCO, a.O); + + + + } + + public void SetValue(HslLanternSimple simple,bool boolDeg) + { + if (boolDeg) + { + simple.LanternBackground=System.Drawing.Color.Green; + } + else + { + simple.LanternBackground = System.Drawing.Color.Gray; + } } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Su/SuSongInit.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Su/SuSongInit.cs index f551519..d560774 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Su/SuSongInit.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Su/SuSongInit.cs @@ -92,6 +92,9 @@ namespace Mesnac.Action.ChemicalWeighing.Su }; private void Sel() { + var ssss= DateTime.Now.ToString("hh:mm:ss"); + endTime.MCValue=ssss; + var a = Convert.ToDateTime(GetA()); var b = Convert.ToDateTime(GetB()); @@ -173,7 +176,7 @@ namespace Mesnac.Action.ChemicalWeighing.Su private string GetB() { - return Convert.ToDateTime(endDate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endTime.MCValue).ToShortTimeString(); + return Convert.ToDateTime(endDate.MCValue).AddHours(0).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endTime.MCValue).ToShortTimeString(); } } } diff --git a/Main/MCEdit/Data/MCProject/nodeForm/FormQuRenAnNue.xml b/Main/MCEdit/Data/MCProject/nodeForm/FormQuRenAnNue.xml index facc796..7ed5053 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/FormQuRenAnNue.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/FormQuRenAnNue.xml @@ -1,5 +1,77 @@ + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + C线确认 + 624, 341 + BtnC + 196, 55 + 65 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + B线确认 + 360, 341 + BtnB + 207, 55 + 64 + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL + + + + False + + + + None + True + True + False + + + Red + DarkGray + A线确认 + 81, 341 + BtnA + 208, 55 + 63 + 1332, 191 HslCO diff --git a/Main/MCEdit/MCEdit.csproj b/Main/MCEdit/MCEdit.csproj index 02ab42c..7b40c11 100644 --- a/Main/MCEdit/MCEdit.csproj +++ b/Main/MCEdit/MCEdit.csproj @@ -416,6 +416,7 @@ + PreserveNewest diff --git a/Main/MCRun/Data/SysConfig/MenuConfig.dat b/Main/MCRun/Data/SysConfig/MenuConfig.dat index 259713f..f00ba47 100644 Binary files a/Main/MCRun/Data/SysConfig/MenuConfig.dat and b/Main/MCRun/Data/SysConfig/MenuConfig.dat differ