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/BinManage/InitBinFormAction.cs

97 lines
2.7 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Mesnac.Action.Base;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mesnac.Action.ChemicalWeighing.BinManage
{
class InitBinFormAction : ChemicalWeighingAction, IAction
{
#region 事件定义
/// <summary>
/// 刷新料仓信息事件
/// </summary>
public static event EventHandler OnRefreshBin;
#endregion
private RuntimeParameter _runtime;
private DbMCControl _binGridControl = null; //料仓列表控件
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
#region 事件订阅
if (true)
{
//修改料仓信息后,触发刷新页面事件
ModifyBinAction.OnModifyBin -= Process_Event;
ModifyBinAction.OnModifyBin += Process_Event;
}
#endregion
DbMCControl binGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Pmt_Bin").FirstOrDefault(); //获取料仓控件
this._binGridControl = binGridControl;
//刷新料仓信息
this.requestBinInfo();
}
/// <summary>
/// 刷新料仓信息
/// </summary>
protected void requestBinInfo()
{
//获取料仓信息表
DataTable binTable = BinHelper.getBin();
lock (String.Empty)
{
if (this._binGridControl != null && this._binGridControl.BaseControl != null)
{
this._binGridControl.BaseControl.BindDataSource = null;
this._binGridControl.BaseControl.BindDataSource = binTable;
}
else
{
ICSharpCode.Core.LoggingService<InitBinFormAction>.Warn("刷新料仓信息失败物料数据控件为Null...");
}
}
#region 触发事件, 刷新料仓信息
if (OnRefreshBin != null)
{
OnRefreshBin(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
}
#endregion
}
#region 事件处理方法
private void Process_Event(object sender, EventArgs e)
{
if (sender is RuntimeParameter)
{
this.Run(sender as RuntimeParameter);
}
else
{
this.Run(this._runtime);
}
}
#endregion
}
}