using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; namespace Core.LZMes.Client.UIF { public partial class UIF042060 : FrmBase { public UIF042060() { InitializeComponent(); } #region "TooBar Event" public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(""); break; case "Save": this.Save(); break; case "Exit": this.Close(); break; } } private void DoQuery(string Condition) { try { ArrayList al = new ArrayList(); al.Add("UIF042060.Query_RollPlan_Mill"); this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBQuery"; ccp.MethodName = "doSimpleQuery"; ccp.ServerParams = new object[] { al }; CoreClientParam obj = this.ExecuteQuery(ccp, CoreInvokeType.Internal); if (obj.ReturnInfo.Length == 0) { System.Data.DataTable tab0 = Common.FixDBManager.ConvertToDataTable(obj.ReturnObject as System.Collections.ArrayList, this.dataSet1.Tables["C_TBF03_SPEC_MILL"]); tab0.TableName = "C_TBF03_SPEC_MILL"; this.dataSet1.Tables["C_TBF03_SPEC_MILL"].Merge(tab0); this.dataSet1.AcceptChanges(); }; getRectange(); } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void Save() { try { if (!CheckSave()) return; string ex = ""; Hashtable paramHsmp = new Hashtable(); //操作对象类型:轧辊计划 热轧卷 paramHsmp.Add("i1", this.opt_Type.Value.ToString()); paramHsmp.Add("i2", this.opt_eidt.Value.ToString()); paramHsmp.Add("i3", this.txt_BCoilNO.Text.Trim() + ";" + this.txt_ECoilNO.Text.Trim()); paramHsmp.Add("i4", this.txt_ACoilNO.Text.Trim() + ";" + Common.FixDBManager.CheckNullStr(this.optionBF.Value.ToString())); paramHsmp.Add("i5", CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName()); paramHsmp.Add("o6", ex); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIB.COM.ComDBProcedure"; ccp.MethodName = "doXmlProcedure"; ccp.ServerParams = new Object[] { "UIF042060.RollPlan_Edit", paramHsmp }; CoreClientParam obj = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); System.Collections.ArrayList err = obj.ReturnObject as System.Collections.ArrayList; if (err!=null && err.Count > 0 && Common.FixDBManager.CheckNullStr(err[0])!="1") { MessageBox.Show(err[0].ToString(), Common.FixDBManager.MsgCaption); } else { MessageBox.Show("执行成功", Common.FixDBManager.MsgCaption); DoQuery(""); } } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private bool CheckSave() { if (Common.FixDBManager.CheckNullStr(this.opt_Type.Value).Length == 0 | Common.FixDBManager.CheckNullStr(this.opt_eidt.Value).Length == 0 | this.txt_BCoilNO.Text.Trim().Length ==0 | this.txt_ECoilNO.Text.Trim().Length==0 ) { MessageBox.Show("请确认执行条件",Common.FixDBManager.MsgCaption); return false; } if (Common.FixDBManager.CheckNullStr(this.opt_eidt.Value.ToString()) == "移动") { if (this.txt_ACoilNO.Text.Trim().Length == 0 | Common.FixDBManager.CheckNullStr(this.optionBF.Value).Length == 0 ) { MessageBox.Show("请确认移动的目标和位置", Common.FixDBManager.MsgCaption); return false; } } return true; } #endregion #region "Rectange" //设定基料最大高度 private int Max_Height = 81; //基料卷展示的宽度 private int width = 9; private int locy = 10; //宽度X坐标(第一个基料卷) private int locx1 = 0; //厚度X坐标(第一个基料卷) private int locx2 = 0; //轧制单元X坐标(第一个单元) private int locx_roll = 0; //轧制单元Y坐标 private int locy_roll = 81; //轧制单元高度 private int roll_height = 22; private string tempCoilNO = ""; //Coil Tip System.Windows.Forms.ToolTip Coil_Tip = new ToolTip(); //背景颜色配色 Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance(); private void getRectange() { try { pal_Rectange.Visible = false; locx1 = locx2 = locx_roll = 0; System.Int16 wth; double thk; string coilNO; string rollNO = ""; int rollCoilCnt = 0; int totalCnt = 0; this.pal_Rectange.Controls.Clear(); Coil_Tip.RemoveAll(); foreach (DataRow row in this.dataSet1.Tables["C_TBF03_SPEC_MILL"].Rows) { wth = Convert.ToInt16(row["C_ORD_WTH"]); thk = Convert.ToDouble(row["C_ORD_THK"]); coilNO = Convert.ToString(row["COIL_NO"]); string tempRollNO = Convert.ToString(row["ROLL_MANA_NO"]); if (rollNO != "" && rollNO != tempRollNO) { getRollRectange(totalCnt, rollCoilCnt, rollNO); rollCoilCnt = 1; } else { rollCoilCnt = rollCoilCnt + 1; totalCnt = totalCnt + 1; } rollNO = tempRollNO; getWidthRectange(row); getThkRectange(row); } getRollRectange(totalCnt, rollCoilCnt, rollNO); pal_Rectange.Visible = true; } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void getRollRectange(int totalCnt,int rollCnt,string rollNO) { System.Windows.Forms.Label lab_roll = new Label(); lab_roll.AutoSize = false; lab_roll.TextAlign = ContentAlignment.MiddleCenter; lab_roll.BackColor = System.Drawing.Color.White; lab_roll.BorderStyle = BorderStyle.FixedSingle; this.pal_Rectange.Controls.Add(lab_roll); lab_roll.Location = new System.Drawing.Point(locx_roll, locy_roll); lab_roll.Name = rollNO; lab_roll.Size = new System.Drawing.Size(rollCnt * width, roll_height); lab_roll.TabIndex = 1; lab_roll.Text = rollNO; lab_roll.DoubleClick += new EventHandler(lab_roll_DoubleClick); this.locx_roll = this.locx_roll + rollCnt * width; } private void getWidthRectange(System.Data.DataRow row) { try { System.Decimal height = Common.FixDBManager.CheckNullDecimal(row["C_ORD_WTH"]); string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]); string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]); string tip_str = getTipStr(row); int lab_locy = 0; int lab_height = 0; if (height <= 900) { lab_height = Convert.ToInt16((height / 900) * 26); lab_locy = 81 - lab_height; } else if (height > 900 & height <= 1100) { lab_height = Convert.ToInt16(((height - 900) / 200) * 26) + 26; lab_locy = 81 - lab_height; } else if (height > 1100 & height <= 1400) { lab_height = Convert.ToInt16(((height - 1100) / 300) * 26) + 26 + 26; lab_locy = 81 - lab_height; } else { lab_height = 81; lab_locy = 0; } System.Windows.Forms.Label lab_width = new Label(); lab_width.AutoSize = false; lab_width.BorderStyle = BorderStyle.FixedSingle; lab_width.Text = ""; if (Status_CD == "A") { lab_width.BackColor = this.lab_plan.BackColor; } else if (Status_CD == "B") { lab_width.BackColor = this.lab_Standby.BackColor; } else if (Status_CD == "C") { lab_width.BackColor = this.lab_P.BackColor; } else if (Status_CD == "D") { lab_width.BackColor = this.lab_E.BackColor; } this.pal_Rectange.Controls.Add(lab_width); lab_width.Location = new System.Drawing.Point(locx1, lab_locy); lab_width.Name = Coil_NO; lab_width.Tag = Coil_NO; lab_width.Size = new System.Drawing.Size(width, lab_height); Coil_Tip.SetToolTip(lab_width, tip_str); this.locx1 = this.locx1 + this.width; lab_width.DoubleClick += new EventHandler(lab_width_DoubleClick); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void getThkRectange(System.Data.DataRow row) { try { int lab_locy = locy_roll + roll_height; System.Double height = Convert.ToDouble(row["C_ORD_THK"]); string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]); string Coil_NO = Common.FixDBManager.CheckNullStr(row["COIL_NO"]); string tip_str = getTipStr(row); int lab_height = 0; if (height <= 2) { lab_height = Convert.ToInt16((height / 2) * 26); } else if (height > 2 & height <= 2.8) { lab_height = Convert.ToInt16(((height - 2) / 0.8) * 26) + 26; } else if (height > 2.8 & height <= 4) { lab_height = Convert.ToInt16(((height - 2.8) / 1.2) * 26) + 26 + 26; } else { lab_height = 81; } System.Windows.Forms.Label Clab_height = new Label(); Clab_height.AutoSize = false; Clab_height.BorderStyle = BorderStyle.FixedSingle; Clab_height.Text = ""; if (Status_CD == "A") { Clab_height.BackColor = this.lab_plan.BackColor; } else if (Status_CD == "B") { Clab_height.BackColor = this.lab_Standby.BackColor; } else if (Status_CD == "C") { Clab_height.BackColor = this.lab_P.BackColor; } else if (Status_CD == "D") { Clab_height.BackColor = this.lab_E.BackColor; } this.pal_Rectange.Controls.Add(Clab_height); Clab_height.Location = new System.Drawing.Point(locx2, lab_locy); Clab_height.Name = "H" + Coil_NO; Clab_height.Tag = Coil_NO; Clab_height.Size = new System.Drawing.Size(width, lab_height); Coil_Tip.SetToolTip(Clab_height, tip_str); this.locx2 = this.locx2 + this.width; Clab_height.DoubleClick += new EventHandler(Clab_height_DoubleClick); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private string getTipStr(System.Data.DataRow row) { try { string tip_str = "热卷号:" + Common.FixDBManager.CheckNullStr(row["COIL_NO"]) + "\n"; tip_str = tip_str + "热卷内径:" + Common.FixDBManager.CheckNullStr(row["COIL_INDIA"]) + "\n"; tip_str = tip_str + "热卷外径:" + Common.FixDBManager.CheckNullStr(row["COIL_OUTDIA"]) + "\n"; tip_str = tip_str + "轧制厚度:" + Common.FixDBManager.CheckNullStr(row["C_ORD_THK"]) + "\n"; tip_str = tip_str + "轧制宽度:" + Common.FixDBManager.CheckNullStr(row["C_ORD_WTH"]) + "\n"; tip_str = tip_str + "轧制单元内顺序:" + Common.FixDBManager.CheckNullStr(row["ROLL_COIL_SEQ"]); return tip_str; } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); return ""; } } #endregion #region "Label Event" void lab_roll_DoubleClick(object sender, EventArgs e) { try { this.ugrd_RollPlan.Selected.Rows.Clear(); string RollNO = (sender as System.Windows.Forms.Label).Name; for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++) { if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["ROLL_MANA_NO"].Value) == RollNO) { this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]); } } this.ugrd_RollPlan.Selected.Rows[0].Activated = true; } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } void lab_width_DoubleClick(object sender, EventArgs e) { try { this.ugrd_RollPlan.Selected.Rows.Clear(); string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString(); for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++) { if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO) { this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]); } } this.ugrd_RollPlan.Selected.Rows[0].Activated = true; } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } void Clab_height_DoubleClick(object sender, EventArgs e) { try { this.ugrd_RollPlan.Selected.Rows.Clear(); string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString(); for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++) { if (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value) == CoilNO) { this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]); } } this.ugrd_RollPlan.Selected.Rows[0].Activated = true; } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion #region "Text Event" private void text_MouseClick(object sender, MouseEventArgs e) { System.Windows.Forms.TextBox text = (System.Windows.Forms.TextBox)sender; text.Text = this.tempCoilNO; } #endregion #region "OptionSet Event" private void opt_eidt_ValueChanged(object sender, EventArgs e) { try { if (Common.FixDBManager.CheckNullStr(this.opt_eidt.Value) == "移动") { optionBF.Enabled = true; this.txt_ACoilNO.BackColor = System.Drawing.Color.Yellow; } else { optionBF.Enabled = false; this.txt_ACoilNO.BackColor = System.Drawing.SystemColors.Control; } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion #region "Grid Event" private void ugrd_RollPlan_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e) { try { if (e.Row != null) { if (Common.FixDBManager.CheckNullStr(this.opt_Type.Value) == "轧辊") { if (Common.FixDBManager.CheckNullStr(this.opt_eidt.Value) == "分离") { this.tempCoilNO = Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_MANA_NO"].Value) + "-" + Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_COIL_SEQ"].Value).PadLeft(3,'0'); } else { this.tempCoilNO = Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_MANA_NO"].Value); } } else { this.tempCoilNO = Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_MANA_NO"].Value) + "-" + Common.FixDBManager.CheckNullStr(e.Row.Cells["ROLL_COIL_SEQ"].Value).PadLeft(3, '0'); ; } } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void ugrd_RollPlan_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e) { try { if (this.ugrd_RollPlan.ActiveRow != null) { if (e.Cell.Column.Key == "ORD_NO" | e.Cell.Column.Key == "ORD_SEQ") { Core.LZMes.Client.UIB.UIB010301 frm = new Core.LZMes.Client.UIB.UIB010301(); frm.ob = this.ob; frm.OrderNO = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_NO"].Value); frm.OrderSEQ = Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.ActiveRow.Cells["ORD_SEQ"].Value); ; frm.ShowDialog(); } } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion #region "Init" private void UIF042060_Load(object sender, EventArgs e) { try { foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ugrd_RollPlan.DisplayLayout.Bands[0].Columns) { Common.FixDBManager.SetCellActivation(col.Key.ToString(), "C_TBF03_SPEC_MILL", this.ugrd_RollPlan, "ACTIVATEONLY"); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } #endregion } }