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

60 lines
2.0 KiB
C#

using Mesnac.Action.Base;
using Mesnac.Controls.Base;
11 months ago
using Mesnac.Controls.Default;
using System;
using System.Collections.Generic;
11 months ago
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesnac.Action.ChemicalWeighing.Report.DryMixer
{
/// <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_DryMixer").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);
11 months ago
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 < 5; i++)
{
var dr = dataTable.NewRow();
dr[0] = i;
dr[1] = i;
dataTable.Rows.Add(dr);
}
MCCombobox1.DataSource=dataTable;
}
}
}