QCM030701.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Infragistics.Win.UltraWinGrid;
  11. namespace Core.LZMes.Client.QCM.QCM03
  12. {
  13. public partial class QCM030701 : FrmBase
  14. {
  15. public QCM030701()
  16. {
  17. InitializeComponent();
  18. }
  19. public string lock_id = "";
  20. private void QCM030701_Load(object sender, EventArgs e)
  21. {
  22. try
  23. {
  24. this.dataSet4.Clear();
  25. string CIC_ID = lock_id;
  26. CoreClientParam ccp = new CoreClientParam();
  27. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  28. if(CIC_ID .Contains("C"))
  29. {
  30. ccp.MethodName = "GetChemeResult";
  31. }else{
  32. ccp.MethodName = "GetRChemeResult";
  33. }
  34. ccp.ServerParams = new object[] { CIC_ID };
  35. ccp.SourceDataTable = this.dataSet4.Tables[0];
  36. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  37. ccp = new CoreClientParam();
  38. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  39. ccp.MethodName = "GetCheme";
  40. ccp.ServerParams = new object[] { CIC_ID };
  41. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  42. UltraGridRow judge_row = null;
  43. foreach (UltraGridRow ugst in this.ultraGrid5.Rows)
  44. {
  45. if (ccp.ReturnInfo.Contains(ugst.Cells["STD_TYPE"].Text.ToString()))
  46. {
  47. ugst.Appearance.BackColor = Color.Green;
  48. }
  49. if (!ugst.Cells["STD_TYPE"].Text.ToString().Contains("标准") && !ugst.Cells["STD_TYPE"].Text.ToString().Contains("要求"))
  50. {
  51. judge_row = ugst;
  52. }
  53. if (judge_row != null)
  54. {
  55. foreach (UltraGridRow ugs in this.ultraGrid5.Rows)
  56. {
  57. 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() == "特殊要求(熔炼)"))
  58. {
  59. for (int i = 0; i < ugs.Cells.Count; i++)
  60. {
  61. if (!string.IsNullOrEmpty(ugs.Cells[i].Text) && ugs.Cells[i].Text.ToString().Contains(" "))
  62. {
  63. string[] str_arr = ugs.Cells[i].Text.ToString().Replace(" ", "#").Split('#');
  64. if (str_arr.Length == 1)
  65. {
  66. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  67. {
  68. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  69. {
  70. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  71. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  72. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  73. {
  74. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  75. }
  76. }
  77. }
  78. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  79. {
  80. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  81. {
  82. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  83. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  84. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  85. {
  86. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  87. }
  88. }
  89. }
  90. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  91. {
  92. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  93. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  94. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  95. {
  96. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  97. }
  98. }
  99. }
  100. else if (str_arr.Length == 2)
  101. {
  102. if (str_arr[0].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  103. {
  104. if (double.Parse(str_arr[0].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  105. {
  106. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  107. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  108. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  109. {
  110. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  111. }
  112. }
  113. }
  114. else if (str_arr[0].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  115. {
  116. if (double.Parse(str_arr[0].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  117. {
  118. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  119. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  120. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  121. {
  122. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  123. }
  124. }
  125. }
  126. if (str_arr[1].Contains("<=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  127. {
  128. if (double.Parse(str_arr[1].Replace("<=", "")) < double.Parse(judge_row.Cells[i].Text.ToString()))
  129. {
  130. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  131. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  132. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  133. {
  134. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  135. }
  136. }
  137. }
  138. else if (str_arr[1].Contains(">=") && !string.IsNullOrEmpty(judge_row.Cells[i].Text))
  139. {
  140. if (double.Parse(str_arr[1].Replace(">=", "")) > double.Parse(judge_row.Cells[i].Text.ToString()))
  141. {
  142. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  143. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  144. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  145. {
  146. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  147. }
  148. }
  149. }
  150. else if (string.IsNullOrEmpty(judge_row.Cells[i].Text))
  151. {
  152. judge_row.Cells[i].Appearance.BackColor = Color.Red;
  153. judge_row.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  154. if (ugs.Cells["STD_TYPE"].Text.ToString() == "特殊要求(熔炼)")
  155. {
  156. ugs.Cells["STD_TYPE"].Appearance.BackColor = Color.Red;
  157. }
  158. }
  159. }
  160. }
  161. }
  162. }
  163. }
  164. }
  165. }
  166. //for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  167. //{
  168. // foreach (UltraGridRow ugr5 in this.ultraGrid5.Rows)
  169. // {
  170. // if (ccp.ReturnInfo.Contains(ugr5.Cells["STD_TYPE"].Text.ToString()))
  171. // {
  172. // ugr5.Appearance.BackColor = Color.Green;
  173. // }
  174. // 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()))
  175. // {
  176. // ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_code_s"].ToString()].Appearance.BackColor = Color.Red;
  177. // }
  178. // }
  179. //}
  180. RefreshAndAutoSize(ultraGrid5);
  181. }
  182. catch (Exception ex)
  183. {
  184. System.Diagnostics.Debug.WriteLine(ex.ToString());
  185. MessageBox.Show("系统出错,请联系管理人员", "警告");
  186. }
  187. }
  188. public static void RefreshAndAutoSize(UltraGrid ultraGrid)
  189. {
  190. try
  191. {
  192. ultraGrid.BeginUpdate();
  193. foreach (UltraGridBand band in ultraGrid.DisplayLayout.Bands)
  194. {
  195. foreach (UltraGridColumn column in band.Columns)
  196. {
  197. column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, band.ColHeadersVisible ? true : false);
  198. }
  199. }
  200. }
  201. catch { }
  202. ultraGrid.EndUpdate();
  203. }
  204. }
  205. }