using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; namespace Core.LZMes.Client.QCM { public partial class QCM0203 : FrmBase { public QCM0203() { InitializeComponent(); } private void QCM0203_Load(object sender, EventArgs e) { this.comboBox4.SelectedIndex = 0; dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1); ValueList v = new ValueList(); v.ValueListItems.Add("1", "已判"); v.ValueListItems.Add("0", "未判"); this.ultraGrid1.DisplayLayout.Bands[0].Columns["JUDGE_STATUS"].ValueList = v.Clone(); this.ultraGrid2.DisplayLayout.Bands[0].Columns["ISJUDGE"].ValueList = v.Clone(); this.DoQuery();//查询 } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "InExport": // 导出实绩 ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid1, this.Text); ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid2, this.Text); break; } } //查询订单 private void DoQuery() { try { if (String.IsNullOrEmpty(comboBox4.Text)) { MessageBox.Show("请选择按什么时间去查!"); return; } this.dataSet1.Clear(); this.dataSet2.Clear(); String starttime = this.dateTimePicker1.Value.ToString("yyyy-MM-dd"); String endtime = this.dateTimePicker2.Value.ToString("yyyy-MM-dd"); string batchNo = this.textBox1.Text.Trim(); string batchNo2 = this.BATCH_NO2.Text.Trim(); string design_key = this.textBox3.Text.Trim(); string psc_desc = this.textBox4.Text.Trim(); string pline_name = this.PLINE_NAME.Text.Trim(); string dateTimeName = this.comboBox4.Text.Trim(); string materialNo = this.textBox2.Text.Trim(); //if (this.dateTimePicker1.Value > this.dateTimePicker2.Value) //{ // MessageBox.Show("日期查询条件开始日期大于结束日期!!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); // return; //} //if (this.BATCH_NO2.Text.Trim() != null && !this.BATCH_NO2.Text.Trim().Equals("")) //{ // if (this.textBox1.Text.Trim() == null || this.textBox1.Text.Equals("")) // { // MessageBox.Show("请输入轧批号开始范围!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); // this.textBox1.Focus(); // return; // } //} //if (this.textBox1.Text.Trim() != null && !this.textBox1.Text.Trim().Equals("")) //{ // if (this.BATCH_NO2.Text.Trim() == null || this.BATCH_NO2.Text.Equals("")) // { // MessageBox.Show("请输入轧批号结束范围!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); // this.BATCH_NO2.Focus(); // return; // } //} //轧批号 小框框 是否勾选 if (this.checkBox1.Checked) { starttime = ""; endtime = ""; } else { batchNo = ""; batchNo2 = ""; } if (this.checkBox2.Checked) { starttime = ""; endtime = ""; } else { materialNo = ""; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly"; ccp.MethodName = "Query"; ccp.ServerParams = new object[] { batchNo, batchNo2, design_key, psc_desc, starttime, endtime, pline_name, dateTimeName, materialNo }; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); foreach (UltraGridRow ugr in this.ultraGrid1.Rows) { ugr.Cells["Column1"].Value = ugr.Cells["THICK"].Value + "*" + ugr.Cells["WIDTH"].Value + "*" + ugr.Cells["LENGTH"].Value; } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("查询异常!","警告"); } } //查询材质实绩 private void DoQueryDetail(String SMP_NO) { try { this.dataSet2.Clear(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly"; ccp.MethodName = "getQltySampleItem"; ccp.ServerParams = new object[] { SMP_NO }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错!请联系管理人员", "警告"); } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { try { this.DoQueryDetail(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Value.ToString()); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错!请联系管理人员", "警告"); } } private void checkBox1_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.textBox1.Enabled = true; this.BATCH_NO2.Enabled = true; } else { if(!this.checkBox2.Checked){ this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.textBox1.Enabled = false; this.BATCH_NO2.Enabled = false; } } private void checkBox2_Click(object sender, EventArgs e) { if (this.checkBox2.Checked) { this.dateTimePicker1.Enabled = false; this.dateTimePicker2.Enabled = false; this.textBox2.Enabled = true; } else { if (!this.checkBox1.Checked) { this.dateTimePicker1.Enabled = true; this.dateTimePicker2.Enabled = true; } this.textBox2.Enabled = false; } } #region 不合格项变颜色 private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.Cells["IS_PASS"].Value.ToString().Equals("1")) { e.Row.Appearance.ForeColor = Color.Red;// 红色 一行 // e.Row.Cells["val1"].Appearance.ForeColor = Color.Red;//一个 } } #endregion } }