QCM030102.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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 System.Collections;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. namespace Core.LZMes.Client.QCM
  14. {
  15. public partial class QCM030102 : FrmBase
  16. {
  17. public QCM030102()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case"Query":
  26. this.DoQuery();
  27. break;
  28. case "Judge":
  29. this.Judge();
  30. break;
  31. case "Cancel":
  32. this.Cancel();
  33. break;
  34. case "Export":
  35. this.DoExport();
  36. break;
  37. }
  38. }
  39. private void Judge()
  40. {
  41. try
  42. {
  43. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  44. List<string> list1 = new List<string>();
  45. if (ugr == null)
  46. return;
  47. string heat_no = ugr.Cells["HEAT_NO"].Value.ToString();
  48. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  49. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  50. string grade_name = ugr.Cells["GRADE_NAME"].Value.ToString();
  51. string username = this.UserInfo.GetUserName();
  52. string assay_no = "";
  53. foreach (UltraGridRow ugrs in this.ultraGrid2.Rows)
  54. {
  55. if (ugrs.Cells["CHECKBOX"].Text.ToString() == "True")
  56. {
  57. assay_no = ugrs.Cells["STD_TYPE"].Value.ToString();
  58. list1.Add(assay_no);
  59. }
  60. }
  61. if (list1.Count == 0)
  62. {
  63. MessageBox.Show("请选择检验实绩!");
  64. return;
  65. }
  66. CoreClientParam ccp = new CoreClientParam();
  67. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  68. ccp.MethodName = "JudgeByHuman1";
  69. ccp.ServerParams = new object[] { heat_no, material_no, design_key, username, grade_name, list1 };
  70. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  71. if (ccp.ReturnCode == -1)
  72. {
  73. return;
  74. }
  75. MessageBox.Show("判定成功!");
  76. }
  77. catch (Exception EX)
  78. {
  79. MessageBox.Show(EX.ToString());
  80. }
  81. }
  82. private void Cancel()
  83. {
  84. try
  85. {
  86. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  87. if (ugr == null)
  88. return;
  89. string inspection_lot = ugr.Cells["inspection_lot"].Value.ToString();
  90. string smp_no = ugr.Cells["smp_no"].Value.ToString();
  91. string username = this.UserInfo.GetUserName();
  92. CoreClientParam ccp = new CoreClientParam();
  93. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
  94. ccp.MethodName = "CancelJudge";
  95. ccp.ServerParams = new object[] { inspection_lot,smp_no,username };
  96. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  97. if (ccp.ReturnCode == -1)
  98. {
  99. return;
  100. }
  101. MessageBox.Show("取消判定成功!");
  102. }
  103. catch (Exception ex)
  104. {
  105. System.Diagnostics.Debug.WriteLine(ex.ToString());
  106. MessageBox.Show("系统出错,请联系管理人员", "警告");
  107. }
  108. }
  109. private void DoQuery()
  110. {
  111. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  112. {
  113. DoQueryMe();
  114. }
  115. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  116. {
  117. DoQueryRe();
  118. }
  119. }
  120. //查询待判信息
  121. private void DoQueryMe()
  122. {
  123. try
  124. {
  125. if (comboBox1.SelectedIndex == 2)
  126. {
  127. MessageBox.Show("请选择委托生成或者发送时间!");
  128. return;
  129. }
  130. this.dataSet2.Clear();
  131. string heatno = textBox1.Text.Trim();
  132. string BOARD_NO = textBox2.Text.Trim();
  133. string design_key = textBox3.Text.Trim();
  134. string psc = textBox4.Text.Trim();
  135. string prodline = comboBox3.Text.ToString();
  136. string status = this.comboBox1.SelectedIndex.ToString();
  137. CoreClientParam ccp = new CoreClientParam();
  138. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  139. ccp.MethodName = "getRejudgeInfo";
  140. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"),heatno, BOARD_NO, design_key, psc,"2" ,prodline,status};
  141. ccp.SourceDataTable = this.dataSet2.Tables[0];
  142. this.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
  143. }
  144. catch (Exception ex)
  145. {
  146. System.Diagnostics.Debug.WriteLine(ex.ToString());
  147. MessageBox.Show("系统出错,请联系管理人员", "警告");
  148. }
  149. }
  150. //查询判定记录
  151. private void DoQueryRe()
  152. {
  153. try
  154. {
  155. if (comboBox1.SelectedIndex != 2)
  156. {
  157. MessageBox.Show("请选择判定时间!");
  158. return;
  159. }
  160. this.dataSet1.Clear();
  161. string heatno = textBox1.Text.Trim();
  162. string BOARD_NO = textBox2.Text.Trim();
  163. string design_key = textBox3.Text.Trim();
  164. string psc = textBox4.Text.Trim();
  165. string prodline = comboBox3.Text.ToString();
  166. CoreClientParam ccp = new CoreClientParam();
  167. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
  168. ccp.MethodName = "GetJudgeChemRecord";
  169. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), heatno, BOARD_NO, design_key, psc,"2",prodline };
  170. ccp.SourceDataTable = this.dataSet1.Tables[0];
  171. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  172. }
  173. catch (Exception ex)
  174. {
  175. System.Diagnostics.Debug.WriteLine(ex.ToString());
  176. MessageBox.Show("系统出错,请联系管理人员", "警告");
  177. }
  178. }
  179. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  180. {
  181. try
  182. {
  183. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  184. if (ugr == null)
  185. return;
  186. this.dataSet4.Clear();
  187. string cic_id = ugr.Cells["CIC_ID"].Value.ToString();
  188. CoreClientParam ccp = new CoreClientParam();
  189. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  190. ccp.MethodName = "GetChemeResult";
  191. ccp.ServerParams = new object[] { cic_id };
  192. ccp.SourceDataTable = this.dataSet4.Tables[0];
  193. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  194. ccp = new CoreClientParam();
  195. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  196. ccp.MethodName = "GetCheme";
  197. ccp.ServerParams = new object[] { cic_id };
  198. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  199. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  200. {
  201. foreach (UltraGridRow ugr5 in this.ultraGrid5.Rows)
  202. {
  203. 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()))
  204. {
  205. if (ugr5.Cells.Contains(ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()))
  206. {
  207. ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()].Appearance.BackColor = Color.Red;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. catch (Exception ex)
  214. {
  215. System.Diagnostics.Debug.WriteLine(ex.ToString());
  216. MessageBox.Show("系统出错,请联系管理人员", "警告");
  217. }
  218. }
  219. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  220. {
  221. try
  222. {
  223. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  224. if (ugr == null)
  225. return;
  226. this.dataSet3.Clear();
  227. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  228. string smp_no = ugr.Cells["SMP_NO"].Value.ToString();
  229. CoreClientParam ccp = new CoreClientParam();
  230. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  231. ccp.MethodName = "GetChemeInfo";
  232. ccp.ServerParams = new object[] { design_key, smp_no };
  233. ccp.SourceDataTable = this.dataSet3.Tables[0];
  234. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  235. foreach (UltraGridRow ugs in this.ultraGrid2.Rows)
  236. {
  237. ugs.Cells["CHECKBOX"].Value = ugs.Cells["CHECKBOXS"].Text.ToString();
  238. }
  239. }
  240. catch (Exception ex)
  241. {
  242. System.Diagnostics.Debug.WriteLine(ex.ToString());
  243. MessageBox.Show("系统出错,请联系管理人员", "警告");
  244. }
  245. }
  246. private void QCM030102_Load(object sender, EventArgs e)
  247. {
  248. this.comboBox3.SelectedIndex = 0;
  249. this.comboBox1.SelectedIndex = 1;
  250. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  251. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  252. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  253. this.DoQuery();
  254. }
  255. private void ultraTabControl1_Click(object sender, EventArgs e)
  256. {
  257. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  258. {
  259. this.comboBox1.SelectedIndex = 2;
  260. }
  261. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  262. {
  263. this.comboBox1.SelectedIndex = 1;
  264. }
  265. }
  266. private void DoExport()
  267. {
  268. try
  269. {
  270. if (this.ultraGrid4.Rows.Count == 0)
  271. {
  272. MessageBox.Show("没有可以导出的数据", "提示");
  273. return;
  274. }
  275. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  276. {
  277. string fName = this.saveFileDialog1.FileName;
  278. this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName);
  279. Process.Start(fName);
  280. }
  281. }
  282. catch (Exception ex)
  283. {
  284. System.Diagnostics.Debug.WriteLine(ex.ToString());
  285. }
  286. }
  287. }
  288. }