| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.LgClassModel;
- using CoreFS.CA06;
- using Infragistics.Win;
- namespace Core.StlMes.Client.LgCommon
- {
- public partial class frmSetHopper : frmStyleBase
- {
- private OpeBase ob = null;
- public frmSetHopper(string szDeviceName, OpeBase ob)
- {
- InitializeComponent();
- this.ob = ob;
- this.devicePos = szDeviceName;
- ClsControlPack.SetUltraGridAppearance(this);
- ulgridMtrInfo.DisplayLayout.Override.RowSelectors = DefaultableBoolean.False;
- }
- #region " Member Variable"
- private List<CostBaseMetalTypeEntity> CostBaseMetalTypeEntityList;
- private DataTable m_dtMain = null;
- //private DataTable m_dtStationconMaterial = null;
- private DataTable _dtHopper;
- private string devicePos = ""; //CVT01
- private string _curMaterType = ""; //FL
- private PictureBox _curPicBx = null;
- private Label _curLbl = null;
- #endregion
- //选择料斗
- private void PicClickHandler(object sender, System.EventArgs e)
- {
- SetPicNoSelectState();
- _curPicBx = (PictureBox) sender;
- _curPicBx.BorderStyle = BorderStyle.Fixed3D;
- SetLabelColor();
- }
- private void SetPicNoSelectState()
- {
- _curPicBx = null;
- _curLbl = null;
- foreach (Control ctl in panel2.Controls)
- {
- if (ctl is PictureBox)
- ((PictureBox) ctl).BorderStyle = BorderStyle.None;
- }
- foreach (Control ctl in panel2.Controls)
- {
- if (ctl is Label)
- ((Label) ctl).ForeColor = Color.Black;
- }
- foreach (Control ctl in panel3.Controls)
- {
- if (ctl is PictureBox)
- ((PictureBox) ctl).BorderStyle = BorderStyle.None;
- }
- foreach (Control ctl in panel3.Controls)
- {
- if (ctl is Label)
- ((Label) ctl).ForeColor = Color.Black;
- }
- }
- private void SetLabelColor()
- {
- try
- {
- if (_curPicBx == null)
- {
- return;
- }
- string lbName;
- if (Convert.ToInt32(_curPicBx.Name.Substring(10, _curPicBx.Name.Length - 10)) < 31)
- {
- lbName = "label" + _curPicBx.Tag.ToString();
- foreach (Control c in this.panel2.Controls)
- {
- if (c.Name == lbName)
- {
- ((Label) c).ForeColor = Color.Red;
- return;
- }
- }
- }
- else
- {
- lbName = "label" + _curPicBx.Tag.ToString();
- foreach (Control c in this.panel3.Controls)
- {
- if (c.Name == lbName)
- {
- ((Label) c).ForeColor = Color.Red;
- return;
- }
- }
- }
- }
- catch
- {
- }
- }
- private void frmSetHopper_Load(object sender, EventArgs e)
- {
- switch (this.devicePos.Substring(0, 3))
- {
- case "BOF": // 转炉
- this.ultraGroupBox2.Visible = false;
- this.rbWS.Visible = false;
- this.rbFZL.Text = "辅助料";
- this.rbHJ.Text = "合金";
- this.ultraGroupBox1.Dock = DockStyle.Fill;
- break;
- case "EAF": // 转炉
- this.ultraGroupBox2.Visible = false;
- this.rbWS.Visible = false;
- this.rbFZL.Text = "辅助料";
- this.rbHJ.Text = "合金";
- this.rbHJ.Visible = false;
- this.ultraGroupBox1.Dock = DockStyle.Fill;
- break;
- case "CAS": // 钢包站
- this.rbFZL.Visible = true;
- this.rbHJ.Text = "合金微调";
- break;
- case "LF0": // 精炼炉
- this.rbFZL.Visible = true;
- this.rbHJ.Text = "合金微调";
- break;
- case "RH0": // RH炉
- case "VD0": // RH炉
- this.rbFZL.Visible = true;
- this.rbHJ.Text = "合金微调";
- break;
- case "THJ": // 转炉合金
- this.ultraGroupBox2.Visible = false;
- this.rbWS.Visible = false; // 喂丝料按钮
- this.rbFZL.Enabled = false; // 辅助料
- this.ultraGroupBox1.Dock = DockStyle.Fill;
- break;
- default:
- break;
- }
- this.comboBox1.SelectedIndex = 6;
- this.ClearLableText();
- GetDataSource();
- //GetStationconMaterialData(this.devicePos.Substring(0, 3));
- // BindingGrid(m_dtMain);
- if (rbFZL.Visible)
- {
- rbFZL.Checked = true;
- radioButton_Click(rbFZL, null);
- }
- else if (rbHJ.Visible)
- {
- rbHJ.Checked = true;
- radioButton_Click(rbHJ, null);
- }
- else if (rbWS.Visible)
- {
- rbWS.Checked = true;
- radioButton_Click(rbWS, null);
- }
- //chkdevNo.Checked = true;
- }
- #region " InitDataSoutce"
- private void GetDataSource()
- {
- ClsControlPack.SetReadOnly(ulgridMtrInfo);
- EntityHelper.ShowGridCaption<CostBaseMetalTypeEntity>(ulgridMtrInfo.DisplayLayout.Bands[0]);
- string strMsg = "";
- bool bSuccess = false;
- CostBaseMetalTypeEntityList = EntityHelper.GetData<CostBaseMetalTypeEntity>(
- "Core.LgMes.Server.LgDeviceManager.StlAdditive.GetMaterialData", null, ob);
- costBaseMetalTypeEntityBindingSource.DataSource = CostBaseMetalTypeEntityList;
- ClsControlPack.RefreshAndAutoSize(ulgridMtrInfo);
- //DataSet ds = ClsDataAccessPack.GetMaterialData(out bSuccess, out strMsg, ob);
- //if (bSuccess && ds != null && ds.Tables.Count > 0)
- //{
- // this.m_dtMain = ds.Tables[0];
- //}
- }
- #endregion
- private void ClearLableText()
- {
- this.lblG1.Text = "";
- this.lblG2.Text = "";
- this.lblG3.Text = "";
- this.lblG4.Text = "";
- this.lblG5.Text = "";
- this.lblG6.Text = "";
- this.lblG7.Text = "";
- this.lblG8.Text = "";
- this.lblG9.Text = "";
- this.lblG10.Text = "";
- this.lblG11.Text = "";
- this.lblG12.Text = "";
- this.lblG13.Text = "";
- this.lblG14.Text = "";
- this.lblG15.Text = "";
- this.lblG16.Text = "";
- this.lblG17.Text = "";
- this.lblG18.Text = "";
- this.lblG19.Text = "";
- this.lblG20.Text = "";
- this.lblG21.Text = "";
- this.lblG22.Text = "";
- this.lblG23.Text = "";
- this.lblG24.Text = "";
- this.lblW1.Text = "";
- this.lblW2.Text = "";
- this.lblW3.Text = "";
- this.lblW4.Text = "";
- this.lblW5.Text = "";
- this.lblW6.Text = "";
- this.lblW7.Text = "";
- this.lblW8.Text = "";
- }
- private void GetCurrLabel()
- {
- try
- {
- if (_curPicBx == null)
- {
- this._curLbl = null;
- return;
- }
- string lbName;
- if (Convert.ToInt32(_curPicBx.Name.Substring(10, _curPicBx.Name.Length - 10)) < 31)
- {
- lbName = "lblG" + _curPicBx.Tag.ToString();
- foreach (Control c in this.panel2.Controls)
- {
- if (c.Name == lbName)
- {
- this._curLbl = (Label) c;
- return;
- }
- }
- }
- else
- {
- lbName = "lblW" + _curPicBx.Tag.ToString();
- foreach (Control c in this.panel3.Controls)
- {
- if (c.Name == lbName)
- {
- this._curLbl = (Label) c;
- return;
- }
- }
- }
- }
- catch
- {
- this._curLbl = null;
- }
- }
- private void btClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 添料
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btAdd_Click(object sender, EventArgs e)
- {
- string szWLLX = "";
- Infragistics.Win.UltraWinGrid.UltraGridRow urg = this.ulgridMtrInfo.ActiveRow;
- if (urg == null)
- {
- MessageBox.Show("请选择物料!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- if (_curPicBx == null)
- {
- MessageBox.Show("请选择料斗!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- GetCurrLabel();
- if (_curLbl.Tag != null)
- szWLLX = _curLbl.Tag.ToString();
- var CostBaseMetalTypeEntity = urg.ListObject as CostBaseMetalTypeEntity;
- if (CostBaseMetalTypeEntity==null ) return;
- string MATERIELTYPE = "";
- //switch (CostBaseMetalTypeEntity.ArcCode)
- //{
- // case "HJ":
- // MATERIELTYPE = "HJ";
- // break;
- // case "FL":
- // MATERIELTYPE = "FL";
- // break;
- //}
- try
- {
- ServerHelper.SetData("Core.LgMes.Server.LgDeviceManager.StlAdditive.InsertStlMaterialConfig",
- new object[]
- {
- new object[]
- {
- _curPicBx.Tag.ToString(),
- this.devicePos,
- rbFZL.Checked?rbFZL.Tag.ToString():rbHJ.Checked?rbHJ.Tag.ToString():rbWS.Tag.ToString(),
- CostBaseMetalTypeEntity.ItemCode,
- comboBox1.SelectedItem.ToString(),
- "1"
- }
- }, ob);
- this._curLbl.Text = CostBaseMetalTypeEntity.ItemName;
- _curLbl.Tag = CostBaseMetalTypeEntity.ArcCode;
- }
- catch (Exception ex)
- {
- if (ex is MESException)
- {
- }
- else
- MessageBox.Show("添料失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- private void btReset_Click(object sender, EventArgs e)
- {
- if (this._curPicBx == null)
- {
- MessageBox.Show("请选择料斗!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- GetCurrLabel();
- if (this._curLbl.Text.Equals(string.Empty))
- return;
- DialogResult dia = MessageBox.Show("是否确认重置当前选中的料斗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
- if (dia == DialogResult.No) return;
- try
- {
- ServerHelper.SetData("Core.LgMes.Server.LgDeviceManager.StlAdditive.DeleteStlMaterialConfig",
- new object[]
- {
- new object[]
- {
- _curPicBx.Tag.ToString(),
- this.devicePos,
- rbFZL.Checked?rbFZL.Tag.ToString():rbHJ.Checked?rbHJ.Tag.ToString():rbWS.Tag.ToString()
- }
- }, ob);
- this._curLbl.Text = "";
- _curLbl.Tag = "";
- }
- catch (Exception ex)
- {
- if (ex is MESException)
- {
- }
- else
- MessageBox.Show("重置失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- this._curLbl.Text = "";
- }
- private void SetPicText(bool IsJS, string hopperNo, string str, string szWLLX)
- {
- if (!IsJS)
- {
- switch (hopperNo)
- {
- case "1":
- this.lblG1.Text = str;
- this.lblG1.Tag = szWLLX;
- break;
- case "2":
- this.lblG2.Text = str;
- this.lblG2.Tag = szWLLX;
- break;
- case "3":
- this.lblG3.Text = str;
- this.lblG3.Tag = szWLLX;
- break;
- case "4":
- this.lblG4.Text = str;
- this.lblG4.Tag = szWLLX;
- break;
- case "5":
- this.lblG5.Text = str;
- this.lblG5.Tag = szWLLX;
- break;
- case "6":
- this.lblG6.Text = str;
- this.lblG6.Tag = szWLLX;
- break;
- case "7":
- this.lblG7.Text = str;
- this.lblG7.Tag = szWLLX;
- break;
- case "8":
- this.lblG8.Text = str;
- this.lblG8.Tag = szWLLX;
- break;
- case "9":
- this.lblG9.Text = str;
- this.lblG9.Tag = szWLLX;
- break;
- case "10":
- this.lblG10.Text = str;
- this.lblG10.Tag = szWLLX;
- break;
- case "11":
- this.lblG11.Text = str;
- this.lblG11.Tag = szWLLX;
- break;
- case "12":
- this.lblG12.Text = str;
- this.lblG12.Tag = szWLLX;
- break;
- case "13":
- this.lblG13.Text = str;
- this.lblG13.Tag = szWLLX;
- break;
- case "14":
- this.lblG14.Text = str;
- this.lblG14.Tag = szWLLX;
- break;
- case "15":
- this.lblG15.Text = str;
- this.lblG15.Tag = szWLLX;
- break;
- case "16":
- this.lblG16.Text = str;
- this.lblG16.Tag = szWLLX;
- break;
- case "17":
- this.lblG17.Text = str;
- this.lblG17.Tag = szWLLX;
- break;
- case "18":
- this.lblG18.Text = str;
- this.lblG18.Tag = szWLLX;
- break;
- case "19":
- this.lblG19.Text = str;
- this.lblG19.Tag = szWLLX;
- break;
- case "20":
- this.lblG20.Text = str;
- this.lblG20.Tag = szWLLX;
- break;
- case "21":
- this.lblG21.Text = str;
- this.lblG21.Tag = szWLLX;
- break;
- case "22":
- this.lblG22.Text = str;
- this.lblG22.Tag = szWLLX;
- break;
- case "23":
- this.lblG23.Text = str;
- this.lblG23.Tag = szWLLX;
- break;
- case "24":
- this.lblG24.Text = str;
- this.lblG24.Tag = szWLLX;
- break;
- default:
- break;
- }
- }
- else
- {
- if (hopperNo == "1")
- {
- this.lblW1.Text = str;
- this.lblW1.Tag = szWLLX;
- }
- if (hopperNo == "2")
- {
- this.lblW2.Text = str;
- this.lblW2.Tag = szWLLX;
- }
- if (hopperNo == "3")
- {
- this.lblW3.Text = str;
- this.lblW3.Tag = szWLLX;
- }
- if (hopperNo == "4")
- {
- this.lblW4.Text = str;
- this.lblW4.Tag = szWLLX;
- }
- if (hopperNo == "5")
- {
- this.lblW5.Text = str;
- this.lblW5.Tag = szWLLX;
- }
- if (hopperNo == "6")
- {
- this.lblW6.Text = str;
- this.lblW6.Tag = szWLLX;
- }
- if (hopperNo == "7")
- {
- this.lblW7.Text = str;
- this.lblW7.Tag = szWLLX;
- }
- if (hopperNo == "8")
- {
- this.lblW8.Text = str;
- this.lblW8.Tag = szWLLX;
- }
- }
- }
- private void GetDataForHopper()
- {
- string SqlID = "";
- ArrayList Args = new ArrayList();
- SqlID = "StlMaterialConfig.Select";
- Args.Add(devicePos);
- Args.Add(_curMaterType);
-
- bool bSuccess = false;
- string strMsg = "";
- DataSet ds = ClsDataAccessPack.GetData(SqlID, Args, out bSuccess, out strMsg, ob);
- if (bSuccess && ds != null && ds.Tables.Count > 0)
- {
- _dtHopper = ds.Tables[0];
- DataRow[] drs = null;
- bool bFlag = false;
- for (int i = 0; i < _dtHopper.Rows.Count; i++)
- {
- try
- {
- DataRow dr = _dtHopper.Rows[i];
- string id = dr["MSNUMID"].ToString();
- drs = _dtHopper.Select(" MSNUMID = '" + id + "'"); //and MATERIELTYPE='" + _curMaterType + "'"
- if (drs.Length > 0)
- {
- for (int j = 0; j < drs.Length; j++)
- {
- if (drs[j]["MATERIELCODE"].ToString() != "")
- {
- SetPicText((_curMaterType == "WS"), drs[j]["MSNUMID"].ToString(), drs[j]["ITEM_NAME"].ToString(), drs[j]["MATERIELTYPE"].ToString());
- bFlag = true;
- break;
- }
- }
- }
- if (false == bFlag)
- SetPicText((_curMaterType == "WS"), dr["MSNUMID"].ToString(), dr["ITEM_NAME"].ToString(), dr["MATERIELTYPE"].ToString());
- if (bFlag)
- bFlag = false;
- }
- catch { }
- }
- }
- }
- //显示料斗配置信息
- private void radioButton_Click(object sender, System.EventArgs e)
- {
- try
- {
- this.btAdd.Enabled = true;
- if (_curMaterType != ((RadioButton)sender).Tag.ToString())
- _curMaterType = ((RadioButton)sender).Tag.ToString();
- else
- return;
- if (_curMaterType != "WS")
- {
- panel2.Enabled = true;
- panel3.Enabled = false;
- }
- else // 物料类型为喂丝
- {
- panel2.Enabled = false;
- panel3.Enabled = true;
- }
- ClearLableText();
- SetPicNoSelectState();
- GetDataForHopper();
- //costBaseMetalTypeEntityBindingSource.DataSource =
- // CostBaseMetalTypeEntityList.Where(p => p.ArcCode == _curMaterType).ToList();
- ulgridMtrInfo.DataBind();
- //if (chkdevNo.Checked)
- //{
- // this.m_dtStationconMaterial.DefaultView.RowFilter = "MATERIELTYPE='" + _curMaterType + "'";
- // ulgridMtrInfo.DataSource = this.m_dtStationconMaterial;
- //}
- //else
- //{
- // this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + _curMaterType + "'";
- // ulgridMtrInfo.DataSource = this.m_dtMain;
- //}
- this.ulgridMtrInfo.UpdateData();
- }
- catch { }
- finally
- {
- ClsControlPack.RefreshAndAutoSize(ulgridMtrInfo);
- }
- }
- private void chkdevNo_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- //if (chkdevNo.Checked)
- //{
- // this.m_dtStationconMaterial.DefaultView.RowFilter = "MATERIELTYPE='" + _curMaterType + "'";
- // ulgridMtrInfo.DataSource = this.m_dtStationconMaterial;
- //}
- //else
- //{
- // this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + _curMaterType + "'";
- // ulgridMtrInfo.DataSource = this.m_dtMain;
- //}
- //this.ulgridMtrInfo.UpdateData();
- }
- catch { }
- finally
- {
- ClsControlPack.RefreshAndAutoSize(ulgridMtrInfo);
- }
- }
- }
- }
|