|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using ICSharpCode.Core;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Codd.Session;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Alarm.PmtAlarm
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 报警参数查询业务
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class SelectAction: ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须要调用的
|
|
|
|
|
ICSharpCode.Core.LoggingService<SelectAction>.Debug("报警参数-查询...");
|
|
|
|
|
|
|
|
|
|
FrmInsert frmInsert = new FrmInsert(ActionType.Query,null);
|
|
|
|
|
DialogResult result = frmInsert.ShowDialog();
|
|
|
|
|
if (result == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
|
|
dbHelper.ClearParameter();
|
|
|
|
|
dbHelper.CommandType = System.Data.CommandType.Text;
|
|
|
|
|
|
|
|
|
|
StringBuilder sbSql = new StringBuilder("SELECT * FROM Pmt_Alarm WHERE 1=1");
|
|
|
|
|
if (frmInsert.AlarmPLC != Mesnac.Basic.LanguageHelper.PleaseSelect)
|
|
|
|
|
{
|
|
|
|
|
sbSql.Append(" AND Alarm_PLC = @AlarmPLC");
|
|
|
|
|
dbHelper.AddParameter("@AlarmPLC", frmInsert.AlarmPLC);
|
|
|
|
|
}
|
|
|
|
|
if (!String.IsNullOrEmpty(frmInsert.AlarmBlock))
|
|
|
|
|
{
|
|
|
|
|
sbSql.Append(" AND Alarm_Block like @AlarmBlock");
|
|
|
|
|
dbHelper.AddParameter("@AlarmBlock", "%" + frmInsert.AlarmBlock + "%");
|
|
|
|
|
}
|
|
|
|
|
if (!String.IsNullOrEmpty(frmInsert.Alarm_Alias))
|
|
|
|
|
{
|
|
|
|
|
sbSql.Append(" AND Alarm_Alias like @Alarm_Alias");
|
|
|
|
|
dbHelper.AddParameter("@Alarm_Alias", "%" + frmInsert.Alarm_Alias + "%");
|
|
|
|
|
}
|
|
|
|
|
if (!String.IsNullOrEmpty(frmInsert.Alarm_Cn_Info))
|
|
|
|
|
{
|
|
|
|
|
sbSql.Append(" AND Alarm_Cn_Info = @Alarm_Cn_Info");
|
|
|
|
|
dbHelper.AddParameter("@Alarm_Cn_Info", frmInsert.Alarm_Cn_Info);
|
|
|
|
|
}
|
|
|
|
|
sbSql.Append(" ORDER BY Alarm_PLC, Alarm_Block, Alarm_Cn_Info");
|
|
|
|
|
|
|
|
|
|
dbHelper.CommandText = sbSql.ToString();
|
|
|
|
|
DataTable table = dbHelper.ToDataTable();
|
|
|
|
|
|
|
|
|
|
//刷新DataGridView数据
|
|
|
|
|
DbMCControl dgPmtAlarmInfo = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Alarm").FirstOrDefault();
|
|
|
|
|
if (dgPmtAlarmInfo == null || !(dgPmtAlarmInfo.BaseControl is DataGridView))
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<InsertAction>.Warn("报警参数-查询-缺少报警参数DataGridView控件...");
|
|
|
|
|
runtime.IsReturn = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
dgPmtAlarmInfo.BaseControl.BindDataSource = null;
|
|
|
|
|
dgPmtAlarmInfo.BaseControl.BindDataSource = table;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|