|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Windows.Forms;
|
|
|
using System.Data;
|
|
|
using Mesnac.Action.Base;
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Alarm.PmtAlarm
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 报警参数窗体初始化
|
|
|
/// </summary>
|
|
|
public class InitFormAction : ChemicalWeighingAction, IAction
|
|
|
{
|
|
|
private RuntimeParameter _runtime;
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
{
|
|
|
|
|
|
base.RunIni(runtime); //必须要调用的
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
ICSharpCode.Core.LoggingService<InitFormAction>.Debug("报警参数-窗体初始化...");
|
|
|
|
|
|
//通用调用刷新计划事件订阅
|
|
|
|
|
|
ModifyAction.OnModifyRefresh -= Process_Event;
|
|
|
ModifyAction.OnModifyRefresh += Process_Event;
|
|
|
|
|
|
RefreshAction.OnRefresh -= Process_Event;
|
|
|
RefreshAction.OnRefresh += Process_Event;
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Alarm").FirstOrDefault();
|
|
|
//DbMCControl ctlAlarmPLC = base.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "[Pmt_Alarm].[Alarm_PLC]").FirstOrDefault();
|
|
|
//if (ctlAlarmPLC == null || !(ctlAlarmPLC.BaseControl is ComboBox))
|
|
|
//{
|
|
|
// ICSharpCode.Core.LoggingService<InitFormAction>.Warn("报警参数-窗体初始化-界面中缺少报警PLC组合框控件...");
|
|
|
// return;
|
|
|
//}
|
|
|
|
|
|
//DataTable dt = new DataTable();
|
|
|
//dt.Columns.Add("ItemName", typeof(string));
|
|
|
//dt.Columns.Add("ItemValue", typeof(string));
|
|
|
|
|
|
//DataRow dr = dt.NewRow();
|
|
|
//dr["ItemName"] = Mesnac.Basic.LanguageHelper.PleaseSelect;
|
|
|
//dr["ItemValue"] = Mesnac.Basic.LanguageHelper.PleaseSelect;
|
|
|
//dt.Rows.Add(dr);
|
|
|
|
|
|
//foreach (string plc in Mesnac.Equips.Factory.Instance.AllEquips.Keys)
|
|
|
//{
|
|
|
// dr = dt.NewRow();
|
|
|
// dr["ItemName"] = plc;
|
|
|
// dr["ItemValue"] = plc;
|
|
|
// dt.Rows.Add(dr);
|
|
|
//}
|
|
|
//ctlAlarmPLC.BaseControl.BindDataSource = dt;
|
|
|
|
|
|
|
|
|
//DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Alarm").FirstOrDefault();
|
|
|
if (clientGridControl == null || !(clientGridControl.BaseControl is DataGridView))
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService<ModifyAction>.Error("{预警管理—初始化}缺少警管理控件...");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
DataGridView alarmGridView = clientGridControl.BaseControl as DataGridView;
|
|
|
|
|
|
DataTable table = AlarmHelper.GetPmtAlarmInfoTable();
|
|
|
lock (String.Empty)
|
|
|
{
|
|
|
//本地计划
|
|
|
if (clientGridControl != null && clientGridControl.BaseControl != null)
|
|
|
{
|
|
|
clientGridControl.BaseControl.BindDataSource = null;
|
|
|
clientGridControl.BaseControl.BindDataSource = table;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService<InitFormAction>.Warn("预警管理初始化失败:本地计划控件为Null...");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
#region 事件处理方法
|
|
|
|
|
|
private void Process_Event(object sender, EventArgs e)
|
|
|
{
|
|
|
if (sender is RuntimeParameter)
|
|
|
{
|
|
|
this.Run(sender as RuntimeParameter);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
this.Run(this._runtime);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|