using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using System.Collections; using Core.Mes.Client.Common; namespace Core.LgMes.Client.Comm { public partial class frmSetMaterialName : Form { public frmSetMaterialName(string szWLM, string szLX) { InitializeComponent(); this.m_szLX = szLX; this.label1.Text = "当前物料名: " + szWLM; } private DataTable m_dtMain = null; private string m_szLX = "1"; public bool bChange = false; public string m_szWLMC = ""; //物料名称 public string m_szWLBM = ""; //物料编码 public string m_szWLLX = ""; //物料类型 public OpeBase obMain; //服务端URL private void frmSetMaterialName_Load(object sender, EventArgs e) { if (this.m_szLX == "0") { this.rbFZL.Enabled = false; this.rbHJ.Checked = true; } if (this.m_szLX == "3") { rbFZL.Checked = true; rbWS.Visible = true; btReset.Visible = false; } GetDataSource(); BindingGrid(); } private void GetDataSource() { string strFl = ""; //辅料 string strHj = ""; //合金 string strWs = ""; //喂丝 string strBh = ""; //保护渣 try { ArrayList arry = new ArrayList(); string strErr = ""; //1 表示辅料、合金 if (this.m_szLX == "1") { strFl = "FL"; strHj = "HJ"; } else if (this.m_szLX == "0") // 0 表示铁合金 strHj = "HJ"; else if (m_szLX == "3") { strFl = "FL"; strHj = "HJ"; strWs = "WS"; } arry.Add("GetHndMtrInfo.Select"); arry.Add(strFl); arry.Add(strHj); arry.Add(strWs); arry.Add(strBh); CommonClientToServer ccTs = new CommonClientToServer(); ccTs.ob = obMain; //查询料斗物料配置信息 DataSet ds = ccTs.ExecuteQueryFunctions("Core.LgMes.Server.LgJobMgt.ClassCommonModule", "GetHndMtrInfo", arry, out strErr); if (strErr == "" && ds != null) { this.m_dtMain = ds.Tables[0]; } } catch (Exception ex) { string msg = ex.Message; } } private void BindingGrid() { this.ultraGrid1.DataSource = this.m_dtMain; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].Width = 0; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].Header.Caption = "物料编码"; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELFORSHORT"].Width = 130; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELFORSHORT"].Header.Caption = "物料简称"; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELFORSHORT"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELNAME"].Width = 200; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELNAME"].Header.Caption = "物料全称"; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELNAME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].Width = 0; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].Header.Caption = "物料类型"; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].Hidden = true; } private void rbFZL_Click(object sender, EventArgs e) { this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + this.rbFZL.Tag.ToString() + "'"; this.ultraGrid1.UpdateData(); } private void rbHJ_Click(object sender, EventArgs e) { if (this.m_szLX != "0") { this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + this.rbHJ.Tag.ToString() + "'"; this.ultraGrid1.UpdateData(); } } private void ultraGrid1_Click(object sender, EventArgs e) { if (this.ultraGrid1.ActiveRow != null) { this.label1.Text = "当前物料名: " + this.ultraGrid1.ActiveRow.Cells["MATERIELFORSHORT"].Value.ToString(); } } private void btOK_Click(object sender, EventArgs e) { if (this.ultraGrid1.ActiveRow != null) { this.bChange = true; if (m_szWLMC == "RESET") { m_szWLBM = ""; m_szWLMC = ""; m_szWLLX = ""; } else { m_szWLBM = this.ultraGrid1.ActiveRow.Cells["MATERIELCODE"].Value.ToString(); this.m_szWLMC = this.ultraGrid1.ActiveRow.Cells["MATERIELFORSHORT"].Value.ToString(); m_szWLLX = GetWLType(); } } this.Close(); } private void btReset_Click(object sender, EventArgs e) { this.label1.Text = "当前物料名: "; m_szWLMC = "RESET"; } private void btClose_Click(object sender, EventArgs e) { this.Close(); } private void ultraGrid1_DoubleClick(object sender, EventArgs e) { if (this.ultraGrid1.ActiveRow != null) { this.bChange = true; if (m_szWLMC == "RESET") { m_szWLBM = ""; m_szWLMC = ""; m_szWLLX = ""; } else { m_szWLBM = this.ultraGrid1.ActiveRow.Cells["MATERIELCODE"].Value.ToString(); this.m_szWLMC = this.ultraGrid1.ActiveRow.Cells["MATERIELFORSHORT"].Value.ToString(); m_szWLLX = GetWLType(); } } this.Close(); } private string GetWLType() { if (rbFZL.Checked == true) m_szWLLX = "FL"; if (rbHJ.Checked == true) m_szWLLX = "HJ"; if (rbWS.Checked == true) m_szWLLX = "WS"; return m_szWLLX; } private void rbWS_Click(object sender, EventArgs e) { this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + this.rbWS.Tag.ToString() + "'"; this.ultraGrid1.UpdateData(); } } }