24592cb72399ef02a8f3025978fa83fda6ffc788.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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 Infragistics.Win.UltraWinGrid;
  10. using Infragistics.Win;
  11. using System.Collections;
  12. using CoreFS.CA06;
  13. using System.Diagnostics;
  14. namespace Core.LZMes.Client.QCM
  15. {
  16. public partial class QCM030508 : FrmBase
  17. {
  18. public QCM030508()
  19. {
  20. InitializeComponent();
  21. }
  22. public override void ToolBar_Click(object sender, string ToolbarKey)
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. this.DoQuery();
  28. break;
  29. case "Export":
  30. this.DoExport();
  31. break;
  32. case "Save":
  33. this.DoSave();
  34. break;
  35. }
  36. }
  37. private void DoQuery()
  38. {
  39. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  40. {
  41. DoQueryMe();
  42. }
  43. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  44. {
  45. DoQueryRe();
  46. }
  47. if (this.ultraTabControl1.Tabs[2].Selected) //判定记录
  48. {
  49. DoQueryRe1();
  50. }
  51. }
  52. private void DoQueryMe()
  53. {
  54. try
  55. {
  56. this.dataSet3.Clear();
  57. string sbatchno = "";
  58. string ebatchno = "";
  59. if (checkBox3.Checked)
  60. {
  61. sbatchno = this.textBox2.Text.Trim();
  62. if (textBox1.Text.ToString() == "")
  63. {
  64. ebatchno = this.textBox2.Text.Trim();
  65. }
  66. else
  67. {
  68. ebatchno = this.textBox1.Text.Trim();
  69. }
  70. }
  71. string ord_no = "";
  72. if (checkBox1.Checked)
  73. {
  74. ord_no = textBox4.Text.Trim();
  75. }
  76. string ord_no2 = "";
  77. if(this.checkBox4.Checked){
  78. ord_no2 = this.textBox3.Text.Trim();
  79. }
  80. /*if (!checkBox1.Checked && !checkBox3.Checked )
  81. {
  82. MessageBox.Show("轧批号、计划订单号必须选择其中一个条件!");
  83. return;
  84. }*/
  85. CoreClientParam ccp = new CoreClientParam();
  86. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  87. ccp.MethodName = "GetKcZReport1";
  88. ccp.ServerParams = new object[] { sbatchno, ebatchno, ord_no, ord_no2 };
  89. ccp.SourceDataTable = this.dataSet3.Tables[0];
  90. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  91. }
  92. catch (Exception ex)
  93. {
  94. System.Diagnostics.Debug.WriteLine(ex.ToString());
  95. MessageBox.Show("系统出错,请联系管理人员", "警告");
  96. }
  97. }
  98. private void DoQueryRe()
  99. {
  100. try
  101. {
  102. this.dataSet2.Clear();
  103. string sbatchno = "";
  104. string ebatchno = "";
  105. if (checkBox3.Checked)
  106. {
  107. sbatchno = this.textBox2.Text.Trim();
  108. if (textBox1.Text.ToString() == "")
  109. {
  110. ebatchno = this.textBox2.Text.Trim();
  111. }
  112. else
  113. {
  114. ebatchno = this.textBox1.Text.Trim();
  115. }
  116. }
  117. string ord_no = "";
  118. if (checkBox1.Checked)
  119. {
  120. ord_no = textBox4.Text.Trim(); //轧辊单元
  121. }
  122. string ord_no2 = "";
  123. if (this.checkBox4.Checked)
  124. {
  125. ord_no2 = this.textBox3.Text.Trim();
  126. }
  127. /*if (!checkBox1.Checked && !checkBox3.Checked)
  128. {
  129. MessageBox.Show("轧批号、计划订单号必须选择其中一个条件!");
  130. return;
  131. }*/
  132. CoreClientParam ccp = new CoreClientParam();
  133. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  134. ccp.MethodName = "GetKcHReport1";
  135. ccp.ServerParams = new object[] { sbatchno, ebatchno, ord_no, ord_no2 };
  136. ccp.SourceDataTable = this.dataSet2.Tables[0];
  137. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  138. }
  139. catch (Exception ex)
  140. {
  141. System.Diagnostics.Debug.WriteLine(ex.ToString());
  142. MessageBox.Show("系统出错,请联系管理人员", "警告");
  143. }
  144. }
  145. private void DoQueryRe1()
  146. {
  147. try
  148. {
  149. this.dataSet7.Clear();
  150. string sbatchno = "";
  151. string ebatchno = "";
  152. if (checkBox3.Checked)
  153. {
  154. sbatchno = this.textBox2.Text.Trim();
  155. if (textBox1.Text.ToString() == "")
  156. {
  157. ebatchno = this.textBox2.Text.Trim();
  158. }
  159. else
  160. {
  161. ebatchno = this.textBox1.Text.Trim();
  162. }
  163. }
  164. string ord_no = "";
  165. if (checkBox1.Checked)
  166. {
  167. ord_no = textBox4.Text.Trim(); //轧辊单元
  168. }
  169. string ord_no2 = "";
  170. if (this.checkBox4.Checked)
  171. {
  172. ord_no2 = this.textBox3.Text.Trim();
  173. }
  174. /*if (!checkBox1.Checked && !checkBox3.Checked)
  175. {
  176. MessageBox.Show("轧批号、计划订单号必须选择其中一个条件!");
  177. return;
  178. }*/
  179. CoreClientParam ccp = new CoreClientParam();
  180. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  181. ccp.MethodName = "GetBJReport1";
  182. ccp.ServerParams = new object[] { sbatchno, ebatchno, ord_no, ord_no2 };
  183. ccp.SourceDataTable = this.dataSet7.Tables[0];
  184. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  185. }
  186. catch (Exception ex)
  187. {
  188. System.Diagnostics.Debug.WriteLine(ex.ToString());
  189. MessageBox.Show("系统出错,请联系管理人员", "警告");
  190. }
  191. }
  192. private void DoSave()
  193. {
  194. if (this.ultraTabControl1.Tabs[0].Selected)
  195. {
  196. foreach (UltraGridRow ugr in ultraGrid3.Rows)
  197. {
  198. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  199. {
  200. CoreClientParam ccp = new CoreClientParam();
  201. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  202. ccp.MethodName = "in_Judgereason";
  203. ccp.ServerParams = new object[] { ugr.Cells["子板号"].Value.ToString(), ugr.Cells["JUDGE_REASON"].Text.ToString(),
  204. ugr.Cells["JUDGE_REG"].Text.ToString(),ugr.Cells["PTIME"].Text.ToString(),ugr.Cells["COIL_STAT"].Text.ToString() };
  205. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  206. if (ccp.ReturnCode == -1)
  207. {
  208. return;
  209. }
  210. ugr.Cells["CHECK"].Value = "False";
  211. }
  212. }
  213. MessageBox.Show("录入成功");
  214. }
  215. else if (this.ultraTabControl1.Tabs[1].Selected)
  216. {
  217. foreach (UltraGridRow ugr in ultraGrid1.Rows)
  218. {
  219. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  220. {
  221. CoreClientParam ccp = new CoreClientParam();
  222. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  223. ccp.MethodName = "in_Judgereason";
  224. ccp.ServerParams = new object[] { ugr.Cells["子板号"].Value.ToString(), ugr.Cells["JUDGE_REASON"].Text.ToString(),
  225. ugr.Cells["JUDGE_REG"].Text.ToString(),ugr.Cells["PTIME"].Text.ToString(),ugr.Cells["COIL_STAT"].Text.ToString() };
  226. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  227. if (ccp.ReturnCode == -1)
  228. {
  229. return;
  230. }
  231. ugr.Cells["CHECK"].Value = "False";
  232. }
  233. }
  234. MessageBox.Show("录入成功");
  235. }
  236. else if (this.ultraTabControl1.Tabs[2].Selected)
  237. {
  238. foreach (UltraGridRow ugr in ultraGrid2.Rows)
  239. {
  240. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  241. {
  242. CoreClientParam ccp = new CoreClientParam();
  243. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  244. ccp.MethodName = "in_Judgereason";
  245. ccp.ServerParams = new object[] { ugr.Cells["子板号"].Value.ToString(), ugr.Cells["JUDGE_REASON"].Text.ToString(),
  246. ugr.Cells["JUDGE_REG"].Text.ToString(),ugr.Cells["PTIME"].Text.ToString(),ugr.Cells["COIL_STAT"].Text.ToString() };
  247. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  248. if (ccp.ReturnCode == -1)
  249. {
  250. return;
  251. }
  252. ugr.Cells["CHECK"].Value = "False";
  253. }
  254. }
  255. MessageBox.Show("录入成功");
  256. }
  257. }
  258. private void DoExport()
  259. {
  260. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  261. {
  262. this.saveFileDialog1.FileName = "中板线待检信息";
  263. try
  264. {
  265. if (this.ultraGrid3.Rows.Count == 0)
  266. {
  267. MessageBox.Show("没有可以导出的数据", "提示");
  268. return;
  269. }
  270. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  271. {
  272. string fName = this.saveFileDialog1.FileName;
  273. this.ultraGridExcelExporter1.Export(this.ultraGrid3, fName);
  274. Process.Start(fName);
  275. }
  276. }
  277. catch (Exception ex)
  278. {
  279. System.Diagnostics.Debug.WriteLine(ex.ToString());
  280. }
  281. }
  282. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  283. {
  284. this.saveFileDialog1.FileName = "厚板线待检信息";
  285. try
  286. {
  287. if (this.ultraGrid1.Rows.Count == 0)
  288. {
  289. MessageBox.Show("没有可以导出的数据", "提示");
  290. return;
  291. }
  292. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  293. {
  294. string fName = this.saveFileDialog1.FileName;
  295. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  296. Process.Start(fName);
  297. }
  298. }
  299. catch (Exception ex)
  300. {
  301. System.Diagnostics.Debug.WriteLine(ex.ToString());
  302. }
  303. }
  304. if (this.ultraTabControl1.Tabs[2].Selected) //判定记录
  305. {
  306. this.saveFileDialog1.FileName = "板加待检信息";
  307. try
  308. {
  309. if (this.ultraGrid2.Rows.Count == 0)
  310. {
  311. MessageBox.Show("没有可以导出的数据", "提示");
  312. return;
  313. }
  314. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  315. {
  316. string fName = this.saveFileDialog1.FileName;
  317. this.ultraGridExcelExporter1.Export(this.ultraGrid2, fName);
  318. Process.Start(fName);
  319. }
  320. }
  321. catch (Exception ex)
  322. {
  323. System.Diagnostics.Debug.WriteLine(ex.ToString());
  324. }
  325. }
  326. }
  327. private void QCM030508_Load(object sender, EventArgs e)
  328. {
  329. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  330. this.ultraGrid3.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  331. }
  332. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  333. {
  334. if (this.ultraTabControl1.Tabs[0].Selected)
  335. {
  336. foreach (UltraGridRow ugr in this.ultraGrid3.Rows.Where(p => p.IsFilteredOut == false).ToList())
  337. {
  338. if (checkBox2.Checked)
  339. {
  340. ugr.Cells["CHECK"].Value = "True";
  341. }
  342. else
  343. {
  344. ugr.Cells["CHECK"].Value = "False";
  345. }
  346. }
  347. }
  348. else if (this.ultraTabControl1.Tabs[1].Selected)
  349. {
  350. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  351. {
  352. if (checkBox2.Checked)
  353. {
  354. ugr.Cells["CHECK"].Value = "True";
  355. }
  356. else
  357. {
  358. ugr.Cells["CHECK"].Value = "False";
  359. }
  360. }
  361. }
  362. else
  363. {
  364. foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList())
  365. {
  366. if (checkBox2.Checked)
  367. {
  368. ugr.Cells["CHECK"].Value = "True";
  369. }
  370. else
  371. {
  372. ugr.Cells["CHECK"].Value = "False";
  373. }
  374. }
  375. }
  376. }
  377. private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
  378. {
  379. try
  380. {
  381. UltraGridRow ugr = this.ultraGrid3.ActiveRow;
  382. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  383. {
  384. ugr.Cells["CHECK"].Value = "False";
  385. }
  386. else
  387. {
  388. ugr.Cells["CHECK"].Value = "True";
  389. }
  390. }
  391. catch (Exception ex)
  392. {
  393. System.Diagnostics.Debug.WriteLine(ex.ToString());
  394. MessageBox.Show("系统出错,请联系管理人员", "警告");
  395. }
  396. }
  397. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  398. {
  399. try
  400. {
  401. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  402. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  403. {
  404. ugr.Cells["CHECK"].Value = "False";
  405. }
  406. else
  407. {
  408. ugr.Cells["CHECK"].Value = "True";
  409. }
  410. }
  411. catch (Exception ex)
  412. {
  413. System.Diagnostics.Debug.WriteLine(ex.ToString());
  414. MessageBox.Show("系统出错,请联系管理人员", "警告");
  415. }
  416. }
  417. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  418. {
  419. }
  420. private void ultraGrid1_AfterRowActivate22(object sender, EventArgs e)
  421. {
  422. try
  423. {
  424. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  425. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  426. {
  427. ugr.Cells["CHECK"].Value = "False";
  428. }
  429. else
  430. {
  431. ugr.Cells["CHECK"].Value = "True";
  432. }
  433. }
  434. catch (Exception ex)
  435. {
  436. System.Diagnostics.Debug.WriteLine(ex.ToString());
  437. MessageBox.Show("系统出错,请联系管理人员", "警告");
  438. }
  439. }
  440. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  441. {
  442. this.ultraGrid1.ActiveRow = null;
  443. }
  444. }
  445. }