using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.Entity; using Mesnac.Controls.Base; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Mesnac.Action.ChemicalWeighing.DeviceParamManage { public class InitDeviceParamInfo : ChemicalWeighingAction, IAction { public static bool IsFirstRun = true; //是否首次运行 public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须要调用 if(IsFirstRun) { IsFirstRun = false; ICSharpCode.Core.LoggingService.Debug("设备参数管理-窗体初始化业务..."); DataKeyValue ConFeq = new DataKeyValue("ConFeq"); BasePlcHelper.Instance.dataKeyValues.Add(ConFeq); DataKeyValue FanDelay = new DataKeyValue("FanDelay"); BasePlcHelper.Instance.dataKeyValues.Add(FanDelay); DataKeyValue DisSpeed = new DataKeyValue("DisSpeed"); BasePlcHelper.Instance.dataKeyValues.Add(DisSpeed); DataKeyValue DisTime = new DataKeyValue("DisTime"); BasePlcHelper.Instance.dataKeyValues.Add(DisTime); DataKeyValue JZJDisDelay = new DataKeyValue("JZJDisDelay"); BasePlcHelper.Instance.dataKeyValues.Add(JZJDisDelay); DataKeyValue VccHighFrq = new DataKeyValue("VccHighFrq"); BasePlcHelper.Instance.dataKeyValues.Add(VccHighFrq); DataKeyValue VccMidFrq = new DataKeyValue("VccMidFrq"); BasePlcHelper.Instance.dataKeyValues.Add(VccMidFrq); DataKeyValue VccLoeFrq = new DataKeyValue("VccLoeFrq"); BasePlcHelper.Instance.dataKeyValues.Add(VccLoeFrq); DataKeyValue VccHighWei = new DataKeyValue("VccHighWei"); BasePlcHelper.Instance.dataKeyValues.Add(VccHighWei); DataKeyValue VccLowWei = new DataKeyValue("VccLowWei"); BasePlcHelper.Instance.dataKeyValues.Add(VccLowWei); DataKeyValue VccJogWei = new DataKeyValue("VccJogWei"); BasePlcHelper.Instance.dataKeyValues.Add(VccJogWei); DataKeyValue VccExcWei = new DataKeyValue("VccExcWei"); BasePlcHelper.Instance.dataKeyValues.Add(VccExcWei); DataKeyValue VccTimeout = new DataKeyValue("VccTimeout"); BasePlcHelper.Instance.dataKeyValues.Add(VccTimeout); DataKeyValue VccHco = new DataKeyValue("VccHco"); BasePlcHelper.Instance.dataKeyValues.Add(VccHco); DataKeyValue GFAHighFrq = new DataKeyValue("GFAHighFrq"); BasePlcHelper.Instance.dataKeyValues.Add(GFAHighFrq); DataKeyValue GFAMidFrq = new DataKeyValue("GFAMidFrq"); BasePlcHelper.Instance.dataKeyValues.Add(GFAMidFrq); DataKeyValue GFALoeFrq = new DataKeyValue("GFALoeFrq"); BasePlcHelper.Instance.dataKeyValues.Add(GFALoeFrq); DataKeyValue GFAHighWei = new DataKeyValue("GFAHighWei"); BasePlcHelper.Instance.dataKeyValues.Add(GFAHighWei); DataKeyValue GFALowWei = new DataKeyValue("GFALowWei"); BasePlcHelper.Instance.dataKeyValues.Add(GFALowWei); DataKeyValue GFAJogWei = new DataKeyValue("GFAJogWei"); BasePlcHelper.Instance.dataKeyValues.Add(GFAJogWei); DataKeyValue GFAExcWei = new DataKeyValue("GFAExcWei"); BasePlcHelper.Instance.dataKeyValues.Add(GFAExcWei); DataKeyValue GFATimeout = new DataKeyValue("GFATimeout"); BasePlcHelper.Instance.dataKeyValues.Add(GFATimeout); DataKeyValue GFAHco = new DataKeyValue("GFAHco"); BasePlcHelper.Instance.dataKeyValues.Add(GFAHco); DataKeyValue ResinHighFrq = new DataKeyValue("ResinHighFrq"); BasePlcHelper.Instance.dataKeyValues.Add(ResinHighFrq); DataKeyValue ResinMidFrq = new DataKeyValue("ResinMidFrq"); BasePlcHelper.Instance.dataKeyValues.Add(ResinMidFrq); DataKeyValue ResinLoeFrq = new DataKeyValue("ResinLoeFrq"); BasePlcHelper.Instance.dataKeyValues.Add(ResinLoeFrq); DataKeyValue ResinHighWei = new DataKeyValue("ResinHighWei"); BasePlcHelper.Instance.dataKeyValues.Add(ResinHighWei); DataKeyValue ResinLowWei = new DataKeyValue("ResinLowWei"); BasePlcHelper.Instance.dataKeyValues.Add(ResinLowWei); DataKeyValue ResinJogWei = new DataKeyValue("ResinJogWei"); BasePlcHelper.Instance.dataKeyValues.Add(ResinJogWei); DataKeyValue ResinExcWei = new DataKeyValue("ResinExcWei"); BasePlcHelper.Instance.dataKeyValues.Add(ResinExcWei); DataKeyValue ResinTimeout = new DataKeyValue("ResinTimeout"); BasePlcHelper.Instance.dataKeyValues.Add(ResinTimeout); } foreach (var item in BasePlcHelper.Instance.dataKeyValues) { if (item.Name == "VccHighWei" || item.Name == "VccLowWei" || item.Name == "VccJogWei" || item.Name == "VccExcWei" || item.Name == "GFAHighWei" || item.Name == "GFALowWei" || item.Name == "GFAJogWei" || item.Name == "GFAExcWei" || item.Name == "ResinHighWei" || item.Name == "ResinLowWei" || item.Name == "ResinJogWei" || item.Name == "ResinExcWei") { TextBox comboBox = base.GetControlById(item.Name) as TextBox; comboBox.Text = item.NowValue.ToFloat().ToString(); } else { TextBox comboBox = base.GetControlById(item.Name) as TextBox; comboBox.Text = item.NowValue.ToInt().ToString(); } } } } }