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 CoreFS.CA06; using Infragistics.Win.UltraWinGrid; namespace Core.LZMes.Client.QCM.QCM03 { public partial class QCM030701 : FrmBase { public QCM030701() { InitializeComponent(); } public string lock_id = ""; private void QCM030701_Load(object sender, EventArgs e) { try { this.dataSet4.Clear(); string CIC_ID = lock_id; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl"; if(CIC_ID .Contains("C")) { ccp.MethodName = "GetChemeResult"; }else{ ccp.MethodName = "GetRChemeResult"; } ccp.ServerParams = new object[] { CIC_ID }; ccp.SourceDataTable = this.dataSet4.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); ccp = new CoreClientParam(); ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl"; ccp.MethodName = "GetCheme"; ccp.ServerParams = new object[] { CIC_ID }; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); UltraGridRow judge_row = null; foreach (UltraGridRow ugst in this.ultraGrid5.Rows) { if (ccp.ReturnInfo.Contains(ugst.Cells["STD_TYPE"].Text.ToString())) { ugst.Appearance.BackColor = Color.Green; } if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求")) { judge_row = ugst; } if (judge_row != null) { foreach (UltraGridRow ugs in this.ultraGrid5.Rows) { if (!string.IsNullOrEmpty(ugs.Cells["STD_TYPE"].Text) && (((CIC_ID.StartsWith("RL") || CIC_ID.StartsWith("RA")) && ugs.Cells["STD_TYPE"].Text.ToString() == "放行标准(熔炼)") || ugs.Cells["STD_TYPE"].Text.ToString() == "交付标准(熔炼)" || ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")) { for (int i = 0; i < ugs.Cells.Count; i++) { if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" ")) { string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#'); if (str_arr.Length == 1) { if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text)) { if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString())) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text)) { if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString())) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } else if (string.IsNullOrEmpty(judge_row.Cells[i].Text)) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } else if (str_arr.Length == 2) { if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text)) { if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString())) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text)) { if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString())) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text)) { if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString())) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text)) { if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString())) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } else if (string.IsNullOrEmpty(judge_row.Cells[i].Text)) { judge_row.Cells[i].Appearance.BackColor = Color.Red; judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)") { ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red; } } } } } } } } } //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++) //{ // foreach (UltraGridRow ugr5 in this.ultraGrid5.Rows) // { // if (ccp.ReturnInfo.Contains(ugr5.Cells["STD_TYPE"].Text.ToString())) // { // ugr5.Appearance.BackColor = Color.Green; // } // if (ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmin"].ToString()) && ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Value.ToString().Contains(ccp.SourceDataTable.Rows[i]["stdmax"].ToString())) // { // ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Appearance.BackColor = Color.Red; // } // } //} RefreshAndAutoSize(ultraGrid5); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); MessageBox.Show("系统出错,请联系管理人员", "警告"); } } public static void RefreshAndAutoSize(UltraGrid ultraGrid) { try { ultraGrid.BeginUpdate(); foreach (UltraGridBand band in ultraGrid.DisplayLayout.Bands) { foreach (UltraGridColumn column in band.Columns) { column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, band.ColHeadersVisible ? true : false); } } } catch { } ultraGrid.EndUpdate(); } } }