using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.Entity; using Mesnac.Action.ChemicalWeighing.Product.PptPlan; using Mesnac.Action.ChemicalWeighing.Technical.XlRecipe; using Mesnac.Controls.Base; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Mesnac.Action.ChemicalWeighing.Report.SolventReport { /// /// 生产报表初始化窗体 /// class InitFormAction : ChemicalWeighingAction, IAction { private RuntimeParameter _runtime; public void Run(RuntimeParameter runtime) { base.RunIni(runtime); //必须要调用的 this._runtime = runtime; ICSharpCode.Core.LoggingService.Debug("生产报表-窗体初始化..."); //SelectRowAction.OnRefresh -= Process_Event; //SelectRowAction.OnRefresh += Process_Event; List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件 IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl; IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl; starttime.MCValue = DateTime.Parse("00:00:00"); endtime.MCValue = DateTime.Parse("23:59:59"); //var comShiftime = base.GetControlById("comShiftime") as System.Windows.Forms.ComboBox;//班组名称 //if (comShiftime != null) //{ // List list = TechnicalHelper.GetPmt_ShiftimeList(); // comShiftime.DataSource = list; //} var comRecipe = base.GetControlById("comRecipe") as System.Windows.Forms.ComboBox;//配方名称 if (comRecipe != null) { //List list = PlanHelper.GetRecipeMaterialListPY(); IFreeSql _freeSql = DBHelper.FreeHelper.Instance; string sql = "select distinct Batch from RT_plan where Batch is not null"; var list = _freeSql.Select().WithSql(sql).ToList(); comRecipe.DataSource = list; comRecipe.DisplayMember = "Batch"; comRecipe.ValueMember = "Batch"; } } #region 事件处理方法 private void Process_Event(object sender, EventArgs e) { if (sender is RuntimeParameter) { this.Run(sender as RuntimeParameter); } else { this.Run(this._runtime); } } #endregion } public class BatchObj { public string Batch { get; set; } } }