using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using CoreFS.CA06;
using System.Diagnostics;
using Infragistics.Win.UltraWinMaskedEdit;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using System.IO;
namespace Core.LgMes.Client.LgIntegrationQuery
{
///
/// FrmAdditStat 的摘要说明。
///
public class frmAdditStatHis : Core.Mes.Client.Common.frmStyleBase
{
#region " Construct "
private System.Windows.Forms.Panel panel1;
private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1;
private Infragistics.Win.UltraWinTabControl.UltraTabControl ultraTabControl1;
private Infragistics.Win.UltraWinTabControl.UltraTabSharedControlsPage ultraTabSharedControlsPage1;
private Infragistics.Win.UltraWinTabControl.UltraTabPageControl ultraTabPageControl1;
private Infragistics.Win.UltraWinTabControl.UltraTabPageControl ultraTabPageControl2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboBox2;
private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.CheckBox checkBox2;
private System.Windows.Forms.CheckBox checkBox3;
private System.Windows.Forms.CheckBox checkBox4;
private ComboBox cboGW;
private ComboBox cboGWID;
private UltraMaskedEdit ultraMaskedEdit2;
private UltraMaskedEdit ultraMaskedEdit1;
private Button button2;
private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter GridExcelExporter;
private CheckBox chkSteel;
private TextBox txtSteel;
private System.ComponentModel.IContainer components;
public frmAdditStatHis()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinTabControl.UltraTab ultraTab1 = new Infragistics.Win.UltraWinTabControl.UltraTab();
Infragistics.Win.UltraWinTabControl.UltraTab ultraTab2 = new Infragistics.Win.UltraWinTabControl.UltraTab();
Infragistics.Win.UltraWinEditors.EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton("edit");
Infragistics.Win.UltraWinEditors.EditorButton editorButton2 = new Infragistics.Win.UltraWinEditors.EditorButton("clear");
Infragistics.Win.UltraWinEditors.EditorButton editorButton3 = new Infragistics.Win.UltraWinEditors.EditorButton("edit");
Infragistics.Win.UltraWinEditors.EditorButton editorButton4 = new Infragistics.Win.UltraWinEditors.EditorButton("clear");
this.ultraTabPageControl1 = new Infragistics.Win.UltraWinTabControl.UltraTabPageControl();
this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.ultraTabPageControl2 = new Infragistics.Win.UltraWinTabControl.UltraTabPageControl();
this.ultraGrid2 = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.panel1 = new System.Windows.Forms.Panel();
this.ultraTabControl1 = new Infragistics.Win.UltraWinTabControl.UltraTabControl();
this.ultraTabSharedControlsPage1 = new Infragistics.Win.UltraWinTabControl.UltraTabSharedControlsPage();
this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox();
this.txtSteel = new System.Windows.Forms.TextBox();
this.chkSteel = new System.Windows.Forms.CheckBox();
this.button2 = new System.Windows.Forms.Button();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.ultraMaskedEdit2 = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit();
this.ultraMaskedEdit1 = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit();
this.cboGW = new System.Windows.Forms.ComboBox();
this.cboGWID = new System.Windows.Forms.ComboBox();
this.checkBox4 = new System.Windows.Forms.CheckBox();
this.checkBox3 = new System.Windows.Forms.CheckBox();
this.checkBox2 = new System.Windows.Forms.CheckBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.GridExcelExporter = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter(this.components);
this.ultraTabPageControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
this.ultraTabPageControl2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ultraGrid2)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ultraTabControl1)).BeginInit();
this.ultraTabControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit();
this.ultraGroupBox1.SuspendLayout();
this.SuspendLayout();
//
// ultraTabPageControl1
//
this.ultraTabPageControl1.Controls.Add(this.ultraGrid1);
this.ultraTabPageControl1.Location = new System.Drawing.Point(2, 21);
this.ultraTabPageControl1.Name = "ultraTabPageControl1";
this.ultraTabPageControl1.Size = new System.Drawing.Size(900, 329);
//
// ultraGrid1
//
appearance1.TextHAlignAsString = "Left";
this.ultraGrid1.DisplayLayout.CaptionAppearance = appearance1;
appearance2.BackColor = System.Drawing.SystemColors.ActiveBorder;
appearance2.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance2.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance2.BorderColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance2;
appearance3.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance3;
this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
appearance4.BackColor = System.Drawing.SystemColors.ControlLightLight;
appearance4.BackColor2 = System.Drawing.SystemColors.Control;
appearance4.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance4.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance4;
this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
appearance5.FontData.SizeInPoints = 10F;
this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance5;
this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
appearance6.FontData.SizeInPoints = 9F;
appearance6.TextHAlignAsString = "Center";
this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance6;
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;
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.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ultraGrid1.Location = new System.Drawing.Point(0, 0);
this.ultraGrid1.Name = "ultraGrid1";
this.ultraGrid1.Size = new System.Drawing.Size(900, 329);
this.ultraGrid1.TabIndex = 20;
//
// ultraTabPageControl2
//
this.ultraTabPageControl2.Controls.Add(this.ultraGrid2);
this.ultraTabPageControl2.Location = new System.Drawing.Point(-10000, -10000);
this.ultraTabPageControl2.Name = "ultraTabPageControl2";
this.ultraTabPageControl2.Size = new System.Drawing.Size(900, 329);
//
// ultraGrid2
//
appearance7.TextHAlignAsString = "Left";
this.ultraGrid2.DisplayLayout.CaptionAppearance = appearance7;
appearance8.BackColor = System.Drawing.SystemColors.ActiveBorder;
appearance8.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance8.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance8.BorderColor = System.Drawing.SystemColors.Window;
this.ultraGrid2.DisplayLayout.GroupByBox.Appearance = appearance8;
appearance9.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid2.DisplayLayout.GroupByBox.BandLabelAppearance = appearance9;
this.ultraGrid2.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.ultraGrid2.DisplayLayout.GroupByBox.Hidden = true;
appearance10.BackColor = System.Drawing.SystemColors.ControlLightLight;
appearance10.BackColor2 = System.Drawing.SystemColors.Control;
appearance10.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance10.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid2.DisplayLayout.GroupByBox.PromptAppearance = appearance10;
this.ultraGrid2.DisplayLayout.MaxColScrollRegions = 1;
this.ultraGrid2.DisplayLayout.MaxRowScrollRegions = 1;
appearance11.FontData.SizeInPoints = 10F;
this.ultraGrid2.DisplayLayout.Override.CellAppearance = appearance11;
this.ultraGrid2.DisplayLayout.Override.CellPadding = 0;
appearance12.FontData.SizeInPoints = 9F;
appearance12.TextHAlignAsString = "Center";
this.ultraGrid2.DisplayLayout.Override.HeaderAppearance = appearance12;
this.ultraGrid2.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
this.ultraGrid2.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard;
this.ultraGrid2.DisplayLayout.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex;
this.ultraGrid2.DisplayLayout.Override.RowSelectorWidth = 25;
this.ultraGrid2.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
this.ultraGrid2.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
this.ultraGrid2.Dock = System.Windows.Forms.DockStyle.Fill;
this.ultraGrid2.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.ultraGrid2.Location = new System.Drawing.Point(0, 0);
this.ultraGrid2.Name = "ultraGrid2";
this.ultraGrid2.Size = new System.Drawing.Size(900, 329);
this.ultraGrid2.TabIndex = 21;
this.ultraGrid2.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ultraGrid2_InitializeLayout);
//
// panel1
//
this.panel1.Controls.Add(this.ultraTabControl1);
this.panel1.Controls.Add(this.ultraGroupBox1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(904, 437);
this.panel1.TabIndex = 0;
//
// ultraTabControl1
//
this.ultraTabControl1.Controls.Add(this.ultraTabSharedControlsPage1);
this.ultraTabControl1.Controls.Add(this.ultraTabPageControl1);
this.ultraTabControl1.Controls.Add(this.ultraTabPageControl2);
this.ultraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.ultraTabControl1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.ultraTabControl1.Location = new System.Drawing.Point(0, 85);
this.ultraTabControl1.MinTabWidth = 100;
this.ultraTabControl1.Name = "ultraTabControl1";
this.ultraTabControl1.SharedControlsPage = this.ultraTabSharedControlsPage1;
this.ultraTabControl1.Size = new System.Drawing.Size(904, 352);
this.ultraTabControl1.TabIndex = 5;
ultraTab1.TabPage = this.ultraTabPageControl1;
ultraTab1.Text = "金属料";
ultraTab2.TabPage = this.ultraTabPageControl2;
ultraTab2.Text = "辅料";
this.ultraTabControl1.Tabs.AddRange(new Infragistics.Win.UltraWinTabControl.UltraTab[] {
ultraTab1,
ultraTab2});
this.ultraTabControl1.ViewStyle = Infragistics.Win.UltraWinTabControl.ViewStyle.VisualStudio2005;
this.ultraTabControl1.SelectedTabChanged += new Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventHandler(this.ultraTabControl1_SelectedTabChanged);
//
// ultraTabSharedControlsPage1
//
this.ultraTabSharedControlsPage1.Location = new System.Drawing.Point(-10000, -10000);
this.ultraTabSharedControlsPage1.Name = "ultraTabSharedControlsPage1";
this.ultraTabSharedControlsPage1.Size = new System.Drawing.Size(900, 329);
//
// ultraGroupBox1
//
this.ultraGroupBox1.Controls.Add(this.txtSteel);
this.ultraGroupBox1.Controls.Add(this.chkSteel);
this.ultraGroupBox1.Controls.Add(this.button2);
this.ultraGroupBox1.Controls.Add(this.comboBox2);
this.ultraGroupBox1.Controls.Add(this.ultraMaskedEdit2);
this.ultraGroupBox1.Controls.Add(this.ultraMaskedEdit1);
this.ultraGroupBox1.Controls.Add(this.cboGW);
this.ultraGroupBox1.Controls.Add(this.cboGWID);
this.ultraGroupBox1.Controls.Add(this.checkBox4);
this.ultraGroupBox1.Controls.Add(this.checkBox3);
this.ultraGroupBox1.Controls.Add(this.checkBox2);
this.ultraGroupBox1.Controls.Add(this.checkBox1);
this.ultraGroupBox1.Controls.Add(this.label6);
this.ultraGroupBox1.Controls.Add(this.dateTimePicker2);
this.ultraGroupBox1.Controls.Add(this.dateTimePicker1);
this.ultraGroupBox1.Controls.Add(this.button1);
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(904, 85);
this.ultraGroupBox1.TabIndex = 4;
//
// txtSteel
//
this.txtSteel.Enabled = false;
this.txtSteel.Location = new System.Drawing.Point(511, 45);
this.txtSteel.Name = "txtSteel";
this.txtSteel.Size = new System.Drawing.Size(252, 21);
this.txtSteel.TabIndex = 88;
//
// chkSteel
//
this.chkSteel.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chkSteel.Location = new System.Drawing.Point(459, 43);
this.chkSteel.Name = "chkSteel";
this.chkSteel.Size = new System.Drawing.Size(56, 24);
this.chkSteel.TabIndex = 87;
this.chkSteel.Text = "钢种";
this.chkSteel.CheckedChanged += new System.EventHandler(this.chkSteel_CheckedChanged);
//
// button2
//
this.button2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(769, 41);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 28);
this.button2.TabIndex = 86;
this.button2.Text = "导出";
this.button2.UseVisualStyleBackColor = false;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.Enabled = false;
this.comboBox2.Location = new System.Drawing.Point(694, 14);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(69, 20);
this.comboBox2.TabIndex = 54;
//
// ultraMaskedEdit2
//
editorButton1.Key = "edit";
editorButton2.Key = "clear";
this.ultraMaskedEdit2.ButtonsRight.Add(editorButton1);
this.ultraMaskedEdit2.ButtonsRight.Add(editorButton2);
this.ultraMaskedEdit2.EditAs = Infragistics.Win.UltraWinMaskedEdit.EditAsType.String;
this.ultraMaskedEdit2.Enabled = false;
this.ultraMaskedEdit2.Location = new System.Drawing.Point(102, 45);
this.ultraMaskedEdit2.Name = "ultraMaskedEdit2";
this.ultraMaskedEdit2.PromptChar = ' ';
this.ultraMaskedEdit2.Size = new System.Drawing.Size(121, 21);
this.ultraMaskedEdit2.TabIndex = 85;
this.ultraMaskedEdit2.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultraMaskedEdit1_EditorButtonClick);
//
// ultraMaskedEdit1
//
editorButton3.Key = "edit";
editorButton4.Key = "clear";
this.ultraMaskedEdit1.ButtonsRight.Add(editorButton3);
this.ultraMaskedEdit1.ButtonsRight.Add(editorButton4);
this.ultraMaskedEdit1.EditAs = Infragistics.Win.UltraWinMaskedEdit.EditAsType.String;
this.ultraMaskedEdit1.Enabled = false;
this.ultraMaskedEdit1.Location = new System.Drawing.Point(103, 14);
this.ultraMaskedEdit1.Name = "ultraMaskedEdit1";
this.ultraMaskedEdit1.PromptChar = ' ';
this.ultraMaskedEdit1.Size = new System.Drawing.Size(120, 21);
this.ultraMaskedEdit1.TabIndex = 84;
this.ultraMaskedEdit1.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultraMaskedEdit1_EditorButtonClick);
//
// cboGW
//
this.cboGW.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboGW.Enabled = false;
this.cboGW.Items.AddRange(new object[] {
"转炉",
"吹氩站",
"精炼炉",
"RH炉",
"脱硫"});
this.cboGW.Location = new System.Drawing.Point(232, 45);
this.cboGW.Name = "cboGW";
this.cboGW.Size = new System.Drawing.Size(71, 20);
this.cboGW.TabIndex = 69;
this.cboGW.SelectedIndexChanged += new System.EventHandler(this.cboGW_SelectedIndexChanged);
//
// cboGWID
//
this.cboGWID.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboGWID.Enabled = false;
this.cboGWID.Location = new System.Drawing.Point(310, 45);
this.cboGWID.Name = "cboGWID";
this.cboGWID.Size = new System.Drawing.Size(144, 20);
this.cboGWID.TabIndex = 70;
//
// checkBox4
//
this.checkBox4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox4.Location = new System.Drawing.Point(643, 12);
this.checkBox4.Name = "checkBox4";
this.checkBox4.Size = new System.Drawing.Size(55, 24);
this.checkBox4.TabIndex = 63;
this.checkBox4.Text = "班组";
this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox4_CheckedChanged);
//
// checkBox3
//
this.checkBox3.Enabled = false;
this.checkBox3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox3.Location = new System.Drawing.Point(259, 44);
this.checkBox3.Name = "checkBox3";
this.checkBox3.Size = new System.Drawing.Size(98, 24);
this.checkBox3.TabIndex = 62;
this.checkBox3.Text = "工序位置";
this.checkBox3.Visible = false;
this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox3_CheckedChanged);
//
// checkBox2
//
this.checkBox2.Checked = true;
this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox2.Location = new System.Drawing.Point(234, 12);
this.checkBox2.Name = "checkBox2";
this.checkBox2.Size = new System.Drawing.Size(70, 24);
this.checkBox2.TabIndex = 61;
this.checkBox2.Text = "时间从";
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
//
// checkBox1
//
this.checkBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.checkBox1.Location = new System.Drawing.Point(12, 12);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(88, 24);
this.checkBox1.TabIndex = 60;
this.checkBox1.Text = "熔炼号从";
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(457, 17);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(21, 14);
this.label6.TabIndex = 59;
this.label6.Text = "到";
//
// dateTimePicker2
//
this.dateTimePicker2.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker2.Location = new System.Drawing.Point(494, 14);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.Size = new System.Drawing.Size(144, 21);
this.dateTimePicker2.TabIndex = 58;
//
// dateTimePicker1
//
this.dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dateTimePicker1.Location = new System.Drawing.Point(310, 14);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(144, 21);
this.dateTimePicker1.TabIndex = 56;
//
// button1
//
this.button1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(769, 10);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 28);
this.button1.TabIndex = 55;
this.button1.Text = "查询";
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(65, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(21, 14);
this.label2.TabIndex = 50;
this.label2.Text = "到";
//
// frmAdditStatHis
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.ClientSize = new System.Drawing.Size(904, 437);
this.Controls.Add(this.panel1);
this.Name = "frmAdditStatHis";
this.Text = "frmAdditStat";
this.Load += new System.EventHandler(this.frmAdditStatHis_Load);
this.ultraTabPageControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
this.ultraTabPageControl2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ultraGrid2)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ultraTabControl1)).EndInit();
this.ultraTabControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit();
this.ultraGroupBox1.ResumeLayout(false);
this.ultraGroupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
#endregion
#region " Valiable "
private DataSet _dsHj = new DataSet();
private DataSet _dsFl = new DataSet();
public string _strWhere = " where to_char(jobtime, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd')";
public string _strCob1 = "";
public string _strCob2 = "";
#endregion
#region " Init "
#region " 金属料 "
private void InitData1()
{
try
{
UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
band.Columns[0].Header.Caption = "加热处理号";
band.Columns[0].Width = 80;
band.Columns[0].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[0].Hidden = true;
band.Columns[1].Header.Caption = "熔炼号";
band.Columns[1].Width = 80;
band.Columns[1].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[2].Header.Caption = "牌号";
band.Columns[2].Width = 70;
band.Columns[2].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[3].Header.Caption = "设备号";
band.Columns[3].Width = 60;
band.Columns[3].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
//band.Columns[2].Hidden = true;
band.Columns[4].Header.Caption = "班次";
band.Columns[4].Width = 60;
band.Columns[4].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
//band.Columns[2].Hidden = true;
int intIronWsteel = 0;
if (cboGW.Text == "转炉" && this.ultraTabControl1.Tabs[0].Selected == true)
{
band.Columns[5].Header.Caption = "铁水";
band.Columns[5].Width = 60;
band.Columns[5].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[6].Header.Caption = "废钢";
band.Columns[6].Width = 60;
band.Columns[6].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
intIronWsteel = 2;
}
string strSel = "";
if (this.checkBox3.Checked)
strSel = string.Format("MATERIELTYPE='HJ'"); ///, "BOF0" + Convert.ToString(this.cboGWID.SelectedIndex + 1));
else
strSel = "MATERIELTYPE='HJ'";
DataRow[] drs = _dsGridInfo.Tables[0].Select(strSel);//, "wlbm ASC");
int count = drs.Length;
for (int i = 0; i < count; i++)
{
DataRow dr = drs[i];
band.Columns[5 + intIronWsteel + i].Header.Caption = dr["materielforshort"].ToString();
band.Columns[5 + intIronWsteel + i].Width = 70;
band.Columns[5 + intIronWsteel + i].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
band.Columns[5 + intIronWsteel + i].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[5 + intIronWsteel + i].Format = "#########.00";
}
//band.Columns[6 + count].Hidden = true;
//band.Columns[6 + count + 1].Hidden = true;
this.ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = RowSelectorNumberStyle.RowIndex;
if (band.Summaries.Count > 0 && band.Summaries.Count==count) return;
band.Summaries.Clear();
SummarySettings summary = band.Summaries.Add(SummaryType.Count, band.Columns[1]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
summary.DisplayFormat = "合计:";
summary = band.Summaries.Add(SummaryType.Count, band.Columns[1]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
summary.DisplayFormat = "平均:";
for (int i = 5; i < 5 + count + intIronWsteel; i++)
{
summary = band.Summaries.Add(SummaryType.Sum, band.Columns[i]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
if (i > 4)
summary.DisplayFormat = " {0:#####}";
else
summary.DisplayFormat = " {0:#####.000}";
summary.Appearance.TextHAlign = HAlign.Right;
summary.Appearance.ForeColor = Color.DarkBlue;
summary.Appearance.BackColor = Color.White;
summary = band.Summaries.Add(SummaryType.Average, band.Columns[i]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
if (i > 4)
summary.DisplayFormat = " {0:#####}";
else
summary.DisplayFormat = " {0:#####.000}";
summary.Appearance.TextHAlign = HAlign.Right;
summary.Appearance.ForeColor = Color.DarkBlue;
summary.Appearance.BackColor = Color.White;
}
band.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;
}
catch
{ }
}
#endregion
#region " 散装料 "
private void InitData2()
{
try
{
UltraGridBand band = this.ultraGrid2.DisplayLayout.Bands[0];
band.Columns[0].Header.Caption = "加热处理号";
band.Columns[0].Width = 80;
band.Columns[0].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[0].Hidden = true;
band.Columns[1].Header.Caption = "熔炼号";
band.Columns[1].Width = 80;
band.Columns[1].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[2].Header.Caption = "牌号";
band.Columns[2].Width = 70;
band.Columns[2].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[3].Header.Caption = "设备号";
band.Columns[3].Width = 60;
band.Columns[3].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
//band.Columns[2].Hidden = true;
band.Columns[4].Header.Caption = "班次";
band.Columns[4].Width = 60;
band.Columns[4].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
//band.Columns[2].Hidden = true;
string strSel = "";
if (this.checkBox3.Checked)
strSel = "MATERIELTYPE='FL'";//strSel = string.Format("wllx='FL' and lcwz='{0}'", "CVT0"+Convert.ToString(this.comboBox1.SelectedIndex+1));
else
strSel = "MATERIELTYPE='FL'";
DataRow[] drs = _dsGridInfo.Tables[0].Select(strSel);
int count = drs.Length;
for (int i = 0; i < count; i++)
{
DataRow dr = drs[i];
band.Columns[5 + i].Header.Caption = dr["materielforshort"].ToString();
band.Columns[5 + i].Width = 85;
band.Columns[5 + i].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
band.Columns[5 + i].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
band.Columns[5 + i].Format = "#########.00";
//if (i >= count - 4) ////////////// add by tsh on 08-01-05
//band.Columns[1 + i].Hidden = true;
}
this.ultraGrid2.DisplayLayout.Override.RowSelectorNumberStyle = RowSelectorNumberStyle.RowIndex;
if (band.Summaries.Count > 0 && band.Summaries.Count == count) return;
band.Summaries.Clear();
SummarySettings summary = band.Summaries.Add(SummaryType.Count, band.Columns[1]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
summary.DisplayFormat = "合计:";
summary = band.Summaries.Add(SummaryType.Count, band.Columns[1]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
summary.DisplayFormat = "平均:";
for (int i = 5; i < 5 + count; i++)
{
summary = band.Summaries.Add(SummaryType.Sum, band.Columns[i]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
if (i > 4)
summary.DisplayFormat = " {0:#####}";
else
summary.DisplayFormat = " {0:#####.000}";
summary.Appearance.TextHAlign = HAlign.Right;
summary.Appearance.ForeColor = Color.DarkBlue;
summary.Appearance.BackColor = Color.White;
summary = band.Summaries.Add(SummaryType.Average, band.Columns[i]);
summary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
if (i > 4)
summary.DisplayFormat = " {0:#####}";
else
summary.DisplayFormat = " {0:#####.000}";
summary.Appearance.TextHAlign = HAlign.Right;
summary.Appearance.ForeColor = Color.DarkBlue;
summary.Appearance.BackColor = Color.White;
}
band.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;
}
catch
{ }
}
#endregion
#endregion
#region " Control Events "
private void EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraMaskedEdit ume = (UltraMaskedEdit)sender;
switch (e.Button.Key)
{
case "edit":
frmNumberWriter frm = new frmNumberWriter();
frm._strText = ume.Text.Trim();
frm.Location = GetChildWindowLocation(frm.Size);
frm.ShowDialog();
ume.Text = frm._strText;
break;
case "clear":
if (ume.Text.Trim().Length > 0)
{
ume.Tag = ume.Text.Trim();
ume.Text = "";
}
else
{
if (ume.Tag != null)
ume.Text = ume.Tag.ToString();
}
break;
}
}
//==========================================================
// 获取子窗体弹出的位置坐标
//==========================================================
private Point GetChildWindowLocation(Size ChildWindowSize)
{
int width = Cursor.Position.X + ChildWindowSize.Width - Screen.PrimaryScreen.Bounds.Width;
int height = Cursor.Position.Y + ChildWindowSize.Height - Screen.PrimaryScreen.Bounds.Height + 30;
if (width > 0)
width = Cursor.Position.X - width;
else
width = Cursor.Position.X;
if (height > 0)
height = Cursor.Position.Y - height + 10;
else
height = Cursor.Position.Y + 10;
return new Point(width, height);
}
private void InitControl()
{
this.comboBox2.DataSource = BuildTableDuty();
this.comboBox2.ValueMember = "id";
this.comboBox2.DisplayMember = "name";
if (_strCob2 == "")
this.comboBox2.SelectedIndex = 0;
else
this.comboBox2.SelectedValue = _strCob2;
//if (_strCob1 == "")
// this.cboGWID.SelectedIndex = 0;
//else
// this.cboGWID.SelectedIndex = Convert.ToInt32(_strCob1.Substring(0,1))-1;
}
///
/// 初始化班次
///
///
private DataTable BuildTableDuty()
{
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("id", typeof(System.String));
dt.Columns.Add(dc);
dc = new DataColumn("name", typeof(System.String));
dt.Columns.Add(dc);
DataRow dr = dt.NewRow();
dr[0] = "0";
dr[1] = "全部";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "1";
dr[1] = "甲";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "2";
dr[1] = "乙";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "3";
dr[1] = "丙";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "4";
dr[1] = "丁";
dt.Rows.Add(dr);
dt.AcceptChanges();
return dt;
}
#endregion
#region " Control Events "
private void ultraGrid2_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
UltraGridBand band = this.ultraGrid2.DisplayLayout.Bands[0];
if (this.ultraGrid2.Rows.Count < 1) return;
try
{
DateTime dtForeTime = Convert.ToDateTime(this.ultraGrid2.Rows[0].Cells[18].Value);
DateTime dtCurrTime = dtForeTime;
TimeSpan ts = new TimeSpan();
for (int i = 1; i < this.ultraGrid2.Rows.Count; i++)
{
dtCurrTime = Convert.ToDateTime(this.ultraGrid2.Rows[i].Cells[18].Value);
ts = dtCurrTime - dtForeTime;
if (ts.Minutes > 99 || ts.Minutes < 0)
this.ultraGrid2.Rows[i].Cells[20].Value = 0;
else
this.ultraGrid2.Rows[i].Cells[20].Value = ts.Minutes;
dtForeTime = dtCurrTime;
}
}
catch { }
}
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
this.ultraMaskedEdit1.Enabled = this.checkBox1.Checked;
this.ultraMaskedEdit2.Enabled = this.checkBox1.Checked;
}
private void checkBox2_CheckedChanged(object sender, System.EventArgs e)
{
this.dateTimePicker1.Enabled = this.checkBox2.Checked;
this.dateTimePicker2.Enabled = this.checkBox2.Checked;
}
private void checkBox3_CheckedChanged(object sender, System.EventArgs e)
{
this.cboGWID.Enabled = this.checkBox3.Checked;
// this.cboGW.Enabled = this.checkBox3.Checked;
}
private void checkBox4_CheckedChanged(object sender, System.EventArgs e)
{
this.comboBox2.Enabled = this.checkBox4.Checked;
}
#endregion
#region " InitGrid "
private DataSet _dsGridInfo;
private void GetGridInfo()
{
try
{
string addTalbeName = "";
string strWhere = "";
string strgw = Convert.ToString(GetGW(this.cboGW.SelectedIndex));
string resTalbeName = TableName(strgw, out addTalbeName);
if (checkBox2.Checked) //时间
strWhere = " and a.updatetime>=to_date('" + dateTimePicker1.Value.ToString() + "','yyyy-MM-dd HH24:mi:ss') " +
" and a.updatetime<=to_date('" + dateTimePicker2.Value.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
else
strWhere = " and a.updatetime>=to_date('" + System.DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00" + "','yyyy-MM-dd HH24:mi:ss') " +
" and a.updatetime<=to_date('" + System.DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59" + "','yyyy-MM-dd HH24:mi:ss') ";
//if (Convert.ToString(Convert.ToString(this.cboGWID.SelectedIndex)) != "0") //岗位
// strWhere += " and a.stationcode='" + addTalbeName + "0" + Convert.ToString(Convert.ToString(this.cboGWID.SelectedIndex)) + "'";
//else
// strWhere += " and a.stationcode like '" + addTalbeName + "%'";
if (this.ultraTabControl1.Tabs[0].Selected == true)
strWhere += " and a.MATERIELTYPE='HJ'";
else
strWhere += " and a.MATERIELTYPE='FL'";
_dsGridInfo = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("lgIntegrationQuery", "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", "GetAddGridInfoHis", new object[] { addTalbeName, strWhere }, out strOut);
// _dsGridInfo = this.RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private string GetSqlWhere2()
{
string str = "";
if (this.checkBox4.Checked)
{
str = string.Format(" where substr(bc,2,1)='{0}' ", this.comboBox2.SelectedIndex + 1);
}
return str;
}
private string GetSqlWhere1()
{
string str = " where 1=1 ";
if (this.checkBox1.Checked)
{
str += string.Format(" and (lh >= '{0}' and lh <= '{1}') ",
this.ultraMaskedEdit1.Text.Trim(), this.ultraMaskedEdit2.Text.Trim());
}
if (this.checkBox2.Checked)
{
str += string.Format(" and (jlsk >= to_date('{0}','yyyy-MM-dd HH24:mi:ss') "
+ " and jlsk <= to_date('{1}','yyyy-MM-dd HH24:mi:ss')) ",
this.dateTimePicker1.Text, this.dateTimePicker2.Text);
}
return str;
}
private void button1_Click(object sender, System.EventArgs e)
{
GetAdditStat();
}
///
/// 获取物料信息
///
private void GetAdditStat()
{
string sqlstr;
string addTalbeName = "";
string strGw = Convert.ToString(GetGW(this.cboGW.SelectedIndex));
string strGWID = Convert.ToString(this.cboGWID.SelectedIndex);
string strWhere = "";
GetGridInfo(); //初始化物料信息列名
if (this.ultraTabControl1.Tabs[0].Selected == true)
sqlstr = BuildSql(Convert.ToString(Convert.ToString(this.cboGWID.SelectedIndex)), "HJ");
else
sqlstr = BuildSql(Convert.ToString(Convert.ToString(this.cboGWID.SelectedIndex)), "FL");
if (checkBox2.Checked) //时间
strWhere = " and t.jmdate>=to_date('" + dateTimePicker1.Value.ToString() + "','yyyy-MM-dd HH24:mi:ss') " +
" and t.jmdate<=to_date('" + dateTimePicker2.Value.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
else
strWhere = " and t.jmdate>=to_date('" + System.DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00" +"','yyyy-MM-dd HH24:mi:ss') " +
" and t.jmdate<=to_date('" + System.DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59" +"','yyyy-MM-dd HH24:mi:ss') ";
try
{
string resTalbeName = TableName(strGw, out addTalbeName);
if (this.ultraTabControl1.Tabs[0].Selected == true)
{
strWhere += " and t.MATERIELTYPE = 'HJ'";
_dsHj = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("lgIntegrationQuery", "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", "GetADDITIVESHis", new object[] { sqlstr, strWhere, resTalbeName, addTalbeName }, out strOut);
// _dsHj = this.RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;
DataTable dtHj = FormatData(_dsHj, "HJ");
this.ultraGrid1.DataSource = dtHj;
InitData1();
}
else
{
strWhere += " and t.MATERIELTYPE = 'FL'";
_dsFl = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod("lgIntegrationQuery", "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", "GetADDITIVESHis", new object[] { sqlstr, strWhere, resTalbeName, addTalbeName }, out strOut);
DataTable dtFl = FormatData(_dsFl, "FL");
this.ultraGrid2.DataSource = dtFl;
InitData2();
// _dsFl = this.RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;
// this.ultraGrid2.DataSource = _dsFl;
// InitData2();
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
///
/// 将获取的数据序列化
///
///
///
private DataTable FormatData(DataSet _dsFl,string Type)
{
DataTable dtFl = new DataTable();
dtFl.Columns.Add("heatprocessno");
dtFl.Columns.Add("heatno");
dtFl.Columns.Add("STEEL");
dtFl.Columns.Add("STATIONCODE");
dtFl.Columns.Add("SHIFTCODE");
if (cboGW.Text == "转炉" && Type =="HJ")
{
dtFl.Columns.Add("IRONPOTWGT"); //铁水
dtFl.Columns.Add("WSTEELWGT"); //废钢
}
string strSel = "";
if (this.checkBox3.Checked)
strSel = "MATERIELTYPE='" + Type + "'";//strSel = string.Format("wllx='FL' and lcwz='{0}'", "CVT0"+Convert.ToString(this.comboBox1.SelectedIndex+1));
else
strSel = "MATERIELTYPE='" + Type + "'";
DataRow[] drs = _dsGridInfo.Tables[0].Select(strSel);
int count = drs.Length;
for (int i = 0; i < count; i++)
{
DataRow dr = drs[i];
dtFl.Columns.Add(dr[0].ToString() + "_" + dr[2].ToString().Substring(0, dr[2].ToString().IndexOf('-')));
}
bool bolIs = false;
foreach (DataRow drfl in _dsFl.Tables[0].Rows)
{
foreach (DataRow Isdrfl in dtFl.Rows)
{
if (drfl["heatprocessno"].ToString() == Isdrfl["heatprocessno"].ToString())
{
bolIs = true;
break;
}
}
if (!bolIs)
{
DataRow drFL = dtFl.NewRow();
drFL["heatprocessno"] = drfl["heatprocessno"].ToString();
drFL["heatno"] = drfl["heatno"].ToString();
drFL["STEEL"] = drfl["STEEL"].ToString();
drFL["STATIONCODE"] = drfl["WSID"].ToString() + GetGW(drfl["STATIONCODE"].ToString());
drFL["SHIFTCODE"] =GetBC( drfl["SHIFTCODE"].ToString());
if (cboGW.Text == "转炉" && Type=="HJ")
{
drFL["IRONPOTWGT"] = drfl["IRONPOTWGT"].ToString();//铁水
drFL["WSTEELWGT"] = drfl["WSTEELWGT"].ToString();//废钢
}
foreach (DataColumn dcfl in dtFl.Columns)
{
if (dcfl.ColumnName.ToString() == drfl["MATERIELCODE"].ToString() + "_" + drfl["hoppernumid"].ToString())
{
drFL[dcfl.ColumnName.ToString()] = drfl["JMWGT"].ToString();
}
}
dtFl.Rows.Add(drFL);
bolIs = false;
}
else
{
foreach (DataRow drFlvalue in dtFl.Rows)
{
if (drFlvalue["heatprocessno"].ToString() == drfl["heatprocessno"].ToString())
{
foreach (DataColumn dcfl in dtFl.Columns)
{
if (dcfl.ColumnName.ToString() == drfl["MATERIELCODE"].ToString() + "_" + drfl["hoppernumid"].ToString())
{
drFlvalue[dcfl.ColumnName.ToString()] = drfl["JMWGT"].ToString();
}
}
bolIs = false;
}
}
}
}
return dtFl;
}
private string BuildSql(string wsid, string WlType)
{
string sqlstr = "";
if (checkBox2.Checked) //时间
sqlstr = " and a.optdate>=to_date('" + dateTimePicker1.Value.ToString() + "','yyyy-MM-dd HH24:mi:ss') " +
" and a.optdate<=to_date('" + dateTimePicker2.Value.ToString() + "','yyyy-MM-dd HH24:mi:ss') ";
else
sqlstr = " and a.optdate>=to_date('" + System.DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00" + "','yyyy-MM-dd HH24:mi:ss') " +
" and a.optdate<=to_date('" + System.DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59" + "','yyyy-MM-dd HH24:mi:ss') ";
if (checkBox1.Checked) //熔炼号
{
if (!string.IsNullOrEmpty(ultraMaskedEdit1.Text) && !string.IsNullOrEmpty(ultraMaskedEdit2.Text))
{
if (string.Compare(ultraMaskedEdit1.Text.Trim(), ultraMaskedEdit2.Text.Trim()) != 1)
sqlstr += " and a.heatno>='" + ultraMaskedEdit1.Text.ToString() + "' and a.heatno<='" + ultraMaskedEdit2.Text.ToString() + "'";
else
MessageBox.Show("结束熔炼号不能大于开始熔炼号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else if (!string.IsNullOrEmpty(ultraMaskedEdit1.Text) && string.IsNullOrEmpty(ultraMaskedEdit2.Text))
sqlstr += " and a.heatno='" + ultraMaskedEdit1.Text.ToString() + "'";
else if (string.IsNullOrEmpty(ultraMaskedEdit1.Text) && !string.IsNullOrEmpty(ultraMaskedEdit2.Text))
sqlstr += " and a.heatno='" + ultraMaskedEdit2.Text.ToString() + "'";
}
if (wsid != "0") //岗位
sqlstr += " and a.stationcode='0" + wsid + "'";
if(checkBox4.Checked && this.comboBox2.SelectedIndex !=0 )
sqlstr += " and substr(SHIFTCODE,2,1)='" + comboBox2.SelectedIndex + "'";
//钢种
if (chkSteel.Checked && txtSteel.Text.Trim().Length > 0)
{
string strSteeAll = "", str = "";
string[] strSteel = txtSteel.Text.Split(',');
for (int i = 0; i < strSteel.Length; i++)
{
if (!string.IsNullOrEmpty(strSteel[i]))
strSteeAll = strSteeAll + "'" + strSteel[i] + "',";
}
str = strSteeAll.Substring(0, strSteeAll.Length - 1);
sqlstr += string.Format(" and a.plansteel in ({0})", str); // lower(b.jhgz)
}
//sqlstr += " and b.MATERIELTYPE='" + WlType + "'"; //物料类型(合金、辅料)
return sqlstr;
}
#endregion
private void ultraMaskedEdit1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
UltraMaskedEdit ume = (UltraMaskedEdit)sender;
switch (e.Button.Key)
{
case "edit":
frmNumberWriter frm = new frmNumberWriter();
frm._strText = ume.Text.Trim();
frm.Location = GetChildWindowLocation(frm.Size);
frm.ShowDialog();
ume.Text = frm._strText;
break;
case "clear":
if (ume.Text.Trim().Length > 0)
{
ume.Tag = ume.Text.Trim();
ume.Text = "";
}
else
{
if (ume.Tag != null)
ume.Text = ume.Tag.ToString();
}
break;
}
}
private void cboGW_SelectedIndexChanged(object sender, EventArgs e)
{
cboGWID.Items.Clear();
cboGWID.Items.AddRange(GetCWIDItems(cboGW.SelectedIndex));
cboGWID.SelectedIndex = 0;
}
///
/// 初始化工位
///
///
///
private object[] GetCWIDItems(int index)
{
switch (index)
{
case 0:
return new object[] { "所有", "1#转炉", "2#转炉", "3#转炉" };
case 1:
return new object[] { "所有", "1#吹氩站", "2#吹氩站", "3#吹氩站" };
case 2:
return new object[] { "所有", "1#精炼炉", "2#精炼炉" };
case 3:
return new object[] { "所有", "1#RH炉", "2#RH炉" };
case 4:
return new object[] { "所有", "1#脱硫", "2#脱硫" };
default:
return new object[] { "所有岗位" };
}
}
///
/// 岗位编码
///
///
///
private string GetGW(int index)
{
switch (index)
{
case 0:
return "BOF0";
case 1:
return "CAS0";
case 2:
return "LFS0";
case 3:
return "RHS0";
case 4:
return "HMP0";
default:
return "0";
}
}
///
/// 岗位名称
///
///
///
private string GetGW(string GwID)
{
switch (GwID)
{
case "BOF0":
return "#转炉";
case "CAS0":
return "#吹氩";
case "LFS0":
return "#钢包";
case "RHS0":
return "RH炉";
case "HMP0":
return "脱硫";
default:
return "";
}
}
///
/// 班别
///
///
///
private string GetBC(string bcID)
{
string bb = "";
if (bcID.Length > 1) bb = bcID.Substring(1, 1);
switch (bb)
{
case "1":
return "甲";
case "2":
return "乙";
case "3":
return "丙";
case "4":
return "丁";
default:
return "";
}
}
///
/// 根据岗位获取表名
///
/// 岗位
/// 物料表
/// 返回实绩信息表
private string TableName(string GWID, out string addTableName)
{
string resTableName = "";
string addtableName = "";
switch (GWID)
{
case "BOF0":
resTableName = "JOB_BOF_Optinfo";
addtableName = "C";
break;
case "CAS0":
resTableName = "JOB_CAS_Optinfo";
addtableName = "D";
break;
case "RHS0":
resTableName = "JOB_RHS_Optinfo";
addtableName = "F";
break;
case "LFS0":
resTableName = "JOB_LFS_Optinfo";
addtableName = "E";
break;
case "HMP0":
resTableName = "JOB_HMP_Optinfo";
addtableName = "B";
break;
}
addTableName = addtableName;
return resTableName;
}
private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
{
GetAdditStat();
}
private void ExportExcel()
{
try
{
string StrfileName = System.Windows.Forms.Application.StartupPath + "\\Report\\物料消耗明细.xls";
if(ultraTabControl1.SelectedTab.Index==0)
this.GridExcelExporter.Export(this.ultraGrid1, StrfileName);
else
this.GridExcelExporter.Export(this.ultraGrid2, StrfileName);
ProcessStartInfo p = new ProcessStartInfo(StrfileName);
p.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
Process.Start(p);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n处理方法:查看(" + System.Windows.Forms.Application.StartupPath + ")目录下是否有[ Report文件夹 ],如果没有请手动创建!");
}
}
private void button2_Click(object sender, EventArgs e)
{
ExportExcel();
}
private void chkSteel_CheckedChanged(object sender, EventArgs e)
{
txtSteel.Enabled = chkSteel.Checked;
}
private void frmAdditStatHis_Load(object sender, EventArgs e)
{
ultraGrid1.Font = new System.Drawing.Font("Tahoma", 9F);
ultraGrid2.Font = new System.Drawing.Font("Tahoma", 9F);
this.dateTimePicker1.Text = System.DateTime.Today.ToString("yyyy-MM-dd") + " 00:00:00";
this.dateTimePicker2.Text = System.DateTime.Today.ToString("yyyy-MM-dd") + " 23:59:59";
cboGW.SelectedIndex = 0;
checkBox3.Checked = true;
InitControl();
GetGridInfo();
}
}
}