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.
66 lines
2.7 KiB
C#
66 lines
2.7 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Action.ChemicalWeighing.LjTanNum;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjStock
|
|
{
|
|
public class UpdateAction:ChemicalWeighingAction,IAction
|
|
{
|
|
public static event EventHandler OnUpdateMaterial;
|
|
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,
|
|
"Stock").FirstOrDefault(); //获取物料数据控件
|
|
this._materialGridControl = materialGridControl;
|
|
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];
|
|
|
|
StockView actionCodeView = new StockView()
|
|
{
|
|
Id = (int)dataGridViewRow.Cells["id"].Value,
|
|
Code = dataGridViewRow.Cells["Code"].Value.ToString(),
|
|
StockName = dataGridViewRow.Cells["StockName"].Value.ToString(),
|
|
MTypeId = (int)dataGridViewRow.Cells["MTypeId"].Value,
|
|
High = Convert.ToInt64(dataGridViewRow.Cells["High"].Value),
|
|
Slow = Convert.ToInt64(dataGridViewRow.Cells["Slow"].Value),
|
|
SlowScale = Convert.ToInt64(dataGridViewRow.Cells["SlowScale"].Value),
|
|
Lead = Convert.ToInt64(dataGridViewRow.Cells["Lead"].Value),
|
|
Jog = Convert.ToInt64(dataGridViewRow.Cells["Jog"].Value)
|
|
};
|
|
|
|
FrmStock frmStock = new FrmStock(actionCodeView);
|
|
DialogResult result = frmStock.ShowDialog();
|
|
this._runtime.BaseControl.MCEnabled = false;
|
|
if (result == DialogResult.OK)
|
|
{
|
|
if (OnUpdateMaterial != null)
|
|
{
|
|
OnUpdateMaterial(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
|
|
}
|
|
|
|
frmStock.Dispose();
|
|
|
|
}
|
|
|
|
this._runtime.BaseControl.MCEnabled = true;
|
|
}
|
|
}
|
|
} |