From 6378b8faa9184e5981fab12fcaaa6914fcd91b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Sat, 16 Dec 2023 18:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E8=AE=BE=E7=BD=AE=E8=9E=BA?= =?UTF-8?q?=E6=97=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/AutoControl.cs | 37 ++++++++++++++-- .../AutoControl/PlcAutoWriteHelper.cs | 43 +++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs index 3e1887e..f3de485 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs @@ -360,11 +360,42 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } } + //设置现场重量 + if(ButtonE.GelSetWeight == runtime.Sender) { - - - + var singE = ControlsHelper.SingleSelect(RadioE); + if (singE == 0) + { + MessageBox.Show("请选择湿混机"); + } + else + { + float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString()); + float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString()); + int no = (singE + 1) / 2; + string message = $"确认设置螺旋{no} 现场重量 {w}"; + if (MessageBox.Show($"{message}?", "现场参数确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + if (t < 0.1) + { + MessageBox.Show("公差不能小于0.1!"); + return; + } + + + SetValue value = new SetValue() + { + Value = w, + Toterance = t + }; + + PlcAutoWriteHelper.WetSetWeight(value, RadioE); + } + + } #endregion diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs index 19f7151..c3cdbde 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs @@ -815,6 +815,49 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } + + + public static bool WetSetWeight(SetValue value, MCRadioButtonEntity RadioE) + { + + + + var singE = ControlsHelper.SingleSelect(RadioE); + + switch (singE) + { + case 1: + case 2: + DB2105WriteHelper.WriteSetValueH1(value); + break; + case 3: + case 4: + + DB2105WriteHelper.WriteSetValueH2(value); + break; + + case 5: + case 6: + DB2105WriteHelper.WriteSetValueH3(value); + + break; + + + case 7: + case 8: + + DB2105WriteHelper.WriteSetValueH4(value); + + break; + + default: + MessageBox.Show("当前未选择产线!"); + return false; + } + + return true; + + } private static void ShowError() { string message = "称量未结束 请稍后";