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/Report/GelDoser/InitFormAction.cs

61 lines
2.0 KiB
C#

using Mesnac.Action.Base;
using Mesnac.Controls.Base;
using Mesnac.Controls.Default;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Mesnac.Action.ChemicalWeighing.Report.GelDoser
{
/// <summary>
/// 糊化机报表窗体初始化事件
/// </summary>
public class InitFormAction : ChemicalWeighingAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
ICSharpCode.Core.LoggingService<InitFormAction>.Debug("糊化机报表-窗体初始化...");
#region 获取界面控件
DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault(); //获取本机台计划网格控件
if (clientGridControl == null)
{
ICSharpCode.Core.LoggingService<InitFormAction>.Error("{糊化机报表-窗体加载} 缺少日志网格控件...");
return;
}
#endregion
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
startdate.MCValue = DateTime.Now.AddDays(-3);
var MCCombobox1 = GetAllControls().FirstOrDefault(x => x.Name == "MCCombobox1") as MCCombobox;
DataTable dataTable = new DataTable();
dataTable.Columns.Add("CmbValue", typeof(string));
dataTable.Columns.Add("CmbDisplay", typeof(string));
for (int i = 1; i < 9; i++)
{
var dr = dataTable.NewRow();
dr[0] = i;
dr[1] = i;
dataTable.Rows.Add(dr);
}
MCCombobox1.DataSource = dataTable;
}
}
}