From e8d4407b80dce83b111a71f7c9133608cbce4443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=84=E5=A4=B4?= Date: Tue, 18 Jun 2024 15:56:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=89=E8=AE=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LjDeliver/DeliverInitAction.cs | 71 ++- .../LjDeliver/Entity/DeliverEntity.cs | 16 + DataBlockHelper/DBHelpers/MReadHelp.cs | 10 +- .../Data/MCProject/nodeForm/LjDeliver.xml | 568 +++++++++++++++++- 4 files changed, 652 insertions(+), 13 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/DeliverInitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/DeliverInitAction.cs index a80b826..750f8a1 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/DeliverInitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/DeliverInitAction.cs @@ -3,6 +3,7 @@ using DataBlockHelper.DBHelpers; using DataBlockHelper.Entity; using DevExpress.Data.Filtering.Helpers; +using DevExpress.Office; using DevExpress.Utils.FormShadow; using HslCommunication.LogNet; @@ -169,6 +170,27 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver this.PressureCurve.SetLeftCurve("C_OUT", null, Color.LightGreen); } + bool IsPowerOfTwo(int number, out int exponent) + { + exponent = 0; + if (number < 1) + { + return false; + } + + while (number > 1) + { + if (number % 2 != 0) + { + return false; + } + number /= 2; + exponent++; + } + + return true; + } + /// /// Plc数据刷新 /// @@ -704,6 +726,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver PlcTemp.Cabinet12 = bbb[11]; PlcTemp.Cabinet13 = bbb[12]; PlcTemp.Cabinet14 = bbb[13]; + + PlcTemp.Cabinet15 = bbb[14]; PlcTemp.Steps1 = new bool[7] @@ -1023,6 +1047,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver ControlsImprot.SetControlCabinet(CabinetE.Cabinet8, PlcTemp.Cabinet8); ControlsImprot.SetControlCabinet(CabinetE.Cabinet9, PlcTemp.Cabinet9); ControlsImprot.SetControlCabinet(CabinetE.Cabinet10, PlcTemp.Cabinet10); + ControlsImprot.SetControlCabinet(CabinetE.Cabinet11, PlcTemp.Cabinet11); ControlsImprot.SetControlCabinet(CabinetE.Cabinet12, PlcTemp.Cabinet12); ControlsImprot.SetControlCabinet(CabinetE.Cabinet13, PlcTemp.Cabinet13); @@ -1036,6 +1061,12 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver ControlsImprot.SetMCLabel(LabelE.PFTStatus5, PlcTemp.Status[4], 3); ControlsImprot.SetMCLabel(LabelE.PFTStatus6, PlcTemp.Status[5], 3); + + + + + + ControlsImprot.SetMCLabel(LabelE.PFTStepCode1, ControlsHelper.JudgePFTStatus(PlcTemp.Steps1)); ControlsImprot.SetMCLabel(LabelE.PFTStepCode2, ControlsHelper.JudgePFTStatus(PlcTemp.Steps2)); ControlsImprot.SetMCLabel(LabelE.PFTStepCode3, ControlsHelper.JudgePFTStatus(PlcTemp.Steps3)); @@ -1051,6 +1082,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver ControlsImprot.SetMCLabel(LabelE.PFTStepName6, ControlsHelper.ConvertStepName(ControlsHelper.JudgePFTStatus(PlcTemp.Steps6))); ControlsHelper.SetHslBottle(bottleE.Bottle1, PlcTemp.Bottle1_Set); + ControlsHelper.SetHslBottle(bottleE.Bottle2, PlcTemp.Bottle2_Set); ControlsHelper.SetHslBottle(bottleE.Bottle3, PlcTemp.Bottle3_Set); ControlsHelper.SetHslBottle(bottleE.Bottle4, PlcTemp.Bottle4_Set); @@ -1082,8 +1114,45 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver ControlsImprot.SetMCLabel(LabelE.HslBottleValue13, JiSuan(PlcTemp.Bottle13_Set, dic["碳粉7"]) + "t"); ControlsImprot.SetMCLabel(LabelE.HslBottleValue14, JiSuan(PlcTemp.Bottle14_Set, dic["碳粉8"]) + "t"); ControlsImprot.SetMCLabel(LabelE.HslBottleValue15, JiSuan(PlcTemp.Bottle15_Set, dic["回收罐"]) + "t"); + + + Db2101Helper db2101 = new Db2101Helper(); + var ab = db2101.LinA; + LabelE.linAName.Text = destinations[Get(ab.destination)]; + LabelE.linANum.Text = ab.number.ToString(); + + ab = db2101.LinB; + LabelE.linBName.Text = destinations[Get(ab.destination)]; + LabelE.linBNum.Text = ab.number.ToString(); + + + ab = db2101.LinC; + LabelE.linCName.Text = destinations[Get(ab.destination)]; + LabelE.linCNum.Text = ab.number.ToString(); } - + + string[] destinations = new string[] { + "大仓A", "大仓B", "大仓C", "大仓D", "大仓E", "大仓F", "大仓G", "大仓H", + "大仓I", "大仓J", "大仓K", "大仓L", "大仓M", "大仓N", "大仓O", "大仓P", + "大仓Q", "大仓R", "大仓S", "大仓T", "大仓U", "大仓V", "大仓W", "大仓X", + "大仓Y", "大仓Z" +}; + + public int Get(int destination) + { + int fan = 0; + int number = destination; // 你想要检查的数字 + if (IsPowerOfTwo(number, out int exponent)) + { + fan = exponent; + + Console.WriteLine($"{number} 是 2 的 {exponent} 次方"); + } + + return fan; + + } + public string JiSuan(double x, DaCangValue daCangValue) { var bottleValue3 = Math.Round(x * daCangValue.volume * daCangValue.Density, 2)/100; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/Entity/DeliverEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/Entity/DeliverEntity.cs index d5522be..16e27b0 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/Entity/DeliverEntity.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjDeliver/Entity/DeliverEntity.cs @@ -98,6 +98,22 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver.Entity public MCLabel HslBottleValue13 { get; set; } public MCLabel HslBottleValue14 { get; set; } public MCLabel HslBottleValue15 { get; set; } + + + public MCLabel linAName { get; set; } + public MCLabel linANum { get; set; } + public MCLabel linBName { get; set; } + public MCLabel linBNum { get; set; } + public MCLabel linCName { get; set; } + public MCLabel linCNum { get; set; } + + + + + + + + } internal class LjSwitchEntity diff --git a/DataBlockHelper/DBHelpers/MReadHelp.cs b/DataBlockHelper/DBHelpers/MReadHelp.cs index 9562d1d..04890df 100644 --- a/DataBlockHelper/DBHelpers/MReadHelp.cs +++ b/DataBlockHelper/DBHelpers/MReadHelp.cs @@ -42,10 +42,12 @@ namespace DataBlockHelper.DBHelpers p.ReadBool("M2018.0").Content, p.ReadBool("M2018.1").Content, - p.ReadBool("M2201.4").Content, - p.ReadBool("M2201.5").Content, - p.ReadBool("M2201.6").Content, - p.ReadBool("M2201.7").Content, + p.ReadBool("M2201.0").Content, + p.ReadBool("M2201.1").Content, + p.ReadBool("M2201.2").Content, + p.ReadBool("M2201.3").Content, + + //0 p.ReadBool("M2018.2").Content, }; diff --git a/Main/MCEdit/Data/MCProject/nodeForm/LjDeliver.xml b/Main/MCEdit/Data/MCProject/nodeForm/LjDeliver.xml index cec9f0b..95c0a33 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/LjDeliver.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/LjDeliver.xml @@ -1,6 +1,306 @@ + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓N + ButtonHighlight + 1566, 230 + MCLabel332 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓O + ButtonHighlight + 1653, 277 + MCLabel331 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓M + ButtonHighlight + 1507, 231 + MCLabel330 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓L + ButtonHighlight + 1448, 231 + MCLabel329 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓K + ButtonHighlight + 1389, 231 + MCLabel328 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓J + ButtonHighlight + 1295, 230 + MCLabel327 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓I + ButtonHighlight + 1236, 230 + MCLabel326 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓H + ButtonHighlight + 1177, 231 + MCLabel325 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓G + ButtonHighlight + 1118, 231 + MCLabel324 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓F + ButtonHighlight + 1028, 231 + MCLabel323 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓E + ButtonHighlight + 966, 231 + MCLabel322 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓D + ButtonHighlight + 872, 231 + MCLabel321 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓C + ButtonHighlight + 813, 231 + MCLabel320 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓A + ButtonHighlight + 691, 230 + MCLabel319 + 35, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 大仓B + ButtonHighlight + 754, 231 + MCLabel318 + 35, 12 + @@ -177,7 +477,7 @@ True C21 Window - 534, 173 + 572, 158 MCLabel4 23, 12 @@ -1308,6 +1608,90 @@ 11, 12 + + + + Red + DarkGray + + + False + + + + None + True + True + 压送罐2 + Transparent + ButtonHighlight + 102, 112 + linCNum + 47, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 压送罐2 + Transparent + ButtonHighlight + 17, 112 + linCName + 47, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 数量 + Transparent + ButtonHighlight + 93, 90 + MCLabel333 + 29, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 目标仓 + Transparent + ButtonHighlight + 17, 90 + 目标仓 + 41, 12 + @@ -1560,11 +1944,95 @@ MCLabel311 23, 12 - 354, 757 + 354, 706 MCPanelBlack3 - 203, 83 + 203, 134 + + + + Red + DarkGray + + + False + + + + None + True + True + 压送罐2 + Transparent + ButtonHighlight + 100, 117 + linBNum + 47, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 压送罐2 + Transparent + ButtonHighlight + 14, 117 + linBName + 47, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 数量 + Transparent + ButtonHighlight + 90, 96 + MCLabel336 + 29, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 目标仓 + Transparent + ButtonHighlight + 14, 96 + MCLabel337 + 41, 12 + @@ -1817,11 +2285,95 @@ MCLabel296 23, 12 - 357, 476 + 357, 419 MCPanelBlack2 - 203, 83 + 203, 140 + + + + Red + DarkGray + + + False + + + + None + True + True + 压送罐2 + Transparent + ButtonHighlight + 98, 111 + linANum + 47, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 压送罐2 + Transparent + ButtonHighlight + 14, 111 + linAName + 47, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 数量 + Transparent + ButtonHighlight + 90, 92 + MCLabel340 + 29, 12 + + + + + Red + DarkGray + + + False + + + + None + True + True + 目标仓 + Transparent + ButtonHighlight + 14, 91 + MCLabel341 + 41, 12 + @@ -2074,9 +2626,9 @@ MCLabel275 23, 12 - 354, 192 + 355, 139 MCPanelBlack1 - 203, 83 + 203, 135 @@ -3586,7 +4138,7 @@ True 0 White - 1646, 286 + 1646, 299 HR1OSI01 11, 12