using DataBlockHelper.DBHelpers; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting.Entity; using Mesnac.Controls.Default; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting { public class InitAction : ChemicalWeighingAction, IAction { DB112Helper DB122 = new DB112Helper(); MCTextboxEntity BoxE = new MCTextboxEntity(); SlioEntity slioEntity = new SlioEntity(); PipeEntity pipe=new PipeEntity(); SpeedEntity speed=new SpeedEntity(); List Controls; public void Run(RuntimeParameter runtime) { RunIni(runtime); Controls = GetAllControls(); ControlsHelper.ControlImport(BoxE, Controls); ControlsHelper.ControlImport(slioEntity, Controls); ControlsHelper.ControlImport(pipe, Controls); ControlsHelper.ControlImport(speed, Controls); SetValueFromPlc(); SetValue(); SetDb92Value(); SetSpeed(); } private void SetValueFromPlc() { BoxE.ASetValue1.MCValue = DB122.PressureA.SetValue1; BoxE.ASetValue2.MCValue = DB122.PressureA.SetValue2; BoxE.ASetValue3.MCValue = DB122.PressureA.SetValue3; BoxE.ASetValue4.MCValue = DB122.PressureA.SetValue4; BoxE.ASetValue5.MCValue = DB122.PressureA.SetValue5; BoxE.ASetValue6.MCValue = DB122.PressureA.SetValue6; BoxE.ASetValue7.MCValue = DB122.PressureA.SetValue7; BoxE.ASetValue8.MCValue = DB122.PressureA.SetValue8; BoxE.BSetValue1.MCValue = DB122.PressureB.SetValue1; BoxE.BSetValue2.MCValue = DB122.PressureB.SetValue2; BoxE.BSetValue3.MCValue = DB122.PressureB.SetValue3; BoxE.BSetValue4.MCValue = DB122.PressureB.SetValue4; BoxE.BSetValue5.MCValue = DB122.PressureB.SetValue5; BoxE.BSetValue6.MCValue = DB122.PressureB.SetValue6; BoxE.BSetValue7.MCValue = DB122.PressureB.SetValue7; BoxE.BSetValue8.MCValue = DB122.PressureB.SetValue8; BoxE.CSetValue1.MCValue = DB122.PressureC.SetValue1; BoxE.CSetValue2.MCValue = DB122.PressureC.SetValue2; BoxE.CSetValue3.MCValue = DB122.PressureC.SetValue3; BoxE.CSetValue4.MCValue = DB122.PressureC.SetValue4; BoxE.CSetValue5.MCValue = DB122.PressureC.SetValue5; BoxE.CSetValue6.MCValue = DB122.PressureC.SetValue6; BoxE.CSetValue7.MCValue = DB122.PressureC.SetValue7; BoxE.CSetValue8.MCValue = DB122.PressureC.SetValue8; BoxE.ATimeSetValue1.MCValue = DB122.LineTimeA.SetValue1; BoxE.ATimeSetValue2.MCValue = DB122.LineTimeA.SetValue2; BoxE.BTimeSetValue1.MCValue = DB122.LineTimeB.SetValue1; BoxE.BTimeSetValue2.MCValue = DB122.LineTimeB.SetValue2; BoxE.CTimeSetValue1.MCValue = DB122.LineTimeC.SetValue1; BoxE.CTimeSetValue2.MCValue = DB122.LineTimeC.SetValue2; } private void SetValue() { DB120Helper dB120Help = new DB120Helper(); var hd = dB120Help.GetUhd; slioEntity.TxtA.MCValue = hd.A.ToString(); slioEntity.TxtB.MCValue = hd.B.ToString(); slioEntity.TxtC.MCValue = hd.C.ToString(); slioEntity.TxtD.MCValue = hd.D.ToString(); slioEntity.TxtE.MCValue = hd.E.ToString(); slioEntity.TxtF.MCValue = hd.F.ToString(); slioEntity.TxtG.MCValue = hd.G.ToString(); slioEntity.TxtH.MCValue = hd.H.ToString(); slioEntity.TxtI.MCValue = hd.I.ToString(); slioEntity.TxtJ.MCValue = hd.J.ToString(); slioEntity.TxtK.MCValue = hd.K.ToString(); slioEntity.TxtL.MCValue = hd.L.ToString(); slioEntity.TxtM.MCValue = hd.M.ToString(); slioEntity.TxtN.MCValue = hd.N.ToString(); slioEntity.TxtO.MCValue = hd.O.ToString(); slioEntity.TxtDelay1.MCValue = hd.Delay1.ToString(); slioEntity.TxtDelay2.MCValue = hd.Delay2.ToString(); slioEntity.TxtDelay3.MCValue = hd.Delay3.ToString(); } private void SetDb92Value() { DB92Help dB=new DB92Help(); var p = dB.GetPipe; pipe.MainA.MCValue=p.MainPipieA.ToString(); pipe.AuxA.MCValue = p.AuxPipieA.ToString(); pipe.MainB.MCValue = p.MainPipieB.ToString(); pipe.AuxB.MCValue = p.AuxPipieB.ToString(); pipe.MainC.MCValue = p.MainPipieC.ToString(); pipe.AuxC.MCValue = p.AuxPipieC.ToString(); pipe.Upper.MCValue=p.UpperPressure.ToString(); pipe.Lower.MCValue=p.LowerPressure.ToString(); } private void SetSpeed() { DB137Helper dB137=new DB137Helper(); speed.TxtSpeedA.MCValue=dB137.SpeedA.ToString(); speed.TxtSpeedB.MCValue = dB137.SpeedB.ToString(); speed.TxtSpeedC.MCValue = dB137.SpeedC.ToString(); DB91Helper dB91=new DB91Helper(); speed.TxtSpeedMA.MCValue=dB91.DM1DSM01.SetSpeed_M.ToString(); speed.TxtSpeedMB.MCValue = dB91.DM2DSM01.SetSpeed_M.ToString(); speed.TxtSpeedMC.MCValue = dB91.DM3DSM01.SetSpeed_M.ToString(); speed.SetSpeedA.MCValue=dB91.DM1GDS12.SetSpeed_A.ToString(); speed.SetSpeedM.MCValue = dB91.DM1GDS12.SetSpeed_M.ToString(); } } }