From 2a39faf54564454e3f6f8cc3a093c2c7c87ccd62 Mon Sep 17 00:00:00 2001 From: wangsr Date: Wed, 25 Oct 2023 16:53:17 +0800 Subject: [PATCH] =?UTF-8?q?add=20-=20=E8=87=AA=E5=8A=A8=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=87=86=E5=A4=87=E7=BC=96=E8=BE=91=E5=86=99=E5=85=A5plc?= =?UTF-8?q?=E9=83=A8=E5=88=86=20=E5=87=86=E5=A4=87=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/DryerWaterControl.cs | 10 +- .../AutoControl/GelerWeterControl.cs | 36 +- .../LjMixManager/RecipePlcView.cs | 2 +- .../LjPlanning/LjPlanningPlcHelp.cs | 656 +++++++++--------- .../Mesnac.Action.ChemicalWeighing.csproj | 2 + .../Entity/DB2104Entity/WaterView.cs | 2 +- .../Data/MCProject/nodeForm/AutoControlA.xml | 2 +- 7 files changed, 371 insertions(+), 339 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DryerWaterControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DryerWaterControl.cs index 9f4b2ce..df308c8 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DryerWaterControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DryerWaterControl.cs @@ -69,14 +69,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl HotB.Set = hotBSet; ColdA.Set = coldASet; ColdB.Set = coldBSet; - HotA.TolErance = hotATol; - HotB.TolErance = hotBTol; - ColdA.TolErance = coldATol; - ColdB.TolErance = coldBTol; + HotA.Tolerance = hotATol; + HotB.Tolerance = hotBTol; + ColdA.Tolerance = coldATol; + ColdB.Tolerance = coldBTol; Db2104WriteHelper.WriteAHostWater(HotA); Db2104WriteHelper.WriteBHostWater(HotB); Db2104WriteHelper.WriteAColWater(ColdA); Db2104WriteHelper.WriteBColWater(ColdB); + MesnacServiceManager.Instance.LoggingService.Info("水称数据下发成功!"); + MessageBox.Show("水称数据下发成功"); } else { diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs index 734de24..8be935e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs @@ -1,8 +1,10 @@ -using DataBlockHelper.Entity.DB2104Entity; +using DataBlockHelper.DBHelpers; +using DataBlockHelper.Entity.DB2104Entity; using DataBlockHelper.Entity.DB2106Entity; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; using Mesnac.Controls.Base; +using Mesnac.Core.Service; using System; using System.Collections.Generic; using System.Linq; @@ -118,7 +120,37 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl if (ControlsEntity.Download == runtime.Sender) { - + WaterEntity HotA = new WaterEntity(); + WaterEntity ColdA = new WaterEntity(); + WaterEntity HotB = new WaterEntity(); + WaterEntity ColdB = new WaterEntity(); + + float hotASet, hotBSet, coldASet, coldBSet, hotATol, hotBTol, coldATol, coldBTol; + + if (float.TryParse(Convert.ToString(ControlsEntity.ChooseMaterial1.MCValue), out hotASet) && + ) + { + HotA.Set = hotASet; + HotB.Set = hotBSet; + ColdA.Set = coldASet; + ColdB.Set = coldBSet; + HotA.TolErance = hotATol; + HotB.TolErance = hotBTol; + ColdA.TolErance = coldATol; + ColdB.TolErance = coldBTol; + Db2104WriteHelper.WriteAHostWater(HotA); + Db2104WriteHelper.WriteBHostWater(HotB); + Db2104WriteHelper.WriteAColWater(ColdA); + Db2104WriteHelper.WriteBColWater(ColdB); + MesnacServiceManager.Instance.LoggingService.Info("水称数据下发成功!"); + MessageBox.Show("水称数据下发成功"); + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } } if (ControlsEntity.LineStart == runtime.Sender) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs index cabaf1f..91dc7c4 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/RecipePlcView.cs @@ -4,7 +4,7 @@ { public ushort Bin { get; set; } public float Set { get; set; } - public float TolErance { get; set; } + public float Tolerance { get; set; } } public class Step diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs index 3a5cc54..cca7333 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs @@ -8,114 +8,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning { public class LjPlanningPlcHelp { - - - private static void Dowd(int start, RecipePlcView view) - { - int bin = start; - PlcConnect.Instance.Write($"DB2104.{bin}.0", view.Bin); - int set = start+2; - PlcConnect.Instance.Write($"DB2104.{set}.0",view.Set); - int tolerance = start+6; - PlcConnect.Instance.Write($"DB2104.{tolerance}.0", view.TolErance); - - } - - private static void DowSteps(int start, Step step) - { - int mixCode = start; - PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode); - int mixTime = start + 2; - PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime); - - int mixTemp = start + 4; - PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp); - int mixSpeed = start + 8; - - PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed); - } - - - private static void DowMSteps(int start, MixStep step) - { - int mixCode = start; - PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode); - int mixTime = start + 2; - PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime); - - int mixTemp = start + 4; - PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp); - int mixSpeed = start + 8; - - PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed); - - int setValue = start + 12; - - PlcConnect.Instance.Write($"DB2104.{setValue}.0", step.SetValue); - - int tolerance = start + 16; - - PlcConnect.Instance.Write($"DB2104.{tolerance}.0", step.SetTolerance); - } - - - private static List GetClean(int num) - { - List ls = new List(num); - for (int i = 0; i < num; i++) - { - ls.Add(new RecipePlcView() - { - Bin = 0, - TolErance = 0, - Set = 0 - }); - - } - - return ls; - } - - private static List GetCleanStep(int num) - { - List ls = new List(num); - for (int i = 0; i < num; i++) - { - ls.Add(new Step() - { - MixCode = 0, - MixSpeed = 0, - MixTemp = 0, - MixTime = 0 - }); - - } - - return ls; - } - - private static List GetCleanMixStep(int num) - { - List ls = new List(num); - for (int i = 0; i < num; i++) - { - ls.Add(new MixStep() - { - MixCode = 0, - MixSpeed = 0, - MixTemp = 0, - MixTime = 0, - SetTolerance =0, - SetValue = 0 - }); - - } - - return ls; - } - - /// + /// /// 干混机1 /// /// @@ -144,68 +38,6 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning PlcConnect.Instance.Write($"DB2104.53.6",true); } - private static void DownCleanD1Recipe(int begin) - { - List recipePlcViews = GetClean(12); - List recipeSteps = GetCleanStep(10); - - for (int i = 0; i < recipePlcViews.Count(); i++) - { - var view = recipePlcViews[i]; - Dowd(begin, view); - begin += 10; - } - - begin +=120; - for (int i = 0; i < recipeSteps.Count(); i++) - { - var view = recipeSteps[i]; - DowSteps(begin, view); - begin += 12; - - } - - } - - private static void DownCleanG1Recipe(int begin) - { - List recipePlcViews = GetClean(2); - List recipeSteps = GetCleanStep(10); - - for (int i = 0; i < recipePlcViews.Count(); i++) - { - var view = recipePlcViews[i]; - Dowd(begin, view); - begin += 10; - } - - begin +=20; - for (int i = 0; i < recipeSteps.Count(); i++) - { - var view = recipeSteps[i]; - DowSteps(begin, view); - begin += 12; - - } - - } - - - private static void DownM1CleanRecipe(int begin) - { - - List recipeSteps = GetCleanMixStep(10); - - for (int i = 0; i < recipeSteps.Count(); i++) - { - var view = recipeSteps[i]; - DowMSteps(begin, view); - begin += 20; - - } - - } - @@ -317,8 +149,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning } - public static void DownG2Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG2Recipe(List recipePlcViews, List recipeSteps) { int begin = 1158; DownCleanG1Recipe(begin); @@ -344,8 +175,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning PlcConnect.Instance.Write($"DB2104.54.2", true); } - public static void DownG3Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG3Recipe(List recipePlcViews, List recipeSteps) { int begin = 1298; DownCleanG1Recipe(begin); @@ -370,8 +200,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning PlcConnect.Instance.Write($"DB2104.53.7", true); } - public static void DownG4Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG4Recipe(List recipePlcViews, List recipeSteps) { int begin = 1438; DownCleanG1Recipe(begin); @@ -397,8 +226,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning } - public static void DownG5Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG5Recipe(List recipePlcViews, List recipeSteps) { int begin = 1578; DownCleanG1Recipe(begin); @@ -423,8 +251,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning PlcConnect.Instance.Write($"DB2104.54.6", true); } - public static void DownG6Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG6Recipe(List recipePlcViews, List recipeSteps) { int begin =1718; @@ -451,8 +278,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning PlcConnect.Instance.Write($"DB2104.54.7", true); } - public static void DownG7Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG7Recipe(List recipePlcViews, List recipeSteps) { int begin =1858; @@ -478,8 +304,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning PlcConnect.Instance.Write($"DB2104.55.0", true); } - public static void DownG8Recipe(List recipePlcViews, - List recipeSteps) + public static void DownG8Recipe(List recipePlcViews, List recipeSteps) { @@ -622,161 +447,332 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning } + #region 辅助方法 - public static DryerView GetDryerD1 => GetDryerView(58); - public static DryerView GetDryerD2 => GetDryerView(298); - public static DryerView GetDryerD3 => GetDryerView(538); - public static DryerView GetDryerD4 => GetDryerView(778); - - public static DryerView GetGelatG1 => GetGelatView(1018); - public static DryerView GetGelatG2 => GetGelatView(1158); - public static DryerView GetGelatG3 => GetGelatView(1298); - public static DryerView GetGelatG4 => GetGelatView(1438); - public static DryerView GetGelatG5 => GetGelatView(1578); - public static DryerView GetGelatG6 => GetGelatView(1718); - public static DryerView GetGelatG7 => GetGelatView(1858); - public static DryerView GetGelatG8 => GetGelatView(1998); - - public static List GetWeterM1 = GetWeterView(2138); - public static List GetWeterM2 = GetWeterView(2338); - public static List GetWeterM3 = GetWeterView(2538); - public static List GetWeterM4 = GetWeterView(2738); - public static List GetWeterM5 = GetWeterView(2938); - public static List GetWeterM6 = GetWeterView(3138); - public static List GetWeterM7 = GetWeterView(3338); - public static List GetWeterM8 = GetWeterView(3538); - + public static DryerView GetDryerD1 => GetDryerView(58); + public static DryerView GetDryerD2 => GetDryerView(298); + public static DryerView GetDryerD3 => GetDryerView(538); + public static DryerView GetDryerD4 => GetDryerView(778); + public static DryerView GetGelatG1 => GetGelatView(1018); + public static DryerView GetGelatG2 => GetGelatView(1158); + public static DryerView GetGelatG3 => GetGelatView(1298); + public static DryerView GetGelatG4 => GetGelatView(1438); + public static DryerView GetGelatG5 => GetGelatView(1578); + public static DryerView GetGelatG6 => GetGelatView(1718); + public static DryerView GetGelatG7 => GetGelatView(1858); + public static DryerView GetGelatG8 => GetGelatView(1998); - private static DryerView GetDryerView(int start) - { - var byteTransform = PlcConnect.Instance.ByteTransform; - DryerView view = new DryerView(); - var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 240); - if (operateResult.IsSuccess) - { - List ls = new List(); - var convert = operateResult.Content; - var data = convert.Skip(0).Take(120); - for (int i = 0; i < 12; i++) - { - var bytes = data.Skip(i * 10).Take(10).ToArray(); - RecipePlcView plcView = new RecipePlcView - { - Bin = byteTransform.TransUInt16(bytes, 0), - Set = byteTransform.TransSingle(bytes, 2), - TolErance = byteTransform.TransSingle(bytes, 6) - }; - ls.Add(plcView); - } - - view.RecipePlcViews = ls; - - data = convert.Skip(120).Take(120); - - List lsSteps = new List(); - for (int i = 0; i < 10; i++) - { - var bytes = data.Skip(i * 10).Take(12).ToArray(); - Step step = new Step() - { - MixCode = byteTransform.TransUInt16(bytes, 0), - MixTime = byteTransform.TransUInt16(bytes, 2), - MixTemp = byteTransform.TransSingle(bytes, 4), - MixSpeed =byteTransform.TransSingle(bytes,8) - }; - lsSteps.Add(step); - } - - view.RecipeSteps = lsSteps; + public static List GetWeterM1 = GetWeterView(2138); + public static List GetWeterM2 = GetWeterView(2338); + public static List GetWeterM3 = GetWeterView(2538); + public static List GetWeterM4 = GetWeterView(2738); + public static List GetWeterM5 = GetWeterView(2938); + public static List GetWeterM6 = GetWeterView(3138); + public static List GetWeterM7 = GetWeterView(3338); + public static List GetWeterM8 = GetWeterView(3538); - } - return view; - } - - - private static DryerView GetGelatView(int start) - { - var byteTransform = PlcConnect.Instance.ByteTransform; - DryerView view = new DryerView(); - var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 140); - if (operateResult.IsSuccess) - { - List ls = new List(); - var convert = operateResult.Content; - var data = convert.Skip(0).Take(20); - for (int i = 0; i < 2; i++) - { - var bytes = data.Skip(i * 10).Take(10).ToArray(); - RecipePlcView plcView = new RecipePlcView - { - Bin = byteTransform.TransUInt16(bytes, 0), - Set = byteTransform.TransSingle(bytes, 2), - TolErance = byteTransform.TransSingle(bytes, 6) - }; - ls.Add(plcView); - } - - view.RecipePlcViews = ls; - - data = convert.Skip(20).Take(120); - - List lsSteps = new List(); - for (int i = 0; i < 10; i++) - { - var bytes = data.Skip(i * 10).Take(12).ToArray(); - Step step = new Step() - { - MixCode = byteTransform.TransUInt16(bytes, 0), - MixTime = byteTransform.TransUInt16(bytes, 2), - MixTemp = byteTransform.TransSingle(bytes, 4), - MixSpeed =byteTransform.TransSingle(bytes,8) - }; - lsSteps.Add(step); - } - - view.RecipeSteps = lsSteps; - } + private static DryerView GetDryerView(int start) + { + var byteTransform = PlcConnect.Instance.ByteTransform; + DryerView view = new DryerView(); + var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 240); + if (operateResult.IsSuccess) + { + List ls = new List(); + var convert = operateResult.Content; + var data = convert.Skip(0).Take(120); + for (int i = 0; i < 12; i++) + { + var bytes = data.Skip(i * 10).Take(10).ToArray(); + RecipePlcView plcView = new RecipePlcView + { + Bin = byteTransform.TransUInt16(bytes, 0), + Set = byteTransform.TransSingle(bytes, 2), + TolErance = byteTransform.TransSingle(bytes, 6) + }; + ls.Add(plcView); + } - return view; - } - - - - - - private static List GetWeterView(int start) - { - var byteTransform = PlcConnect.Instance.ByteTransform; - List ls = new List(); - var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 200); - List lsSteps = new List(); - if (operateResult.IsSuccess) - { + view.RecipePlcViews = ls; - var data = operateResult.Content; - - - for (int i = 0; i < 10; i++) - { - var bytes = data.Skip(i * 10).Take(20).ToArray(); - MixStep step = new MixStep() - { - MixCode = byteTransform.TransUInt16(bytes, 0), - MixTime = byteTransform.TransUInt16(bytes, 2), - MixTemp = byteTransform.TransSingle(bytes, 4), - MixSpeed =byteTransform.TransSingle(bytes,8), - SetValue = byteTransform.TransSingle(bytes,12), - SetTolerance = byteTransform.TransSingle(bytes,16) - }; - lsSteps.Add(step); - } - - } + data = convert.Skip(120).Take(120); - return lsSteps; - } + List lsSteps = new List(); + for (int i = 0; i < 10; i++) + { + var bytes = data.Skip(i * 10).Take(12).ToArray(); + Step step = new Step() + { + MixCode = byteTransform.TransUInt16(bytes, 0), + MixTime = byteTransform.TransUInt16(bytes, 2), + MixTemp = byteTransform.TransSingle(bytes, 4), + MixSpeed = byteTransform.TransSingle(bytes, 8) + }; + lsSteps.Add(step); + } + + view.RecipeSteps = lsSteps; + + } + + return view; + } + + + private static DryerView GetGelatView(int start) + { + var byteTransform = PlcConnect.Instance.ByteTransform; + DryerView view = new DryerView(); + var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 140); + if (operateResult.IsSuccess) + { + List ls = new List(); + var convert = operateResult.Content; + var data = convert.Skip(0).Take(20); + for (int i = 0; i < 2; i++) + { + var bytes = data.Skip(i * 10).Take(10).ToArray(); + RecipePlcView plcView = new RecipePlcView + { + Bin = byteTransform.TransUInt16(bytes, 0), + Set = byteTransform.TransSingle(bytes, 2), + TolErance = byteTransform.TransSingle(bytes, 6) + }; + ls.Add(plcView); + } + + view.RecipePlcViews = ls; + + data = convert.Skip(20).Take(120); + + List lsSteps = new List(); + for (int i = 0; i < 10; i++) + { + var bytes = data.Skip(i * 10).Take(12).ToArray(); + Step step = new Step() + { + MixCode = byteTransform.TransUInt16(bytes, 0), + MixTime = byteTransform.TransUInt16(bytes, 2), + MixTemp = byteTransform.TransSingle(bytes, 4), + MixSpeed = byteTransform.TransSingle(bytes, 8) + }; + lsSteps.Add(step); + } + + view.RecipeSteps = lsSteps; + + } + + return view; + } + + + + + + private static List GetWeterView(int start) + { + var byteTransform = PlcConnect.Instance.ByteTransform; + List ls = new List(); + var operateResult = PlcConnect.Instance.Read($"DB2104.{start}.0", 200); + List lsSteps = new List(); + if (operateResult.IsSuccess) + { + + var data = operateResult.Content; + + + for (int i = 0; i < 10; i++) + { + var bytes = data.Skip(i * 10).Take(20).ToArray(); + MixStep step = new MixStep() + { + MixCode = byteTransform.TransUInt16(bytes, 0), + MixTime = byteTransform.TransUInt16(bytes, 2), + MixTemp = byteTransform.TransSingle(bytes, 4), + MixSpeed = byteTransform.TransSingle(bytes, 8), + SetValue = byteTransform.TransSingle(bytes, 12), + SetTolerance = byteTransform.TransSingle(bytes, 16) + }; + lsSteps.Add(step); + } + + } + + return lsSteps; + } + private static void DownCleanD1Recipe(int begin) + { + List recipePlcViews = GetClean(12); + List recipeSteps = GetCleanStep(10); + + for (int i = 0; i < recipePlcViews.Count(); i++) + { + var view = recipePlcViews[i]; + Dowd(begin, view); + begin += 10; + } + + begin += 120; + for (int i = 0; i < recipeSteps.Count(); i++) + { + var view = recipeSteps[i]; + DowSteps(begin, view); + begin += 12; + + } + + } + + private static void DownCleanG1Recipe(int begin) + { + List recipePlcViews = GetClean(2); + List recipeSteps = GetCleanStep(10); + + for (int i = 0; i < recipePlcViews.Count(); i++) + { + var view = recipePlcViews[i]; + Dowd(begin, view); + begin += 10; + } + + begin += 20; + for (int i = 0; i < recipeSteps.Count(); i++) + { + var view = recipeSteps[i]; + DowSteps(begin, view); + begin += 12; + + } + + } + + + private static void DownM1CleanRecipe(int begin) + { + + List recipeSteps = GetCleanMixStep(10); + + for (int i = 0; i < recipeSteps.Count(); i++) + { + var view = recipeSteps[i]; + DowMSteps(begin, view); + begin += 20; + + } + + } + + + private static void Dowd(int start, RecipePlcView view) + { + int bin = start; + PlcConnect.Instance.Write($"DB2104.{bin}.0", view.Bin); + int set = start + 2; + PlcConnect.Instance.Write($"DB2104.{set}.0", view.Set); + int tolerance = start + 6; + PlcConnect.Instance.Write($"DB2104.{tolerance}.0", view.TolErance); + + } + + private static void DowSteps(int start, Step step) + { + int mixCode = start; + PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode); + int mixTime = start + 2; + PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime); + + int mixTemp = start + 4; + PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp); + int mixSpeed = start + 8; + + PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed); + } + + + private static void DowMSteps(int start, MixStep step) + { + int mixCode = start; + PlcConnect.Instance.Write($"DB2104.{mixCode}.0", step.MixCode); + int mixTime = start + 2; + PlcConnect.Instance.Write($"DB2104.{mixTime}.0", step.MixTime); + + int mixTemp = start + 4; + PlcConnect.Instance.Write($"DB2104.{mixTemp}.0", step.MixTemp); + int mixSpeed = start + 8; + + PlcConnect.Instance.Write($"DB2104.{mixSpeed}.0", step.MixSpeed); + + int setValue = start + 12; + + PlcConnect.Instance.Write($"DB2104.{setValue}.0", step.SetValue); + + int tolerance = start + 16; + + PlcConnect.Instance.Write($"DB2104.{tolerance}.0", step.SetTolerance); + } + + + private static List GetClean(int num) + { + List ls = new List(num); + for (int i = 0; i < num; i++) + { + ls.Add(new RecipePlcView() + { + Bin = 0, + TolErance = 0, + Set = 0 + }); + + } + + return ls; + } + + private static List GetCleanStep(int num) + { + List ls = new List(num); + for (int i = 0; i < num; i++) + { + ls.Add(new Step() + { + MixCode = 0, + MixSpeed = 0, + MixTemp = 0, + MixTime = 0 + }); + + } + + return ls; + } + + private static List GetCleanMixStep(int num) + { + List ls = new List(num); + for (int i = 0; i < num; i++) + { + ls.Add(new MixStep() + { + MixCode = 0, + MixSpeed = 0, + MixTemp = 0, + MixTime = 0, + SetTolerance = 0, + SetValue = 0 + }); + + } + + return ls; + } + #endregion + + + } } \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 3106213..7560737 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -219,6 +219,8 @@ + + diff --git a/DataBlockHelper/Entity/DB2104Entity/WaterView.cs b/DataBlockHelper/Entity/DB2104Entity/WaterView.cs index 6770497..82da9d0 100644 --- a/DataBlockHelper/Entity/DB2104Entity/WaterView.cs +++ b/DataBlockHelper/Entity/DB2104Entity/WaterView.cs @@ -4,6 +4,6 @@ { public short Bin { get; set; } public float Set { get; set; } - public float TolErance { get; set; } + public float Tolerance { get; set; } } } \ No newline at end of file diff --git a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml index 253fa87..81e4016 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlA.xml @@ -19,7 +19,7 @@ Red DarkGray - 确定 + 下传 38, 441 WaterConfrim 98, 41