| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- 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;
- using Core.LZMes.Client.UIK.UIK05;
- namespace Core.LZMes.Client.UIF
- {
- public partial class UIF052021 : FrmBase
- {
- public UIF052021()
- {
- InitializeComponent();
- }
- #region "TooBar Event"
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery("");
- break;
- case "Exit":
- this.Close();
- break;
- }
- }
- private void DoQuery(string Condition)
- {
- try
- {
- ArrayList al = new ArrayList();
- al.Add("UIF052020.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["L_TBF03_SPEC_MILL"]);
- tab0.TableName = "L_TBF03_SPEC_MILL";
- this.dataSet1.Tables["L_TBF03_SPEC_MILL"].Merge(tab0);
- this.dataSet1.AcceptChanges();
- };
- getRectange();
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
- #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;
- //Coil Tip
- System.Windows.Forms.ToolTip Coil_Tip = new ToolTip();
- //背景颜色配色
- Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
- private void getRectange()
- {
- try
- {
- 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["L_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);
- }
- 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 <= 0.6)
- {
- lab_height = Convert.ToInt16((height / 0.6) * 26);
- }
- else if (height > 0.6 & height <= 1.4)
- {
- lab_height = Convert.ToInt16(((height - 0.6) / 0.8) * 26) + 26;
- }
- else if (height > 1.4 & height <= 2)
- {
- lab_height = Convert.ToInt16(((height - 1.4) / 0.6) * 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 "Button Event"
- private void btn_Add_Click(object sender, EventArgs e)
- {
- try
- {
- this.ugrd_RollPlan.Selected.Rows.Clear();
- string CoilNO = txt_CoilNO.Text.Trim().ToUpper();
- for (int i = 0; i < this.ugrd_RollPlan.Rows.Count; i++)
- {
- if ((Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["COIL_NO"].Value).IndexOf(CoilNO) > -1) ||
- (Common.FixDBManager.CheckNullStr(this.ugrd_RollPlan.Rows[i].Cells["C_COIL_NO"].Value).IndexOf(CoilNO) > -1))
- {
- this.ugrd_RollPlan.Selected.Rows.Add(this.ugrd_RollPlan.Rows[i]);
- }
- }
- if (ugrd_RollPlan.Selected.Rows.Count > 0)
- this.ugrd_RollPlan.Selected.Rows[0].Activated = true;
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- #endregion
- #region "Grid Event"
- private void ugrd_RollPlan_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
- {
- e.Cell.SelectAll();
- }
- private void ugrd_RollPlan_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
- {
- try
- {
- if (this.ugrd_RollPlan.ActiveRow != null)
- {
- 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 UIF052021_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(), "L_TBF03_SPEC_MILL", this.ugrd_RollPlan, "ACTIVATEONLY");
- }
- }
- catch (System.Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- }
- }
- #endregion
- private void ugrd_RollPlan_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e)
- {
- e.Cell.SelectAll();
- UIK050051 CWindow = new UIK050051();
- CWindow.ob = this.ob;
- CWindow.coilid = this.ugrd_RollPlan.ActiveRow.Cells["COIL_NO"].Text.Trim();
- // CWindow.sTime = this.ultraDateTimeEditor1.DateTime.ToString("yyyy-MM-dd");
- // CWindow.eTime = this.ultraDateTimeEditor2.DateTime.ToString("yyyy-MM-dd");
- //CWindow.thick = this.ultraGrid2.ActiveRow.Cells["COILTHICK"].Text.Trim();
- //CWindow.setthick = this.ultraGrid2.ActiveRow.Cells["COILSETTHICK"].Text.Trim();
- //CWindow.flat = this.ultraGrid2.ActiveRow.Cells["COILFLAT"].Text.Trim();
- {
- CWindow.StartPosition = FormStartPosition.CenterScreen;
- if (CWindow.ShowDialog() == DialogResult.OK)
- {
- //null;
- }
- CWindow.Dispose();
- }
- }
- }
- }
|