From 15c2a22cf3de2f87fcfb30c61b29a30acf6dff5f Mon Sep 17 00:00:00 2001 From: wangsr Date: Sun, 8 Oct 2023 14:54:21 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E9=87=8D=E6=9E=84=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=8E=A7=E5=88=B6=20=E5=AE=8C=E5=96=84=E6=97=A5?= =?UTF-8?q?=E5=BF=97=20=E6=B7=BB=E5=8A=A0=E7=84=A6=E7=82=B9=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManualControl/InitAction.cs | 69 +- .../ManualControl/ManualControlAction.cs | 2094 +++++++++-------- Main/MCEdit/App.config | 1 + Main/MCEdit/Data/MCProject/nodeDevice.xml | 6 +- .../MCProject/nodeForm/ManualWaterControl.xml | 94 +- Main/MCRun/App.config | 3 +- 6 files changed, 1174 insertions(+), 1093 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs index c60b525..d49faa7 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/InitAction.cs @@ -75,10 +75,6 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl base.RunIni(runtime); //必须要调用的 - //InitTimer(); - - //timer.Start(); - McControllist = GetAllDbMCControlsByOption(DbOptionTypes.InitData); WaterActualValue1 = GetBaseControl("WaterActualValue1"); @@ -108,42 +104,21 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ManualLogGridView").FirstOrDefault(); - DataTable table = DBHelp.GetTable(@"select top 100 id, logtext, logtime from Manual_Log order by id desc"); - - if (this.materialGridControl != null && this.materialGridControl.BaseControl != null) - { - this.materialGridControl.BaseControl.BindDataSource = null; - this.materialGridControl.BaseControl.BindDataSource = table; - } - else - { - ICSharpCode.Core.LoggingService.Warn("手动操作日志信息控件为Null..."); - } + LogInsertToDatabase(); timer = new Timer(); timer.Interval = 1000; timer.Enabled = true; timer.Tick += new EventHandler(ReadFromPlc);//添加事件 - } private void ReadFromPlc(object sender, EventArgs e) { flag += 1; - if(flag > 10) + if (flag > 10) { flag = 0; - DataTable table = DBHelp.GetTable(@"select top 100 id, logtext, logtime from Manual_Log order by id desc"); - - if (this.materialGridControl != null && this.materialGridControl.BaseControl != null) - { - this.materialGridControl.BaseControl.BindDataSource = null; - this.materialGridControl.BaseControl.BindDataSource = table; - } - else - { - ICSharpCode.Core.LoggingService.Warn("手动操作日志信息控件为Null..."); - } + LogInsertToDatabase(); } if (GetAllDbMCControlsByOption(DbOptionTypes.InitData).Count == 0) @@ -373,41 +348,27 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl // MetageState4.MCValue = "停止螺旋"; //} - - } - - - //private void InitTimer() - //{ - // //设置定时间隔(毫秒为单位) - // int interval = 900; - // timer = new System.Timers.Timer(interval); - // //设置执行一次(false)还是一直执行(true) - // timer.AutoReset = true; - // //设置是否执行System.Timers.Timer.Elapsed事件 - // timer.Enabled = true; - // //绑定Elapsed事件 - // timer.Elapsed += new System.Timers.ElapsedEventHandler(ReadFromPlc); - //} + } private IBaseControl GetBaseControl(string name) { return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl; } - - private void ManualLogControl(string logName) + private void LogInsertToDatabase() { - var Log = new ManualLogEntity() - { - logtext = logName, - logtime = DateTime.Now, - userid = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName - }; + DataTable table = DBHelp.GetTable(@"select top 100 id, logtext, logtime from Manual_Log order by id desc"); - FreeSqlUnit.Instance.Insert(Log).ExecuteIdentity(); + if (this.materialGridControl != null && this.materialGridControl.BaseControl != null) + { + this.materialGridControl.BaseControl.BindDataSource = null; + this.materialGridControl.BaseControl.BindDataSource = table; + } + else + { + ICSharpCode.Core.LoggingService.Warn("手动操作日志信息控件为Null..."); + } } - } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs index ea7795e..83823a4 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs @@ -1,4 +1,6 @@ using DataBlockHelper; +using DevExpress.Utils.About; +using ICSharpCode.Core; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.InterfaceDocking; @@ -11,6 +13,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -21,9 +24,10 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl class ManualControlAction : ChemicalWeighingAction, IAction { - private List McControllist; + private List McControllist; + private List _McControllist; - private byte GelChooseA; + private byte GelChooseA; private byte GelChooseB; private byte WetChoose1; @@ -31,1042 +35,1156 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl private byte WetChoose3; private byte WetChoose4; - public void Run(RuntimeParameter runtime) + #region 控件属性定义 + + MCButton StartMetage1; + MCButton StopMetage1; + MCButton StartMetage2; + MCButton StopMetage2; + MCButton StartMetage3; + MCButton StopMetage3; + MCButton StartMetage4; + MCButton StopMetage4; + MCButton WaterOut1; + MCButton WaterOut2; + MCButton WaterOut3; + MCButton WaterOut4; + MCButton WaterStop1; + MCButton WaterStop2; + MCButton WaterStop3; + MCButton WaterStop4; + MCButton SpiralOn1; + MCButton SpiralOn2; + MCButton SpiralOn3; + MCButton SpiralOn4; + MCButton SpiralOff1; + MCButton SpiralOff2; + MCButton SpiralOff3; + MCButton SpiralOff4; + + IBaseControl Gel1; + IBaseControl Gel2; + IBaseControl Gel3; + IBaseControl Gel4; + IBaseControl Gel5; + IBaseControl Gel6; + IBaseControl Gel7; + IBaseControl Gel8; + IBaseControl Wet1; + IBaseControl Wet2; + IBaseControl Wet3; + IBaseControl Wet4; + IBaseControl Wet5; + IBaseControl Wet6; + IBaseControl Wet7; + IBaseControl Wet8; + + IBaseControl SetWaterValue1; + IBaseControl SetWaterValue2; + IBaseControl SetWaterValue3; + IBaseControl SetWaterValue4; + IBaseControl SetSpiralValue1; + IBaseControl SetSpiralValue2; + IBaseControl SetSpiralValue3; + IBaseControl SetSpiralValue4; + IBaseControl FastSpiralValue1; + IBaseControl FastSpiralValue2; + IBaseControl FastSpiralValue3; + IBaseControl FastSpiralValue4; + IBaseControl PointSpiralValue1; + IBaseControl PointSpiralValue2; + IBaseControl PointSpiralValue3; + IBaseControl PointSpiralValue4; + IBaseControl FastSpeedSpiralValue1; + IBaseControl FastSpeedSpiralValue2; + IBaseControl FastSpeedSpiralValue3; + IBaseControl FastSpeedSpiralValue4; + IBaseControl LowSpeedSpiralValue1; + IBaseControl LowSpeedSpiralValue2; + IBaseControl LowSpeedSpiralValue3; + IBaseControl LowSpeedSpiralValue4; + IBaseControl PointSpeedSpiralValue1; + IBaseControl PointSpeedSpiralValue2; + IBaseControl PointSpeedSpiralValue3; + IBaseControl PointSpeedSpiralValue4; + + MCButton WetRequest1; + MCButton WetRequest2; + MCButton WetRequest3; + MCButton WetRequest4; + MCButton WetRequest5; + MCButton WetRequest6; + MCButton WetRequest7; + MCButton WetRequest8; + + MCButton Focus; + + #endregion + + + public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须要调用 + ControlImport(); + + + SingleSelect(); + + + BottomSelect(runtime); + + + } + + /// + /// 控件导入 + /// + private void ControlImport() + { + McControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件 + _McControllist = GetAllDbMCControlsByOption(DbOptionTypes.Modify);//获取所有待初始化控件 + + StartMetage1 = GetButtonControl("StartMetage1"); + StopMetage1 = GetButtonControl("StopMetage1"); + StartMetage2 = GetButtonControl("StartMetage2"); + StopMetage2 = GetButtonControl("StopMetage2"); + StartMetage3 = GetButtonControl("StartMetage3"); + StopMetage3 = GetButtonControl("StopMetage3"); + StartMetage4 = GetButtonControl("StartMetage4"); + StopMetage4 = GetButtonControl("StopMetage4"); + WaterOut1 = GetButtonControl("WaterOut1"); + WaterOut2 = GetButtonControl("WaterOut2"); + WaterOut3 = GetButtonControl("WaterOut3"); + WaterOut4 = GetButtonControl("WaterOut4"); + WaterStop1 = GetButtonControl("WaterStop1"); + WaterStop2 = GetButtonControl("WaterStop2"); + WaterStop3 = GetButtonControl("WaterStop3"); + WaterStop4 = GetButtonControl("WaterStop4"); + SpiralOn1 = GetButtonControl("SpiralOn1"); + SpiralOn2 = GetButtonControl("SpiralOn2"); + SpiralOn3 = GetButtonControl("SpiralOn3"); + SpiralOn4 = GetButtonControl("SpiralOn4"); + SpiralOff1 = GetButtonControl("SpiralOff1"); + SpiralOff2 = GetButtonControl("SpiralOff2"); + SpiralOff3 = GetButtonControl("SpiralOff3"); + SpiralOff4 = GetButtonControl("SpiralOff4"); + + Gel1 = GetBaseControl("Gel1"); + Gel2 = GetBaseControl("Gel2"); + Gel3 = GetBaseControl("Gel3"); + Gel4 = GetBaseControl("Gel4"); + Gel5 = GetBaseControl("Gel5"); + Gel6 = GetBaseControl("Gel6"); + Gel7 = GetBaseControl("Gel7"); + Gel8 = GetBaseControl("Gel8"); + Wet1 = GetBaseControl("Wet1"); + Wet2 = GetBaseControl("Wet2"); + Wet3 = GetBaseControl("Wet3"); + Wet4 = GetBaseControl("Wet4"); + Wet5 = GetBaseControl("Wet5"); + Wet6 = GetBaseControl("Wet6"); + Wet7 = GetBaseControl("Wet7"); + Wet8 = GetBaseControl("Wet8"); + + SetWaterValue1 = GetBaseControl("SetWaterValue1"); + SetWaterValue2 = GetBaseControl("SetWaterValue2"); + SetWaterValue3 = GetBaseControl("SetWaterValue3"); + SetWaterValue4 = GetBaseControl("SetWaterValue4"); + SetSpiralValue1 = GetBaseControl("SetSpiralValue1"); + SetSpiralValue2 = GetBaseControl("SetSpiralValue2"); + SetSpiralValue3 = GetBaseControl("SetSpiralValue3"); + SetSpiralValue4 = GetBaseControl("SetSpiralValue4"); + FastSpiralValue1 = GetBaseControl("FastSpiralValue1"); + FastSpiralValue2 = GetBaseControl("FastSpiralValue2"); + FastSpiralValue3 = GetBaseControl("FastSpiralValue3"); + FastSpiralValue4 = GetBaseControl("FastSpiralValue4"); + PointSpiralValue1 = GetBaseControl("PointSpiralValue1"); + PointSpiralValue2 = GetBaseControl("PointSpiralValue2"); + PointSpiralValue3 = GetBaseControl("PointSpiralValue3"); + PointSpiralValue4 = GetBaseControl("PointSpiralValue4"); + FastSpeedSpiralValue1 = GetBaseControl("FastSpeedSpiralValue1"); + FastSpeedSpiralValue2 = GetBaseControl("FastSpeedSpiralValue2"); + FastSpeedSpiralValue3 = GetBaseControl("FastSpeedSpiralValue3"); + FastSpeedSpiralValue4 = GetBaseControl("FastSpeedSpiralValue4"); + LowSpeedSpiralValue1 = GetBaseControl("LowSpeedSpiralValue1"); + LowSpeedSpiralValue2 = GetBaseControl("LowSpeedSpiralValue2"); + LowSpeedSpiralValue3 = GetBaseControl("LowSpeedSpiralValue3"); + LowSpeedSpiralValue4 = GetBaseControl("LowSpeedSpiralValue4"); + PointSpeedSpiralValue1 = GetBaseControl("PointSpeedSpiralValue1"); + PointSpeedSpiralValue2 = GetBaseControl("PointSpeedSpiralValue2"); + PointSpeedSpiralValue3 = GetBaseControl("PointSpeedSpiralValue3"); + PointSpeedSpiralValue4 = GetBaseControl("PointSpeedSpiralValue4"); + + WetRequest1 = GetButtonControl("WetRequest1"); + WetRequest2 = GetButtonControl("WetRequest2"); + WetRequest3 = GetButtonControl("WetRequest3"); + WetRequest4 = GetButtonControl("WetRequest4"); + WetRequest5 = GetButtonControl("WetRequest5"); + WetRequest6 = GetButtonControl("WetRequest6"); + WetRequest7 = GetButtonControl("WetRequest7"); + WetRequest8 = GetButtonControl("WetRequest8"); + + Focus = GetButtonControl("Focus"); + } + + /// + /// 单选框选择操作机台 + /// + private void SingleSelect() + { + if (Convert.ToBoolean(Gel1.MCValue) == true) + { + GelChooseA = 1; + } - #region 控件导入 - - McControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件 - IBaseControl StartMetage1 = GetBaseControl("StartMetage1"); - IBaseControl StopMetage1 = GetBaseControl("StopMetage1"); - IBaseControl StartMetage2 = GetBaseControl("StartMetage2"); - IBaseControl StopMetage2 = GetBaseControl("StopMetage2"); - IBaseControl StartMetage3 = GetBaseControl("StartMetage3"); - IBaseControl StopMetage3 = GetBaseControl("StopMetage3"); - IBaseControl StartMetage4 = GetBaseControl("StartMetage4"); - IBaseControl StopMetage4 = GetBaseControl("StopMetage4"); - IBaseControl WaterOut1 = GetBaseControl("WaterOut1"); - IBaseControl WaterOut2 = GetBaseControl("WaterOut2"); - IBaseControl WaterOut3 = GetBaseControl("WaterOut3"); - IBaseControl WaterOut4 = GetBaseControl("WaterOut4"); - IBaseControl WaterStop1 = GetBaseControl("WaterStop1"); - IBaseControl WaterStop2 = GetBaseControl("WaterStop2"); - IBaseControl WaterStop3 = GetBaseControl("WaterStop3"); - IBaseControl WaterStop4 = GetBaseControl("WaterStop4"); - IBaseControl SpiralOn1 = GetBaseControl("SpiralOn1"); - IBaseControl SpiralOn2 = GetBaseControl("SpiralOn2"); - IBaseControl SpiralOn3 = GetBaseControl("SpiralOn3"); - IBaseControl SpiralOn4 = GetBaseControl("SpiralOn4"); - IBaseControl SpiralOff1 = GetBaseControl("SpiralOff1"); - IBaseControl SpiralOff2 = GetBaseControl("SpiralOff2"); - IBaseControl SpiralOff3 = GetBaseControl("SpiralOff3"); - IBaseControl SpiralOff4 = GetBaseControl("SpiralOff4"); - - IBaseControl Gel1 = GetBaseControl("Gel1"); - IBaseControl Gel2 = GetBaseControl("Gel2"); - IBaseControl Gel3 = GetBaseControl("Gel3"); - IBaseControl Gel4 = GetBaseControl("Gel4"); - IBaseControl Gel5 = GetBaseControl("Gel5"); - IBaseControl Gel6 = GetBaseControl("Gel6"); - IBaseControl Gel7 = GetBaseControl("Gel7"); - IBaseControl Gel8 = GetBaseControl("Gel8"); - IBaseControl Wet1 = GetBaseControl("Wet1"); - IBaseControl Wet2 = GetBaseControl("Wet2"); - IBaseControl Wet3 = GetBaseControl("Wet3"); - IBaseControl Wet4 = GetBaseControl("Wet4"); - IBaseControl Wet5 = GetBaseControl("Wet5"); - IBaseControl Wet6 = GetBaseControl("Wet6"); - IBaseControl Wet7 = GetBaseControl("Wet7"); - IBaseControl Wet8 = GetBaseControl("Wet8"); - - IBaseControl SetWaterValue1 = GetBaseControl("SetWaterValue1"); - IBaseControl SetWaterValue2 = GetBaseControl("SetWaterValue2"); - IBaseControl SetWaterValue3 = GetBaseControl("SetWaterValue3"); - IBaseControl SetWaterValue4 = GetBaseControl("SetWaterValue4"); - IBaseControl SetSpiralValue1 = GetBaseControl("SetSpiralValue1"); - IBaseControl SetSpiralValue2 = GetBaseControl("SetSpiralValue2"); - IBaseControl SetSpiralValue3 = GetBaseControl("SetSpiralValue3"); - IBaseControl SetSpiralValue4 = GetBaseControl("SetSpiralValue4"); - IBaseControl FastSpiralValue1 = GetBaseControl("FastSpiralValue1"); - IBaseControl FastSpiralValue2 = GetBaseControl("FastSpiralValue2"); - IBaseControl FastSpiralValue3 = GetBaseControl("FastSpiralValue3"); - IBaseControl FastSpiralValue4 = GetBaseControl("FastSpiralValue4"); - IBaseControl PointSpiralValue1 = GetBaseControl("PointSpiralValue1"); - IBaseControl PointSpiralValue2 = GetBaseControl("PointSpiralValue2"); - IBaseControl PointSpiralValue3 = GetBaseControl("PointSpiralValue3"); - IBaseControl PointSpiralValue4 = GetBaseControl("PointSpiralValue4"); - IBaseControl FastSpeedSpiralValue1 = GetBaseControl("FastSpeedSpiralValue1"); - IBaseControl FastSpeedSpiralValue2 = GetBaseControl("FastSpeedSpiralValue2"); - IBaseControl FastSpeedSpiralValue3 = GetBaseControl("FastSpeedSpiralValue3"); - IBaseControl FastSpeedSpiralValue4 = GetBaseControl("FastSpeedSpiralValue4"); - IBaseControl LowSpeedSpiralValue1 = GetBaseControl("LowSpeedSpiralValue1"); - IBaseControl LowSpeedSpiralValue2 = GetBaseControl("LowSpeedSpiralValue2"); - IBaseControl LowSpeedSpiralValue3 = GetBaseControl("LowSpeedSpiralValue3"); - IBaseControl LowSpeedSpiralValue4 = GetBaseControl("LowSpeedSpiralValue4"); - IBaseControl PointSpeedSpiralValue1 = GetBaseControl("PointSpeedSpiralValue1"); - IBaseControl PointSpeedSpiralValue2 = GetBaseControl("PointSpeedSpiralValue2"); - IBaseControl PointSpeedSpiralValue3 = GetBaseControl("PointSpeedSpiralValue3"); - IBaseControl PointSpeedSpiralValue4 = GetBaseControl("PointSpeedSpiralValue4"); - - IBaseControl WetRequest1 = GetBaseControl("WetRequest1"); - IBaseControl WetRequest2 = GetBaseControl("WetRequest2"); - IBaseControl WetRequest3 = GetBaseControl("WetRequest3"); - IBaseControl WetRequest4 = GetBaseControl("WetRequest4"); - IBaseControl WetRequest5 = GetBaseControl("WetRequest5"); - IBaseControl WetRequest6 = GetBaseControl("WetRequest6"); - IBaseControl WetRequest7 = GetBaseControl("WetRequest7"); - IBaseControl WetRequest8 = GetBaseControl("WetRequest8"); - - - #endregion - - - #region 单选判断 - - if (Convert.ToBoolean(Gel1.MCValue) == true) - { - GelChooseA = 1; - } + if (Convert.ToBoolean(Gel2.MCValue) == true) + { + GelChooseA = 2; + } - if (Convert.ToBoolean(Gel2.MCValue) == true) - { - GelChooseA = 2; - } + if (Convert.ToBoolean(Gel3.MCValue) == true) + { + GelChooseA = 3; + } - if (Convert.ToBoolean(Gel3.MCValue) == true) - { - GelChooseA = 3; - } + if (Convert.ToBoolean(Gel4.MCValue) == true) + { + GelChooseA = 4; + } - if (Convert.ToBoolean(Gel4.MCValue) == true) - { - GelChooseA = 4; - } + if (Convert.ToBoolean(Gel5.MCValue) == true) + { + GelChooseB = 5; + } - if (Convert.ToBoolean(Gel5.MCValue) == true) - { - GelChooseB = 5; - } + if (Convert.ToBoolean(Gel6.MCValue) == true) + { + GelChooseB = 6; + } - if (Convert.ToBoolean(Gel6.MCValue) == true) - { - GelChooseB = 6; - } + if (Convert.ToBoolean(Gel7.MCValue) == true) + { + GelChooseB = 7; + } - if (Convert.ToBoolean(Gel7.MCValue) == true) - { - GelChooseB = 7; - } + if (Convert.ToBoolean(Gel8.MCValue) == true) + { + GelChooseB = 8; + } - if (Convert.ToBoolean(Gel8.MCValue) == true) - { - GelChooseB = 8; - } + if (Convert.ToBoolean(Wet1.MCValue) == true) + { + WetChoose1 = 1; + } - if (Convert.ToBoolean(Wet1.MCValue) == true) - { - WetChoose1 = 1; - } + if (Convert.ToBoolean(Wet2.MCValue) == true) + { + WetChoose1 = 2; + } - if (Convert.ToBoolean(Wet2.MCValue) == true) - { - WetChoose1 = 2; - } + if (Convert.ToBoolean(Wet3.MCValue) == true) + { + WetChoose2 = 3; + } - if (Convert.ToBoolean(Wet3.MCValue) == true) - { - WetChoose2 = 3; - } + if (Convert.ToBoolean(Wet4.MCValue) == true) + { + WetChoose2 = 4; + } - if (Convert.ToBoolean(Wet4.MCValue) == true) - { - WetChoose2 = 4; - } + if (Convert.ToBoolean(Wet5.MCValue) == true) + { + WetChoose3 = 5; + } - if (Convert.ToBoolean(Wet5.MCValue) == true) - { - WetChoose3 = 5; - } + if (Convert.ToBoolean(Wet6.MCValue) == true) + { + WetChoose3 = 6; + } - if (Convert.ToBoolean(Wet6.MCValue) == true) - { - WetChoose3 = 6; - } + if (Convert.ToBoolean(Wet7.MCValue) == true) + { + WetChoose4 = 7; + } - if (Convert.ToBoolean(Wet7.MCValue) == true) - { - WetChoose4 = 7; - } + if (Convert.ToBoolean(Wet8.MCValue) == true) + { + WetChoose4 = 8; + } + } + + /// + /// 按钮选择事件 + /// + /// 运行时参数 + private void BottomSelect(RuntimeParameter runtime) + { + Focus.Focus(); + if (StartMetage1 == runtime.Sender) + { + short value; + if (short.TryParse(Convert.ToString(SetWaterValue1.MCValue), out value)) + { + if (MessageBox.Show("冷水称A确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + PlcControl("DB2119.20.0", value); + PlcControl("DB2119.28.0", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始称量" + value); + ManualLogControl("冷水称A开始称量 " + value); + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("冷水称A输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + } - if (Convert.ToBoolean(Wet8.MCValue) == true) - { - WetChoose4 = 8; - } + if (StopMetage1 == runtime.Sender) + { + PlcControl("DB2119.28.1", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A称量已手动停止"); + ManualLogControl("冷水称A称量已手动停止"); + MessageBox.Show("称量已停止!"); + } + + if (StartMetage2 == runtime.Sender) + { + short value; + if (short.TryParse(Convert.ToString(SetWaterValue2.MCValue), out value)) + { + if (MessageBox.Show("热水称A确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + PlcControl("DB2119.0.0", value); + PlcControl("DB2119.8.0", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称A开始称量" + value); + ManualLogControl("热水称A开始称量 " + value); + PlcControl("DB2119.0.0", value); + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("热水称A输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + } - #endregion + if (StopMetage2 == runtime.Sender) + { + PlcControl("DB2119.8.1", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称A称量已手动停止"); + ManualLogControl("热水称A称量已手动停止"); + MessageBox.Show("称量已停止!"); + } + if (StartMetage3 == runtime.Sender) + { + short value; + if (short.TryParse(Convert.ToString(SetWaterValue3.MCValue), out value)) + { + if (MessageBox.Show("冷水称B确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始称量" + value); + ManualLogControl("冷水称B开始称量 " + value); + PlcControl("DB2119.30.0", value); + PlcControl("DB2119.38.0", true); + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("冷水称B输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + } - #region 按钮选择 + if (StopMetage3 == runtime.Sender) + { + PlcControl("DB2119.38.1", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称B称量已手动停止"); + ManualLogControl("冷水称B称量已手动停止"); + MessageBox.Show("称量已停止!"); + } - if (StartMetage1 == runtime.Sender) - { - float value; - if (float.TryParse(Convert.ToString(SetWaterValue1.MCValue), out value)) - { - if (MessageBox.Show("冷水称A确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始称量" + value); - ManualLogControl("冷水称A开始称量 " + value); - PlcConnect.Instance.Write("DB2119.20.0", Convert.ToUInt16(value)); - PlcConnect.Instance.Write("DB2119.28.0", true); - } - else + if (StartMetage4 == runtime.Sender) + { + short value; + if (short.TryParse(Convert.ToString(SetWaterValue4.MCValue), out value)) { - MesnacServiceManager.Instance.LoggingService.Info("冷水称A输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; + if (MessageBox.Show("热水称B确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + MesnacServiceManager.Instance.LoggingService.Info("热水称B开始称量" + value); + ManualLogControl("热水称B开始称量 " + value); + PlcControl("DB2119.10.0", value); + PlcControl("DB2119.18.0", true); } - } + else + { + MesnacServiceManager.Instance.LoggingService.Info("热水称B输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + } - if (StopMetage1 == runtime.Sender) - { - PlcConnect.Instance.Write("DB2119.28.1", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A称量已手动停止"); - ManualLogControl("冷水称A称量已手动停止"); - MessageBox.Show("称量已停止!"); - } + if (StopMetage4 == runtime.Sender) + { + PlcControl("DB2119.18.1", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称B称量已手动停止"); + ManualLogControl("热水称B称量已手动停止"); + MessageBox.Show("称量已停止!"); + } - if (StartMetage2 == runtime.Sender) - { - float value; - if (float.TryParse(Convert.ToString(SetWaterValue2.MCValue), out value)) - { - if (MessageBox.Show("热水称A确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - MesnacServiceManager.Instance.LoggingService.Info("热水称A开始称量" + value); - ManualLogControl("热水称A开始称量 " + value); - PlcConnect.Instance.Write("DB2119.0.0", Convert.ToUInt16(value)); - PlcConnect.Instance.Write("DB2119.8.0", true); - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("热水称A输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } - } - - if (StopMetage2 == runtime.Sender) - { - PlcConnect.Instance.Write("DB2119.8.1", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称A称量已手动停止"); - ManualLogControl("热水称A称量已手动停止"); - MessageBox.Show("称量已停止!"); - } + if (WaterOut1 == runtime.Sender) + { + if (MessageBox.Show("冷水称A确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } - if (StartMetage3 == runtime.Sender) - { - float value; - if (float.TryParse(Convert.ToString(SetWaterValue3.MCValue), out value)) - { - if (MessageBox.Show("冷水称B确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始称量" + value); - ManualLogControl("冷水称B开始称量 " + value); - PlcConnect.Instance.Write("DB2119.30.0", Convert.ToUInt16(value)); - PlcConnect.Instance.Write("DB2119.38.0", true); - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("冷水称B输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } - } - - if (StopMetage3 == runtime.Sender) - { - PlcConnect.Instance.Write("DB2119.38.1", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B称量已手动停止"); - ManualLogControl("冷水称B称量已手动停止"); - MessageBox.Show("称量已停止!"); - } + switch (GelChooseA) + { + case 1: + PlcControl("DB2119.26.0", 1); + PlcControl("DB2119.28.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅1排水"); + ManualLogControl("冷水称A开始向糊化锅1排水"); + break; + case 2: + PlcControl("DB2119.26.0", 2); + PlcControl("DB2119.28.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅2排水"); + ManualLogControl("冷水称A开始向糊化锅2排水"); + break; + case 3: + PlcControl("DB2119.26.0", 3); + PlcControl("DB2119.28.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅3排水"); + ManualLogControl("冷水称A开始向糊化锅3排水"); + break; + case 4: + PlcControl("DB2119.26.0", 4); + PlcControl("DB2119.28.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅4排水"); + ManualLogControl("冷水称A开始向糊化锅4排水"); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + } - if (StartMetage4 == runtime.Sender) - { - float value; - if (float.TryParse(Convert.ToString(SetWaterValue4.MCValue), out value)) - { - if (MessageBox.Show("热水称B确认开始称量?", "称量确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - MesnacServiceManager.Instance.LoggingService.Info("热水称B开始称量" + value); - ManualLogControl("热水称B开始称量 " + value); - PlcConnect.Instance.Write("DB2119.10.0", Convert.ToUInt16(value)); - PlcConnect.Instance.Write("DB2119.18.0", true); - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("热水称B输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } - } - - if (StopMetage4 == runtime.Sender) - { - PlcConnect.Instance.Write("DB2119.18.1", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称B称量已手动停止"); - ManualLogControl("热水称B称量已手动停止"); - MessageBox.Show("称量已停止!"); - } + if (WaterOut2 == runtime.Sender) + { + if (MessageBox.Show("热水称A确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } - if (WaterOut1 == runtime.Sender) - { - if (MessageBox.Show("冷水称A确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - - switch (GelChooseA) - { - case 1: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.28.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅1排水"); - ManualLogControl("冷水称A开始向糊化锅1排水"); - break; - case 2: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.28.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅2排水"); - ManualLogControl("冷水称A开始向糊化锅2排水"); - break; - case 3: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.28.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅3排水"); - ManualLogControl("冷水称A开始向糊化锅3排水"); - break; - case 4: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.28.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A开始向糊化锅4排水"); - ManualLogControl("冷水称A开始向糊化锅4排水"); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - - - } - - if (WaterOut2 == runtime.Sender) - { - if (MessageBox.Show("热水称A确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - - switch (GelChooseA) - { - case 1: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.8.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅1排水"); - ManualLogControl("热水称A开始向糊化锅1排水"); - break; - case 2: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.8.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅2排水"); - ManualLogControl("热水称A开始向糊化锅2排水"); - break; - case 3: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.8.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅3排水"); - ManualLogControl("热水称A开始向糊化锅3排水"); - break; - case 4: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.8.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅4排水"); - ManualLogControl("热水称A开始向糊化锅4排水"); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - - } - - if (WaterOut3 == runtime.Sender) - { - if (MessageBox.Show("冷水称B确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - - switch (GelChooseB) - { - case 5: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.38.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅5排水"); - ManualLogControl("冷水称B开始向糊化锅5排水"); - break; - case 6: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.38.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅6排水"); - ManualLogControl("冷水称B开始向糊化锅6排水"); - break; - case 7: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.38.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅7排水"); - ManualLogControl("冷水称B开始向糊化锅7排水"); - break; - case 8: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.38.4", true); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅8排水"); - ManualLogControl("冷水称B开始向糊化锅8排水"); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - - - } - - if (WaterOut4 == runtime.Sender) - { - if (MessageBox.Show("热水称B确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - - switch (GelChooseB) - { - case 5: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.18.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅5排水"); - ManualLogControl("热水称B开始向糊化锅5排水"); - break; - case 6: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.18.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅6排水"); - ManualLogControl("热水称B开始向糊化锅6排水"); - break; - case 7: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.18.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅7排水"); - ManualLogControl("热水称B开始向糊化锅7排水"); - break; - case 8: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.18.4", true); - MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅8排水"); - ManualLogControl("热水称B开始向糊化锅8排水"); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - - - } - - if (WaterStop1 == runtime.Sender) - { - switch (GelChooseA) - { - case 1: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.28.5", true); - break; - case 2: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.28.5", true); - break; - case 3: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.28.5", true); - break; - case 4: - PlcConnect.Instance.Write("DB2119.26.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.28.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - MessageBox.Show("冷水称A已停止排水"); - ManualLogControl("冷水称A停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("冷水称A停止排水"); - } - - if (WaterStop2 == runtime.Sender) - { - switch (GelChooseA) - { - case 1: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.8.5", true); - break; - case 2: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.8.5", true); - break; - case 3: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.8.5", true); - break; - case 4: - PlcConnect.Instance.Write("DB2119.6.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.8.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - MessageBox.Show("热水称A已停止排水"); - ManualLogControl("热水称A停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("热水称A停止排水"); - } - - if (WaterStop3 == runtime.Sender) - { - switch (GelChooseB) - { - case 5: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.38.5", true); - break; - case 6: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.38.5", true); - break; - case 7: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.38.5", true); - break; - case 8: - PlcConnect.Instance.Write("DB2119.36.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.38.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - MessageBox.Show("冷水称B已停止排水"); - ManualLogControl("冷水称B停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("冷水称B停止排水"); - } - - if (WaterStop4 == runtime.Sender) - { - switch (GelChooseB) - { - case 5: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.18.5", true); - break; - case 6: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.18.5", true); - break; - case 7: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(3)); - PlcConnect.Instance.Write("DB2119.18.5", true); - break; - case 8: - PlcConnect.Instance.Write("DB2119.16.0", Convert.ToUInt16(4)); - PlcConnect.Instance.Write("DB2119.18.5", true); - break; - default: - MessageBox.Show("请选择一个糊化锅!"); - return; - } - - MessageBox.Show("热水称B已停止排水"); - ManualLogControl("热水称B停止排水"); - MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水"); - } - - - if (SpiralOn1 == runtime.Sender) - { - float valueSet; - float valueFast; - float valuePoint; - float valueSpeedFast; - float valueSpeedLow; - float valueSpeedPoint; - if (float.TryParse(Convert.ToString(SetSpiralValue1.MCValue), out valueSet) && - float.TryParse(Convert.ToString(FastSpiralValue1.MCValue), out valueFast) && - float.TryParse(Convert.ToString(PointSpiralValue1.MCValue), out valuePoint) && - float.TryParse(Convert.ToString(FastSpeedSpiralValue1.MCValue), out valueSpeedFast) && - float.TryParse(Convert.ToString(LowSpeedSpiralValue1.MCValue), out valueSpeedLow) && - float.TryParse(Convert.ToString(PointSpeedSpiralValue1.MCValue), out valueSpeedPoint)) - { - if (MessageBox.Show("螺旋1确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("螺旋1输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } - - switch (WetChoose1) - { - case 1: - PlcConnect.Instance.Write("DB2119.40.0", Convert.ToUInt16(valueSet)); - PlcConnect.Instance.Write("DB2119.44.0", Convert.ToUInt16(valueFast)); - PlcConnect.Instance.Write("DB2119.46.0", Convert.ToUInt16(valuePoint)); - PlcConnect.Instance.Write("DB2119.50.0", Convert.ToUInt16(valueSpeedFast)); - PlcConnect.Instance.Write("DB2119.52.0", Convert.ToUInt16(valueSpeedLow)); - PlcConnect.Instance.Write("DB2119.54.0", Convert.ToUInt16(valueSpeedPoint)); - PlcConnect.Instance.Write("DB2119.58.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.60.0", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋1启动向湿混机1 " + valueSet); - ManualLogControl("螺旋1启动向湿混机1" + valueSet); - break; - case 2: - PlcConnect.Instance.Write("DB2119.40.0", Convert.ToUInt16(valueSet)); - PlcConnect.Instance.Write("DB2119.44.0", Convert.ToUInt16(valueFast)); - PlcConnect.Instance.Write("DB2119.46.0", Convert.ToUInt16(valuePoint)); - PlcConnect.Instance.Write("DB2119.50.0", Convert.ToUInt16(valueSpeedFast)); - PlcConnect.Instance.Write("DB2119.52.0", Convert.ToUInt16(valueSpeedLow)); - PlcConnect.Instance.Write("DB2119.54.0", Convert.ToUInt16(valueSpeedPoint)); - PlcConnect.Instance.Write("DB2119.58.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.60.0", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋1启动向湿混机2 " + valueSet); - ManualLogControl("螺旋1启动向湿混机2 " + valueSet); - break; - default: - MessageBox.Show("请选择一个湿混机!"); - return; - } - - - } - - if (SpiralOn2 == runtime.Sender) - { - float valueSet; - float valueFast; - float valuePoint; - float valueSpeedFast; - float valueSpeedLow; - float valueSpeedPoint; - if (float.TryParse(Convert.ToString(SetSpiralValue2.MCValue), out valueSet) && - float.TryParse(Convert.ToString(FastSpiralValue2.MCValue), out valueFast) && - float.TryParse(Convert.ToString(PointSpiralValue2.MCValue), out valuePoint) && - float.TryParse(Convert.ToString(FastSpeedSpiralValue2.MCValue), out valueSpeedFast) && - float.TryParse(Convert.ToString(LowSpeedSpiralValue2.MCValue), out valueSpeedLow) && - float.TryParse(Convert.ToString(PointSpeedSpiralValue2.MCValue), out valueSpeedPoint)) - { - if (MessageBox.Show("螺旋2确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("螺旋2输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } - - switch (WetChoose2) - { - case 3: - PlcConnect.Instance.Write("DB2119.62.0", Convert.ToUInt16(valueSet)); - PlcConnect.Instance.Write("DB2119.66.0", Convert.ToUInt16(valueFast)); - PlcConnect.Instance.Write("DB2119.68.0", Convert.ToUInt16(valuePoint)); - PlcConnect.Instance.Write("DB2119.72.0", Convert.ToUInt16(valueSpeedFast)); - PlcConnect.Instance.Write("DB2119.74.0", Convert.ToUInt16(valueSpeedLow)); - PlcConnect.Instance.Write("DB2119.76.0", Convert.ToUInt16(valueSpeedPoint)); - PlcConnect.Instance.Write("DB2119.80.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.82.0", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋2启动向湿混机3 " + valueSet); - ManualLogControl("螺旋2启动向湿混机3 " + valueSet); - break; - case 4: - PlcConnect.Instance.Write("DB2119.62.0", Convert.ToUInt16(valueSet)); - PlcConnect.Instance.Write("DB2119.66.0", Convert.ToUInt16(valueFast)); - PlcConnect.Instance.Write("DB2119.68.0", Convert.ToUInt16(valuePoint)); - PlcConnect.Instance.Write("DB2119.72.0", Convert.ToUInt16(valueSpeedFast)); - PlcConnect.Instance.Write("DB2119.74.0", Convert.ToUInt16(valueSpeedLow)); - PlcConnect.Instance.Write("DB2119.76.0", Convert.ToUInt16(valueSpeedPoint)); - PlcConnect.Instance.Write("DB2119.80.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.82.0", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋2启动向湿混机4 " + valueSet); - ManualLogControl("螺旋2启动向湿混机4 " + valueSet); - break; - default: - MessageBox.Show("请选择一个湿混机!"); - return; - } - - - } - - if (SpiralOn3 == runtime.Sender) - { - float valueSet; - float valueFast; - float valuePoint; - float valueSpeedFast; - float valueSpeedLow; - float valueSpeedPoint; - if (float.TryParse(Convert.ToString(SetSpiralValue3.MCValue), out valueSet) && - float.TryParse(Convert.ToString(FastSpiralValue3.MCValue), out valueFast) && - float.TryParse(Convert.ToString(PointSpiralValue3.MCValue), out valuePoint) && - float.TryParse(Convert.ToString(FastSpeedSpiralValue3.MCValue), out valueSpeedFast) && - float.TryParse(Convert.ToString(LowSpeedSpiralValue3.MCValue), out valueSpeedLow) && - float.TryParse(Convert.ToString(PointSpeedSpiralValue3.MCValue), out valueSpeedPoint)) - { - if (MessageBox.Show("螺旋3确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("螺旋3输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } - - switch (WetChoose3) - { - case 5: - PlcConnect.Instance.Write("DB2119.84.0", Convert.ToUInt16(valueSet)); - PlcConnect.Instance.Write("DB2119.88.0", Convert.ToUInt16(valueFast)); - PlcConnect.Instance.Write("DB2119.90.0", Convert.ToUInt16(valuePoint)); - PlcConnect.Instance.Write("DB2119.94.0", Convert.ToUInt16(valueSpeedFast)); - PlcConnect.Instance.Write("DB2119.96.0", Convert.ToUInt16(valueSpeedLow)); - PlcConnect.Instance.Write("DB2119.98.0", Convert.ToUInt16(valueSpeedPoint)); - PlcConnect.Instance.Write("DB2119.102.0", Convert.ToUInt16(1)); - PlcConnect.Instance.Write("DB2119.104.0", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋3启动向湿混机5 " + valueSet); - ManualLogControl("螺旋3启动向湿混机5 " + valueSet); - break; - case 6: - PlcConnect.Instance.Write("DB2119.84.0", Convert.ToUInt16(valueSet)); - PlcConnect.Instance.Write("DB2119.88.0", Convert.ToUInt16(valueFast)); - PlcConnect.Instance.Write("DB2119.90.0", Convert.ToUInt16(valuePoint)); - PlcConnect.Instance.Write("DB2119.94.0", Convert.ToUInt16(valueSpeedFast)); - PlcConnect.Instance.Write("DB2119.96.0", Convert.ToUInt16(valueSpeedLow)); - PlcConnect.Instance.Write("DB2119.98.0", Convert.ToUInt16(valueSpeedPoint)); - PlcConnect.Instance.Write("DB2119.102.0", Convert.ToUInt16(2)); - PlcConnect.Instance.Write("DB2119.104.0", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋3启动向湿混机6 " + valueSet); - ManualLogControl("螺旋3启动向湿混机6 " + valueSet); - break; - default: - MessageBox.Show("请选择一个湿混机!"); - return; - } - - - } - - if (SpiralOn4 == runtime.Sender) - { - MessageBox.Show("二期工程,敬请期待!"); - //float valueSet; - //float valueFast; - //float valuePoint; - //float valueSpeedFast; - //float valueSpeedLow; - //float valueSpeedPoint; - //if (float.TryParse(Convert.ToString(SetSpiralValue4.MCValue), out valueSet) && - // float.TryParse(Convert.ToString(FastSpiralValue4.MCValue), out valueFast) && - // float.TryParse(Convert.ToString(PointSpiralValue4.MCValue), out valuePoint) && - // float.TryParse(Convert.ToString(FastSpeedSpiralValue4.MCValue), out valueSpeedFast) && - // float.TryParse(Convert.ToString(LowSpeedSpiralValue4.MCValue), out valueSpeedLow) && - // float.TryParse(Convert.ToString(PointSpeedSpiralValue4.MCValue), out valueSpeedPoint)) - //{ - // if (MessageBox.Show("螺旋4确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - // { - // return; - // } - // MesnacServiceManager.Instance.LoggingService.Info("螺旋4启动"); - //} - //else - //{ - // MesnacServiceManager.Instance.LoggingService.Info("螺旋4输入数值的格式有误"); - // MessageBox.Show("输入数值的格式有误!"); - // return; - //} - - //switch (WetChoose4) - //{ - // case 7: - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSet)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueFast)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valuePoint)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSpeedFast)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSpeedLow)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSpeedPoint)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(1)); - // PlcConnect.Instance.Write("DB2119..0", true); - // break; - // case 8: - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSet)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueFast)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valuePoint)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSpeedFast)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSpeedLow)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(valueSpeedPoint)); - // PlcConnect.Instance.Write("DB2119..0", Convert.ToUInt16(2)); - // PlcConnect.Instance.Write("DB2119..0", true); - // break; - // default: return; - //} - } - - if (SpiralOff1 == runtime.Sender) + switch (GelChooseA) + { + case 1: + PlcControl("DB2119.6.0", 1); + PlcControl("DB2119.8.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅1排水"); + ManualLogControl("热水称A开始向糊化锅1排水"); + break; + case 2: + PlcControl("DB2119.6.0", 2); + PlcControl("DB2119.8.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅2排水"); + ManualLogControl("热水称A开始向糊化锅2排水"); + break; + case 3: + PlcControl("DB2119.6.0", 3); + PlcControl("DB2119.8.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅3排水"); + ManualLogControl("热水称A开始向糊化锅3排水"); + break; + case 4: + PlcControl("DB2119.6.0", 4); + PlcControl("DB2119.8.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称A开始向糊化锅4排水"); + ManualLogControl("热水称A开始向糊化锅4排水"); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + } + + if (WaterOut3 == runtime.Sender) { - PlcConnect.Instance.Write("DB2119.60.1", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋1已手动停止"); - ManualLogControl("螺旋1已手动停止"); - MessageBox.Show("螺旋1已停止!"); - } + if (MessageBox.Show("冷水称B确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } - if (SpiralOff2 == runtime.Sender) - { - PlcConnect.Instance.Write("DB2119.82.1", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋2已手动停止"); - ManualLogControl("螺旋2已手动停止"); - MessageBox.Show("螺旋2已停止!"); - } + switch (GelChooseB) + { + case 5: + PlcControl("DB2119.36.0", 1); + PlcControl("DB2119.38.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅5排水"); + ManualLogControl("冷水称B开始向糊化锅5排水"); + break; + case 6: + PlcControl("DB2119.36.0", 2); + PlcControl("DB2119.38.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅6排水"); + ManualLogControl("冷水称B开始向糊化锅6排水"); + break; + case 7: + PlcControl("DB2119.36.0", 3); + PlcControl("DB2119.38.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅7排水"); + ManualLogControl("冷水称B开始向糊化锅7排水"); + break; + case 8: + PlcControl("DB2119.36.0", 4); + PlcControl("DB2119.38.4", true); + MesnacServiceManager.Instance.LoggingService.Info("冷水称B开始向糊化锅8排水"); + ManualLogControl("冷水称B开始向糊化锅8排水"); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + } - if (SpiralOff3 == runtime.Sender) - { - PlcConnect.Instance.Write("DB2119.104.1", true); - MesnacServiceManager.Instance.LoggingService.Info("螺旋3已手动停止"); - ManualLogControl("螺旋3已手动停止"); - MessageBox.Show("螺旋3已停止!"); - } + if (WaterOut4 == runtime.Sender) + { + if (MessageBox.Show("热水称B确认开始排水?", "排水确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } - if (SpiralOff4 == runtime.Sender) - { - MessageBox.Show("二期工程,敬请期待!"); - //PlcConnect.Instance.Write("DB2119..1", true); - //MesnacServiceManager.Instance.LoggingService.Info("螺旋4已手动停止"); - //MessageBox.Show("螺旋4已停止!"); - } - - - if (WetRequest1 == runtime.Sender) + switch (GelChooseB) + { + case 5: + PlcControl("DB2119.16.0", 1); + PlcControl("DB2119.18.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅5排水"); + ManualLogControl("热水称B开始向糊化锅5排水"); + break; + case 6: + PlcControl("DB2119.16.0", 2); + PlcControl("DB2119.18.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅6排水"); + ManualLogControl("热水称B开始向糊化锅6排水"); + break; + case 7: + PlcControl("DB2119.16.0", 3); + PlcControl("DB2119.18.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅7排水"); + ManualLogControl("热水称B开始向糊化锅7排水"); + break; + case 8: + PlcControl("DB2119.16.0", 4); + PlcControl("DB2119.18.4", true); + MesnacServiceManager.Instance.LoggingService.Info("热水称B开始向糊化锅8排水"); + ManualLogControl("热水称B开始向糊化锅8排水"); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + } + + if (WaterStop1 == runtime.Sender) { - if (MessageBox.Show("糊化机1确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "1", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest2 == runtime.Sender) - { - if (MessageBox.Show("糊化机2确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "2", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest3 == runtime.Sender) - { - if (MessageBox.Show("糊化机3确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "3", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest4 == runtime.Sender) - { - if (MessageBox.Show("糊化机4确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "4", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest5 == runtime.Sender) - { - if (MessageBox.Show("糊化机5确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "5", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest6 == runtime.Sender) - { - if (MessageBox.Show("糊化机6确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "6", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest7 == runtime.Sender) - { - if (MessageBox.Show("糊化机7确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "7", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } - - if (WetRequest8 == runtime.Sender) - { - if (MessageBox.Show("糊化机8确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - string id = System.Guid.NewGuid().ToString(); - TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() - { - reqCode = id, - reqTime = DateTime.Now, - deviceNo = "8", - state = "1" - }; - HttpResponse httpResponse = new HttpResponse(); - ManualLogControl("糊化机8下发请求"); - string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); - ManualLogControl("糊化机8返回数据 " + returnTest); - } + switch (GelChooseA) + { + case 1: + PlcControl("DB2119.26.0", 1); + PlcControl("DB2119.28.5", true); + break; + case 2: + PlcControl("DB2119.26.0", 2); + PlcControl("DB2119.28.5", true); + break; + case 3: + PlcControl("DB2119.26.0", 3); + PlcControl("DB2119.28.5", true); + break; + case 4: + PlcControl("DB2119.26.0", 4); + PlcControl("DB2119.28.5", true); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + + MessageBox.Show("冷水称A已停止排水"); + ManualLogControl("冷水称A停止排水"); + MesnacServiceManager.Instance.LoggingService.Info("冷水称A停止排水"); + } + + if (WaterStop2 == runtime.Sender) + { + switch (GelChooseA) + { + case 1: + PlcControl("DB2119.6.0", 1); + PlcControl("DB2119.8.5", true); + break; + case 2: + PlcControl("DB2119.6.0", 2); + PlcControl("DB2119.8.5", true); + break; + case 3: + PlcControl("DB2119.6.0", 3); + PlcControl("DB2119.8.5", true); + break; + case 4: + PlcControl("DB2119.6.0", 4); + PlcControl("DB2119.8.5", true); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + + MessageBox.Show("热水称A已停止排水"); + ManualLogControl("热水称A停止排水"); + MesnacServiceManager.Instance.LoggingService.Info("热水称A停止排水"); + } + + if (WaterStop3 == runtime.Sender) + { + switch (GelChooseB) + { + case 5: + PlcControl("DB2119.36.0", 1); + PlcControl("DB2119.38.5", true); + break; + case 6: + PlcControl("DB2119.36.0", 2); + PlcControl("DB2119.38.5", true); + break; + case 7: + PlcControl("DB2119.36.0", 3); + PlcControl("DB2119.38.5", true); + break; + case 8: + PlcControl("DB2119.36.0", 4); + PlcControl("DB2119.38.5", true); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + + MessageBox.Show("冷水称B已停止排水"); + ManualLogControl("冷水称B停止排水"); + MesnacServiceManager.Instance.LoggingService.Info("冷水称B停止排水"); + } + + if (WaterStop4 == runtime.Sender) + { + switch (GelChooseB) + { + case 5: + PlcControl("DB2119.16.0", 1); + PlcControl("DB2119.18.5", true); + break; + case 6: + PlcControl("DB2119.16.0", 2); + PlcControl("DB2119.18.5", true); + break; + case 7: + PlcControl("DB2119.16.0", 3); + PlcControl("DB2119.18.5", true); + break; + case 8: + PlcControl("DB2119.16.0", 4); + PlcControl("DB2119.18.5", true); + break; + default: + MessageBox.Show("请选择一个糊化锅!"); + return; + } + + MessageBox.Show("热水称B已停止排水"); + ManualLogControl("热水称B停止排水"); + MesnacServiceManager.Instance.LoggingService.Info("热水称B停止排水"); + } + + + if (SpiralOn1 == runtime.Sender) + { + short valueSet; + short valueFast; + short valuePoint; + short valueSpeedFast; + short valueSpeedLow; + short valueSpeedPoint; + if (short.TryParse(Convert.ToString(SetSpiralValue1.MCValue), out valueSet) && + short.TryParse(Convert.ToString(FastSpiralValue1.MCValue), out valueFast) && + short.TryParse(Convert.ToString(PointSpiralValue1.MCValue), out valuePoint) && + short.TryParse(Convert.ToString(FastSpeedSpiralValue1.MCValue), out valueSpeedFast) && + short.TryParse(Convert.ToString(LowSpeedSpiralValue1.MCValue), out valueSpeedLow) && + short.TryParse(Convert.ToString(PointSpeedSpiralValue1.MCValue), out valueSpeedPoint)) + { + if (MessageBox.Show("螺旋1确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("螺旋1输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + + switch (WetChoose1) + { + case 1: + PlcControl("DB2119.40.0", valueSet); + PlcControl("DB2119.44.0", valueFast); + PlcControl("DB2119.46.0", valuePoint); + PlcControl("DB2119.50.0", valueSpeedFast); + PlcControl("DB2119.52.0", valueSpeedLow); + PlcControl("DB2119.54.0", valueSpeedPoint); + PlcControl("DB2119.58.0", 1); + PlcControl("DB2119.60.0", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋1启动向湿混机1 " + valueSet); + ManualLogControl("螺旋1启动向湿混机1" + valueSet); + break; + case 2: + PlcControl("DB2119.40.0", valueSet); + PlcControl("DB2119.44.0", valueFast); + PlcControl("DB2119.46.0", valuePoint); + PlcControl("DB2119.50.0", valueSpeedFast); + PlcControl("DB2119.52.0", valueSpeedLow); + PlcControl("DB2119.54.0", valueSpeedPoint); + PlcControl("DB2119.58.0", 2); + PlcControl("DB2119.60.0", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋1启动向湿混机2 " + valueSet); + ManualLogControl("螺旋1启动向湿混机2 " + valueSet); + break; + default: + MessageBox.Show("请选择一个湿混机!"); + return; + } + } + + if (SpiralOn2 == runtime.Sender) + { + short valueSet; + short valueFast; + short valuePoint; + short valueSpeedFast; + short valueSpeedLow; + short valueSpeedPoint; + if (short.TryParse(Convert.ToString(SetSpiralValue2.MCValue), out valueSet) && + short.TryParse(Convert.ToString(FastSpiralValue2.MCValue), out valueFast) && + short.TryParse(Convert.ToString(PointSpiralValue2.MCValue), out valuePoint) && + short.TryParse(Convert.ToString(FastSpeedSpiralValue2.MCValue), out valueSpeedFast) && + short.TryParse(Convert.ToString(LowSpeedSpiralValue2.MCValue), out valueSpeedLow) && + short.TryParse(Convert.ToString(PointSpeedSpiralValue2.MCValue), out valueSpeedPoint)) + { + if (MessageBox.Show("螺旋2确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("螺旋2输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + + switch (WetChoose2) + { + case 3: + PlcControl("DB2119.62.0", valueSet); + PlcControl("DB2119.66.0", valueFast); + PlcControl("DB2119.68.0", valuePoint); + PlcControl("DB2119.72.0", valueSpeedFast); + PlcControl("DB2119.74.0", valueSpeedLow); + PlcControl("DB2119.76.0", valueSpeedPoint); + PlcControl("DB2119.80.0", 1); + PlcControl("DB2119.82.0", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋2启动向湿混机3 " + valueSet); + ManualLogControl("螺旋2启动向湿混机3 " + valueSet); + break; + case 4: + PlcControl("DB2119.62.0", valueSet); + PlcControl("DB2119.66.0", valueFast); + PlcControl("DB2119.68.0", valuePoint); + PlcControl("DB2119.72.0", valueSpeedFast); + PlcControl("DB2119.74.0", valueSpeedLow); + PlcControl("DB2119.76.0", valueSpeedPoint); + PlcControl("DB2119.80.0", 2); + PlcControl("DB2119.82.0", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋2启动向湿混机4 " + valueSet); + ManualLogControl("螺旋2启动向湿混机4 " + valueSet); + break; + default: + MessageBox.Show("请选择一个湿混机!"); + return; + } + } + if (SpiralOn3 == runtime.Sender) + { + short valueSet; + short valueFast; + short valuePoint; + short valueSpeedFast; + short valueSpeedLow; + short valueSpeedPoint; + if (short.TryParse(Convert.ToString(SetSpiralValue3.MCValue), out valueSet) && + short.TryParse(Convert.ToString(FastSpiralValue3.MCValue), out valueFast) && + short.TryParse(Convert.ToString(PointSpiralValue3.MCValue), out valuePoint) && + short.TryParse(Convert.ToString(FastSpeedSpiralValue3.MCValue), out valueSpeedFast) && + short.TryParse(Convert.ToString(LowSpeedSpiralValue3.MCValue), out valueSpeedLow) && + short.TryParse(Convert.ToString(PointSpeedSpiralValue3.MCValue), out valueSpeedPoint)) + { + if (MessageBox.Show("螺旋3确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("螺旋3输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + + switch (WetChoose3) + { + case 5: + PlcControl("DB2119.84.0", valueSet); + PlcControl("DB2119.88.0", valueFast); + PlcControl("DB2119.90.0", valuePoint); + PlcControl("DB2119.94.0", valueSpeedFast); + PlcControl("DB2119.96.0", valueSpeedLow); + PlcControl("DB2119.98.0", valueSpeedPoint); + PlcControl("DB2119.102.0", 1); + PlcControl("DB2119.104.0", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋3启动向湿混机5 " + valueSet); + ManualLogControl("螺旋3启动向湿混机5 " + valueSet); + break; + case 6: + PlcControl("DB2119.84.0", valueSet); + PlcControl("DB2119.88.0", valueFast); + PlcControl("DB2119.90.0", valuePoint); + PlcControl("DB2119.94.0", valueSpeedFast); + PlcControl("DB2119.96.0", valueSpeedLow); + PlcControl("DB2119.98.0", valueSpeedPoint); + PlcControl("DB2119.102.0", 2); + PlcControl("DB2119.104.0", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋3启动向湿混机6 " + valueSet); + ManualLogControl("螺旋3启动向湿混机6 " + valueSet); + break; + default: + MessageBox.Show("请选择一个湿混机!"); + return; + } + } + if (SpiralOn4 == runtime.Sender) + { + MessageBox.Show("二期工程,敬请期待!"); + //short valueSet; + //short valueFast; + //short valuePoint; + //short valueSpeedFast; + //short valueSpeedLow; + //short valueSpeedPoint; + //if (short.TryParse(Convert.ToString(SetSpiralValue4.MCValue), out valueSet) && + // short.TryParse(Convert.ToString(FastSpiralValue4.MCValue), out valueFast) && + // short.TryParse(Convert.ToString(PointSpiralValue4.MCValue), out valuePoint) && + // short.TryParse(Convert.ToString(FastSpeedSpiralValue4.MCValue), out valueSpeedFast) && + // short.TryParse(Convert.ToString(LowSpeedSpiralValue4.MCValue), out valueSpeedLow) && + // short.TryParse(Convert.ToString(PointSpeedSpiralValue4.MCValue), out valueSpeedPoint)) + //{ + // if (MessageBox.Show("螺旋4确认启动?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + // { + // return; + // } + // MesnacServiceManager.Instance.LoggingService.Info("螺旋4启动"); + //} + //else + //{ + // MesnacServiceManager.Instance.LoggingService.Info("螺旋4输入数值的格式有误"); + // MessageBox.Show("输入数值的格式有误!"); + // return; + //} + + //switch (WetChoose4) + //{ + // case 7: + // PlcControl("DB2119..0", valueSet); + // PlcControl("DB2119..0", valueFast); + // PlcControl("DB2119..0", valuePoint); + // PlcControl("DB2119..0", valueSpeedFast); + // PlcControl("DB2119..0", valueSpeedLow); + // PlcControl("DB2119..0", valueSpeedPoint); + // PlcControl("DB2119..0", 1); + // PlcControl("DB2119..0", true); + // break; + // case 8: + // PlcControl("DB2119..0", valueSet); + // PlcControl("DB2119..0", valueFast); + // PlcControl("DB2119..0", valuePoint); + // PlcControl("DB2119..0", valueSpeedFast); + // PlcControl("DB2119..0", valueSpeedLow); + // PlcControl("DB2119..0", valueSpeedPoint); + // PlcControl("DB2119..0", 2); + // PlcControl("DB2119..0", true); + // break; + // default: return; + //} + } + + if (SpiralOff1 == runtime.Sender) + { + PlcControl("DB2119.60.1", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋1已手动停止"); + ManualLogControl("螺旋1已手动停止"); + MessageBox.Show("螺旋1已停止!"); + } + if (SpiralOff2 == runtime.Sender) + { + PlcControl("DB2119.82.1", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋2已手动停止"); + ManualLogControl("螺旋2已手动停止"); + MessageBox.Show("螺旋2已停止!"); + } - #endregion + if (SpiralOff3 == runtime.Sender) + { + PlcControl("DB2119.104.1", true); + MesnacServiceManager.Instance.LoggingService.Info("螺旋3已手动停止"); + ManualLogControl("螺旋3已手动停止"); + MessageBox.Show("螺旋3已停止!"); + } + if (SpiralOff4 == runtime.Sender) + { + MessageBox.Show("二期工程,敬请期待!"); + //PlcControl("DB2119..1", true); + //MesnacServiceManager.Instance.LoggingService.Info("螺旋4已手动停止"); + //MessageBox.Show("螺旋4已停止!"); + } + if (WetRequest1 == runtime.Sender) + { + if (MessageBox.Show("湿混机1确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "1", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机1下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机1下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机1返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机1返回数据" + returnTest); + } + + if (WetRequest2 == runtime.Sender) + { + if (MessageBox.Show("湿混机2确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "2", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机2下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机2下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机2返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机2返回数据" + returnTest); + } + + if (WetRequest3 == runtime.Sender) + { + if (MessageBox.Show("湿混机3确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "3", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机3下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机3下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机3返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机3返回数据" + returnTest); + } + + if (WetRequest4 == runtime.Sender) + { + if (MessageBox.Show("湿混机4确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "4", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机4下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机4下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机4返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机4返回数据" + returnTest); + } + + if (WetRequest5 == runtime.Sender) + { + if (MessageBox.Show("湿混机5确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "5", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机5下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机5下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机5返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机5返回数据" + returnTest); + } + + if (WetRequest6 == runtime.Sender) + { + if (MessageBox.Show("湿混机6确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "6", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机6下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机6下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机6返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机6返回数据" + returnTest); + } + + if (WetRequest7 == runtime.Sender) + { + if (MessageBox.Show("湿混机7确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "7", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机7下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机7下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机7返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机7返回数据" + returnTest); + } + + if (WetRequest8 == runtime.Sender) + { + if (MessageBox.Show("湿混机8确认下发请求?", "下发确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + string id = System.Guid.NewGuid().ToString(); + TankIsDischargedSyncEntity tankIsDischargedSyncEntity = new TankIsDischargedSyncEntity() + { + reqCode = id, + reqTime = DateTime.Now, + deviceNo = "8", + state = "1" + }; + HttpResponse httpResponse = new HttpResponse(); + ManualLogControl("湿混机8下发请求"); + MesnacServiceManager.Instance.LoggingService.Info("湿混机8下发请求"); + string returnTest = httpResponse.PostResponse(tankIsDischargedSyncEntity); + ManualLogControl("湿混机8返回数据 " + returnTest); + MesnacServiceManager.Instance.LoggingService.Info("湿混机8返回数据" + returnTest); + } + } + + private void PlcControl(string address, short binNo) + { + PlcConnect.Instance.Write(address, binNo); } + private void PlcControl(string address, bool state) + { + PlcConnect.Instance.Write(address, state); + } + - private IBaseControl GetBaseControl(string name) + private IBaseControl GetBaseControl(string name) { - return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl; + return _McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl; } - private void ManualLogControl(string logName) + private MCButton GetButtonControl(string name) + { + return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl as MCButton; + } + + private void ManualLogControl(string logName) { var Log = new ManualLogEntity() { diff --git a/Main/MCEdit/App.config b/Main/MCEdit/App.config index a54157b..d3261d9 100644 --- a/Main/MCEdit/App.config +++ b/Main/MCEdit/App.config @@ -82,6 +82,7 @@ + diff --git a/Main/MCEdit/Data/MCProject/nodeDevice.xml b/Main/MCEdit/Data/MCProject/nodeDevice.xml index 0c4c1d6..0b6144f 100644 --- a/Main/MCEdit/Data/MCProject/nodeDevice.xml +++ b/Main/MCEdit/Data/MCProject/nodeDevice.xml @@ -13,7 +13,7 @@ - + @@ -3958,7 +3958,7 @@ - + @@ -5395,7 +5395,7 @@ - + diff --git a/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml b/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml index cee628b..209554d 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/ManualWaterControl.xml @@ -293,7 +293,7 @@ - Query + Modify True True @@ -342,7 +342,7 @@ - Query + Modify True True @@ -385,7 +385,7 @@ - Query + Modify True True @@ -434,7 +434,7 @@ - Query + Modify True True @@ -455,7 +455,7 @@ - Query + Modify True True True @@ -479,7 +479,7 @@ - Query + Modify True True @@ -557,7 +557,7 @@ - Query + Modify True True True @@ -581,7 +581,7 @@ - Query + Modify True True @@ -708,7 +708,7 @@ - Query + Modify True True @@ -770,7 +770,7 @@ - Query + Modify True True @@ -813,7 +813,7 @@ - Query + Modify True True @@ -856,7 +856,7 @@ - Query + Modify True True @@ -899,7 +899,7 @@ - Query + Modify True True @@ -989,7 +989,7 @@ - Query + Modify True True True @@ -1029,7 +1029,7 @@ - Query + Modify True True True @@ -1053,7 +1053,7 @@ - Query + Modify True True @@ -1142,7 +1142,7 @@ - Query + Modify True True @@ -1204,7 +1204,7 @@ - Query + Modify True True @@ -1247,7 +1247,7 @@ - Query + Modify True True @@ -1290,7 +1290,7 @@ - Query + Modify True True @@ -1333,7 +1333,7 @@ - Query + Modify True True @@ -1423,7 +1423,7 @@ - Query + Modify True True True @@ -1463,7 +1463,7 @@ - Query + Modify True True True @@ -1487,7 +1487,7 @@ - Query + Modify True True @@ -1595,7 +1595,7 @@ - Query + Modify True True @@ -1638,7 +1638,7 @@ - Query + Modify True True @@ -1681,7 +1681,7 @@ - Query + Modify True True @@ -1724,7 +1724,7 @@ - Query + Modify True True @@ -1767,7 +1767,7 @@ - Query + Modify True True @@ -1857,7 +1857,7 @@ - Query + Modify True True True @@ -1897,7 +1897,7 @@ - Query + Modify True True True @@ -1921,7 +1921,7 @@ - Query + Modify True True @@ -2339,7 +2339,7 @@ - Query + Modify True True True @@ -2360,7 +2360,7 @@ - Query + Modify True True True @@ -2406,7 +2406,7 @@ - Query + Modify True True True @@ -2427,7 +2427,7 @@ - Query + Modify True True True @@ -2576,7 +2576,7 @@ - Query + Modify True True @@ -2695,7 +2695,7 @@ - Query + Modify True True @@ -3119,7 +3119,7 @@ - Query + Modify True True True @@ -3140,7 +3140,7 @@ - Query + Modify True True True @@ -3161,7 +3161,7 @@ - Query + Modify True True True @@ -3207,7 +3207,7 @@ - Query + Modify True True True @@ -3238,7 +3238,7 @@ - Query + Modify True True @@ -3343,7 +3343,7 @@ - Query + Modify True True @@ -3413,13 +3413,13 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL - + Focus False - None + Query True True False @@ -3482,7 +3482,7 @@ False False Control - 1506, 832 + 1256, 832 WindowsDefaultLocation 手动控制 Normal diff --git a/Main/MCRun/App.config b/Main/MCRun/App.config index 4556058..b7f1fc2 100644 --- a/Main/MCRun/App.config +++ b/Main/MCRun/App.config @@ -73,6 +73,7 @@ + @@ -83,7 +84,7 @@ - +