|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Mesnac.Action.Base;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjPlanning
|
|
|
|
|
{
|
|
|
|
|
public class InItDbAction:ChemicalWeighingAction, IAction
|
|
|
|
|
{
|
|
|
|
|
private DbMCControl _materialGridControl = null; //物料列表控件
|
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
base.RunIni(runtime); //必须调用
|
|
|
|
|
this._runtime = runtime;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AddAction.OnAdd -= Process_Event;
|
|
|
|
|
AddAction.OnAdd += Process_Event;
|
|
|
|
|
|
|
|
|
|
DbMCControl materialGridControl =
|
|
|
|
|
this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "lj_planning")
|
|
|
|
|
.FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
this._materialGridControl = materialGridControl;
|
|
|
|
|
FileControl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FileControl()
|
|
|
|
|
{
|
|
|
|
|
DataTable table =
|
|
|
|
|
DBHelp.GetTable(@"select Id, No, Status, CreateTime, UpdateTime, BegTime, EndTime, NumCar, Share, MetageAId, MetageAName, MixAId,
|
|
|
|
|
MixAName, MetageB1Id, MetageB1Name, MetageB2Id, MetageB2Name, MixBId, MixBName, MixCId, MixCName, RecipeType, Remark, ProductLineId, ProductLineName from lj_planning");
|
|
|
|
|
|
|
|
|
|
if (this._materialGridControl != null && this._materialGridControl.BaseControl != null)
|
|
|
|
|
{
|
|
|
|
|
this._materialGridControl.BaseControl.BindDataSource = null;
|
|
|
|
|
this._materialGridControl.BaseControl.BindDataSource = table;
|
|
|
|
|
//DBLog("成功!");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<InitDbAction>.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
|
|
|
|
|
}
|
|
|
|
|
}
|