using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using CoreFS.CA06;
using System.Threading;
using System.Diagnostics;
using Infragistics.Win.UltraWinMaskedEdit;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using System.IO;
using Core.Mes.Client.Common;
using Core.LgMes.Client.Report;
using Core.LgMes.Client.lgBll.lgReport;
using Infragistics.Win.UltraWinMaskedEdit;
namespace Core.LgMes.Client.LgIntegrationQuery
{
///
/// FrmIronEleQry 的摘要说明。
///
public class FrmHlReport : Core.Mes.Client.Common.frmStyleBase
{
private System.Windows.Forms.Label label2;
private Infragistics.Win.UltraWinDataSource.UltraDataSource ultraDataSource1;
private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor uldtEndTime;
private CheckBox chkTime;
private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor uldtBeginTime;
private Label label4;
private IContainer components;
string strStartTime = "";
private TextBox textBox1;
private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter GridExcelExporter;
string strEndTime = "";
private Infragistics.Win.UltraWinEditors.UltraCheckEditor uCkEditorForFilter;
private Core.LgMes.Client.lgBll.lgResMgt.CommonAtomStlCcmMgt lgCcmReprt = null;
public FrmHlReport()
{
if (lgCcmReprt == null)
{
lgCcmReprt = new Core.LgMes.Client.lgBll.lgResMgt.CommonAtomStlCcmMgt();
}
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose( bool disposing )
{
try
{
}
catch { }
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
Infragistics.Win.Appearance appearance70 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance71 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance72 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance73 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance74 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance75 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance76 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance77 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance78 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance79 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance80 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
this.label2 = new System.Windows.Forms.Label();
this.ultraDataSource1 = new Infragistics.Win.UltraWinDataSource.UltraDataSource(this.components);
this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.chkTime = new System.Windows.Forms.CheckBox();
this.uldtBeginTime = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor();
this.uldtEndTime = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor();
this.GridExcelExporter = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter(this.components);
this.uCkEditorForFilter = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
((System.ComponentModel.ISupportInitialize)(this.ultraDataSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
this.ultraGroupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.uldtBeginTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uldtEndTime)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.uCkEditorForFilter)).BeginInit();
this.SuspendLayout();
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(413, 18);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 51;
this.label2.Text = "炉号";
//
// ultraGrid1
//
appearance70.TextHAlignAsString = "Left";
this.ultraGrid1.DisplayLayout.CaptionAppearance = appearance70;
appearance71.BackColor = System.Drawing.SystemColors.ActiveBorder;
appearance71.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance71.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance71.BorderColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance71;
appearance72.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance72;
this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
appearance73.BackColor = System.Drawing.SystemColors.ControlLightLight;
appearance73.BackColor2 = System.Drawing.SystemColors.Control;
appearance73.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance73.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance73;
this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
appearance74.BackColor = System.Drawing.SystemColors.Window;
appearance74.ForeColor = System.Drawing.SystemColors.ControlText;
this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance74;
appearance75.BackColor = System.Drawing.SystemColors.Highlight;
appearance75.ForeColor = System.Drawing.SystemColors.HighlightText;
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance75;
this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.None;
appearance76.BackColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance76;
appearance77.FontData.SizeInPoints = 10F;
appearance77.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance77;
this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
this.ultraGrid1.DisplayLayout.Override.DefaultRowHeight = 25;
appearance78.BackColor = System.Drawing.SystemColors.Control;
appearance78.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance78.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
appearance78.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance78.BorderColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance78;
appearance79.TextHAlignAsString = "Left";
this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance79;
this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard;
this.ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex;
this.ultraGrid1.DisplayLayout.Override.RowSelectorWidth = 25;
appearance80.BackColor = System.Drawing.SystemColors.ControlLight;
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance80;
this.ultraGrid1.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
this.ultraGrid1.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ultraGrid1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ultraGrid1.Location = new System.Drawing.Point(0, 47);
this.ultraGrid1.Name = "ultraGrid1";
this.ultraGrid1.Size = new System.Drawing.Size(975, 446);
this.ultraGrid1.TabIndex = 19;
//
// ultraGroupBox1
//
this.ultraGroupBox1.Controls.Add(this.uCkEditorForFilter);
this.ultraGroupBox1.Controls.Add(this.textBox1);
this.ultraGroupBox1.Controls.Add(this.label4);
this.ultraGroupBox1.Controls.Add(this.chkTime);
this.ultraGroupBox1.Controls.Add(this.uldtBeginTime);
this.ultraGroupBox1.Controls.Add(this.uldtEndTime);
this.ultraGroupBox1.Controls.Add(this.label2);
this.ultraGroupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.ultraGroupBox1.Location = new System.Drawing.Point(0, 0);
this.ultraGroupBox1.Name = "ultraGroupBox1";
this.ultraGroupBox1.Size = new System.Drawing.Size(975, 47);
this.ultraGroupBox1.TabIndex = 21;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(448, 11);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 285;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(243, 16);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(21, 14);
this.label4.TabIndex = 284;
this.label4.Text = "到";
//
// chkTime
//
this.chkTime.AutoSize = true;
this.chkTime.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.chkTime.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chkTime.Location = new System.Drawing.Point(21, 14);
this.chkTime.Name = "chkTime";
this.chkTime.Size = new System.Drawing.Size(79, 18);
this.chkTime.TabIndex = 283;
this.chkTime.Text = "时间 从";
this.chkTime.UseVisualStyleBackColor = true;
this.chkTime.CheckedChanged += new System.EventHandler(this.chkTime_CheckedChanged);
//
// uldtBeginTime
//
appearance5.BorderAlpha = Infragistics.Win.Alpha.UseAlphaLevel;
appearance5.BorderColor = System.Drawing.Color.Black;
this.uldtBeginTime.ButtonAppearance = appearance5;
this.uldtBeginTime.DateTime = new System.DateTime(2008, 1, 12, 0, 0, 0, 0);
this.uldtBeginTime.Enabled = false;
this.uldtBeginTime.FormatProvider = new System.Globalization.CultureInfo("en-US");
this.uldtBeginTime.FormatString = "yyyy-MM-dd HH:mm";
this.uldtBeginTime.Location = new System.Drawing.Point(104, 14);
this.uldtBeginTime.MaskInput = "yyyy-mm-dd hh:mm";
this.uldtBeginTime.Name = "uldtBeginTime";
this.uldtBeginTime.Size = new System.Drawing.Size(133, 19);
this.uldtBeginTime.TabIndex = 282;
this.uldtBeginTime.UseFlatMode = Infragistics.Win.DefaultableBoolean.True;
this.uldtBeginTime.Value = new System.DateTime(2008, 1, 12, 0, 0, 0, 0);
this.uldtBeginTime.ValueChanged += new System.EventHandler(this.uldtBeginTime_ValueChanged);
//
// uldtEndTime
//
this.uldtEndTime.DateTime = new System.DateTime(2008, 11, 24, 0, 0, 0, 0);
this.uldtEndTime.FormatProvider = new System.Globalization.CultureInfo("en-US");
this.uldtEndTime.FormatString = "yyyy-MM-dd HH:mm";
this.uldtEndTime.Location = new System.Drawing.Point(271, 12);
this.uldtEndTime.MaskInput = "yyyy-mm-dd hh:mm";
this.uldtEndTime.Name = "uldtEndTime";
this.uldtEndTime.Size = new System.Drawing.Size(136, 21);
this.uldtEndTime.TabIndex = 281;
this.uldtEndTime.Value = new System.DateTime(2008, 11, 24, 0, 0, 0, 0);
//
// uCkEditorForFilter
//
appearance3.BackColor = System.Drawing.Color.LimeGreen;
appearance3.TextVAlignAsString = "Middle";
this.uCkEditorForFilter.Appearance = appearance3;
this.uCkEditorForFilter.BackColor = System.Drawing.Color.LimeGreen;
this.uCkEditorForFilter.BackColorInternal = System.Drawing.Color.Transparent;
this.uCkEditorForFilter.Location = new System.Drawing.Point(578, 11);
this.uCkEditorForFilter.Name = "uCkEditorForFilter";
this.uCkEditorForFilter.Size = new System.Drawing.Size(46, 20);
this.uCkEditorForFilter.TabIndex = 291;
this.uCkEditorForFilter.Text = "过滤";
this.uCkEditorForFilter.CheckedChanged += new System.EventHandler(this.uCkEditorForFilter_CheckedChanged);
//
// FrmHlReport
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.ClientSize = new System.Drawing.Size(975, 493);
this.Controls.Add(this.ultraGrid1);
this.Controls.Add(this.ultraGroupBox1);
this.Name = "FrmHlReport";
this.StatusCustomInfo = "F1:用户视图 F2:表格拖选统计";
this.Text = "恒拉统计表";
this.Load += new System.EventHandler(this.FrmIronEleQry_Load);
((System.ComponentModel.ISupportInitialize)(this.ultraDataSource1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
this.ultraGroupBox1.ResumeLayout(false);
this.ultraGroupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.uldtBeginTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.uldtEndTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.uCkEditorForFilter)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void FrmIronEleQry_Load(object sender, System.EventArgs e)
{
this.uldtBeginTime.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 00:00";
this.uldtEndTime.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 23:59";
this.chkTime.Checked = true;
}
///
/// ds需要的字段
///
///
private string[] returnColumnName()
{
return new string[] { "OPTDATE", "HEATNO", "STATIONCODE", "INFO2", "INFO3", "INFO4", "INFO1", "CASTFLOW", "BC", "BB", "TOTALTIME", "LMLTEMPT", "LMLTEMPTRESULT", "MWRAPTEMPT05", "BJFYL", "BJZHL", "FRONTLINE", "ISSTARTCCM", "HITMWRAPTEMPT", "HLTIME", "PRODUCTCPTCODE" };
}
///
///
///
///
private string[] returnColumnHeaderName()
{
return new string[] { "操作时间", "炉号", "连铸机号", "钢种", "断面1", "断面2", "断面", "铸机流", "班次", "班别", "浇铸时间", "钢种液相线", "成品液相线", "中包温度", "成品包晶反应率", "成品包晶转化率", "上道工序", "开浇炉", "中包温度命中", "恒拉时间", "非恒拉原因" };
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "Query":
this.doQuery();
break;
case "Close":
this.Close();
break;
case "Export":
this.ExportExcel();
break;
default:
break;
}
}
private void chkTime_CheckedChanged(object sender, EventArgs e)
{
uldtBeginTime.Enabled = chkTime.Checked;
uldtEndTime.Enabled = chkTime.Checked;
}
private void uldtBeginTime_ValueChanged(object sender, EventArgs e)
{
}
#region "Auto Refresh"
///
/// 返回ccm拉速信息
///
///
private DataSet getAllCcmData()
{
return LgCcmReportCollection.returnDsOfCcmCastSpeedReport(new ClientParamWithSqlConditionAndOpenBase(this.getSqlCondition(),this.ob));
}
///
/// 获取查询条件
///
///
private string getSqlCondition()
{
string strStartTime = this.uldtBeginTime.DateTime.ToString("yyyy-MM-dd");
string strEndTime = this.uldtEndTime.DateTime.ToString("yyyy-MM-dd");
string sqlCondition = string.Format(string.Format(" and a.optdate >= trunc({0}) and a.optdate <= trunc({1} + 1)", "to_date('{0}','yyyy-mm-dd')", "to_date('{1}','yyyy-mm-dd')"), strStartTime, strEndTime);
if (this.textBox1.Text.Trim().Length > 0)
{
sqlCondition = sqlCondition + string.Format(" and a.heatno like '%{0}%'", this.textBox1.Text.Trim());
}
//sqlCondition += sqlCondition + " and round((nvl(a.endtime,null ) - a.starttime )*86400 / 60, 2)<60";
return sqlCondition;
}
///
/// 通过炉号返回ccm信息
///
///
///
private DataSet getCcminfoByHeatNo(string heatNo)
{
return lgCcmReprt.returnDsOfCcmChemInfo(new ClientParamWithSqlConditionAndOpenBase(string.Format(" and HEATNO = '{0}'", heatNo), this.ob));
}
// 获取炉号计划牌号和断面
private Hashtable getPlsteelAndFaceSecetion(string vheatno)
{
DataSet ds = getCcminfoByHeatNo(vheatno);
Hashtable hs = new Hashtable();
string[] temp = null;
if (ds.Tables[0].Rows.Count > 0)
{
DataRow dr = ds.Tables[0].Rows[0];
string v1 = dr["SHIFTCODE"].ToString().Substring(0, 1);
string v2 = dr["SHIFTCODE"].ToString().Substring(1, 1);
string v3 = dr["LMLTEMPT"].ToString();
string v4 = dr["MWRAPTEMPT05"].ToString();
string v5 = dr["FRONTLINE"].ToString();
string v6 = dr["ISSTARTCCM"].ToString();
string v7 = dr["HITMWRAPTEMPT"].ToString();
string v8 = dr["LMLTEMPTRESULT"].ToString();
string v9 = dr["BILLETSECTION2"].ToString();
string v10 = dr["HLSTANDARDTIME1"].ToString();
string v11 = dr["HLSTANDARDTIME2"].ToString();
string v12 = dr["PRODUCTCPTCODE"].ToString();
string v13 = dr["BJFYL"].ToString();
string v14 = dr["BJZHL"].ToString();
if (v4 == "")
{
v4 = dr["MWRAPTEMPT20"].ToString();
}
if (v9 == "")
{
v9 = dr["BILLETSECTION"].ToString();
}
string vBc = (v1 == "1") ? "白" : (v1 == "2") ? "中" : "夜";
string vBb = (v2 == "1") ? "甲" : (v2 == "2") ? "乙" : (v2 == "3")? "丙":"丁";
temp = new string[] { dr["PLANSTEEL"].ToString(), dr["BILLETSECTION"].ToString(), dr["STATIONCODE"].ToString(), vBc, vBb, v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14};
if (!hs.Contains(dr["HEATNO"].ToString()))
{
hs.Add(dr["HEATNO"].ToString(), temp);
}
}
return hs;
}
///
/// 获取所有拉速
///
///
///
///
private ArrayList getAllFixedSpeed(DataSet ds, string columnName)
{
ArrayList list = new ArrayList();
if(ds == null || ds.Tables.Count == 0)
return list;
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (!list.Contains(dr[columnName].ToString()))
{
list.Add(dr[columnName].ToString());
}
}
}
list.Sort();
return list;
}
private ArrayList getAllHeatNo(DataSet ds)
{
ArrayList list = new ArrayList();
list = getAllFixedSpeed(ds,"HEATNO");
return list;
}
private DataSet initDataSet(DataSet dsAllColumn, DataSet dsData, ArrayList listHeatNo, ArrayList listallFixedSpeedLis, string[] arrayCastFlow)
{
DataSet ds = dsAllColumn.Clone();
DataRow drtemp = null;
Hashtable hs = null;
string[] planSteel = null;
DataTable dt = ds.Tables[0];
DataView dvtemp = null;
DataTable temp = null;
DataView dv1 = null;
dvtemp = new DataView(dsData.Tables[0]);
foreach (string s in listHeatNo)
{
dvtemp.RowFilter = string.Format("HEATNO = '{0}'", s);
dv1 = new DataView(dvtemp.ToTable());
double totalTime = 0;
hs = getPlsteelAndFaceSecetion(s);
try
{
for (int i = 0; i < arrayCastFlow.Length; i++)
{
dv1.RowFilter = string.Format("CASTFLOW = '{0}'", arrayCastFlow[i]);
temp = dv1.ToTable();
totalTime = 0;
drtemp = dt.NewRow();
planSteel = hs[temp.Rows[0]["HEATNO"].ToString()] as string[];
drtemp["OPTDATE"] = temp.Rows[0]["OPTDATE"];
drtemp["HEATNO"] = temp.Rows[0]["HEATNO"];
//drtemp["CASTFLOW"] = arrayCastFlow[i];
string[] faceResult = planSteel[1].Split('X');
string[] faceResult2 = planSteel[11].Split('X');
try
{
drtemp["INFO2"] = planSteel[0];
drtemp["STATIONCODE"] = planSteel[2];
if (i == 0)
{
drtemp["INFO3"] = faceResult[0];
drtemp["INFO4"] = faceResult[1];
drtemp["INFO1"] = planSteel[1];
drtemp["HLTIME"] = planSteel[12].ToString() == "0" ? "" : planSteel[12];
}
else
{
drtemp["INFO3"] = faceResult2[0];
drtemp["INFO4"] = faceResult2[1];
drtemp["INFO1"] = planSteel[11];
drtemp["HLTIME"] = planSteel[13].ToString() == "0" ? "" : planSteel[13];
}
drtemp["BC"] = planSteel[3];
drtemp["BB"] = planSteel[4];
drtemp["LMLTEMPT"] = planSteel[5];
drtemp["MWRAPTEMPT05"] = planSteel[6];
drtemp["FRONTLINE"] = planSteel[7];
drtemp["ISSTARTCCM"] = planSteel[8];
drtemp["HITMWRAPTEMPT"] = planSteel[9];
drtemp["LMLTEMPTRESULT"] = planSteel[10];
drtemp["PRODUCTCPTCODE"] = planSteel[14];
drtemp["BJFYL"] = planSteel[15];
drtemp["BJZHL"] = planSteel[16];
if (planSteel[2]=="01")
{
drtemp["CASTFLOW"] = arrayCastFlow[i];
}
else if (planSteel[2]=="02")
{
if (i == 0)
{
drtemp["CASTFLOW"] = "S3";
}
else
{
drtemp["CASTFLOW"] = "S4";
}
}
else
{
drtemp["CASTFLOW"] = "S5";
}
}
catch
{ }
foreach (DataRow dr in temp.Rows)
{
if (listallFixedSpeedLis.Contains(dr["FIXEDSPEED"].ToString()))
{
drtemp[dr["FIXEDSPEED"].ToString()] = Convert.ToDouble((drtemp[dr["FIXEDSPEED"].ToString()].ToString().Length == 0) ? "0" : drtemp[dr["FIXEDSPEED"].ToString()].ToString())
+ ((dr["FIXEDTIME"].ToString().Length == 0) ? 0 : Convert.ToDouble(dr["FIXEDTIME"]));
totalTime += (dr["FIXEDTIME"].ToString().Length == 0) ? 0 : Convert.ToDouble(dr["FIXEDTIME"]);
// try{
// if( Convert.ToDouble(dr["FIXEDTIME"]) >totalTime)
// totalTime = Convert.ToDouble(dr["FIXEDTIME"]);
//}catch{}
}
}
drtemp["TOTALTIME"] = totalTime;
dt.Rows.Add(drtemp);
}
}
catch
{
}
}
return ds;
}
private void doQueryReport()
{
if (uldtEndTime.DateTime.Date.Subtract(uldtBeginTime.DateTime.Date).Days > 180)
{
MessageBox.Show("查询时间不可超过6个月。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (uldtBeginTime.DateTime.Date > uldtEndTime.DateTime.Date)
{
MessageBox.Show("查询开始日期不能大于结束日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
DataSet ds = getAllColumn();
DataSet dsData = getAllCcmData();
//ds.Tables[0].Columns.Add("LMLTEMPT", typeof(System.String));
//dsData.Tables[0].Columns.Add("LMLTEMPT",typeof(System.String));
DataTable dt = ds.Tables[0];
ArrayList allFixedSpeedList = getAllFixedSpeed(dsData, "FIXEDSPEED");
ArrayList listHeatNo = getAllHeatNo(dsData);
DataSet dsRealData = initDataSet(ds, dsData, listHeatNo, allFixedSpeedList, new string[] { "S1","S2"});
ds.Clear();
ds.Merge(dsRealData);
ds.Tables[0].TableName = "TABLE1";
DataView dv = new DataView(ds.Tables[0]);
dv.Sort = "OPTDATE";
try
{
this.ultraGrid1.Refresh();
((this.ultraGrid1.DataSource) as DataTable).Clear();
}
catch
{
}
this.ultraGrid1.DataSource = dv.ToTable();
initUltraGrid();
}
///
/// 构造新的dataset,包含需要显示的字段
///
///
private DataSet getAllColumn()
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
string[] columnName = returnColumnName();
foreach(string s in columnName)
{
dt.Columns.Add(new DataColumn(s, Type.GetType("System.String"))); // 时间
}
foreach (string s in this.getAllFixedSpeed(getAllCcmData(), "FIXEDSPEED"))
{
dt.Columns.Add(new DataColumn(s, Type.GetType("System.String"))); // 各拉速
}
ds.Tables.Add(dt);
return ds;
}
///
/// 设置需要显示的列宽
///
///
private Hashtable returnColumnWidth()
{
Hashtable hs = new Hashtable();
hs.Add("HEATNO",90);
hs.Add("OPTDATE", 100);
hs.Add("BJFYL", 90);
hs.Add("BJZHL", 90);
return hs;
}
///
/// 初始化grid
///
private void initUltraGrid()
{
try
{
string[] columnName = returnColumnName();
string[] columnHeaderName = returnColumnHeaderName();
Hashtable hs = returnColumnWidth();
int columnWidht = 50;
int otherColumnWidth = 40; // 拉速宽度
for(int i = 0; i < columnName.Length;i++)
{
try
{
this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Header.Caption = columnHeaderName[i];
if (hs.Contains(columnName[i]))
this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Width = Convert.ToInt16(hs[columnName[i]]);
else
this.ultraGrid1.DisplayLayout.Bands[0].Columns[columnName[i]].Width = columnWidht;
}
catch
{
}
}
for (int i = 0; i < this.ultraGrid1.DisplayLayout.Bands[0].Columns.Count; i++)
{
if (i > 21)
{
this.ultraGrid1.DisplayLayout.Bands[0].Columns[i].Width = otherColumnWidth;
}
}
//设置列只读
Core.Mes.Client.Common.UltraGridMgt.SetUltraGridColumnsReadOnly(ref this.ultraGrid1);
}
catch
{
}
}
private void doQuery()
{
doQueryReport();
}
private void ExportExcel()
{
try
{
string StrfileName = "连铸恒拉明细表.xls";
this.GridExcelExporter.Export(this.ultraGrid1, StrfileName);
ProcessStartInfo p = new ProcessStartInfo(StrfileName);
p.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
Process.Start(p);
}
catch (Exception ex)
{
}
}
#endregion
private void uCkEditorForFilter_CheckedChanged(object sender, EventArgs e)
{
try
{
if (uCkEditorForFilter.Checked)
{
ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
}
else
{
ultraGrid1.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
ultraGrid1.DisplayLayout.Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
}
}
catch { }
}
}
}