using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using CoreFS.CA06; using PrintSolution; //using Excel=Microsoft.Office.Interop.Excel; //using Microsoft.Office.Interop.Excel; using System.Reflection; using Excel1 = Microsoft.Office.Interop.Excel; //using Excel; namespace Core.LZMes.Client.UIM.UIM02 { public partial class UIM020070 : FrmBase { private int coil_no_index = -1;//冷轧卷在轧制计划的下标位置 public UIM020070() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Export": // this.DataTabletoExcelkk(this.dataSet1.Tables[0]); this.DoExport1(); break; case "Print": this.DoPrint(); break; case "Exit": this.Close(); break; } } private void UIM020040_Load(object sender, EventArgs e) { } private void DoExport1() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fileName = this.saveFileDialog1.FileName; ultraGridExcelExporter1.Export(ultraGrid1, fileName); System.Diagnostics.Process.Start(fileName); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } /// /// 查询重卷计划 /// private void DoQuery() { bool flag = false; //string trnfGroup = this.ultraComboEditor3.Text.Trim(); //string trnfShift = this.ultraComboEditor2.Text.Trim(); string trnfShift = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//班次 string trnfGroup = -1 == this.ultraComboEditor3.SelectedIndex ? "" : this.ultraComboEditor3.Value.ToString();//班组 string pFromDate = null == this.ultraDateTimeEditor1.Value ? "" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"); string pToDate = null == this.ultraDateTimeEditor2.Value ? "" : this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"); string mFromDate = null == this.ultraDateTimeEditor3.Value ? "" : this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd"); string mToDate = null == this.ultraDateTimeEditor4.Value ? "" : this.ultraDateTimeEditor4.DateTime.ToString("yyyyMMdd"); string ordNo = textBox3.Text.Trim(); string ordSeq = textBox1.Text.Trim(); string coilNo = textBox2.Text.Trim(); if ("".Equals(ordNo) && coilNo.Equals("")) { if ("".Equals(mFromDate) || "".Equals(mToDate) || (ultraDateTimeEditor4.DateTime - ultraDateTimeEditor3.DateTime).Days > 30) { if ("".Equals(pFromDate) || "".Equals(pToDate) || (ultraDateTimeEditor2.DateTime - ultraDateTimeEditor1.DateTime).Days > 30) { MessageBox.Show("请选择合适的查询条件后再进行查询操作,否则导致数据量过大!"); return; } } } this.dataSet1.Tables[0].Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM02.UIM020070"; ccp.MethodName = "queryReelPlan"; ccp.ServerParams = new Object[] { pFromDate, pToDate, mFromDate, mToDate, ordNo, ordSeq, coilNo, trnfShift, trnfGroup}; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); coil_no_index = -1; DataRowCollection drs = dataSet1.Tables[0].Rows; for (int i = 0; i < drs.Count; i++) { Color color = Color.FromArgb(255, 255, 255); string status = drs[i]["STATUS_CD"].ToString().Trim(); double coilWth = double.Parse(drs[i]["C_COIL_WTH"].ToString().Trim()); double ordWth = double.Parse(drs[i]["C_COIL_THK"].ToString().Trim()); string ingDecGrd = drs[i]["INGR_DEC_GRD"].ToString().Trim(); if ("轧制吊销".Equals(status)) { color = Color.FromArgb(255, 128, 128); } else if ("轧制进行".Equals(status)) { color = Color.FromArgb(0, 192, 0); if (coilWth < ordWth) { color = Color.SandyBrown; } } else if ("轧制完成".Equals(status)) { color = Color.FromArgb(192, 255, 192); } else if ("上料完成".Equals(status)) { color = Color.FromArgb(192, 192, 255); } else if ("轧废".Equals(status)) { color = Color.FromArgb(192, 192, 192); } else { if (!"合格".Equals(ingDecGrd)) { color = Color.FromArgb(255, 204, 0); } else if (coilWth < ordWth) { color = Color.SandyBrown; } } ultraGrid1.Rows[i].Appearance.BackColor = color; } try { getRectange(); }catch(Exception EX) { MessageBox.Show(EX.ToString()); } } #region "Rectange" //基料卷展示的宽度 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.panel5.Controls.Clear(); Coil_Tip.RemoveAll(); foreach (DataRow row in this.dataSet1.Tables[0].Rows) { wth = Convert.ToInt16(row["C_COIL_WTH"]); thk = Convert.ToDouble(row["C_COIL_THK"]); //coilNO = Convert.ToString(row["C_COIL_NO"]); //string tempRollNO = Convert.ToString(row["ROLL_MANA_NO"]); //if (rollNO != null) //&& 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.panel5.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_COIL_WTH"]); string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]); string Coil_NO = Common.FixDBManager.CheckNullStr(row["C_COIL_NO"]); string tip_str = getTipStr(row); int lab_locy = 0; int lab_height = 0; if (height <= 800) { lab_height = Convert.ToInt16((height / 800) * 26); lab_locy = 90 - lab_height; } else if (height > 800 & height <= 1100) { lab_height = Convert.ToInt16(((height - 800) / 300) * 26) + 26; lab_locy = 90 - lab_height; } else if (height > 1100 & height <= 1400) { lab_height = Convert.ToInt16(((height - 1100) / 300) * 26) + 26 + 26; lab_locy = 90 - lab_height; } else { lab_height = 90; 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 == "轧制作业待机") { lab_width.BackColor = this.label14.BackColor; } else if (Status_CD == "轧制吊销") { lab_width.BackColor = this.label7.BackColor; } else if (Status_CD == "上料完成") { lab_width.BackColor = this.label16.BackColor; } else if (Status_CD == "轧制进行") { lab_width.BackColor = this.label11.BackColor; } else if (Status_CD == "轧制完成") { lab_width.BackColor = this.label9.BackColor; } else if (Status_CD == "轧废") { lab_width.BackColor = this.label17.BackColor; } this.panel5.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_COIL_THK"]); string Status_CD = Common.FixDBManager.CheckNullStr(row["STATUS_CD"]); string Coil_NO = Common.FixDBManager.CheckNullStr(row["C_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.2) { lab_height = Convert.ToInt16(((height - 0.6) / 0.8) * 26) + 26; } else if (height > 1.2 & height <= 1.8) { lab_height = Convert.ToInt16(((height - 1.2) / 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 == "轧制作业待机") { Clab_height.BackColor = this.label14.BackColor; } else if (Status_CD == "轧制吊销") { Clab_height.BackColor = this.label7.BackColor; } else if (Status_CD == "上料完成") { Clab_height.BackColor = this.label16.BackColor; } else if (Status_CD == "轧制进行") { Clab_height.BackColor = this.label11.BackColor; } else if (Status_CD == "轧制完成") { Clab_height.BackColor = this.label9.BackColor; } else if (Status_CD == "轧废") { Clab_height.BackColor = this.label17.BackColor; } this.panel5.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["C_COIL_NO"]) + "\n"; tip_str = tip_str + "原料内径:" + Common.FixDBManager.CheckNullStr(row["C_COIL_INDIA"]) + "\n"; tip_str = tip_str + "原料外径:" + Common.FixDBManager.CheckNullStr(row["C_OUTDIA"]) + "\n"; tip_str = tip_str + "原料厚度:" + Common.FixDBManager.CheckNullStr(row["C_COIL_THK"]) + "\n"; tip_str = tip_str + "原料宽度:" + Common.FixDBManager.CheckNullStr(row["C_COIL_WTH"]); 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.ultraGrid1.Selected.Rows.Clear(); // string RollNO = (sender as System.Windows.Forms.Label).Name; // for (int i = 0; i < this.ultraGrid1.Rows.Count; i++) // { // if (Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[i].Cells["ROLL_MANA_NO"].Value) == RollNO) // { // this.ultraGrid1.Selected.Rows.Add(this.ultraGrid1.Rows[i]); // } // } // this.ultraGrid1.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.ultraGrid1.Selected.Rows.Clear(); string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString();//L5-053562-10A0000 //string CoilNO = "L5-053562-10A0000"; for (int i = 0; i < this.ultraGrid1.Rows.Count; i++) { if (Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[i].Cells["C_COIL_NO"].Value) == CoilNO) { //string a = "12"; this.ultraGrid1.Selected.Rows.Add(this.ultraGrid1.Rows[i]); } } this.ultraGrid1.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.ultraGrid1.Selected.Rows.Clear(); string CoilNO = (sender as System.Windows.Forms.Label).Tag.ToString(); for (int i = 0; i < this.ultraGrid1.Rows.Count; i++) { if (Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[i].Cells["C_COIL_NO"].Value) == CoilNO) { this.ultraGrid1.Selected.Rows.Add(this.ultraGrid1.Rows[i]); } } this.ultraGrid1.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.ultraGrid1.Selected.Rows.Clear(); // // string CoilNO = txt_CoilNO.Text.Trim().ToUpper(); // for (int i = 0; i < this.ultraGrid1.Rows.Count; i++) // { // if ((Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[i].Cells["C_COIL_NO"].Value).IndexOf(CoilNO) > -1) || // (Common.FixDBManager.CheckNullStr(this.ultraGrid1.Rows[i].Cells["R_COIL_NO"].Value).IndexOf(CoilNO) > -1)) // { // this.ultraGrid1.Selected.Rows.Add(this.ultraGrid1.Rows[i]); // } // } // if (ultraGrid1.Selected.Rows.Count > 0) // this.ultraGrid1.Selected.Rows[0].Activated = true; // } // catch (System.Exception ex) // { // System.Diagnostics.Debug.WriteLine(ex.ToString()); // } //} #endregion private void DoExport() { try { if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { string fileName = this.saveFileDialog1.FileName; this.ultraGrid1.DisplayLayout.Bands[0].Columns["STATUS_CD"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["C_EXTSHAPE_REQ"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ACID_PROD_PATH"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["BZ"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORDCUST_CD"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["INGR_DEC_GRD"].Hidden = true; this.ultraGrid1.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.None; ultraGridExcelExporter1.Export(ultraGrid1, fileName); System.Diagnostics.Process.Start(fileName); this.ultraGrid1.BeginUpdate(); this.ultraGrid1.DisplayLayout.Bands[0].Columns["STATUS_CD"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["C_EXTSHAPE_REQ"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ACID_PROD_PATH"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["BZ"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["ORDCUST_CD"].Hidden = true; this.ultraGrid1.DisplayLayout.Bands[0].Columns["INGR_DEC_GRD"].Hidden = true; this.ultraGrid1.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn; this.ultraGrid1.EndUpdate(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private string NumTochr(int Num) { int n = 64 + Num; return "" + (Char)n; } private string NumToExeclRowStr(int Num) { int X, Y; if (Num < 27) { return NumTochr(Num); } X = Num / 26; Y = Num - X * 26; return NumTochr(X) + NumTochr(Y); } /// /// 将DataTable中的列名及数据导出到Excel表中 /// /// 要导出的DataTable /// Excel的保存路径及名称 public void DataTabletoExcelkk(System.Data.DataTable tmpDataTable) { string fileName = saveFileDialog1.FileName; string FileName; saveFileDialog1.FileName = "重卷计划查询报表"; saveFileDialog1.DefaultExt = ".xls"; saveFileDialog1.Filter = "excel文件(*.xls)|*.xls|所有文件(*.*)|*.*"; if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK) { fileName = saveFileDialog1.FileName; FileName = fileName; } string FilePath = saveFileDialog1.FileName; if (tmpDataTable == null) return; int rowNum = tmpDataTable.Rows.Count; int columnNum = tmpDataTable.Columns.Count; int rowIndex = 1; int columnIndex = 0; Excel1.Application xlApp = new Excel1.ApplicationClass(); //Microsoft.Office.Interop.Excel.Application xlApp; //xlApp = new Microsoft.Office.Interop.Excel.Application(); xlApp.DefaultFilePath = ""; xlApp.DisplayAlerts = false; xlApp.SheetsInNewWorkbook = 1; Excel1._Workbook xlBook = (Excel1._Workbook)(xlApp.Workbooks.Add(Missing.Value));//添加新工作簿 Excel1.Worksheet ws = (Excel1.Worksheet)xlBook.Worksheets[1]; int colnum = tmpDataTable.Columns.Count; Excel1.Range r = ws.get_Range("A1", NumToExeclRowStr(colnum) + "1"); object[] objHeader = new object[colnum]; //将DataTable的列名导入Excel表第一行 foreach (DataColumn dc in tmpDataTable.Columns) { objHeader[columnIndex] = dc.Caption; columnIndex++; } r.Value2 = objHeader; //将DataTable中的数据导入Excel中 for (int i = 0; i < rowNum; i++) { rowIndex++; columnIndex = 0; for (int j = 0; j < columnNum; j++) { objHeader[columnIndex] = tmpDataTable.Rows[i][j].ToString(); columnIndex++; } r = ws.get_Range("A" + (i + 2), NumToExeclRowStr(colnum) + (i + 2)); r.Value2 = objHeader; } //将合同号的数据转换为excel中的数字格式,否则为科学计数法格式 Excel1.Range RMXNEW; string Inf0 = ""; Inf0 = "AD1:" + "AD2"; RMXNEW = ws.get_Range(Inf0, Type.Missing); RMXNEW.EntireColumn.HorizontalAlignment = Excel1.XlHAlign.xlHAlignCenter;  RMXNEW.EntireColumn.NumberFormat = "0"; //填充要合并的数值到两个List ArrayList al = new ArrayList(); ArrayList al1 = new ArrayList(); foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows) { string yaoqiuType = row.Cells["JISHUYAOQIU"].Text; al.Add(yaoqiuType); string beizhuType = row.Cells["ORD_RMK"].Text; al1.Add(beizhuType); } //合并特殊要求 if (al.Count > 0) { int XXCount = al.Count; string LastName = ""; int LastPosInf = -1; for (int i = 0; i < XXCount; i++) { if (LastName == "") { LastName = (string)al[i]; LastPosInf = i; } else { if (LastName == (string)al[i]) { if (i == XXCount - 1) { if (LastPosInf != i) { Excel1.Range RMX; string Inf = ""; Inf = "AS" + (LastPosInf + 2).ToString() + ":" + "AS" + (i + 2).ToString(); RMX = ws.get_Range(Inf, Type.Missing); RMX.MergeCells = true; RMX.Merge(0); } } } else { if (LastPosInf != i - 1) { Excel1.Range RMX; string Inf = ""; Inf = "AS" + (LastPosInf + 2).ToString() + ":" + "AS" + (i + 1).ToString(); RMX = ws.get_Range(Inf, Type.Missing); RMX.MergeCells = true; RMX.Merge(0); } LastName = (string)al[i]; LastPosInf = i; } } } } al.Clear(); //合并备注列 if (al1.Count > 0) { int XXCount = al1.Count; string LastName = ""; int LastPosInf = -1; for (int i = 0; i < XXCount; i++) { if (LastName == "") { LastName = (string)al1[i]; LastPosInf = i; } else { if (LastName == (string)al1[i]) { if (i == XXCount - 1) { if (LastPosInf != i) { Excel1.Range RMX; string Inf = ""; Inf = "AT" + (LastPosInf + 2).ToString() + ":" + "AT" + (i + 2).ToString(); RMX = ws.get_Range(Inf, Type.Missing); RMX.MergeCells = true; RMX.Merge(0); } } } else { if (LastPosInf != i - 1) { Excel1.Range RMX; string Inf = ""; Inf = "AT" + (LastPosInf + 2).ToString() + ":" + "AT" + (i + 1).ToString(); RMX = ws.get_Range(Inf, Type.Missing); RMX.MergeCells = true; RMX.Merge(0); } LastName = (string)al1[i]; LastPosInf = i; } } } } al1.Clear(); //导出到EXCEL中 只需要某些列,下面删除多余的列(已经在datatable中按字段排好序) Excel1.Range RMX1; string Inf1 = ""; Inf1 = "A1:" + "W1"; RMX1 = ws.get_Range(Inf1, Type.Missing); RMX1.EntireColumn.Delete(0); r.EntireColumn.AutoFit(); xlBook.SaveCopyAs(FilePath); } private void DoPrint() { if (MessageBox.Show("您确认流程卡打印信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { if (coil_no_index >= 0) { Infragistics.Win.UltraWinGrid.UltraGridRow uRow = ultraGrid1.Rows[coil_no_index]; ArrayList param = new ArrayList(); param.Add(uRow.Cells["C_COIL_NO"].Value.ToString().Trim().Substring(0, 9)); param.Add(uRow.Cells["STL_GRD"].Value.ToString().Trim()); param.Add(uRow.Cells["H_COIL_NO"].Value.ToString().Trim()); param.Add(uRow.Cells["H_SIZE"].Value.ToString().Trim()); param.Add(uRow.Cells["H_WEIGHT"].Value.ToString().Trim()); param.Add(uRow.Cells["SPEC_STL_GRD"].Value.ToString().Trim()); param.Add(uRow.Cells["C_COIL_NO"].Value.ToString().Trim().Substring(0,12)); param.Add(uRow.Cells["C_SIZE"].Value.ToString().Trim()); string prodLine = uRow.Cells["PROD_LINE"].Value.ToString().Trim(); if (prodLine == "L") { param.Add("否"); param.Add(uRow.Cells["C_TOT_DEC_GRD"].Value.ToString().Trim()); param.Add(uRow.Cells["C_CAUSE"].Value.ToString().Trim()); param.Add(uRow.Cells["C_WEIGHT"].Value.ToString().Trim()); param.Add(uRow.Cells["C_YARD"].Value.ToString().Trim()); param.Add("连退"); param.Add("是"); } else { param.Add("是"); param.Add(uRow.Cells["C_TOT_DEC_GRD"].Value.ToString().Trim()); param.Add(uRow.Cells["C_CAUSE"].Value.ToString().Trim()); param.Add(uRow.Cells["C_WEIGHT"].Value.ToString().Trim()); param.Add(uRow.Cells["C_YARD"].Value.ToString().Trim()); param.Add("酸轧成品"); param.Add("否"); } param.Add(uRow.Cells["C_COIL_NO"].Value.ToString().Trim()); param.Add(ultraGrid1.Rows[coil_no_index].Cells["C_COIL_THK"].Value.ToString().Trim() + "*" + ultraGrid1.Rows[coil_no_index].Cells["C_COIL_WTH"].Value.ToString().Trim()); param.Add(uRow.Cells["L_TOT_DEC_GRD"].Value.ToString().Trim()); param.Add(uRow.Cells["L_CAUSE"].Value.ToString().Trim()); param.Add(uRow.Cells["C_ACT_WGT"].Value.ToString().Trim()); param.Add(uRow.Cells["C_CUR_LOAD_LOC"].Value.ToString().Trim()); try { ExcelPrinter ePrinter = new ExcelPrinter("FlowCard3.xml", param); ePrinter.PageSetup.IsCustom = true; ePrinter.PageSetup.TopMargin = 40; ePrinter.PageSetup.BottomMargin = 1; ePrinter.PageSetup.LeftMargin = 1; ePrinter.PageSetup.RightMargin = 0.5; ePrinter.Orientation = 1;//横向打印 ePrinter.printExcel(); } catch (Exception ex) { MessageBox.Show("打印失败,请关闭程序后重新操作!"); return; } } else { MessageBox.Show("请选择打印钢卷!"); return; } } } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { ultraGrid1.UpdateData(); if (e.Cell.Column.Key.Equals("CHK")) { if (Convert.ToBoolean(e.Cell.Value)) { string C_COILNO = e.Cell.Row.Cells["C_COIL_NO"].Text.Trim(); if (coil_no_index != -1) { ultraGrid1.Rows[coil_no_index].Cells["CHK"].Value = false; } coil_no_index = e.Cell.Row.Index; } else { coil_no_index = -1; } } } private void UIM020070_Load(object sender, EventArgs e) { try { foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn col in this.ultraGrid1.DisplayLayout.Bands[0].Columns) { //Common.FixDBManager.SetCellActivation(col.Key.ToString(), "L_TBF03_SPEC_REEL", this.ultraGrid1, "ACTIVATEONLY"); } } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }