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.
62 lines
2.0 KiB
C#
62 lines
2.0 KiB
C#
using Mesnac.Action.Base;
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjRecipeData
|
|
{
|
|
public class UpdateAction: ChemicalWeighingAction, IAction
|
|
{
|
|
public static event EventHandler OnUpdate;
|
|
|
|
private DbMCControl _materialGridControl = null; //物料列表控件
|
|
private RuntimeParameter _runtime;
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime); //必须调用
|
|
this._runtime = runtime;
|
|
|
|
DbMCControl materialGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local,
|
|
"Lj_Formula").FirstOrDefault(); //获取物料数据控件
|
|
this._materialGridControl = materialGridControl;
|
|
FileControl();
|
|
}
|
|
|
|
private void FileControl()
|
|
{
|
|
|
|
DataGridView clientGridView = this._materialGridControl.BaseControl as DataGridView;
|
|
|
|
//验证是否选中某物料
|
|
if (clientGridView.SelectedRows.Count != 1)
|
|
{
|
|
|
|
MessageBox.Show("请选择要修改的数据", Mesnac.Basic.LanguageHelper.Caption,
|
|
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
this._runtime.IsReturn = true;
|
|
return;
|
|
}
|
|
|
|
var dataGridViewRow = clientGridView.SelectedRows[0];
|
|
var id = Convert.ToInt32(dataGridViewRow.Cells["Id"].Value);
|
|
|
|
|
|
FrmWeiRecipeDataAdd frm = new FrmWeiRecipeDataAdd(id);
|
|
DialogResult result = frm.ShowDialog();
|
|
this._runtime.BaseControl.MCEnabled = false;
|
|
if (result == DialogResult.OK)
|
|
{
|
|
if (OnUpdate != null)
|
|
{
|
|
OnUpdate(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
|
|
}
|
|
|
|
frm.Dispose();
|
|
|
|
}
|
|
|
|
this._runtime.BaseControl.MCEnabled = true;
|
|
}
|
|
}
|
|
} |