| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- using System;
- using System.Collections;
- using System.Windows.Forms;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System.Drawing;
- using System.Data;
- namespace Core.StlMes.Client.LgCommon
- {
- public delegate void GetDataDelegate();
- public partial class ucResBofc : ucResBase
- {
- /// <summary>
- /// 吹氧次数按钮点击事件代理
- /// </summary>
- public GetDataDelegate GetOxygenBlastTimesHandler = null;
- /// <summary>
- /// 氧枪历史按钮点击事件代理
- /// </summary>
- public GetDataDelegate GetOxygenLanceHistoryHandler = null;
- public bool allowSave = true; //是否允许修改实绩
- public bool allowSave1 = true; //是否允许修改实绩
- public bool allowSave2 = true; //是否允许修改实绩
- public bool allowSave3 = true; //是否允许修改实绩
- public DataSet dsTept = new DataSet(); //出钢温度
- public ucResBofc()
- {
- InitializeComponent();
- try
- {
- if (ultraDataSource1.Rows.Count>0)
- ultraDataSource1.Rows[0]["OXYGENLANCEHISTORY"] = "氧枪历史";
- }
- catch { }
- }
- protected override void InitValuelist()
- {
- base.InitValuelist();
- try
- {
- ValueList vlist = ClsBusinessPack.GetValuelistBlockSlagEffect();
- ClsControlPack.SetGridValuelist(ref ultraGrid1, "BLKREDEFFECTS", ref vlist);
- ValueList vlist1 = ClsBusinessPack.GetValuelistBlockSlagMode();
- ClsControlPack.SetGridValuelist(ref ultraGrid1, "BLKREDMODE", ref vlist1);
- ValueList vlist2 = ClsBusinessPack.GetValuelistIronSourceForBOF();
- ClsControlPack.SetGridValuelist(ref ultraGrid1, "MOLIRNTYPE", ref vlist2);
- }
- catch { }
- }
- public override void ResetData()
- {
- base.ResetData();
- try
- {
- UltraGridRow row = ultraGrid1.Rows[0];
- row.Cells["OXYGENLANCEHISTORY"].Value = "氧枪枪位曲线";
- }
- catch { }
- }
- public override void SetData(Hashtable ar)
- {
- base.SetData(ar);
- try
- {
- UltraGridRow row = ultraGrid1.Rows[0];
- row.Cells["OXYGENLANCEHISTORY"].Value = "氧枪枪位曲线";
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["CHANGESTARTTIME"], row.Cells["CHANGEENDTIME"], row.Cells["CHANGETIME"]);
- //ClsBusinessPack.GetTimeSpanfromUI(row.Cells["OPENOXYGENTIME"], row.Cells["STOPOXYGENTIME"], row.Cells["SUPPLYOXYGENTIME"]);
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["TAPPINGSTARTTIME"], row.Cells["TAPPINGENDTIME"], row.Cells["TAPPINGTIME"]);
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["PSSTARTTIME"], row.Cells["PSENDTIME"], row.Cells["BRPSTIME"]);
- if (dsTept != null && dsTept.Tables[0].Rows.Count > 0)
- {
- ValueList vlist3 = ClsBusinessPack.GetValuelistTeptForBOF(dsTept);
- ClsControlPack.SetGridValuelist(ref ultraGrid1, "TERMINUSTEPT", ref vlist3);
- }
- else
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns["TERMINUSTEPT"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
- }
- }
- catch { }
- }
- private void ultraGrid1_KeyPress(object sender, KeyPressEventArgs e)
- {
- string strKey = this.ultraGrid1.ActiveCell.Column.ToString();
- if (strKey == "OGGNUMID" || strKey == "GAGE" || strKey == "SAGE" ||
- strKey == "BLOWO2TIMES" || strKey == "EMOLSTLTIME" || strKey == "IRONPOTID")
- {
- if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 6) && e.KeyChar != '\b')
- {
- e.Handled = true;
- }
- }
- if (strKey == "RSSTOVENO")
- {
- if (!(Char.IsNumber(e.KeyChar) && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length <= 8) && e.KeyChar != '\b')
- {
- e.Handled = true;
- }
- }
- if (strKey == "IRONPOTWGT" || strKey == "IRONTEMPERATURE" || strKey == "WSTEELWGT" ||
- strKey == "PIGIRONWGT" || strKey == "O2CONSUME" || strKey == "TOPN2CONSUME" ||
- strKey == "TERMINUSC" || strKey == "TERMINUSO2" || strKey == "TERMINUSTEPT" ||
- strKey == "RSWGT" )
- {
- if (!(e.KeyChar == '\b') && ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length >= 6)
- {
- e.Handled = true;
- }
- if (!(Char.IsNumber(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == '.'))
- {
- e.Handled = true;
- }
- if (e.KeyChar == '.')
- {
- char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
- if (arrary.Length == 0)
- {
- ultraGrid1.ActiveRow.Cells[strKey].Value = "0.";
- ultraGrid1.ActiveRow.Cells[strKey].SelStart = ultraGrid1.ActiveRow.Cells[strKey].Value.ToString().Length;
- e.Handled = true;
- }
- else
- {
- for (int i = 0; i < arrary.Length; i++)
- {
- if (arrary[i] == '.')
- e.Handled = true;
- }
- }
- }
- }
- if (strKey == "MEMO")
- {
- char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
- if (!(e.KeyChar == '\b') && arrary.Length >= 40)
- {
- // MessageBox.Show("生产记事不能超过40个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- e.Handled = true;
- }
- }
- if (strKey == "PROTECTDTEG")
- {
- char[] arrary = ultraGrid1.ActiveRow.Cells[strKey].Text.ToCharArray();
- if (!(e.KeyChar == '\b') && arrary.Length >= 10)
- {
- // MessageBox.Show("保护渣名称不能超过10个字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- e.Handled = true;
- }
- }
- }
- protected override void ultraGrid1_AfterCellUpdate(object sender, CellEventArgs e)
- {
- base.ultraGrid1_AfterCellUpdate(sender, e);
- try
- {
- if (!e.Cell.Column.Hidden && e.Cell.Column.CellActivation == Activation.AllowEdit)
- {
- string strKey = e.Cell.Column.Key.ToUpper();
- UltraGridRow row = e.Cell.Row;
- if (strKey.Equals("CHANGESTARTTIME") || strKey.Equals("CHANGEENDTIME"))
- {
- if ((DateTime)ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Value)
- {
- e.Cell.Appearance.BackColor = Color.Red;
- MessageBox.Show("兑铁结束时刻不能早于开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- allowSave = false;
- return;
- }
- else
- {
- if (ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["CHANGESTARTTIME"].Appearance.BackColor = Color.Orange;
- }
- if (ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["CHANGEENDTIME"].Appearance.BackColor = Color.Orange;
- }
- allowSave = true;
- }
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["CHANGESTARTTIME"], row.Cells["CHANGEENDTIME"], row.Cells["CHANGETIME"]);
- }
- else if (strKey.Equals("OPENOXYGENTIME") || strKey.Equals("STOPOXYGENTIME"))
- {
- if ((DateTime)ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Value)
- {
- e.Cell.Appearance.BackColor = Color.Red;
- MessageBox.Show("停氧时刻不能早于开氧时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- allowSave1 = false;
- return;
- }
- else
- {
- if (ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["OPENOXYGENTIME"].Appearance.BackColor = Color.Orange;
- }
- if (ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["STOPOXYGENTIME"].Appearance.BackColor = Color.Orange;
- }
- allowSave1 = true;
- }
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["OPENOXYGENTIME"], row.Cells["STOPOXYGENTIME"], row.Cells["SUPPLYOXYGENTIME"]);
- }
- else if (strKey.Equals("TAPPINGSTARTTIME") || strKey.Equals("TAPPINGENDTIME"))
- {
- if ((DateTime)ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Value)
- {
- e.Cell.Appearance.BackColor = Color.Red;
- MessageBox.Show("出钢结束时刻不能早于出钢开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- allowSave2 = false;
- return;
- }
- else
- {
- if (ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["TAPPINGSTARTTIME"].Appearance.BackColor = Color.Orange;
- }
- if (ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["TAPPINGENDTIME"].Appearance.BackColor = Color.Orange;
- }
- allowSave2 = true;
- }
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["TAPPINGSTARTTIME"], row.Cells["TAPPINGENDTIME"], row.Cells["TAPPINGTIME"]);
- }
- else if (strKey.Equals("PSSTARTTIME") || strKey.Equals("PSENDTIME"))
- {
- if ((DateTime)ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Value > (DateTime)ultraGrid1.ActiveRow.Cells["PSENDTIME"].Value)
- {
- e.Cell.Appearance.BackColor = Color.Red;
- MessageBox.Show("溅渣结束时刻不能早于溅渣开始时刻", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
- allowSave3 = false;
- return;
- }
- else
- {
- if (ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["PSSTARTTIME"].Appearance.BackColor = Color.Orange;
- }
- if (ultraGrid1.ActiveRow.Cells["PSENDTIME"].Appearance.BackColor == Color.Red)
- {
- ultraGrid1.ActiveRow.Cells["PSENDTIME"].Appearance.BackColor = Color.Orange;
- }
- allowSave3 = true;
- }
- ClsBusinessPack.GetTimeSpanfromUI(row.Cells["PSSTARTTIME"], row.Cells["PSENDTIME"], row.Cells["BRPSTIME"]);
- }
- }
- }
- catch { }
- }
- protected override void ultraGrid1_ClickCellButton(object sender, CellEventArgs e)
- {
- base.ultraGrid1_ClickCellButton(sender, e);
- try
- {
- string strKey = e.Cell.Column.Key.ToUpper();
- if (e.Cell.Column.DataType != typeof(DateTime))
- {
- if (strKey.Equals("RSSTOVENO"))
- {
- frmHeatNoEditor frm = new frmHeatNoEditor();
- frm.InputText = Convert.ToString(e.Cell.Text);
- frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- e.Cell.Value = frm.InputText;
- ultraGrid1.UpdateData();
- }
- }
- else if (strKey.Equals("BLOWO2TIMES"))
- {
- if (GetOxygenBlastTimesHandler != null)
- this.Invoke(GetOxygenBlastTimesHandler);
- }
- else if (strKey.Equals("OXYGENLANCEHISTORY"))
- {
- if (GetOxygenLanceHistoryHandler != null)
- this.Invoke(GetOxygenLanceHistoryHandler);
- }
- else
- {
- frmInputDecimal frm = new frmInputDecimal(Convert.ToString(e.Cell.Text));
- frm.Location = ClsControlPack.GetChildWindowLocation(frm.Size);
- if (frm.ShowDialog() == DialogResult.OK)
- {
- if (!frm.ValueChanged) return;
- e.Cell.Value = frm.Value;
- ultraGrid1.UpdateData();
- }
- }
- }
- }
- catch { }
- }
- private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
- {
- }
- }
- }
|