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.
64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using Mesnac.Action.Base;
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
using Mesnac.Action.ChemicalWeighing.Technical.PmtRecipe.entity;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.MaterialManage
|
|
{
|
|
class InsertMaterialAction : ChemicalWeighingAction, IAction
|
|
{
|
|
|
|
#region 事件定义
|
|
|
|
/// <summary>
|
|
/// 新增物料事件定义
|
|
/// </summary>
|
|
public static event EventHandler OnInsertMaterial;
|
|
|
|
#endregion
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime);
|
|
this._runtime = runtime;
|
|
this.DoWork();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增物料
|
|
/// </summary>
|
|
private void DoWork()
|
|
{
|
|
this._runtime.BaseControl.MCEnabled = false;
|
|
//创建新增用户窗体
|
|
FrmMaterial frmInsertMaterial = new FrmMaterial(0);
|
|
frmInsertMaterial.ShowDialog(this._runtime.BaseControl.MCRoot as Control);
|
|
//点击确定按钮后DialogResult属性为OK
|
|
if (frmInsertMaterial.DialogResult == DialogResult.OK)
|
|
{
|
|
//获取用户对象
|
|
Base_MaterialInfo material = frmInsertMaterial.Material;
|
|
MaterialHelper.addMaterial(material);
|
|
|
|
#region 触发事件
|
|
|
|
if (OnInsertMaterial != null)
|
|
{
|
|
OnInsertMaterial(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
frmInsertMaterial.Dispose();
|
|
this._runtime.BaseControl.MCEnabled = true;
|
|
}
|
|
}
|
|
}
|