using System; using System.IO; using System.Drawing; using System.Collections; using System.Diagnostics; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Threading; using CoreFS.CA06; using Infragistics.Win.UltraWinMaskedEdit; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; namespace Core.LgMes.Client.LgIntegrationQuery { /// /// ELEMENTS 的摘要说明。 /// public class frmLgElementsHis : Core.Mes.Client.Common.frmStyleBase { #region " Construct " private Infragistics.Win.Misc.UltraGroupBox ultraGroupBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.ComponentModel.IContainer components; private System.Windows.Forms.Label label3; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox comboBox2; private System.Windows.Forms.Label label7; private System.Windows.Forms.ComboBox comboBox3; private System.Windows.Forms.Label label8; private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.Label label9; public string StrPost = "0"; private Label label11; private Label label10; private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor dateTimePicker1; private Infragistics.Win.UltraWinEditors.UltraDateTimeEditor dateTimePicker2; private UltraMaskedEdit ultraMaskedEdit1; private UltraMaskedEdit ultraMaskedEdit2; private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter GridExcelExporter; private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager ultraToolbarsManager1; private UltraGrid EMGrid; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Bottom; private string m_szEntry = ""; private DataSet dataSet1; private DataTable dataTable1; private DataColumn dataColumn7; private DataColumn dataColumn8; private DataColumn dataColumn9; private DataColumn dataColumn84; private DataColumn dataColumn85; string[] strERow; private TextBox txtSteel; private CheckBox chkGasSample; //化学成份列名 string[] strRowName = new string[] { "C", "Si", "Mn", "P", "S", "Als", "V", "Nb", "Ti", "Asn", "Sn", "Cu", "Sb", "Alt", "O", "N", "H" }; private DataColumn dataColumn1; Int32 intSelectedIndex = -1; //选择的岗位 public frmLgElementsHis(string szPost) { InitializeComponent(); this._devPos = szPost; } public frmLgElementsHis() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); this._devPos = StrPost; } public frmLgElementsHis(string szEntry, string szLH) { InitializeComponent(); this._devPos = StrPost; this.m_szEntry = szEntry; this.ultraMaskedEdit1.Text = szLH; } /// /// 清理所有正在使用的资源。 /// protected override void Dispose(bool disposing) { try { if (_getDataThread != null) _getDataThread.Abort(); } catch { } if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); 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"); Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand1 = new Infragistics.Win.UltraWinGrid.UltraGridBand("Table1", -1); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("序号"); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("熔炼号"); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("计划牌号"); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("化验时间"); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn5 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("JHGZ"); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn6 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("shiftcode", -1, 7905313); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); Infragistics.Win.ValueList valueList1 = new Infragistics.Win.ValueList(7905313); Infragistics.Win.ValueListItem valueListItem1 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem2 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem3 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem4 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem5 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem6 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem7 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem8 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem9 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem10 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem11 = new Infragistics.Win.ValueListItem(); Infragistics.Win.ValueListItem valueListItem12 = new Infragistics.Win.ValueListItem(); Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar1"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("set"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("excel"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SRow"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("set"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("excel"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("SRow"); this.ultraGroupBox1 = new Infragistics.Win.Misc.UltraGroupBox(); this.chkGasSample = new System.Windows.Forms.CheckBox(); this.txtSteel = new System.Windows.Forms.TextBox(); this.ultraMaskedEdit2 = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit(); this.ultraMaskedEdit1 = new Infragistics.Win.UltraWinMaskedEdit.UltraMaskedEdit(); this.dateTimePicker2 = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor(); this.dateTimePicker1 = new Infragistics.Win.UltraWinEditors.UltraDateTimeEditor(); this.label11 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.checkBox1 = new System.Windows.Forms.CheckBox(); this.comboBox3 = new System.Windows.Forms.ComboBox(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label8 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.comboBox2 = new System.Windows.Forms.ComboBox(); this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.EMGrid = new Infragistics.Win.UltraWinGrid.UltraGrid(); this.dataSet1 = new System.Data.DataSet(); this.dataTable1 = new System.Data.DataTable(); this.dataColumn7 = new System.Data.DataColumn(); this.dataColumn8 = new System.Data.DataColumn(); this.dataColumn9 = new System.Data.DataColumn(); this.dataColumn84 = new System.Data.DataColumn(); this.dataColumn85 = new System.Data.DataColumn(); this.dataColumn1 = new System.Data.DataColumn(); this._panel1_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.ultraToolbarsManager1 = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this._panel1_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._panel1_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._panel1_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.GridExcelExporter = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter(this.components); ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).BeginInit(); this.ultraGroupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dateTimePicker2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dateTimePicker1)).BeginInit(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.EMGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).BeginInit(); this.SuspendLayout(); // // ultraGroupBox1 // this.ultraGroupBox1.Controls.Add(this.chkGasSample); this.ultraGroupBox1.Controls.Add(this.txtSteel); this.ultraGroupBox1.Controls.Add(this.ultraMaskedEdit2); this.ultraGroupBox1.Controls.Add(this.ultraMaskedEdit1); this.ultraGroupBox1.Controls.Add(this.dateTimePicker2); this.ultraGroupBox1.Controls.Add(this.dateTimePicker1); this.ultraGroupBox1.Controls.Add(this.label11); this.ultraGroupBox1.Controls.Add(this.label10); this.ultraGroupBox1.Controls.Add(this.label9); this.ultraGroupBox1.Controls.Add(this.checkBox1); this.ultraGroupBox1.Controls.Add(this.comboBox3); this.ultraGroupBox1.Controls.Add(this.comboBox1); this.ultraGroupBox1.Controls.Add(this.label8); this.ultraGroupBox1.Controls.Add(this.label7); this.ultraGroupBox1.Controls.Add(this.comboBox2); this.ultraGroupBox1.Controls.Add(this.button3); this.ultraGroupBox1.Controls.Add(this.button2); this.ultraGroupBox1.Controls.Add(this.button1); this.ultraGroupBox1.Controls.Add(this.textBox1); this.ultraGroupBox1.Controls.Add(this.label6); this.ultraGroupBox1.Controls.Add(this.label5); this.ultraGroupBox1.Controls.Add(this.label4); this.ultraGroupBox1.Controls.Add(this.label1); this.ultraGroupBox1.Dock = System.Windows.Forms.DockStyle.Top; this.ultraGroupBox1.Location = new System.Drawing.Point(0, 28); this.ultraGroupBox1.Name = "ultraGroupBox1"; this.ultraGroupBox1.Size = new System.Drawing.Size(1008, 77); this.ultraGroupBox1.TabIndex = 3; // // chkGasSample // this.chkGasSample.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.chkGasSample.Location = new System.Drawing.Point(656, 44); this.chkGasSample.Name = "chkGasSample"; this.chkGasSample.Size = new System.Drawing.Size(82, 24); this.chkGasSample.TabIndex = 85; this.chkGasSample.Text = "气体样"; // // txtSteel // this.txtSteel.Location = new System.Drawing.Point(553, 46); this.txtSteel.Name = "txtSteel"; this.txtSteel.Size = new System.Drawing.Size(87, 21); this.txtSteel.TabIndex = 84; // // ultraMaskedEdit2 // editorButton1.Key = "edit"; editorButton1.Text = ""; editorButton2.Key = "clear"; this.ultraMaskedEdit2.ButtonsRight.Add(editorButton1); this.ultraMaskedEdit2.ButtonsRight.Add(editorButton2); this.ultraMaskedEdit2.EditAs = Infragistics.Win.UltraWinMaskedEdit.EditAsType.String; this.ultraMaskedEdit2.Location = new System.Drawing.Point(239, 46); this.ultraMaskedEdit2.Name = "ultraMaskedEdit2"; this.ultraMaskedEdit2.PromptChar = ' '; this.ultraMaskedEdit2.Size = new System.Drawing.Size(126, 21); this.ultraMaskedEdit2.TabIndex = 83; this.ultraMaskedEdit2.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.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.Location = new System.Drawing.Point(84, 46); this.ultraMaskedEdit1.Name = "ultraMaskedEdit1"; this.ultraMaskedEdit1.PromptChar = ' '; this.ultraMaskedEdit1.Size = new System.Drawing.Size(126, 21); this.ultraMaskedEdit1.TabIndex = 82; this.ultraMaskedEdit1.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.EditorButtonClick); // // dateTimePicker2 // this.dateTimePicker2.FormatProvider = new System.Globalization.CultureInfo("en-US"); this.dateTimePicker2.FormatString = "yyyy-MM-dd HH:mm"; this.dateTimePicker2.Location = new System.Drawing.Point(239, 15); this.dateTimePicker2.MaskInput = "yyyy-mm-dd hh:mm"; this.dateTimePicker2.Name = "dateTimePicker2"; this.dateTimePicker2.Size = new System.Drawing.Size(126, 21); this.dateTimePicker2.TabIndex = 80; // // dateTimePicker1 // this.dateTimePicker1.FormatProvider = new System.Globalization.CultureInfo("en-US"); this.dateTimePicker1.FormatString = "yyyy-MM-dd HH:mm"; this.dateTimePicker1.Location = new System.Drawing.Point(84, 15); this.dateTimePicker1.MaskInput = "yyyy-mm-dd hh:mm"; this.dateTimePicker1.Name = "dateTimePicker1"; this.dateTimePicker1.Size = new System.Drawing.Size(126, 21); this.dateTimePicker1.TabIndex = 79; // // label11 // this.label11.AutoSize = true; this.label11.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label11.Location = new System.Drawing.Point(214, 49); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(21, 14); this.label11.TabIndex = 78; this.label11.Text = "到"; // // label10 // this.label10.AutoSize = true; this.label10.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label10.Location = new System.Drawing.Point(214, 18); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(21, 14); this.label10.TabIndex = 77; this.label10.Text = "到"; // // label9 // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label9.Location = new System.Drawing.Point(518, 49); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(35, 14); this.label9.TabIndex = 72; this.label9.Text = "牌号"; // // 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(656, 13); this.checkBox1.Name = "checkBox1"; this.checkBox1.Size = new System.Drawing.Size(82, 24); this.checkBox1.TabIndex = 71; this.checkBox1.Text = "自动刷新"; this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged); // // comboBox3 // this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox3.Items.AddRange(new object[] { "全部", "甲", "乙", "丙", "丁"}); this.comboBox3.Location = new System.Drawing.Point(445, 46); this.comboBox3.Name = "comboBox3"; this.comboBox3.Size = new System.Drawing.Size(70, 20); this.comboBox3.TabIndex = 69; // // comboBox1 // this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.Items.AddRange(new object[] { "铁水", "转炉", "吹氩站", "精炼炉", "RH炉", "连铸"}); this.comboBox1.Location = new System.Drawing.Point(445, 15); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(71, 20); this.comboBox1.TabIndex = 64; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // label8 // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label8.Location = new System.Drawing.Point(375, 49); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(70, 14); this.label8.TabIndex = 70; this.label8.Text = "选择班组:"; // // label7 // this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label7.Location = new System.Drawing.Point(375, 18); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(70, 14); this.label7.TabIndex = 68; this.label7.Text = "工序位置:"; // // comboBox2 // this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox2.Location = new System.Drawing.Point(528, 15); this.comboBox2.Name = "comboBox2"; this.comboBox2.Size = new System.Drawing.Size(112, 20); this.comboBox2.TabIndex = 65; // // button3 // this.button3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.button3.Location = new System.Drawing.Point(900, 45); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(72, 23); this.button3.TabIndex = 58; this.button3.Text = "全部显示"; this.button3.UseVisualStyleBackColor = false; this.button3.Click += new System.EventHandler(this.button3_Click); // // 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(852, 45); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(40, 23); this.button2.TabIndex = 57; this.button2.Text = ">>"; this.button2.Click += new System.EventHandler(this.button2_Click); // // 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(748, 45); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(40, 23); this.button1.TabIndex = 56; this.button1.Text = "<<"; this.button1.Click += new System.EventHandler(this.button1_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(788, 46); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(64, 21); this.textBox1.TabIndex = 55; this.textBox1.Text = "20"; // // label6 // this.label6.AutoSize = true; this.label6.ForeColor = System.Drawing.Color.Red; this.label6.Location = new System.Drawing.Point(842, 19); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(0, 12); this.label6.TabIndex = 54; // // label5 // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label5.Location = new System.Drawing.Point(746, 18); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(98, 14); this.label5.TabIndex = 52; this.label5.Text = "当前数据显示:"; // // 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(21, 49); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(63, 14); this.label4.TabIndex = 48; this.label4.Text = "熔炼号从"; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Location = new System.Drawing.Point(7, 18); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(77, 14); this.label1.TabIndex = 15; this.label1.Text = "化验时间从"; // // panel1 // this.panel1.Controls.Add(this.label3); this.panel1.Controls.Add(this.label2); this.panel1.Controls.Add(this.EMGrid); this.panel1.Controls.Add(this.ultraGroupBox1); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Left); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Right); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Top); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Bottom); 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(1008, 653); this.panel1.TabIndex = 12; // // label3 // this.label3.BackColor = System.Drawing.Color.Blue; this.label3.ForeColor = System.Drawing.SystemColors.ControlText; this.label3.Location = new System.Drawing.Point(564, 271); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(100, 23); this.label3.TabIndex = 11; this.label3.Text = "label3"; this.label3.Visible = false; // // label2 // this.label2.BackColor = System.Drawing.Color.Red; this.label2.Location = new System.Drawing.Point(458, 230); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(100, 23); this.label2.TabIndex = 6; this.label2.Text = "label2"; this.label2.Visible = false; // // EMGrid // this.EMGrid.DataMember = "Table1"; this.EMGrid.DataSource = this.dataSet1; ultraGridColumn1.Header.VisiblePosition = 0; ultraGridColumn1.Hidden = true; ultraGridColumn1.Width = 54; ultraGridColumn2.Header.Caption = "炉号"; ultraGridColumn2.Header.VisiblePosition = 1; ultraGridColumn2.Width = 132; ultraGridColumn3.Header.VisiblePosition = 2; ultraGridColumn3.Width = 76; ultraGridColumn4.Header.VisiblePosition = 3; ultraGridColumn4.Width = 148; ultraGridColumn5.Header.VisiblePosition = 4; ultraGridColumn5.Hidden = true; ultraGridColumn6.Header.VisiblePosition = 5; ultraGridColumn6.Width = 53; ultraGridBand1.Columns.AddRange(new object[] { ultraGridColumn1, ultraGridColumn2, ultraGridColumn3, ultraGridColumn4, ultraGridColumn5, ultraGridColumn6}); this.EMGrid.DisplayLayout.BandsSerializer.Add(ultraGridBand1); appearance1.FontData.BoldAsString = "True"; appearance1.FontData.SizeInPoints = 10F; this.EMGrid.DisplayLayout.Override.CellAppearance = appearance1; appearance2.FontData.BoldAsString = "True"; this.EMGrid.DisplayLayout.Override.HeaderAppearance = appearance2; valueListItem1.DataValue = "11"; valueListItem1.DisplayText = "白-甲"; valueListItem2.DataValue = "12"; valueListItem2.DisplayText = "白-乙"; valueListItem3.DataValue = "13"; valueListItem3.DisplayText = "白-丙"; valueListItem4.DataValue = "14"; valueListItem4.DisplayText = "白-丁"; valueListItem5.DataValue = "21"; valueListItem5.DisplayText = "中-甲"; valueListItem6.DataValue = "22"; valueListItem6.DisplayText = "中-乙"; valueListItem7.DataValue = "23"; valueListItem7.DisplayText = "中-丙"; valueListItem8.DataValue = "24"; valueListItem8.DisplayText = "中-丁"; valueListItem9.DataValue = "31"; valueListItem9.DisplayText = "夜-甲"; valueListItem10.DataValue = "32"; valueListItem10.DisplayText = "夜-乙"; valueListItem11.DataValue = "33"; valueListItem11.DisplayText = "夜-丙"; valueListItem12.DataValue = "34"; valueListItem12.DisplayText = "夜-丁"; valueList1.ValueListItems.AddRange(new Infragistics.Win.ValueListItem[] { valueListItem1, valueListItem2, valueListItem3, valueListItem4, valueListItem5, valueListItem6, valueListItem7, valueListItem8, valueListItem9, valueListItem10, valueListItem11, valueListItem12}); this.EMGrid.DisplayLayout.ValueLists.AddRange(new Infragistics.Win.ValueList[] { valueList1}); this.EMGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.EMGrid.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.EMGrid.Location = new System.Drawing.Point(0, 105); this.EMGrid.Name = "EMGrid"; this.EMGrid.Size = new System.Drawing.Size(1008, 548); this.EMGrid.TabIndex = 6; this.EMGrid.DoubleClickRow += new Infragistics.Win.UltraWinGrid.DoubleClickRowEventHandler(this.EMGrid_DoubleClickRow); this.EMGrid.Click += new System.EventHandler(this.EMGrid_Click); // // dataSet1 // this.dataSet1.DataSetName = "NewDataSet"; this.dataSet1.Locale = new System.Globalization.CultureInfo("zh-CN"); this.dataSet1.Tables.AddRange(new System.Data.DataTable[] { this.dataTable1}); // // dataTable1 // this.dataTable1.Columns.AddRange(new System.Data.DataColumn[] { this.dataColumn7, this.dataColumn8, this.dataColumn9, this.dataColumn84, this.dataColumn85, this.dataColumn1}); this.dataTable1.TableName = "Table1"; // // dataColumn7 // this.dataColumn7.ColumnName = "序号"; // // dataColumn8 // this.dataColumn8.ColumnName = "熔炼号"; // // dataColumn9 // this.dataColumn9.ColumnName = "计划牌号"; // // dataColumn84 // this.dataColumn84.ColumnName = "化验时间"; // // dataColumn85 // this.dataColumn85.Caption = "牌号编码"; this.dataColumn85.ColumnName = "JHGZ"; // // dataColumn1 // this.dataColumn1.Caption = "班别"; this.dataColumn1.ColumnName = "shiftcode"; // // _panel1_Toolbars_Dock_Area_Left // this._panel1_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Left.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215))))); this._panel1_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._panel1_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 28); this._panel1_Toolbars_Dock_Area_Left.Name = "_panel1_Toolbars_Dock_Area_Left"; this._panel1_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 625); this._panel1_Toolbars_Dock_Area_Left.ToolbarsManager = this.ultraToolbarsManager1; // // ultraToolbarsManager1 // this.ultraToolbarsManager1.DesignerFlags = 1; this.ultraToolbarsManager1.DockWithinContainer = this.panel1; this.ultraToolbarsManager1.LockToolbars = true; this.ultraToolbarsManager1.ShowFullMenusDelay = 500; this.ultraToolbarsManager1.ShowQuickCustomizeButton = false; this.ultraToolbarsManager1.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.VisualStudio2005; ultraToolbar1.DockedColumn = 0; ultraToolbar1.DockedRow = 0; buttonTool1.InstanceProps.IsFirstInGroup = true; buttonTool2.InstanceProps.IsFirstInGroup = true; buttonTool3.InstanceProps.IsFirstInGroup = true; buttonTool4.InstanceProps.IsFirstInGroup = true; ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool1, buttonTool2, buttonTool3, buttonTool4}); ultraToolbar1.Text = "UltraToolbar1"; this.ultraToolbarsManager1.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] { ultraToolbar1}); buttonTool5.SharedPropsInternal.Caption = "查询"; buttonTool5.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool6.SharedPropsInternal.Caption = "设置样点"; buttonTool6.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool7.SharedPropsInternal.Caption = "导Excel"; buttonTool7.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool8.SharedPropsInternal.Caption = "设置列"; buttonTool8.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool5, buttonTool6, buttonTool7, buttonTool8}); this.ultraToolbarsManager1.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.ultraToolbarsManager1_ToolClick); // // _panel1_Toolbars_Dock_Area_Right // this._panel1_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Right.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215))))); this._panel1_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._panel1_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(1008, 28); this._panel1_Toolbars_Dock_Area_Right.Name = "_panel1_Toolbars_Dock_Area_Right"; this._panel1_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 625); this._panel1_Toolbars_Dock_Area_Right.ToolbarsManager = this.ultraToolbarsManager1; // // _panel1_Toolbars_Dock_Area_Top // this._panel1_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Top.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215))))); this._panel1_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._panel1_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._panel1_Toolbars_Dock_Area_Top.Name = "_panel1_Toolbars_Dock_Area_Top"; this._panel1_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(1008, 28); this._panel1_Toolbars_Dock_Area_Top.ToolbarsManager = this.ultraToolbarsManager1; // // _panel1_Toolbars_Dock_Area_Bottom // this._panel1_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215))))); this._panel1_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._panel1_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 653); this._panel1_Toolbars_Dock_Area_Bottom.Name = "_panel1_Toolbars_Dock_Area_Bottom"; this._panel1_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(1008, 0); this._panel1_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.ultraToolbarsManager1; // // frmLgElementsHis // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.ClientSize = new System.Drawing.Size(1008, 653); this.Controls.Add(this.panel1); this.Name = "frmLgElementsHis"; this.Text = "历史化学成分查询"; this.Load += new System.EventHandler(this.ELEMENTS_Load); ((System.ComponentModel.ISupportInitialize)(this.ultraGroupBox1)).EndInit(); this.ultraGroupBox1.ResumeLayout(false); this.ultraGroupBox1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.dateTimePicker2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dateTimePicker1)).EndInit(); this.panel1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.EMGrid)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataTable1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).EndInit(); this.ResumeLayout(false); } #endregion #endregion public int sValue(string Svalue, string SCHvalue) { if (SCHvalue.Length < 1) { return 0; } if (Svalue.Length > 0) { string BValue = "-1"; string EValue = "-1"; if (Svalue.IndexOf("~") > 0) { BValue = Svalue.Substring(0, Svalue.IndexOf("~")); EValue = Svalue.Substring(Svalue.IndexOf("~") + 1, Svalue.Length - Svalue.IndexOf("~") - 1); if (double.Parse(SCHvalue) >= double.Parse(BValue) && double.Parse(SCHvalue) <= double.Parse(EValue)) { return 0; //正确 } else { return -1; } } else { if (Svalue.IndexOf("<=") > -1) { EValue = Svalue.Substring(Svalue.IndexOf("<=") + 2, Svalue.Length - Svalue.IndexOf("<=") - 2); if (double.Parse(SCHvalue) <= double.Parse(EValue)) { return 0; //正确 } else { return -1; } } else { if (Svalue.IndexOf("<") > -1 && Svalue.IndexOf("=") == -1) { EValue = Svalue.Substring(Svalue.IndexOf("<") + 1, Svalue.Length - Svalue.IndexOf("<") - 1); if (double.Parse(SCHvalue) < double.Parse(EValue)) { return 0; //正确 } else { return -1; } } else { if (Svalue.IndexOf(">=") > -1) { EValue = Svalue.Substring(Svalue.IndexOf(">=") + 1, Svalue.Length - Svalue.IndexOf(">=") - 1); if (double.Parse(SCHvalue) >= double.Parse(EValue)) { return 0; //正确 } else { return -1; } } else { if (Svalue.IndexOf(">") > -1 && Svalue.IndexOf("=") == -1) { EValue = Svalue.Substring(Svalue.IndexOf(">") + 1, Svalue.Length - Svalue.IndexOf(">") - 1); if (double.Parse(SCHvalue) > double.Parse(EValue)) { return 0; //正确 } else { return -1; } } else { EValue = Svalue; try { if (double.Parse(SCHvalue) == double.Parse(EValue)) { return 0; //正确 } } catch { } return -1; } } } } } } return 0; } public void GetTAM_StandardElement()/// 查询判定牌号成分 { try { // string strForeSmeltingId = "", strSme = ""; Color tmpC = c1; string szJHGZ = "", strErr = "", szWhere = "", szQJ = "", szJYH = ""; object obj = null; for (int j = 0; j < EMGrid.Rows.Count; j++) { for (int i = 0; i < EMGrid.DisplayLayout.Bands[0].Columns.Count; i++) { EMGrid.Rows[j].Cells[i].Appearance.ForeColor = Color.Black; } if (j == 0) { EMGrid.Rows[j].Appearance.BackColor = tmpC; //if (this.comboBox1.SelectedIndex == 0) if (intSelectedIndex == 0) strForeSmeltingId = EMGrid.Rows[j].Cells[1].Value.ToString().Substring(0, EMGrid.Rows[j].Cells[1].Value.ToString().IndexOf("-")); else { if (EMGrid.Rows[j].Cells[1].Value.ToString().Length >= 9) strForeSmeltingId = EMGrid.Rows[j].Cells[1].Value.ToString().Substring(0, 9); } } else { //if (this.comboBox1.SelectedIndex == 0) if (intSelectedIndex == 0) strSme = EMGrid.Rows[j].Cells[1].Value.ToString().Substring(0, EMGrid.Rows[j].Cells[1].Value.ToString().IndexOf("-")); else { if (EMGrid.Rows[j].Cells[1].Value.ToString().Length >= 9) strSme = EMGrid.Rows[j].Cells[1].Value.ToString().Substring(0, 9); } if (strForeSmeltingId == strSme) { tmpC = SetRowBackColor(EMGrid.Rows[j], tmpC, true); } else { tmpC = SetRowBackColor(EMGrid.Rows[j], tmpC, false); strForeSmeltingId = strSme; } } // string StrHic=EMGrid.Rows[j].Cells ["dataColumn30"].Value .ToString ().Trim (); // string StrT="02"; //if (this.comboBox1.SelectedIndex == 0) if (intSelectedIndex == 0) continue; szJHGZ = EMGrid.Rows[j].Cells["JHGZ"].Value.ToString(); szJYH = EMGrid.Rows[j].Cells[1].Value.ToString().Substring(0, 9); strErr = ""; //if (!string.IsNullOrEmpty(szJYH)) // szDev = szJYH.Substring(szJYH.IndexOf("_") + 1, 1); string[] ArrayId = new string[strERow.Length]; szWhere = " and t.STEELCODE='" + szJHGZ + "' and t.stationcode=(select ccm_ID from bsa_istlsch where heat_id='" + szJYH + "')"; //条件 string szEleStd = "";// "('C','Si','Mn','P','S','Als','Al','Cr','Mo','Ti','Nb','B','V','Cu','Ca') "; string szCrfStd = "('L02001','L02005') "; int id = 0; for (int i = 6; i < EMGrid.DisplayLayout.Bands[0].Columns.Count; i++) { if (EMGrid.Rows[j].Cells[i].Appearance.ForeColor == Color.Red || EMGrid.Rows[j].Cells[i].Appearance.ForeColor == Color.FromArgb(204, 153, 0)) EMGrid.Rows[j].Cells[i].Appearance.ForeColor = Color.Black; } //铁样与转炉样不判定 if (EMGrid.Rows[j].Cells["熔炼号"].Value.ToString().IndexOf('A') == -1 && EMGrid.Rows[j].Cells["熔炼号"].Value.ToString().IndexOf('B') == -1 && EMGrid.Rows[j].Cells["熔炼号"].Value.ToString().IndexOf('C') == -1 && EMGrid.Rows[j].Cells["熔炼号"].Value.ToString().Substring(11, 1) != "3" && EMGrid.Rows[j].Cells["熔炼号"].Value.ToString().Substring(11, 1) != "4") { //设置要获取的化学成分标准 for (int i = 6; i < EMGrid.DisplayLayout.Bands[0].Columns.Count; i++) { if (EMGrid.DisplayLayout.Bands[0].Columns[i].Hidden == false) { szEleStd = szEleStd + "','" + EMGrid.DisplayLayout.Bands[0].Columns[i].Header.Caption; ArrayId[id] = EMGrid.DisplayLayout.Bands[0].Columns[i].Header.Caption; id++; } } if (!string.IsNullOrEmpty(szEleStd)) { szEleStd = "('" + szEleStd.Substring(3, szEleStd.Length - 3) + "')"; //获取成分标准 obj = null;//hengxing ClientCommon._RemotingHelp.ExecuteMethod("lgJobMgt", // "Core.LgMes.Server.lgJobMgt.classCommonModule", // "GetProcStandardValue", new object[] { szWhere, szEleStd, szCrfStd }, out strErr); } else continue; if (strErr != "") { continue; // MessageBox.Show(strErr); } else if (obj != null) { ArrayList ar = obj as ArrayList; DataSet dsStandard = (ar[0] as DataSet); if (dsStandard.Tables[0].Rows.Count == 0) { for (int i = 3; i < 18; i++) { if (EMGrid.Rows[j].Cells[i].Appearance.ForeColor == Color.Red) EMGrid.Rows[j].Cells[i].Appearance.ForeColor = Color.Black; } continue; } //DataSet dsCraft = ar[1] as DataSet; // string [] ArrayId={"","","","02001","02002","02003","02004","02005","02016","02026","02010", // "02007","02006","02008","02009","02011","02012","02013","02014", // "02015","02017","02018","02019","02020","02021","02022","02023", // "02024","02025","02027","02028","02029","02030","02031","02032","2033","2034","2035"}; //string[] ArrayId ={ "", "", "", "C", "Si", "Mn", "P", "S", "Als", "Al", "Cr", "Mo", "Ti", "Nb", "B", "V", "Cu", "Ca" }; foreach (DataRow Drow in dsStandard.Tables[0].Rows) { for (int i = 0; i < ArrayId.Length; i++) { // if (EMGrid.Rows[j].Cells[i + 6].Value.ToString().Length > 0) if (EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Value.ToString().Length > 0) { if (Drow["BASENAME"].ToString() == ArrayId[i]) { int reP = 0; try { if (reP == 0) { if (Drow["ITEM1MIN"].ToString() != "" && Drow["ITEM1MAX"].ToString() != "") szQJ = Drow["ITEM1MIN"].ToString() + "~" + Drow["ITEM1MAX"].ToString(); else if (Drow["ITEM1MIN"].ToString() != "" && Drow["ITEM1MAX"].ToString() == "") szQJ = "> " + Drow["ITEM1MIN"].ToString(); else if (Drow["ITEM1MIN"].ToString() == "" && Drow["ITEM1MAX"].ToString() != "") szQJ = "<= " + Drow["ITEM1MAX"].ToString(); reP = sValue(szQJ, EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Value.ToString()); } } catch (Exception ex) { Console.WriteLine(ex.Message); } if (reP == -1 && Drow["std_dc"].ToString() == "2") { EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Appearance.ForeColor = Color.FromArgb(204, 153, 0);// Color.Yellow; } else if (reP == -1 && Drow["std_dc"].ToString() == "1" && EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Appearance.ForeColor == Color.FromArgb(204, 153, 0)) { EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Appearance.ForeColor = Color.Red; } else if (EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Appearance.ForeColor != Color.FromArgb(204, 153, 0)) { EMGrid.Rows[j].Cells[Drow["BASENAME"].ToString()].Appearance.ForeColor = Color.Black; } break; } } } } } } } } catch { } } public void GetId(int RowId, Infragistics.Win.UltraWinGrid.UltraGrid GRID) { int i = RowId; if (GRID.Rows[i].Cells[1].Value.ToString().Length > 0) { if (GRID.Rows[i].Cells[0].Value.ToString().IndexOf("√") < 0) { GRID.Rows[i].Cells[0].Value = GRID.Rows[i].Cells[0].Value + "√"; //GRID.Rows [i].Appearance.ForeColor =label3.BackColor ; } else { GRID.Rows[i].Cells[0].Value = GRID.Rows[i].Cells[0].Value.ToString().Substring(0, GRID.Rows[i].Cells[0].Value.ToString().IndexOf("√")); //GRID.Rows [i].Appearance .ForeColor =label3.ForeColor ; } } } private void EMGrid_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e) { GetId(e.Row.Index, EMGrid); if (EMGrid.Rows[e.Row.Index].Cells[0].Value.ToString().IndexOf("√") > 0) { frmLgEleConfig.StrT = "02"; frmLgEleConfig.StrHic = EMGrid.Rows[e.Row.Index].Cells[1].Text.Trim().ToString(); string szLH = EMGrid.Rows[e.Row.Index].Cells["熔炼号"].Value.ToString(); string[] szAr = szLH.Split('-'); szLH = szAr[0];// + szAr[1]; if (szLH.Length < 9) return; frmLgEleConfig.strSteelCode = EMGrid.Rows[e.Row.Index].Cells["JHGZ"].Text.Trim().ToString(); string szJYH = EMGrid.ActiveRow.Cells[1].Value.ToString(); string szEleStd = ""; //设置要获取的化学成分标准 for (int i = 5; i < EMGrid.DisplayLayout.Bands[0].Columns.Count; i++) { if (EMGrid.DisplayLayout.Bands[0].Columns[i].Hidden == false) { szEleStd = szEleStd + "','" + EMGrid.DisplayLayout.Bands[0].Columns[i].Header.Caption; } } frmLgEleConfig.szEleStd = szEleStd; frmLgEleConfig Azhupi = new frmLgEleConfig( frmLgEleConfig.StrHic, frmLgEleConfig.StrT, szJYH.Substring(9, 1)); // _devPos.Substring(0, 3) //frmLgEleConfig WinPlan = new frmLgEleConfig(); Azhupi.ShowDialog(this); } } 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); } #region " Main Code " //增加分页显示功能 private DataSet _dsAll = new DataSet(); private DataSet _dsSet; private int _intBegin = 0; private int _intEnd = 20; private string _strDuty = "0"; private string _dvRowFilter = ""; private string _strWhere1 = ""; private string _strWhere2 = ""; private string _szTableName = ""; public string _devPos = ""; private Color c1 = Color.PaleGreen; private Color c2 = Color.White; private void button1_Click(object sender, System.EventArgs e) { int step = 20; try { step = Convert.ToInt32(this.textBox1.Text.Trim()); if (step < 1) throw new Exception(); } catch { MessageBox.Show("请输入正确的显示行数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.Cursor = Cursors.WaitCursor; dataTable1.Clear(); if (_dsAll.Tables.Count <= 0) return; int count = _dsAll.Tables[0].DefaultView.Count; if (_intBegin < step) { _intEnd = _intBegin; _intBegin = 0; } else { _intEnd = _intBegin; _intBegin -= step; } if (_intBegin > 0) this.button1.Enabled = true; else button1.Enabled = false; if (_intEnd < count) this.button2.Enabled = true; else button2.Enabled = false; this.label6.Text = String.Format("第 {0} 行到第 {1} 行, 共 {2} 行", _intBegin + 1, _intEnd, count); SetEachRowData(); #region Display Splash widow // Update UI // UpdateUI(false); // // //显示提示对话框 // frmSplash = new SplashForm(this); // frmSplash.Show(); #endregion //数据获取启动线程。执行完后关闭 Thread t = new Thread(new ThreadStart(DoStandFetchReady)); t.IsBackground = true; t.Start(); } private void DoStandFetchReady() { GetTAM_StandardElement(); try { this.Cursor = Cursors.Default; } catch { } //关闭正在取数据的对话框 // Invoke(new UpdateUIDelegate(UpdateUI), new object[] { true }); } private void button2_Click(object sender, System.EventArgs e) { int step = 20; try { step = Convert.ToInt32(this.textBox1.Text.Trim()); if (step < 1) throw new Exception(); } catch { MessageBox.Show("请输入正确的显示行数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.Cursor = Cursors.WaitCursor; dataTable1.Clear(); if (_dsAll.Tables.Count <= 0) return; int count = _dsAll.Tables[0].DefaultView.Count; this._intBegin = this._intEnd; this._intEnd += step; if (_intEnd > count) _intEnd = count; if (_intBegin > 0) this.button1.Enabled = true; else button1.Enabled = false; if (_intEnd < count) this.button2.Enabled = true; else button2.Enabled = false; this.label6.Text = String.Format("第 {0} 行到第 {1} 行, 共 {2} 行", _intBegin + 1, _intEnd, count); SetEachRowData(); #region Display Splash widow // // Update UI // UpdateUI(false); // // //显示提示对话框 // frmSplash = new SplashForm(this); // frmSplash.Show(); // #endregion //数据获取启动线程。执行完后关闭 Thread t = new Thread(new ThreadStart(DoStandFetchReady)); t.IsBackground = true; t.Start(); this.Cursor = Cursors.Default; } private void button3_Click(object sender, System.EventArgs e) { try { if (_dsAll == null || _dsAll.Tables.Count <= 0) return; int count = _dsAll.Tables[0].DefaultView.Count; if (this.button3.Text == "全部显示") { this._intBegin = 0; this.button3.Text = "分页显示"; this.button1.Enabled = false; this.button2.Enabled = false; if (_intEnd == count) return; else this._intEnd = count; } else { int step = 20; try { step = Convert.ToInt32(this.textBox1.Text.Trim()); if (step < 1) throw new Exception(); } catch { MessageBox.Show("请输入正确的显示行数!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this._intBegin = 0; if (step < count) { this._intEnd = step; this.button1.Enabled = false; this.button2.Enabled = true; } else { this._intEnd = count; this.button1.Enabled = false; this.button2.Enabled = false; this.button3.Text = "全部显示"; return; } this.button3.Text = "全部显示"; } this.Cursor = Cursors.WaitCursor; if (count == 0) { this.label6.Text = "无数据"; this.Cursor = Cursors.Default; return; } else this.label6.Text = String.Format("第 {0} 行到第 {1} 行, 共 {2} 行", _intBegin, _intEnd, count); button3.Enabled = false; SetEachRowData(); button3.Enabled = true; #region Display Splash widow // Update UI // UpdateUI(false); // // //显示提示对话框 // frmSplash = new SplashForm(this); // frmSplash.Show(); #endregion //数据获取启动线程。执行完后关闭 Thread t = new Thread(new ThreadStart(DoStandFetchReady)); t.IsBackground = true; t.Start(); } catch { button3.Enabled = true; } //GetTAM_StandardElement(); //this.Cursor = Cursors.Default; } #region " Delete Code " //SplashForm frmSplash = null; /// /// Updates the UI. /// //private void UpdateUI(bool IsDataLoaded) //{ // if ( IsDataLoaded ) // { // //this.statusBar1.Text = "Done."; // //关闭展现的对话框 // if (this.frmSplash != null) // { // frmSplash.Reset(); // frmSplash.Close(); // } // } // else // { // this.BackColor = SystemColors.Control; // } //} #endregion #region " Init " private void ELEMENTS_Load(object sender, System.EventArgs e) { EMGrid.Font = new System.Drawing.Font("Tahoma", 9F); string strErr = ""; //获取所有化学成份列名 DataSet dsElements = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetElementRow", null, out strErr); if (strErr=="" && dsElements != null) { foreach (DataRow dr in dsElements.Tables[0].Rows) { dataTable1.Columns.Add(dr["BaseName"].ToString(), typeof(System.Decimal)); //添加列 } } string strElementsRow = ElementsConfig.GetElementsRow(); //调用函数获取要显示的列名 strERow = strElementsRow.Split('*'); GetCurrDuty(); // GetSteelCode(); dateTimePicker1.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 00:00"; dateTimePicker2.Value = DateTime.Today.ToString("yyyy-MM-dd") + " 23:59"; if (_devPos == "0") { this.comboBox1.SelectedIndex = 1; } else { int intIndex = 1; switch (_devPos.Substring(0, 3)) { case "HMP": intIndex = 0; break; case "BOF": intIndex = 1; break; case "CAS": intIndex = 2; break; case "LFS": intIndex = 3; break; case "RHS": intIndex = 4; break; case "CCM": intIndex = 5; break; default: break; } comboBox1.SelectedIndex = intIndex; } this.SetDuty(); GetDataFromAll(); StartGetDataThread(); } // private void DoDataFetchCurr() // { // GetDataFromCurr(); // //关闭正在取数据的对话框 //// Invoke(new UpdateUIDelegate(UpdateUI), new object[] { true }); // } // private void DoDataFetchReady() // { // this.GetDataFromAll(); // //关闭正在取数据的对话框 //// Invoke(new UpdateUIDelegate(UpdateUI), new object[] { true }); // } //private string strQualityLH = ""; private void DoDataFetchQalityReady() { //this.GetQualityInfo(strQualityLH); //关闭正在取数据的对话框 // Invoke(new UpdateUIDelegate(UpdateUI), new object[] { true }); } // delegate for the UI updater public delegate void UpdateUIDelegate(bool IsDataLoaded); public void GetQualityInfo(string szLH) { try { this.ultraMaskedEdit1.Text = szLH; _strWhere1 = String.Format(" where lh like '%{0}%' ", this.ultraMaskedEdit1.Text.Trim()); object obj = null;//hengxing ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "SetQualityBackward", // new object[] { _strWhere1 }, out strErr); _dsAll = obj as DataSet; _dsAll.Tables[0].DefaultView.RowFilter = _dvRowFilter; SetDataToGrid(); } catch (Exception ex) { string Msg = ex.Message; } } /// /// 将数据装载到DATASET /// private void SetEachRowData() { try { DataRow newRow = dataTable1.NewRow(); DataRow Drow; dataTable1.Clear(); int RowId = this._intBegin + 1; for (int i = this._intBegin; i < this._intEnd; i++) { newRow = dataTable1.NewRow(); Drow = _dsAll.Tables[0].DefaultView[i].Row; newRow[0] = RowId++; newRow[1] = Drow["HEATNO"].ToString() + "-" + Drow["ASSAYTYPECODE"].ToString(); //newRow[2] = Drow["JHGZ"].ToString(); newRow[2] = Drow["gzbm"].ToString(); if (Drow["ASSAYDATE"].ToString() != "") newRow[3] = Convert.ToDateTime(Drow["ASSAYDATE"]).ToString("yy-MM-dd HH:mm:ss"); newRow[4] = Drow["GZBM"].ToString(); newRow[5] = Drow["shiftcode"].ToString(); foreach (DataColumn dc in _dsAll.Tables[0].Columns) { foreach (DataColumn dc1 in dataTable1.Columns) { if (dc1.ColumnName.ToUpper() == dc.ColumnName.ToUpper()) { if (Drow[dc].ToString() != "") newRow[dc1] = Drow[dc].ToString(); break; } } } dataTable1.Rows.Add(newRow); } SetGridRowHidden(); } catch { } } /// /// 根据设置隐藏不要显示的列 /// private void SetGridRowHidden() { for (int j = 6; j < EMGrid.DisplayLayout.Bands[0].Columns.Count; j++) { EMGrid.DisplayLayout.Bands[0].Columns[j].Hidden = true; EMGrid.DisplayLayout.Bands[0].Columns[j].Width = 60; EMGrid.DisplayLayout.Bands[0].Columns[j].CellActivation = Activation.NoEdit; EMGrid.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.NoEdit; EMGrid.DisplayLayout.Bands[0].Columns[1].CellActivation = Activation.NoEdit; EMGrid.DisplayLayout.Bands[0].Columns[2].CellActivation = Activation.NoEdit; EMGrid.DisplayLayout.Bands[0].Columns[3].CellActivation = Activation.NoEdit; EMGrid.DisplayLayout.Bands[0].Columns[4].CellActivation = Activation.NoEdit; EMGrid.DisplayLayout.Bands[0].Columns[5].CellActivation = Activation.NoEdit; } for (int i = 0; i < strERow.Length; i++) { if (!string.IsNullOrEmpty(strERow[i])) EMGrid.DisplayLayout.Bands[0].Columns[strERow[i]].Hidden = false; } for (int j = 0; j < strRowName.Length; j++) { EMGrid.DisplayLayout.Bands[0].Columns[strRowName[j]].Header.VisiblePosition = j + 4; } EMGrid.DisplayLayout.Bands[0].Columns[5].Header.VisiblePosition = EMGrid.DisplayLayout.Bands[0].Columns.Count; EMGrid.DisplayLayout.Bands[0].Columns[3].Header.VisiblePosition = EMGrid.DisplayLayout.Bands[0].Columns.Count; EMGrid.DisplayLayout.Bands[0].Columns[1].Header.Fixed = true; EMGrid.DisplayLayout.Bands[0].Columns[2].Header.Fixed = true; } private void SetDataToGrid() { this._intBegin = 0; this._intEnd = 20; if (_dsAll != null) { //int count = _dsAll.Tables[0].DefaultView.Count; int count = _dsAll.Tables[0].Rows.Count; if (count <= 20) { _intEnd = count; this.button1.Enabled = false; this.button2.Enabled = false; this.button3.Enabled = false; } else { this.button1.Enabled = false; this.button2.Enabled = true; this.button3.Enabled = true; } if (count == 0) { this.label6.Text = "无数据"; this.EMGrid.Cursor = System.Windows.Forms.Cursors.Arrow; } else this.label6.Text = String.Format("第 1 行到第 {0} 行, 共 {1} 行", _intEnd, count); SetEachRowData(); GetTAM_StandardElement(); // 取成分割标准对比 } else { this.label6.Text = "无数据"; } this.EMGrid.Cursor = System.Windows.Forms.Cursors.Arrow; } #endregion #region " ToolBar Event " private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "query": #region 装载数据 // Update UI // UpdateUI(false); // // //显示提示对话框 // frmSplash = new SplashForm(this); // frmSplash.Show(); #endregion this.GetDataFromAll(); //数据获取启动线程。执行完后关闭 //Thread t = new Thread(new ThreadStart(DoDataFetchReady)); //t.IsBackground = true; //t.Start(); break; case "set": //设置样点 SetSampling(); break; case "SRow": //设置化学成份字段显示 SetRowName(); break; case "excel": ExportExcel(); break; } } /// /// 设置化学成份列名 /// private void SetRowName() { DataSet dsElements = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetElementRow", null, out strErr); if (dsElements != null) { dsElements.Tables[0].Columns.Add(new DataColumn("选择", typeof(System.Boolean))); foreach (DataRow dr in dsElements.Tables[0].Rows) { dr["选择"] = false; } frmConfigElementsRow frm = new frmConfigElementsRow(); frm.StartPosition = FormStartPosition.CenterScreen; frm.WindowState = FormWindowState.Normal; frm._dsSet = dsElements; frm.ShowDialog(); // 判断是否有设置 if (frm._setFlag) { string strElementsRow = ElementsConfig.GetElementsRow(); //调用函数获取要显示的列名 strERow = strElementsRow.Split('*'); GetDataFromAll(); } } } /// /// 显示样点 /// private void SetSampling() { if (_dsSet == null) { _dsSet = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetDisSampling", // null, out strErr); _dsSet.Tables[0].Columns.Add(new DataColumn("选择", typeof(System.Boolean))); foreach (DataRow dr in _dsSet.Tables[0].Rows) { dr["选择"] = true; } } frmSetSampling frm = new frmSetSampling(); frm._dsSet = _dsSet; frm.ShowDialog(); if (frm._setFlag) { _dsSet = frm._dsSet; _dsSet.AcceptChanges(); _dvRowFilter = ""; foreach (DataRow dr in _dsSet.Tables[0].Rows) { if (Convert.ToBoolean(dr["选择"])) { _dvRowFilter += string.Format("or assaytypecode = '{0}' ", dr[0].ToString()); } } if (_dvRowFilter.Length > 0) { _dvRowFilter = _dvRowFilter.Substring(2, _dvRowFilter.Length - 2); } GetDataFromAll(); } } private void ExportExcel() { try { string StrfileName = System.Windows.Forms.Application.StartupPath + "\\Report\\成分明细.xls"; this.GridExcelExporter.Export(this.EMGrid, 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文件夹 ],如果没有请手动创建!"); } } #endregion #region " 直接打开界面 或 查询 " public void GetDataFromAll() { string strFindName = ""; for (int i = 0; i < strERow.Length; i++) { if(!string.IsNullOrEmpty(strERow[i])) strFindName = strFindName +"," + strERow[i]; } try { if (Convert.ToDateTime(dateTimePicker2.Value) < Convert.ToDateTime(dateTimePicker1.Value)) { MessageBox.Show("结束时间必须大于等于开始时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } GetPost(); GetDuty(); if (this.ultraMaskedEdit1.Text.Trim().Length > 0 || this.ultraMaskedEdit2.Text.Trim().Length > 0) BuildSQLWithID(); else BuildSQLWithOutID(); object obj = null;//hengxing ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetAllDevElementHis", // new object[] { _devPos, _strWhere1, _strWhere2, strFindName }, out strErr); _dsAll = obj as DataSet; _dsAll.Tables[0].DefaultView.RowFilter = _dvRowFilter; SetDataToGrid(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } #endregion #region " 从作业管理打开界面 " public void GetDataFromCurr() { try { GetCurrDuty(); _dsAll = null;//hengxing (DataSet)ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetCurrDevElementHis", // new object[] { this._devPos, this._strDuty, GetTableName() }, out strErr); _dsAll.Tables[0].DefaultView.RowFilter = _dvRowFilter; // SetMaskText(); SetPost(); SetDuty(); SetDataToGrid(); } catch { } } private void GetCurrDuty() { try { string strDuty = ""; strDuty = "";//hengxing (string)ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetCurrDuty", // null, out strErr); _strDuty = strDuty.Substring(1, 1); return; } catch { } _strDuty = "0"; } //private void GetSteelCode() //{ // try // { // string strErr = ""; // object obj = ClientCommon._RemotingHelp.ExecuteMethod( // "lgIntegrationQuery", // "Core.LgMes.Server.lgIntegrationQuery.LgGeneralInfo", // "GetSteelInfo", // new object[] { "" }, out strErr); // if (strErr == "" && obj != null) // { // DataSet ds = obj as DataSet; // ultraCombo1.DataSource = ds.Tables[0].DefaultView; // ultraCombo1.DisplayMember = "STEEL"; // ultraCombo1.ValueMember = "STEELCODE"; // ultraCombo1.DisplayLayout.Bands[0].Columns["STEELCODE"].Hidden = true; // ultraCombo1.DisplayLayout.Bands[0].Columns["CATALOGID"].Hidden = true; // ultraCombo1.DisplayLayout.Bands[0].Columns["STEEL"].Band.ColHeadersVisible = false; // ultraCombo1.DisplayLayout.Bands[0].Columns["STEEL"].Width = ultraCombo1.Width; // } // } // catch { } //} #endregion #region " SQL " private void BuildSQLWithOutID() { string begTime = Convert.ToDateTime(dateTimePicker1.Value).ToString("yyyy-MM-dd HH:mm:ss"); string endTime = Convert.ToDateTime(dateTimePicker2.Value).ToString("yyyy-MM-dd HH:mm:ss"); _strWhere1 = " where ASSAYDATE between to_date('" + begTime + "','yyyy-MM-dd HH24:mi:ss') and to_date('" + endTime + "','yyyy-MM-dd HH24:mi:ss') ";// substr(samplingid,2,1)<>'T' and switch (this.comboBox1.SelectedIndex) { case 0: // hylxm like '%FE%' or hylxm like 'T' 铁水 _strWhere1 += " and (ASSAYTYPECODE like 'A%' or ASSAYTYPECODE like 'B%')"; if (this._strDuty != "0") _strWhere1 += " and (substr(SHIFTCODE,2,1) = '" + _strDuty + "' or SHIFTCODE is null)"; break; //case 1: // 转炉 // _strWhere1 += " and ASSAYTYPECODE like 'C%' or ASSAYTYPECODE like 'V%' "; // break; //case 2: // 吹氩站 // _strWhere1 += " and ASSAYTYPECODE like 'D%'"; // break; //case 3: // 精炼炉 // _strWhere1 += " and ASSAYTYPECODE like 'E%'"; // break; //case 4: // RH炉 // _strWhere1 += " and ASSAYTYPECODE like 'F%'"; // break; //case 5: // 连铸机 // _strWhere1 += " and ASSAYTYPECODE like 'G%'"; // break; default: // _strWhere1 += " and ASSAYTYPECODE not like 'A%' and ASSAYTYPECODE not like 'B%'"; break; } _strWhere2 = " where 1 = 1"; string str = this._devPos.Substring(0, 3), szWZ = this._devPos.Substring(4, 1); if (this._strDuty != "0" && str != "HMP") _strWhere2 += string.Format(" and substr(SHIFTCODE,2,1) = '{0}' ", this._strDuty); if (str != "HMP" && szWZ != "0" && str != "SYG") _strWhere2 += string.Format(" and substr(stationcode,3,1) = '{0}'", szWZ); if (txtSteel.Text.Trim() != "") str = txtSteel.Text.ToString();//this.textBox2.Text.Trim().ToLower(); else str = ""; if (str != "") { string strSteeAll = ""; string[] strSteel = str.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); _strWhere2 += string.Format(" and STEELNAME in ({0})", str); // lower(b.jhgz) } //气体样 if (chkGasSample.Checked) { _strWhere2 += " and (N>0 or H>0 or O>0) "; } } private void BuildSQLWithID() { //熔炼号从 if (this.ultraMaskedEdit1.Text.Length == 0) { _strWhere1 = String.Format(" where HEATNO like '%{0}%' ", this.ultraMaskedEdit2.Text.Trim()); } else { if (this.ultraMaskedEdit2.Text.Length == 0) { _strWhere1 = String.Format(" where HEATNO like '%{0}%' ", this.ultraMaskedEdit1.Text.Trim()); } else { _strWhere1 = String.Format(" where HEATNO between '{0}' and '{1}' ", this.ultraMaskedEdit1.Text.Trim(), this.ultraMaskedEdit2.Text.Trim()); } } switch (this.comboBox1.SelectedIndex) { case 0: // hylxm like '%FE%' or hylxm like 'T' 铁水 _strWhere1 += " and (ASSAYTYPECODE like 'A%' or ASSAYTYPECODE like 'B%')"; if (this._strDuty != "0") _strWhere1 += " and (substr(SHIFTCODE,2,1) = '" + _strDuty + "' or SHIFTCODE is null)"; break; //case 1: // 转炉 // _strWhere1 += " and ASSAYTYPECODE like 'C%'"; // break; //case 2: // 吹氩站 // _strWhere1 += " and ASSAYTYPECODE like 'D%'"; // break; //case 3: // 精炼炉 // _strWhere1 += " and ASSAYTYPECODE like 'E%'"; // break; //case 4: // RH炉 // _strWhere1 += " and ASSAYTYPECODE like 'F%'"; // break; //case 5: // 连铸机 // _strWhere1 += " and ASSAYTYPECODE like 'G%'"; // break; default: //_strWhere1 += " and ASSAYTYPECODE not like 'A%' and ASSAYTYPECODE not like 'B%'"; break; } _strWhere2 = " where 1=1"; string str = this._devPos.Substring(0, 3), szWZ = this._devPos.Substring(4, 1); if (this._strDuty != "0" && str != "HMP") _strWhere2 += string.Format(" and substr(SHIFTCODE,2,1) = '{0}' ", this._strDuty); if (str != "HMP" && szWZ != "0" && str != "SYG") _strWhere2 += string.Format(" and substr(stationcode,3,1) = '{0}'", szWZ); if (txtSteel.Text.Trim() != "") str = txtSteel.Text.ToString();//this.textBox2.Text.Trim().ToLower(); else str = ""; if (str != "") { string strSteeAll = ""; string[] strSteel = str.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); _strWhere2 += string.Format(" and STEELNAME in ({0})", str); // lower(b.jhgz) } //气体样 if (chkGasSample.Checked) { _strWhere2 += " and (N>0 or H>0 or O>0) "; } } #endregion #region " ComboBox Event " private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e) { this.comboBox2.Items.Clear(); this.comboBox2.Items.AddRange(GetComboBox2Items(this.comboBox1.SelectedIndex)); this.comboBox2.SelectedIndex = 0; intSelectedIndex = comboBox1.SelectedIndex; } private object[] GetComboBox2Items(int index) { switch (index) { case 1: return new object[] { "所有", "1#转炉", "2#转炉", "3#转炉" }; case 2: return new object[] { "所有", "1#吹氩站", "2#吹氩站", "3#吹氩站" }; case 3: return new object[] { "所有", "1#精炼炉", "2#精炼炉" }; case 4: return new object[] { "所有", "1#RH炉" }; case 5: return new object[] { "所有", "1#连铸", "2#连铸", "3#连铸", "4#连铸" }; default: return new object[] { "所有铁水" }; } } #endregion #region " Common Event " private Color SetRowBackColor(UltraGridRow ugr, Color frc, bool ifSame) { Color c; if (ifSame) { c = frc; } else { if (frc == c1) c = c2; else c = c1; } ugr.Appearance.BackColor = c; return c; } private void SetMaskText() { try { this.ultraMaskedEdit1.Text = ""; this.ultraMaskedEdit2.Text = ""; if (this._devPos.Substring(0, 3) == "BOF" || this._devPos.Substring(0, 3) == "CAS") { int count = _dsAll.Tables[0].Rows.Count; if (count > 1) { this.ultraMaskedEdit1.Text = _dsAll.Tables[0].Rows[count - 1]["LH"].ToString(); this.ultraMaskedEdit2.Text = _dsAll.Tables[0].Rows[0]["LH"].ToString(); } else if (count == 1) { this.ultraMaskedEdit1.Text = _dsAll.Tables[0].Rows[count - 1]["LH"].ToString(); } } } catch { } } private void GetPost() { this._devPos = ""; switch (this.comboBox1.SelectedIndex) { case 0: this._devPos = "HMP0"; this._szTableName = "JOB_HMP_OPTINFO"; break; case 1: this._devPos = "BOF0"; this._szTableName = "JOB_BOF_OPTINFO"; break; case 2: this._devPos = "CAS0"; this._szTableName = "JOB_CAS_OPTINFO"; break; case 3: this._devPos = "LFS0"; this._szTableName = "JOB_LFS_OPTINFO"; break; case 4: this._devPos = "LFS0"; this._szTableName = "JOB_RHS_OPTINFO"; break; case 5: this._devPos = "CCM0"; this._szTableName = "JOB_CCM_OPTINFO"; break; default: this._devPos = "SYGW"; // 所有岗位 this._szTableName = ""; break; } this._devPos += this.comboBox2.SelectedIndex; } private string GetTableName() { string szTableName = ""; switch (_devPos.Substring(0, 3)) { case "HMP": szTableName = "JOB_HMP_OPTINFO"; break; case "BOF": szTableName = "JOB_BOF_OPTINFO"; break; case "CAS": szTableName = "JOB_CAS_OPTINFO"; break; case "LFS": szTableName = "JOB_LFS_OPTINFO"; break; case "CCM": szTableName = "JOB_CCM_OPTINFO"; break; default: break; } return szTableName; } /// /// 设置设备选择框 /// private void SetPost() { this._devPos = CurrectDevPos(this._devPos); if (_devPos.Length < 5) return; switch (_devPos.Substring(0, 3)) { case "HMP": this.comboBox1.SelectedIndex = 0; break; case "BOF": this.comboBox1.SelectedIndex = 1; break; case "CAS": this.comboBox1.SelectedIndex = 2; break; case "LFS": this.comboBox1.SelectedIndex = 3; break; case "RHS": this.comboBox1.SelectedIndex = 4; break; case "CCM": this.comboBox1.SelectedIndex = 5; break; } this.comboBox2.SelectedIndex = Convert.ToInt32(_devPos.Substring(4, 1)); } private void GetDuty() { this._strDuty = this.comboBox3.SelectedIndex.ToString(); } /// /// 设置班组下拉框 /// private void SetDuty() { try { this.comboBox3.SelectedIndex = Convert.ToInt32(this._strDuty); } catch { } } private string CurrectDevPos(string devPos) { if (devPos.Length < 5) return ""; if (devPos.Substring(0, 3) == "BOF") { switch (devPos.Substring(4, 1)) { case "7": devPos = devPos.Replace("7", "1"); break; case "8": devPos = devPos.Replace("8", "2"); break; case "9": devPos = devPos.Replace("9", "3"); break; } } return devPos; } #endregion #region " Auto Refresh " private Thread _getDataThread; private bool On_Off_GetDataThread = false; private delegate void getDataFromAllDelegate(); private void StartGetDataThread() { try { ThreadStart ts = new ThreadStart(GetDataThread); _getDataThread = new Thread(ts); _getDataThread.Name = "GetDataThread "; _getDataThread.Start(); } catch { } } // public bool On_Off_Thread = true; //////////////////////////////////////////////////////////////// private void GetDataThread() { ReStartGetDataThread: while (true) { if (!this.On_Off_Thread || !On_Off_GetDataThread) { System.Threading.Thread.Sleep(500); continue; } try { this.Invoke(new getDataFromAllDelegate(GetDataFromAll)); System.Threading.Thread.Sleep(3000); } catch { } } goto ReStartGetDataThread; } private void checkBox1_CheckedChanged(object sender, System.EventArgs e) { On_Off_GetDataThread = this.checkBox1.Checked; } #endregion private int nRow = -1; private Color c3 = Color.White; private bool bColor = false; private void EMGrid_Click(object sender, System.EventArgs e) { if (this.EMGrid.ActiveRow != null) { foreach (Infragistics.Win.UltraWinGrid.UltraGridRow rw in this.EMGrid.Rows) { if (rw.Appearance.BackColor == Color.LightBlue) rw.Appearance.BackColor = Color.White; } // if(this.EMGrid.ActiveRow.Appearance.BackColor == Color.PaleGreen) // MessageBox.Show("PaleGreen"); if (bColor) { if (nRow < EMGrid.Rows.Count) this.EMGrid.Rows[nRow].Appearance.BackColor = c3; } else { bColor = true; } c3 = this.EMGrid.ActiveRow.Appearance.BackColor; nRow = this.EMGrid.ActiveRow.Index; this.EMGrid.ActiveRow.Appearance.BackColor = Color.LightBlue; } } #endregion } }