You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjTanNum/InItDbAction.cs

59 lines
1.9 KiB
C#

using System;
using System.Data;
using System.Linq;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.LjMaterial;
namespace Mesnac.Action.ChemicalWeighing.LjTanNum
{
public class InItDbAction:ChemicalWeighingAction,IAction
{
private DbMCControl _materialGridControl = null; //物料列表控件
private RuntimeParameter _runtime;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
UpdateAction.OnUpdateMaterial -= Process_Event;
UpdateAction.OnUpdateMaterial += Process_Event;
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
1 year ago
"lj_day_material").FirstOrDefault(); //获取物料数据控件
this._materialGridControl = materialGridControl;
FileControl();
}
private void FileControl()
{
1 year ago
string sql = @"select Id, Code, DayBinName, MTypeId,MTypeName, MId, MName, Remark from lj_day_material;";
DataTable table = DBHelp.GetTable(sql);
if (this._materialGridControl != null && this._materialGridControl.BaseControl != null)
{
this._materialGridControl.BaseControl.BindDataSource = null;
this._materialGridControl.BaseControl.BindDataSource = table;
}
else
{
1 year ago
ICSharpCode.Core.LoggingService<InItDbAction>.Warn("刷新日罐信息失败物料数据控件为Null...");
}
}
private void Process_Event(object sender, EventArgs e)
{
if (sender is RuntimeParameter)
{
this.Run(sender as RuntimeParameter);
}
else
{
this.Run(this._runtime);
}
}
}
}