From 58a79415bd549a1d92a1293ceaea2ddf2d0ce769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=84=E5=A4=B4?= Date: Mon, 12 Aug 2024 16:25:53 +0800 Subject: [PATCH] 2 --- .../MainDetailControlAction.cs | 17 +- .../Mesnac.Action.ChemicalWeighing/Qu/Sb.cs | 413 +++++++++++++++++- 2 files changed, 425 insertions(+), 5 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs index 258738a..0fe2df7 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs @@ -33,6 +33,7 @@ using Mesnac.Action.ChemicalWeighing.Util; using DevExpress.XtraRichEdit.Import.Doc; using System.Threading.Tasks; using DevExpress.Utils.Filtering.Internal; +using Mesnac.Action.ChemicalWeighing.Qu; namespace Mesnac.Action.ChemicalWeighing.MainDetailControl { @@ -46,6 +47,8 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl private DB2107Helper DB2107 = new DB2107Helper(); private DB2119Helper DB2119 = new DB2119Helper(); + Sb2 sb; + private DB2108HelperNew dB2108 = new DB2108HelperNew(); private ConcurrentDictionary conCurrentCache = new ConcurrentDictionary(); @@ -317,6 +320,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl } } int bao = 0; + int ssss = 0; /// /// Plc读数线程池,定时器退出删除 /// @@ -328,6 +332,8 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl timer.Dispose(); } + + no += 1; if (no > 2) { @@ -568,6 +574,10 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl ControlsHelper.SetHslLanternSimpleRequest(HslLanternSimpleE.HslLanternSimpleReq3, MinAnPlc.Heir3); ControlsHelper.SetHslLanternSimpleRequest(HslLanternSimpleE.HslLanternSimpleReq4, MinAnPlc.Heir4); + + + sb = new Sb2(GetAllControls()); + ThreadPool.QueueUserWorkItem(new WaitCallback(NewThread)); @@ -579,6 +589,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl ThreadPool.QueueUserWorkItem((ty) => { AlarmControl(); + sb.Action(); }); } @@ -590,7 +601,11 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl } bao += 1; - + + + + + //现有报警刷新 var db2110 = new Db2110Help(); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/Sb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/Sb.cs index 4d59117..c73a1b7 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/Sb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/Sb.cs @@ -1,4 +1,8 @@ -using Mesnac.Controls.Default; +using DataBlockHelper; + +using DevExpress.Utils.Extensions; + +using Mesnac.Controls.Default; using System; using System.Collections.Generic; @@ -11,12 +15,12 @@ using System.Windows.Forms; namespace Mesnac.Action.ChemicalWeighing.Qu { - public class Sb + public class Sb2 { List Controls; - public Sb(List c) + public Sb2(List c) { this.Controls = c; @@ -29,9 +33,20 @@ namespace Mesnac.Action.ChemicalWeighing.Qu } } + List ls = new List(); + + + private void Add(SpecialLabelBlue special) + { + if (!ls.Contains(special)) + { + ls.Add(special); + } + } public void Action() { + ls.Clear(); PropertyInfo[] sourcePropertyInfoList = this.GetType().GetProperties(); foreach (PropertyInfo sourceProperty in sourcePropertyInfoList) @@ -45,6 +60,371 @@ namespace Mesnac.Action.ChemicalWeighing.Qu } } + + //压送A-B + var boo = GetValue("M151.5"); + + if (boo) + { + Add(SpecialLabelBlue463); + Add(SpecialLabelBlue478); + Add(SpecialLabelBlue549); + Add(SpecialLabelBlue543); + Add(SpecialLabelBlue273); + Add(SpecialLabelBlue510); + + Add(SpecialLabelBlue203); + Add(SpecialLabelBlue508); + + } + + //压送A-A + boo = GetValue("M172.5"); + if (boo) + { + Add(SpecialLabelBlue463); + Add(SpecialLabelBlue478); + Add(SpecialLabelBlue549); + Add(SpecialLabelBlue543); + + Add(SpecialLabelBlue273); + Add(SpecialLabelBlue510); + + Add(SpecialLabelBlue516); + } + + //压送A-C + boo = GetValue("M155.3"); + if (boo) + { + Add(SpecialLabelBlue463); + Add(SpecialLabelBlue478); + Add(SpecialLabelBlue549); + Add(SpecialLabelBlue543); + Add(SpecialLabelBlue205); + Add(SpecialLabelBlue495); + } + + + //压送A-D + boo = GetValue("M155.3"); + if (boo) + { + Add(SpecialLabelBlue463); + Add(SpecialLabelBlue478); + Add(SpecialLabelBlue549); + Add(SpecialLabelBlue543); + Add(SpecialLabelBlue205); + Add(SpecialLabelBlue204); + Add(SpecialLabelBlue361); + } + + + //压送B-1 + boo = GetValue("M111.6"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue274); + Add(SpecialLabelBlue520); + Add(SpecialLabelBlue523); + } + + //压送B-2 + boo = GetValue("M160.2"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue274); + Add(SpecialLabelBlue520); + Add(SpecialLabelBlue198); + Add(SpecialLabelBlue519); + } + + //压送B-3 + boo = GetValue("M160.3"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue274); + Add(SpecialLabelBlue520); + Add(SpecialLabelBlue198); + Add(SpecialLabelBlue197); + Add(SpecialLabelBlue518); + } + + //压送B-4 + boo = GetValue("M160.5"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue274); + Add(SpecialLabelBlue520); + Add(SpecialLabelBlue198); + Add(SpecialLabelBlue197); + Add(SpecialLabelBlue196); + Add(SpecialLabelBlue517); + } + + //压送B-5 + boo = GetValue("M160.6"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue202); + Add(SpecialLabelBlue497); + } + + + //压送B-6 + boo = GetValue("M160.1"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue202); + Add(SpecialLabelBlue201); + Add(SpecialLabelBlue496); + } + + + //压送B-7 + boo = GetValue("M160.4"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue202); + Add(SpecialLabelBlue201); + Add(SpecialLabelBlue200); + Add(SpecialLabelBlue359); + } + + + + //压送B-8 + boo = GetValue("M160.7"); + if (boo) + { + Add(SpecialLabelBlue464); + Add(SpecialLabelBlue480); + Add(SpecialLabelBlue551); + Add(SpecialLabelBlue541); + Add(SpecialLabelBlue202); + Add(SpecialLabelBlue201); + Add(SpecialLabelBlue200); + Add(SpecialLabelBlue199); + Add(SpecialLabelBlue360); + } + + + + + //压送C-A + boo = GetValue("M180.7"); + if (boo) + { + Add(SpecialLabelBlue465); + Add(SpecialLabelBlue483); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue275); + Add(SpecialLabelBlue509); + Add(SpecialLabelBlue513); + + + + } + + + //压送C-B + boo = GetValue("M181.0"); + if (boo) + { +Add(SpecialLabelBlue465); + Add(SpecialLabelBlue483); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + + Add(SpecialLabelBlue275); + Add(SpecialLabelBlue509); + Add(SpecialLabelBlue206); + Add(SpecialLabelBlue507); + } + + //压送C-C + boo = GetValue("M181.1"); + if (boo) + { +Add(SpecialLabelBlue465); + Add(SpecialLabelBlue483); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue208); + Add(SpecialLabelBlue494); + Add(SpecialLabelBlue207); + Add(SpecialLabelBlue362); + } + + + //压送C-d + boo = GetValue("M181.2"); + if (boo) + { +Add(SpecialLabelBlue465); + Add(SpecialLabelBlue483); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue208); + + } + + + + + //压送D-A + boo = GetValue("M181.3"); + if (boo) + { +Add(SpecialLabelBlue332); +Add(SpecialLabelBlue256); +Add(SpecialLabelBlue250); +Add(SpecialLabelBlue249); +Add(SpecialLabelBlue232); +Add(SpecialLabelBlue229); +Add(SpecialLabelBlue228); + } + + + + //压送D-B + boo = GetValue("M181.4"); + if (boo) + { +Add(SpecialLabelBlue332); +Add(SpecialLabelBlue256); +Add(SpecialLabelBlue250); +Add(SpecialLabelBlue249); + +Add(SpecialLabelBlue232); +Add(SpecialLabelBlue229); +Add(SpecialLabelBlue209); +Add(SpecialLabelBlue231); + } + + //压送D-C + boo = GetValue("M181.5"); + if (boo) + { +Add(SpecialLabelBlue332); +Add(SpecialLabelBlue256); +Add(SpecialLabelBlue250); +Add(SpecialLabelBlue249); +Add(SpecialLabelBlue211); +Add(SpecialLabelBlue230); + } + + //压送D-D + boo = GetValue("M181.6"); + if (boo) + { +Add(SpecialLabelBlue332); +Add(SpecialLabelBlue256); +Add(SpecialLabelBlue250); +Add(SpecialLabelBlue249); +Add(SpecialLabelBlue211); +Add(SpecialLabelBlue210); +Add(SpecialLabelBlue233); + } + + + //压送E-A + boo = GetValue("M181.7"); + if (boo) + { + Add(SpecialLabelBlue372); + Add(SpecialLabelBlue369); + Add(SpecialLabelBlue373); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue275); + Add(SpecialLabelBlue509); + Add(SpecialLabelBlue513); + + } + + + + //压送E-B + boo = GetValue("M182.0"); + if (boo) + { +Add(SpecialLabelBlue372); + Add(SpecialLabelBlue369); + Add(SpecialLabelBlue373); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue275); + Add(SpecialLabelBlue509); + Add(SpecialLabelBlue206); + Add(SpecialLabelBlue507); + } + + + //压送E-C + boo = GetValue("M182.1"); + if (boo) + { +Add(SpecialLabelBlue372); + Add(SpecialLabelBlue369); + Add(SpecialLabelBlue373); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue208); + Add(SpecialLabelBlue494); + } + + + //压送E-D + boo = GetValue("M182.2"); + if (boo) + { +Add(SpecialLabelBlue372); + Add(SpecialLabelBlue369); + Add(SpecialLabelBlue373); + Add(SpecialLabelBlue553); + Add(SpecialLabelBlue569); + Add(SpecialLabelBlue208); + Add(SpecialLabelBlue207); + Add(SpecialLabelBlue362); + } + + if (ls.Any()) + { + foreach (var item in ls) + { + SetLightGreen(item); + } + } } public void SetWhite(SpecialLabelBlue special) @@ -92,7 +472,11 @@ public SpecialLabelBlue SpecialLabelBlue206 { get; set; } public SpecialLabelBlue SpecialLabelBlue507 { get; set; } public SpecialLabelBlue SpecialLabelBlue543 { get; set; } public SpecialLabelBlue SpecialLabelBlue205 { get; set; } -public SpecialLabelBlue SpecialLabelBlue204 { get; set; } + public SpecialLabelBlue SpecialLabelBlue495 { get; set; } + + + + public SpecialLabelBlue SpecialLabelBlue204 { get; set; } public SpecialLabelBlue SpecialLabelBlue361 { get; set; } public SpecialLabelBlue SpecialLabelBlue510 { get; set; } public SpecialLabelBlue SpecialLabelBlue203 { get; set; } @@ -144,5 +528,26 @@ public SpecialLabelBlue SpecialLabelBlue273 { get; set; } public SpecialLabelBlue SpecialLabelBlue516 { get; set; } + + public SpecialLabelBlue SpecialLabelBlue497 { get; set; } + + public SpecialLabelBlue SpecialLabelBlue496 { get; set; } + + + + public SpecialLabelBlue SpecialLabelBlue513 { get; set; } + + + public SpecialLabelBlue SpecialLabelBlue359 { get; set; } + + public SpecialLabelBlue SpecialLabelBlue494 { get; set; } + public SpecialLabelBlue SpecialLabelBlue228 { get; set; } + public SpecialLabelBlue SpecialLabelBlue230 { get; set; } + + public bool GetValue(string address) + { + var plc= PlcConnect.Instance.ReadBool(address).Content; + return plc; + } } }