| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- 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.LgJobMgt
- {
- 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();
- }
- }
- }
|