using System.Data; using System.Linq; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.LjMaterial; namespace Mesnac.Action.ChemicalWeighing.LjAction { public class InitDbAction:ChemicalWeighingAction,IAction { private DbMCControl _materialGridControl = null; //物料列表控件 private RuntimeParameter _runtime; public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须调用 this._runtime = runtime; DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ActionCode").FirstOrDefault(); //获取物料数据控件 this._materialGridControl = materialGridControl; FileControl(); } private void FileControl() { DataTable table = MaterialInfoTypeHelp.GetTable(@"select ActionCode.id,code,ActionName,ActionCode.Remark,DeviceUnitId,DeviceUnit.Name from ActionCode left join DeviceUnit on ActionCode.DeviceUnitId = DeviceUnit.Id"); if (this._materialGridControl != null && this._materialGridControl.BaseControl != null) { this._materialGridControl.BaseControl.BindDataSource = null; this._materialGridControl.BaseControl.BindDataSource = table; //DBLog("成功!"); } else { ICSharpCode.Core.LoggingService.Warn("刷新物料信息失败:物料数据控件为Null..."); } } } }