diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs index 3147da8..25583a5 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs @@ -22,7 +22,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Mesnac.Action.ChemicalWeighing.LjMaterial; - +using Mesnac.Action.ChemicalWeighing.MinAn; namespace Mesnac.Action.ChemicalWeighing.ManualControl { @@ -759,6 +759,20 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl if (SpiralOn1 == runtime.Sender) { + + + if (MinAnPlc.Heir1) + { + DialogResult result1 = + MessageBox.Show("1号罐正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (result1 == DialogResult.OK) + { + return; + } + } + + + short valueSet; short valueFast; short valuePoint; @@ -843,6 +857,17 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl if (SpiralOn2 == runtime.Sender) { + + if (MinAnPlc.Heir2) + { + DialogResult result2 = + MessageBox.Show("2号罐正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (result2 == DialogResult.OK) + { + return; + } + } + short valueSet; short valueFast; short valuePoint; @@ -921,6 +946,17 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl if (SpiralOn3 == runtime.Sender) { + + if (MinAnPlc.Heir3) + { + DialogResult result3 = + MessageBox.Show("3号罐正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (result3 == DialogResult.OK) + { + return; + } + } + short valueSet; short valueFast; short valuePoint; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 283c10e..f358071 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -538,6 +538,7 @@ + diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MinAn/MinAnPlc.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MinAn/MinAnPlc.cs new file mode 100644 index 0000000..2268ece --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MinAn/MinAnPlc.cs @@ -0,0 +1,39 @@ +using DataBlockHelper; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.MinAn +{ + public static class MinAnPlc + { + + public static bool Heir1 + { + get + { + return PlcConnect.Instance.ReadBool("M147.5").Content; + } + } + + public static bool Heir2 + { + get + { + return PlcConnect.Instance.ReadBool("M147.6").Content; + } + } + + + public static bool Heir3 + { + get + { + return PlcConnect.Instance.ReadBool("M147.7").Content; + } + } + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs index 8314eab..6940890 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs @@ -12,6 +12,7 @@ using ICSharpCode.Core; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor; +using Mesnac.Action.ChemicalWeighing.MinAn; using Mesnac.Basic; using Mesnac.Codd.Session; using Mesnac.Controls.Base; @@ -29,47 +30,25 @@ namespace Mesnac.Action.ChemicalWeighing.Test public void timer1EventProcessor(object source, EventArgs e) { - OpenDoorService.Insert(new OpenDoorEntity() + + + DialogResult result = + MessageBox.Show("正在上料", "温馨提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); + if (result == DialogResult.OK) { - DeviceId = 0, - OpenTime = DateTime.Now, - CreateTime = DateTime.Now, - Status = 0 - }); + return; + } + + string a = MinAnPlc.Heir1.ToString(); + string b = MinAnPlc.Heir2.ToString(); + string c = MinAnPlc.Heir3.ToString(); + } public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 var allDb=GetAllControls(); - - - - - - - DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); - if (dbHelper == null) - { - throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError); - } - // dbHelper.ClearParameter(); - // dbHelper.CommandType = CommandType.Text; - // dbHelper.CommandText = sql; - - int[] ssss = new int [] { }; - var ss2s = BasePlcHelper.Instance.PlcReadByRunName("BU1BLT01_Set", out ssss); - - - - - - Timer timer1 = new Timer(); - timer1.Interval = 1000; - timer1.Enabled = true; - timer1.Tick += new EventHandler(timer1EventProcessor);//添加事件 - - mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton; mCButton.Click += new EventHandler(timer1EventProcessor);