using System; using System.Collections.Generic; using System.Data; using System.Diagnostics; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors.Filtering.Templates; using ICSharpCode.Core; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.Entity; using Mesnac.Action.ChemicalWeighing.FreeDb; using Mesnac.Action.ChemicalWeighing.LjMetageFormula; using Mesnac.Action.ChemicalWeighing.LjMixFormula; using Mesnac.Action.ChemicalWeighing.LjMixManager; using Mesnac.Action.ChemicalWeighing.LjPlanning; using Mesnac.Action.ChemicalWeighing.LjProdcutLine; using Mesnac.Action.ChemicalWeighing.LjReport.OpenDoor; using Mesnac.Basic; using Mesnac.Codd.Session; using Mesnac.Controls.Base; using Mesnac.Controls.Default; namespace Mesnac.Action.ChemicalWeighing.Test { public class TestAction : DatabaseAction, IAction { MCButton mCButton; public void timer1EventProcessor(object source, EventArgs e) { OpenDoorService.Insert(new OpenDoorEntity() { DeviceId = 0, OpenTime = DateTime.Now, CreateTime = DateTime.Now, Status = 0 }); } public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 var allDb=GetAllControls(); <<<<<<< HEAD //int adsa = BasePlcHelper.Instance.BU1BLT01_Alarm.NowValue.ToInt(); string sql = "insert into ActionCode values (13,'test','',1) select @@IDENTITY"; DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); if (dbHelper == null) { throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError); } // dbHelper.ClearParameter(); // dbHelper.CommandType = CommandType.Text; // dbHelper.CommandText = sql; int[] ssss = new int [] { }; var ss2s = BasePlcHelper.Instance.PlcReadByRunName("BU1BLT01_Set", out ssss); mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.None);//获取所有待初始化控件 startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "MCLabel153".ToLower()).FirstOrDefault().BaseControl; Timer timer1 = new Timer(); timer1.Interval = 1000; timer1.Enabled = true; timer1.Tick += new EventHandler(timer1EventProcessor);//添加事件 //ParametersWithPc.B1.FirstWord 256 768 //badc1el26587193265870 ======= mCButton = allDb.FirstOrDefault(x => x.Name == "MCButton1") as MCButton; mCButton.Click += new EventHandler(timer1EventProcessor); >>>>>>> dep //MCButton1 //OpenDoorService } } }