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/LjPressure/InitDbAction.cs

70 lines
2.2 KiB
C#

1 year ago
using System;
1 year ago
using System.Collections.Generic;
1 year ago
using System.Data;
using System.Linq;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.LjMaterial;
namespace Mesnac.Action.ChemicalWeighing.LjPressure
{
public class InitDbAction : ChemicalWeighingAction, IAction
{
private DbMCControl _materialGridControl = null; //物料列表控件
private RuntimeParameter _runtime;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
1 year ago
UpAction.OnHandler -= Process_Event;
UpAction.OnHandler += Process_Event;
UpdateAction.OnUpdate -= Process_Event;
UpdateAction.OnUpdate += Process_Event;
1 year ago
DbMCControl materialGridControl =
this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "pressureSetting")
.FirstOrDefault(); //获取物料数据控件
this._materialGridControl = materialGridControl;
FileControl();
}
private void FileControl()
{
DataTable table =
1 year ago
DBHelp.GetTable(@"select Id,Name,ActualValue,LowLimit,HighLimit,Alarm,
case Alarm when 1 then '' else '' end as AlarmValue from pressureSetting;");
1 year ago
if (this._materialGridControl != null && this._materialGridControl.BaseControl != null)
{
this._materialGridControl.BaseControl.BindDataSource = null;
this._materialGridControl.BaseControl.BindDataSource = table;
//DBLog("成功!");
}
else
{
ICSharpCode.Core.LoggingService<InitDbAction>.Warn("刷新物料信息失败压力数据控件为Null...");
1 year ago
}
}
#region 事件处理方法
private void Process_Event(object sender, EventArgs e)
{
if (sender is RuntimeParameter)
{
this.Run(sender as RuntimeParameter);
}
else
{
this.Run(this._runtime);
}
}
#endregion
}
}