|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning.Db;
|
|
|
|
|
using Mesnac.Controls.Base;
|
|
|
|
|
using Mesnac.Controls.Default;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjRecipeData
|
|
|
|
|
{
|
|
|
|
|
public class InitDb : ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
private DbMCControl _materialGridControl = null; //物料列表控件
|
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
|
|
|
|
|
|
private MCCombobox LjFormulaKinds = null;
|
|
|
|
|
private MCTextBox LjFormulaName = null;
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须调用
|
|
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
|
|
|
|
AddAction.OnAdd -= Process_Event;
|
|
|
|
|
AddAction.OnAdd += Process_Event;
|
|
|
|
|
|
|
|
|
|
UpdateAction.OnUpdate -= Process_Event;
|
|
|
|
|
UpdateAction.OnUpdate += Process_Event;
|
|
|
|
|
|
|
|
|
|
DelAction.OnDel -= Process_Event;
|
|
|
|
|
DelAction.OnDel += Process_Event;
|
|
|
|
|
|
|
|
|
|
//SelectSingleAction.OnSelectSingle -= Process_Event;
|
|
|
|
|
//SelectSingleAction.OnSelectSingle += Process_Event;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Lj_Formula").FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
|
|
|
|
|
|
|
|
|
|
LjFormulaKinds = mcControllist.FirstOrDefault(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "LjFormulaKinds").BaseControl as MCCombobox; //选择查询类型
|
|
|
|
|
LjFormulaName = mcControllist.FirstOrDefault(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == "LjFormulaName").BaseControl as MCTextBox; //选择查询名称
|
|
|
|
|
|
|
|
|
|
this._materialGridControl = materialGridControl;
|
|
|
|
|
FileControl();
|
|
|
|
|
MCComboBoxData();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FileControl()
|
|
|
|
|
{
|
|
|
|
|
DataTable table = LjFormulaDb.GetMainTable();
|
|
|
|
|
|
|
|
|
|
if (this._materialGridControl != null && this._materialGridControl.BaseControl != null)
|
|
|
|
|
{
|
|
|
|
|
this._materialGridControl.BaseControl.BindDataSource = null;
|
|
|
|
|
this._materialGridControl.BaseControl.BindDataSource = table;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<InitDb>.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
|
|
|
|
|
|
|
|
|
|
private void MCComboBoxData()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
string sql = "select recipetype_Id as CmbValue ,recipetype_Name as CmbDisplay from Base_RecipeType";
|
|
|
|
|
|
|
|
|
|
var dataTable = DBHelp.GetTable(sql);
|
|
|
|
|
|
|
|
|
|
var dr = dataTable.NewRow();
|
|
|
|
|
dr[0] = "-1";
|
|
|
|
|
dr[1] = "全部";
|
|
|
|
|
|
|
|
|
|
dataTable.Rows.InsertAt(dr, 0);
|
|
|
|
|
|
|
|
|
|
LjFormulaKinds.DataSource = dataTable;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|