From 03523bd0ac09299fa192b05c002d41cb7b810cfc Mon Sep 17 00:00:00 2001 From: wangsr Date: Sat, 9 Dec 2023 09:29:56 +0800 Subject: [PATCH] change - use goto --- .../ManualControl/ManualControlAction.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs index 9f1e624..1938007 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/ManualControl/ManualControlAction.cs @@ -27,6 +27,7 @@ using System.Xml.Serialization; using System.Threading; using DataBlockHelper.DBHelpers; using System.Diagnostics; +using DevExpress.XtraRichEdit.Commands.Internal; namespace Mesnac.Action.ChemicalWeighing.ManualControl { @@ -1010,7 +1011,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { var record = FreeSqlUnit.Instance.Select() .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 1 && x.value > 350).ToList().LastOrDefault(); - if (record == null) { return; } + if (record == null) { goto next1; } if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) { if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -1020,6 +1021,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } } + next1: PlcControl("DB2119.40.0", valueSet); PlcControl("DB2119.44.0", valueFast); PlcControl("DB2119.46.0", valuePoint); @@ -1036,7 +1038,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { var record = FreeSqlUnit.Instance.Select() .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 2 && x.value > 350).ToList().LastOrDefault(); - if (record == null) { return; } + if (record == null) { goto next2; } if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) { if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -1046,6 +1048,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } } + next2: PlcControl("DB2119.40.0", valueSet); PlcControl("DB2119.44.0", valueFast); PlcControl("DB2119.46.0", valuePoint); @@ -1108,7 +1111,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { var record = FreeSqlUnit.Instance.Select() .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 3 && x.value > 350).ToList().LastOrDefault(); - if (record == null) { return; } + if (record == null) { goto next3; } if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) { if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -1118,6 +1121,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } } + next3: PlcControl("DB2119.62.0", valueSet); PlcControl("DB2119.66.0", valueFast); PlcControl("DB2119.68.0", valuePoint); @@ -1134,7 +1138,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { var record = FreeSqlUnit.Instance.Select() .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 4 && x.value > 350).ToList().LastOrDefault(); - if (record == null) { return; } + if (record == null) { goto next4; } if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) { if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -1144,6 +1148,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } } + next4: PlcControl("DB2119.62.0", valueSet); PlcControl("DB2119.66.0", valueFast); PlcControl("DB2119.68.0", valuePoint); @@ -1206,7 +1211,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { var record = FreeSqlUnit.Instance.Select() .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 5 && x.value > 350).ToList().LastOrDefault(); - if (record == null) { return; } + if (record == null) { goto next5; } if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) { if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -1216,6 +1221,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } } + next5: PlcControl("DB2119.84.0", valueSet); PlcControl("DB2119.88.0", valueFast); PlcControl("DB2119.90.0", valuePoint); @@ -1232,7 +1238,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl { var record = FreeSqlUnit.Instance.Select() .Where(x => x.valuekind == 3 && x.devicekind == 2 && x.deviceno == 6 && x.value > 350).ToList().LastOrDefault(); - if (record == null) { return; } + if (record == null) { goto next6; } if ((DateTime.Now - record.logtime).Value.TotalMinutes < 15) { if (MessageBox.Show("距离上次下料大于350KG不足15分钟 确认下料?", "螺旋启动确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) @@ -1242,6 +1248,7 @@ namespace Mesnac.Action.ChemicalWeighing.ManualControl } } } + next6: PlcControl("DB2119.84.0", valueSet); PlcControl("DB2119.88.0", valueFast); PlcControl("DB2119.90.0", valuePoint);