QCM0301.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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 QCM0301 : FrmBase
  16. {
  17. public QCM0301()
  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. ugr.Delete(false);
  76. MessageBox.Show("判定成功!");
  77. }
  78. catch (Exception EX)
  79. {
  80. MessageBox.Show(EX.ToString());
  81. }
  82. }
  83. private void Cancel()
  84. {
  85. try
  86. {
  87. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  88. if (ugr == null)
  89. return;
  90. string inspection_lot = ugr.Cells["inspection_lot"].Value.ToString();
  91. string smp_no = ugr.Cells["smp_no"].Value.ToString();
  92. string username = this.UserInfo.GetUserName();
  93. CoreClientParam ccp = new CoreClientParam();
  94. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
  95. ccp.MethodName = "CancelJudge";
  96. ccp.ServerParams = new object[] { inspection_lot,smp_no,username };
  97. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  98. if (ccp.ReturnCode == -1)
  99. {
  100. return;
  101. }
  102. MessageBox.Show("取消判定成功!");
  103. }
  104. catch (Exception ex)
  105. {
  106. System.Diagnostics.Debug.WriteLine(ex.ToString());
  107. MessageBox.Show("系统出错,请联系管理人员", "警告");
  108. }
  109. }
  110. private void DoQuery()
  111. {
  112. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  113. {
  114. DoQueryMe();
  115. this.ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeCards(true);
  116. }
  117. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  118. {
  119. DoQueryRe();
  120. }
  121. }
  122. //查询待判信息
  123. private void DoQueryMe()
  124. {
  125. try
  126. {
  127. if (comboBox1.SelectedIndex == 2)
  128. {
  129. MessageBox.Show("请选择委托生成或者发送时间!");
  130. return;
  131. }
  132. this.dataSet2.Clear();
  133. string heatno = textBox1.Text.Trim();
  134. string BOARD_NO = textBox2.Text.Trim();
  135. string design_key = textBox3.Text.Trim();
  136. string psc = textBox4.Text.Trim();
  137. string prodline = this.comboBox3.Text.ToString();
  138. string status = this.comboBox1.SelectedIndex.ToString();
  139. CoreClientParam ccp = new CoreClientParam();
  140. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  141. ccp.MethodName = "getRejudgeInfo";
  142. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"),heatno, BOARD_NO, design_key, psc,"0",prodline,status };
  143. ccp.SourceDataTable = this.dataSet2.Tables[0];
  144. this.ExecuteQueryToDataTable(ccp,CoreInvokeType.Internal);
  145. }
  146. catch (Exception ex)
  147. {
  148. System.Diagnostics.Debug.WriteLine(ex.ToString());
  149. MessageBox.Show("系统出错,请联系管理人员", "警告");
  150. }
  151. }
  152. //查询判定记录
  153. private void DoQueryRe()
  154. {
  155. try
  156. {
  157. if (comboBox1.SelectedIndex != 2)
  158. {
  159. MessageBox.Show("请选择判定时间!");
  160. return;
  161. }
  162. this.dataSet1.Clear();
  163. string heatno = textBox1.Text.Trim();
  164. string BOARD_NO = textBox2.Text.Trim();
  165. string design_key = textBox3.Text.Trim();
  166. string psc = textBox4.Text.Trim();
  167. string prodline = comboBox3.Text.ToString();
  168. CoreClientParam ccp = new CoreClientParam();
  169. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJudgeChemicalServiceImpl";
  170. ccp.MethodName = "GetJudgeChemRecord";
  171. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), heatno, BOARD_NO, design_key, psc,"0",prodline };
  172. ccp.SourceDataTable = this.dataSet1.Tables[0];
  173. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  174. }
  175. catch (Exception ex)
  176. {
  177. System.Diagnostics.Debug.WriteLine(ex.ToString());
  178. MessageBox.Show("系统出错,请联系管理人员", "警告");
  179. }
  180. }
  181. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  182. {
  183. try
  184. {
  185. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  186. if (ugr == null)
  187. return;
  188. this.dataSet4.Clear();
  189. string cic_id = ugr.Cells["CIC_ID"].Value.ToString();
  190. CoreClientParam ccp = new CoreClientParam();
  191. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  192. ccp.MethodName = "GetChemeResult";
  193. ccp.ServerParams = new object[] { cic_id };
  194. ccp.SourceDataTable = this.dataSet4.Tables[0];
  195. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  196. ccp = new CoreClientParam();
  197. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  198. ccp.MethodName = "GetCheme";
  199. ccp.ServerParams = new object[] { cic_id };
  200. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  201. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  202. {
  203. foreach (UltraGridRow ugr5 in this.ultraGrid5.Rows)
  204. {
  205. 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()))
  206. {
  207. if (ugr5.Cells.Contains(ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()))
  208. {
  209. ugr5.Cells[ccp.SourceDataTable.Rows[i]["phy_name_s"].ToString()].Appearance.BackColor = Color.Red;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. catch (Exception ex)
  216. {
  217. System.Diagnostics.Debug.WriteLine(ex.ToString());
  218. MessageBox.Show("系统出错,请联系管理人员", "警告");
  219. }
  220. }
  221. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  222. {
  223. try
  224. {
  225. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  226. if (ugr == null)
  227. return;
  228. this.dataSet3.Clear();
  229. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  230. string smp_no = ugr.Cells["SMP_NO"].Value.ToString();
  231. CoreClientParam ccp = new CoreClientParam();
  232. ccp.ServerName = "QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl";
  233. ccp.MethodName = "GetChemeInfo";
  234. ccp.ServerParams = new object[] { design_key, smp_no };
  235. ccp.SourceDataTable = this.dataSet3.Tables[0];
  236. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  237. this.ultraGrid2.DisplayLayout.Bands[0].PerformAutoResizeCards(true);
  238. foreach (UltraGridRow ugs in this.ultraGrid2.Rows)
  239. {
  240. ugs.Cells["CHECKBOX"].Value = ugs.Cells["CHECKBOXS"].Text.ToString();
  241. }
  242. }
  243. catch (Exception ex)
  244. {
  245. System.Diagnostics.Debug.WriteLine(ex.ToString());
  246. MessageBox.Show("系统出错,请联系管理人员", "警告");
  247. }
  248. }
  249. private void QCM0301_Load(object sender, EventArgs e)
  250. {
  251. this.comboBox3.SelectedIndex = 0;
  252. this.comboBox1.SelectedIndex = 1;
  253. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  254. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  255. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  256. DoQuery();
  257. }
  258. private void ultraTabControl1_Click(object sender, EventArgs e)
  259. {
  260. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  261. {
  262. this.comboBox1.SelectedIndex = 2;
  263. }
  264. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  265. {
  266. this.comboBox1.SelectedIndex = 1;
  267. }
  268. }
  269. private void DoExport()
  270. {
  271. try
  272. {
  273. if (this.ultraGrid4.Rows.Count == 0)
  274. {
  275. MessageBox.Show("没有可以导出的数据", "提示");
  276. return;
  277. }
  278. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  279. {
  280. string fName = this.saveFileDialog1.FileName;
  281. this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName);
  282. Process.Start(fName);
  283. }
  284. }
  285. catch (Exception ex)
  286. {
  287. System.Diagnostics.Debug.WriteLine(ex.ToString());
  288. }
  289. }
  290. }
  291. }