00c19ad4a6ebd9e5dc409899b420f4156ad99c15.svn-base 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  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;
  11. using System.Collections;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System.Diagnostics;
  14. namespace Core.LZMes.Client.QCM
  15. {
  16. public partial class QCM030303 : FrmBase
  17. {
  18. public QCM030303()
  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. }
  33. }
  34. private void DoQuery()
  35. {
  36. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  37. {
  38. DoQueryMe();
  39. }
  40. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  41. {
  42. DoQueryRe();
  43. }
  44. }
  45. //查询待判信息
  46. private void DoQueryMe()
  47. {
  48. try
  49. {
  50. this.dataSet2.Clear();
  51. string starttime ="";
  52. string endtime = "";
  53. if (checkBox2.Checked)
  54. {
  55. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  56. endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd");
  57. }
  58. string sbatchno = "";
  59. string ebatchno = "";
  60. if (checkBox3.Checked)
  61. {
  62. sbatchno = this.textBox1.Text.Trim();
  63. if (textBox2.Text.ToString() == "")
  64. {
  65. ebatchno = this.textBox1.Text.Trim();
  66. }
  67. else
  68. {
  69. ebatchno = this.textBox2.Text.Trim();
  70. }
  71. }
  72. if (!checkBox2.Checked && !checkBox3.Checked)
  73. {
  74. MessageBox.Show("时间与轧批号必须选择其中一个条件!");
  75. return;
  76. }
  77. string orderno = this.textBox3.Text.Trim();// 订单号
  78. string psc = textBox4.Text.Trim(); //产品描述
  79. string prodline = this.comboBox3.Text.ToString();
  80. string isjudge = this.comboBox4.Text.ToString();
  81. string steelname = this.textBox10.Text.ToString();
  82. CoreClientParam ccp = new CoreClientParam();
  83. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  84. ccp.MethodName = "doQueryMaterialDetailsJ2";
  85. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc,"M" ,prodline,isjudge,steelname};
  86. ccp.SourceDataTable = this.dataSet2.Tables[0];
  87. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  88. }
  89. catch (Exception ex)
  90. {
  91. System.Diagnostics.Debug.WriteLine(ex.ToString());
  92. MessageBox.Show("系统出错,请联系管理人员", "警告");
  93. }
  94. }
  95. //查询判定记录
  96. private void DoQueryRe()
  97. {
  98. try
  99. {
  100. this.dataSet5.Clear();
  101. string starttime = "";
  102. string endtime = "";
  103. if (checkBox2.Checked)
  104. {
  105. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  106. endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  107. }
  108. string sbatchno = "";
  109. string ebatchno = "";
  110. if (checkBox3.Checked)
  111. {
  112. sbatchno = this.textBox1.Text.Trim();
  113. if (textBox2.Text.ToString() == "")
  114. {
  115. ebatchno = this.textBox1.Text.Trim();
  116. }
  117. else
  118. {
  119. ebatchno = this.textBox2.Text.Trim();
  120. }
  121. }
  122. if (!checkBox2.Checked && !checkBox3.Checked)
  123. {
  124. MessageBox.Show("时间与轧批号必须选择其中一个条件!");
  125. return;
  126. }
  127. string orderno = this.textBox3.Text.Trim();// 订单号
  128. string psc = textBox4.Text.Trim(); //产品描述
  129. string stellname = this.textBox10.Text.Trim();
  130. string prodline = this.comboBox3.Text.ToString();
  131. CoreClientParam ccp = new CoreClientParam();
  132. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  133. ccp.MethodName = "GetMeasureInfoJ";
  134. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc, prodline, stellname };
  135. ccp.SourceDataTable = this.dataSet5.Tables[0];
  136. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  137. }
  138. catch (Exception ex)
  139. {
  140. System.Diagnostics.Debug.WriteLine(ex.ToString());
  141. MessageBox.Show("系统出错,请联系管理人员", "警告");
  142. }
  143. }
  144. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  145. {
  146. try
  147. {
  148. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  149. if (ugr == null)
  150. return;
  151. this.dataSet3.Clear();
  152. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  153. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  154. CoreClientParam ccp = new CoreClientParam();
  155. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  156. ccp.MethodName = "getToleranceJ";
  157. ccp.ServerParams = new object[] { design_key, material_no };
  158. ccp.SourceDataTable = this.dataSet3.Tables[0];
  159. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  160. this.dataSet4.Clear();
  161. string sic_id = ugr.Cells["SIZEID"].Value.ToString();
  162. if (sic_id != "")
  163. {
  164. ccp = new CoreClientParam();
  165. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  166. ccp.MethodName = "getQcmJudgeMeasureJ";
  167. ccp.ServerParams = new object[] { sic_id };
  168. ccp.SourceDataTable = this.dataSet4.Tables[0];
  169. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  170. }
  171. if (design_key != "")
  172. {
  173. ccp = new CoreClientParam();
  174. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  175. ccp.MethodName = "GetMemo";
  176. ccp.ServerParams = new object[] { design_key };
  177. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  178. if (ccp.SourceDataTable.Rows.Count == 0)
  179. {
  180. this.textBox6.Text = "";
  181. }
  182. else
  183. {
  184. this.textBox6.Text = ccp.SourceDataTable.Rows[0]["MEMO"].ToString();
  185. }
  186. }
  187. }
  188. catch (Exception ex)
  189. {
  190. System.Diagnostics.Debug.WriteLine(ex.ToString());
  191. MessageBox.Show("系统出错,请联系管理人员", "警告");
  192. }
  193. }
  194. private void QCM0303_Load(object sender, EventArgs e)
  195. {
  196. this.comboBox3.SelectedIndex = 0;
  197. ValueList VFLAW_SIZE_DESC = new ValueList();
  198. VFLAW_SIZE_DESC.ValueListItems.Add("0", "传动侧");
  199. VFLAW_SIZE_DESC.ValueListItems.Add("1", "中间");
  200. VFLAW_SIZE_DESC.ValueListItems.Add("2", "操作侧");
  201. //this.ultraGrid5.DisplayLayout.Bands[0].Columns["THICK_TYPE"].ValueList = VFLAW_SIZE_DESC;
  202. ValueList vsflv = new ValueList();
  203. CoreClientParam ccp = new CoreClientParam(); ccp = new CoreClientParam();
  204. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  205. ccp.MethodName = "findSfLv";
  206. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  207. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  208. {
  209. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  210. }
  211. this.comboBox2.DataSource = vsflv.ValueListItems;
  212. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  213. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  214. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  215. this.comboBox3.SelectedIndex = 0;
  216. this.comboBox4.SelectedIndex = 0;
  217. DoQuery();
  218. }
  219. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  220. {
  221. try
  222. {
  223. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  224. if (ugr == null)
  225. return;
  226. this.dataSet6.Clear();
  227. string sic = ugr.Cells["SIC_ID"].Value.ToString();
  228. CoreClientParam ccp = new CoreClientParam();
  229. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  230. ccp.MethodName = "getToleranceInfoNew";
  231. ccp.ServerParams = new object[] { sic };
  232. ccp.SourceDataTable = this.dataSet6.Tables[0];
  233. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  234. this.dataSet7.Clear();
  235. ccp = new CoreClientParam();
  236. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  237. ccp.MethodName = "getQcmJudgeMeasureJ";
  238. ccp.ServerParams = new object[] { sic };
  239. ccp.SourceDataTable = this.dataSet7.Tables[0];
  240. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  241. }
  242. catch (Exception ex)
  243. {
  244. System.Diagnostics.Debug.WriteLine(ex.ToString());
  245. MessageBox.Show("系统出错,请联系管理人员", "警告");
  246. }
  247. }
  248. private void button1_Click(object sender, EventArgs e)
  249. {
  250. try
  251. {
  252. int count = 0;
  253. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  254. {
  255. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  256. {
  257. count++;
  258. }
  259. }
  260. List<UltraGridRow> lists = new List<UltraGridRow>();
  261. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  262. {
  263. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  264. {
  265. if (count == 1)
  266. {
  267. ArrayList list1 = new ArrayList();
  268. List<ArrayList> list2 = new List<ArrayList>();
  269. List<ArrayList> list3 = new List<ArrayList>();
  270. list1.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());
  271. list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  272. if (comboBox1.Text.ToString() == "")
  273. {
  274. list1.Add("");
  275. list1.Add("");
  276. }
  277. else
  278. {
  279. if (comboBox1.Text.ToString() == "合格")
  280. {
  281. list1.Add("1");
  282. list1.Add("合格");
  283. }
  284. else if (comboBox1.Text.ToString() == "不合格")
  285. {
  286. list1.Add("2");
  287. list1.Add("不合格");
  288. }
  289. else
  290. {
  291. list1.Add("0");
  292. list1.Add("待判");
  293. }
  294. }
  295. string is_zl = "";
  296. if (comboBox2.Text.ToString() == "正品")
  297. {
  298. is_zl = "512601";
  299. }
  300. else if (comboBox2.Text.ToString() == "次品")
  301. {
  302. is_zl = "512602";
  303. }
  304. else if (comboBox2.Text.ToString() == "废品")
  305. {
  306. is_zl = "512603";
  307. }
  308. else if (comboBox2.Text.ToString() == "协议品")
  309. {
  310. is_zl = "512604";
  311. }
  312. else if (comboBox2.Text.ToString() == "订单外")
  313. {
  314. is_zl = "512605";
  315. }
  316. list1.Add(textBox5.Text.Trim().ToString());
  317. list1.Add(this.UserInfo.GetUserName());
  318. list1.Add(this.UserInfo.GetUserOrderText());
  319. list1.Add(this.UserInfo.GetUserGroupText());
  320. list1.Add(is_zl);//质量等级代码
  321. list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称
  322. ArrayList list = new ArrayList();
  323. list.Add(ugr.Cells["BIAS_CODE"].Text.ToString());
  324. list.Add(ugr.Cells["VAL"].Text.ToString());
  325. list.Add(ugr.Cells["BIAS_NAME"].Text.ToString());
  326. list.Add(ugr.Cells["PLAN"].Text.ToString());
  327. list.Add(ugr.Cells["VAL2"].Text.ToString());
  328. list2.Add(list);
  329. list = new ArrayList();
  330. list.Add(ugr.Cells["BIAS_CODE_2"].Text.ToString());
  331. list.Add(ugr.Cells["VAL_2"].Text.ToString());
  332. list.Add(ugr.Cells["BIAS_NAME_2"].Text.ToString());
  333. list.Add(ugr.Cells["PLAN_2"].Text.ToString());
  334. list.Add(ugr.Cells["VAL2_2"].Text.ToString());
  335. list2.Add(list);
  336. ArrayList listc1 = new ArrayList();
  337. listc1.Add("传动侧");
  338. listc1.Add(ugr.Cells["THICK_VAL1"].Text.ToString());
  339. listc1.Add(ugr.Cells["H_VAL1"].Value.ToString());
  340. listc1.Add(ugr.Cells["M_VAL1"].Value.ToString());
  341. listc1.Add(ugr.Cells["R_VAL1"].Value.ToString());
  342. list3.Add(listc1);
  343. listc1 = new ArrayList();
  344. listc1.Add("中间");
  345. listc1.Add(ugr.Cells["THICK_VAL2"].Text.ToString());
  346. listc1.Add(ugr.Cells["H_VAL2"].Value.ToString());
  347. listc1.Add(ugr.Cells["M_VAL2"].Value.ToString());
  348. listc1.Add(ugr.Cells["R_VAL2"].Value.ToString());
  349. list3.Add(listc1);
  350. listc1 = new ArrayList();
  351. listc1.Add("操作侧");
  352. listc1.Add(ugr.Cells["THICK_VAL3"].Text.ToString());
  353. listc1.Add(ugr.Cells["H_VAL3"].Value.ToString());
  354. listc1.Add(ugr.Cells["M_VAL3"].Value.ToString());
  355. listc1.Add(ugr.Cells["R_VAL3"].Value.ToString());
  356. list3.Add(listc1);
  357. if ((comboBox1.Text.ToString() == "合格" && comboBox2.Text.ToString() != "正品") || (comboBox1.Text.ToString() == "不合格" && comboBox2.Text.ToString() == "正品"))
  358. {
  359. MessageBox.Show("检验结果与质量等级不一致!");
  360. return;
  361. }
  362. CoreClientParam ccp = new CoreClientParam();
  363. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  364. ccp.MethodName = "judgeByHuman2";
  365. ccp.ServerParams = new object[] { list1, list2, list3 };
  366. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  367. if (ccp.ReturnCode == -1)
  368. {
  369. return;
  370. }
  371. lists.Add(ugr);
  372. }
  373. else
  374. {
  375. ArrayList list1 = new ArrayList();
  376. List<ArrayList> list3 = new List<ArrayList>();
  377. list1.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());
  378. list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  379. if (comboBox1.Text.ToString() == "")
  380. {
  381. MessageBox.Show("请输入登记结果!");
  382. return;
  383. }
  384. else
  385. {
  386. if (comboBox1.Text.ToString() == "合格")
  387. {
  388. list1.Add("1");
  389. list1.Add("合格");
  390. }
  391. else if (comboBox1.Text.ToString() == "待判")
  392. {
  393. list1.Add("0");
  394. list1.Add("待判");
  395. }
  396. else
  397. {
  398. list1.Add("2");
  399. list1.Add("不合格");
  400. }
  401. }
  402. string is_zl = "";
  403. if (comboBox2.Text.ToString() == "正品")
  404. {
  405. is_zl = "512601";
  406. }
  407. else if (comboBox2.Text.ToString() == "次品")
  408. {
  409. is_zl = "512602";
  410. }
  411. else if (comboBox2.Text.ToString() == "废品")
  412. {
  413. is_zl = "512603";
  414. }
  415. else if (comboBox2.Text.ToString() == "协议品")
  416. {
  417. is_zl = "512604";
  418. }
  419. else if (comboBox2.Text.ToString() == "订单外")
  420. {
  421. is_zl = "512605";
  422. }
  423. list1.Add(textBox5.Text.Trim().ToString());
  424. list1.Add(this.UserInfo.GetUserName());
  425. list1.Add(this.UserInfo.GetUserOrderText());
  426. list1.Add(this.UserInfo.GetUserGroupText());
  427. list1.Add(is_zl);//质量等级代码
  428. list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称
  429. ArrayList listc1 = new ArrayList();
  430. listc1.Add("传动侧");
  431. listc1.Add(ugr.Cells["THICK_VAL1"].Text.ToString());
  432. listc1.Add(ugr.Cells["H_VAL1"].Value.ToString());
  433. listc1.Add(ugr.Cells["M_VAL1"].Value.ToString());
  434. listc1.Add(ugr.Cells["R_VAL1"].Value.ToString());
  435. list3.Add(listc1);
  436. listc1 = new ArrayList();
  437. listc1.Add("中间");
  438. listc1.Add(ugr.Cells["THICK_VAL2"].Text.ToString());
  439. listc1.Add(ugr.Cells["H_VAL2"].Value.ToString());
  440. listc1.Add(ugr.Cells["M_VAL2"].Value.ToString());
  441. listc1.Add(ugr.Cells["R_VAL2"].Value.ToString());
  442. list3.Add(listc1);
  443. listc1 = new ArrayList();
  444. listc1.Add("操作侧");
  445. listc1.Add(ugr.Cells["THICK_VAL3"].Text.ToString());
  446. listc1.Add(ugr.Cells["H_VAL3"].Value.ToString());
  447. listc1.Add(ugr.Cells["M_VAL3"].Value.ToString());
  448. listc1.Add(ugr.Cells["R_VAL3"].Value.ToString());
  449. list3.Add(listc1);
  450. if ((comboBox1.Text.ToString() == "合格" && comboBox2.Text.ToString() != "正品") || (comboBox1.Text.ToString() == "不合格" && comboBox2.Text.ToString() == "正品"))
  451. {
  452. MessageBox.Show("检验结果与质量等级不一致!");
  453. return;
  454. }
  455. CoreClientParam ccp = new CoreClientParam();
  456. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  457. ccp.MethodName = "judgeByHumanJ";
  458. ccp.ServerParams = new object[] { list1,list3 };
  459. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  460. if (ccp.ReturnCode == -1)
  461. {
  462. return;
  463. }
  464. lists.Add(ugr);
  465. }
  466. }
  467. }
  468. for (int i = 0; i < lists.Count; i++)
  469. {
  470. lists[i].Delete(false);
  471. }
  472. MessageBox.Show("检验登记成功!");
  473. }
  474. catch (Exception EX)
  475. {
  476. MessageBox.Show(EX.ToString());
  477. }
  478. //DoQuery();
  479. }
  480. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  481. {
  482. foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList())
  483. {
  484. if (checkBox1.Checked)
  485. {
  486. ugr.Cells["CHECK"].Value = "True";
  487. }
  488. else
  489. {
  490. ugr.Cells["CHECK"].Value = "False";
  491. }
  492. }
  493. }
  494. private void ultraTabControl1_Click(object sender, EventArgs e)
  495. {
  496. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  497. {
  498. this.label11.Visible = false;
  499. this.comboBox4.Visible = false;
  500. this.label12.Text = "判定时间";
  501. }
  502. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  503. {
  504. this.label11.Visible = true;
  505. this.comboBox4.Visible = true;
  506. this.label12.Text = "生产时间";
  507. }
  508. }
  509. private void DoExport()
  510. {
  511. try
  512. {
  513. if (this.ultraGrid4.Rows.Count == 0)
  514. {
  515. MessageBox.Show("没有可以导出的数据", "提示");
  516. return;
  517. }
  518. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  519. {
  520. string fName = this.saveFileDialog1.FileName;
  521. this.ultraGridExcelExporter1.Export(this.ultraGrid4, fName);
  522. Process.Start(fName);
  523. }
  524. }
  525. catch (Exception ex)
  526. {
  527. System.Diagnostics.Debug.WriteLine(ex.ToString());
  528. }
  529. }
  530. private void ultraGrid2_CellChange(object sender, CellEventArgs e)
  531. {
  532. ultraGrid2.UpdateData();
  533. }
  534. }
  535. }