07e3535add829dd0f499dcb39c0ed6bde142bdb9.svn-base 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  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 QCM030301 : FrmBase
  17. {
  18. public QCM030301()
  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 "PlanImport":
  33. this.PlanImport();
  34. break;
  35. }
  36. }
  37. private void PlanImport()
  38. {
  39. }
  40. private void DoQuery()
  41. {
  42. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  43. {
  44. DoQueryMe();
  45. }
  46. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  47. {
  48. DoQueryRe();
  49. }
  50. }
  51. //查询待判信息
  52. private void DoQueryMe()
  53. {
  54. try
  55. {
  56. this.dataSet2.Clear();
  57. string starttime = "";
  58. string endtime = "";
  59. if (checkBox2.Checked)
  60. {
  61. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  62. endtime = this.dateTimePicker2.Value.AddDays(1).ToString("yyyyMMdd");
  63. }
  64. string sbatchno = "";
  65. string ebatchno = "";
  66. if (checkBox3.Checked)
  67. {
  68. sbatchno = this.textBox1.Text.Trim();
  69. }
  70. //if (checkBox3.Checked)
  71. //{
  72. // sbatchno = this.textBox1.Text.Trim();
  73. // if (textBox2.Text.ToString() == "")
  74. // {
  75. // ebatchno = this.textBox1.Text.Trim();
  76. // }
  77. // else
  78. // {
  79. // ebatchno = this.textBox2.Text.Trim();
  80. // }
  81. //}
  82. if (!checkBox2.Checked && !checkBox3.Checked)
  83. {
  84. MessageBox.Show("时间与轧批号必须选择其中一个条件!");
  85. return;
  86. }
  87. string orderno = this.textBox3.Text.Trim();// 订单号
  88. string psc = textBox4.Text.Trim(); //产品描述
  89. string prodline = this.comboBox3.Text.ToString();
  90. string isjudge = this.comboBox4.Text.ToString();
  91. CoreClientParam ccp = new CoreClientParam();
  92. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  93. ccp.MethodName = "doQueryMaterialDetailsBS";
  94. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc,"M",prodline,isjudge };
  95. ccp.SourceDataTable = this.dataSet2.Tables[0];
  96. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  97. }
  98. catch (Exception ex)
  99. {
  100. System.Diagnostics.Debug.WriteLine(ex.ToString());
  101. MessageBox.Show("系统出错,请联系管理人员", "警告");
  102. }
  103. }
  104. //查询判定记录
  105. private void DoQueryRe()
  106. {
  107. try
  108. {
  109. this.dataSet5.Clear();
  110. string starttime = "";
  111. string endtime = "";
  112. if (checkBox2.Checked)
  113. {
  114. starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  115. endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  116. }
  117. string sbatchno = "";
  118. string ebatchno = "";
  119. if (checkBox3.Checked)
  120. {
  121. sbatchno = this.textBox1.Text.Trim();
  122. }
  123. //if (checkBox3.Checked)
  124. //{
  125. // sbatchno = this.textBox1.Text.Trim();
  126. // if (textBox2.Text.ToString() == "")
  127. // {
  128. // ebatchno = this.textBox1.Text.Trim();
  129. // }
  130. // else
  131. // {
  132. // ebatchno = this.textBox2.Text.Trim();
  133. // }
  134. //}
  135. if (!checkBox2.Checked && !checkBox3.Checked)
  136. {
  137. MessageBox.Show("时间与轧批号必须选择其中一个条件!");
  138. return;
  139. }
  140. string orderno = this.textBox3.Text.Trim();// 订单号
  141. string psc = textBox4.Text.Trim(); //产品描述
  142. string prodline = this.comboBox3.Text.ToString();
  143. CoreClientParam ccp = new CoreClientParam();
  144. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  145. ccp.MethodName = "GetMeasureInfoB";
  146. ccp.ServerParams = new object[] { starttime, endtime, sbatchno, ebatchno, orderno, psc, prodline };
  147. ccp.SourceDataTable = this.dataSet5.Tables[0];
  148. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  149. }
  150. catch (Exception ex)
  151. {
  152. System.Diagnostics.Debug.WriteLine(ex.ToString());
  153. MessageBox.Show("系统出错,请联系管理人员", "警告");
  154. }
  155. }
  156. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  157. {
  158. try
  159. {
  160. UltraGridRow ugr = this.ultraGrid2.ActiveRow;
  161. if (ugr == null)
  162. return;
  163. this.dataSet3.Clear();
  164. string design_key = ugr.Cells["DESIGN_KEY"].Value.ToString();
  165. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  166. CoreClientParam ccp = new CoreClientParam();
  167. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  168. ccp.MethodName = "getToleranceZhb";
  169. ccp.ServerParams = new object[] { design_key, material_no };
  170. ccp.SourceDataTable = this.dataSet3.Tables[0];
  171. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  172. this.dataSet4.Clear();
  173. string sic_id = ugr.Cells["SIZEID"].Value.ToString();
  174. if (sic_id != "")
  175. {
  176. ccp = new CoreClientParam();
  177. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  178. ccp.MethodName = "getQcmJudgeMeasure";
  179. ccp.ServerParams = new object[] { sic_id };
  180. ccp.SourceDataTable = this.dataSet4.Tables[0];
  181. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  182. }
  183. if (design_key != "")
  184. {
  185. ccp = new CoreClientParam();
  186. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  187. ccp.MethodName = "GetMemo";
  188. ccp.ServerParams = new object[] { design_key };
  189. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  190. if (ccp.SourceDataTable.Rows.Count == 0)
  191. {
  192. this.textBox6.Text = "";
  193. }
  194. else
  195. {
  196. this.textBox6.Text = ccp.SourceDataTable.Rows[0]["MEMO"].ToString();
  197. }
  198. }
  199. }
  200. catch (Exception ex)
  201. {
  202. System.Diagnostics.Debug.WriteLine(ex.ToString());
  203. MessageBox.Show("系统出错,请联系管理人员", "警告");
  204. }
  205. }
  206. private void QCM0303_Load(object sender, EventArgs e)
  207. {
  208. this.comboBox3.SelectedIndex = 0;
  209. this.comboBox4.SelectedIndex = 0;
  210. ValueList VFLAW_SIZE_DESC = new ValueList();
  211. VFLAW_SIZE_DESC.ValueListItems.Add("0", "头");
  212. VFLAW_SIZE_DESC.ValueListItems.Add("1", "中");
  213. VFLAW_SIZE_DESC.ValueListItems.Add("2", "尾");
  214. this.ultraGrid5.DisplayLayout.Bands[0].Columns["THICK_TYPE"].ValueList = VFLAW_SIZE_DESC;
  215. ValueList vsflv = new ValueList();
  216. CoreClientParam ccp = new CoreClientParam();
  217. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  218. ccp.MethodName = "findSfLv";
  219. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  220. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  221. {
  222. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  223. }
  224. this.comboBox2.DataSource = vsflv.ValueListItems;
  225. this.ultraGrid2.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  226. this.ultraGrid4.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  227. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  228. //this.comboBox3.SelectedIndex = 0;
  229. //DoQuery();
  230. String doPlineCode = DoPlineCode();
  231. if (doPlineCode.Equals("厚板线"))
  232. {
  233. this.comboBox3.SelectedIndex = 1;
  234. }
  235. else
  236. {
  237. this.comboBox3.SelectedIndex = 0;
  238. }
  239. }
  240. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  241. {
  242. try
  243. {
  244. UltraGridRow ugr = this.ultraGrid4.ActiveRow;
  245. if (ugr == null)
  246. return;
  247. this.dataSet6.Clear();
  248. string sic = ugr.Cells["SIC_ID"].Value.ToString();
  249. CoreClientParam ccp = new CoreClientParam();
  250. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  251. ccp.MethodName = "getToleranceInfoNew";
  252. ccp.ServerParams = new object[] { sic };
  253. ccp.SourceDataTable = this.dataSet6.Tables[0];
  254. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  255. this.dataSet7.Clear();
  256. ccp = new CoreClientParam();
  257. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  258. ccp.MethodName = "getQcmJudgeMeasure";
  259. ccp.ServerParams = new object[] { sic };
  260. ccp.SourceDataTable = this.dataSet7.Tables[0];
  261. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  262. }
  263. catch (Exception ex)
  264. {
  265. System.Diagnostics.Debug.WriteLine(ex.ToString());
  266. MessageBox.Show("系统出错,请联系管理人员", "警告");
  267. }
  268. }
  269. private void button1_Click(object sender, EventArgs e)
  270. {
  271. try
  272. {
  273. int num1 = 0;
  274. int num2 = 0;
  275. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  276. {
  277. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  278. {
  279. num1++;
  280. String doPlineCode = DoPlineCode();//20240902 王坚提出
  281. if (doPlineCode.Equals("厚板线") || doPlineCode.Equals("中板线"))
  282. {
  283. String mno=ugr.Cells["MATERIAL_NO"].Value.ToString();
  284. String comboBoxText = this.comboBox1.Text.ToString().Trim();
  285. if (!comboBoxText.Equals("待判"))
  286. {
  287. MessageBox.Show("技术中心规定您的检验结果权限只能选择【待判】不能选择其它!");
  288. return;
  289. }
  290. if (doPlineCode.Equals("厚板线"))
  291. {
  292. if (mno.StartsWith("Z"))
  293. {
  294. MessageBox.Show("您是厚板线操作人员不能操作该子板【" + mno + "】");
  295. return;
  296. }
  297. }
  298. else if (doPlineCode.Equals("中板线"))
  299. {
  300. if (mno.StartsWith("H"))
  301. {
  302. MessageBox.Show("您是中板线操作人员不能操作该子板【" + mno + "】");
  303. return;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. //判断是否都有勾选
  310. if (num1 == 0)
  311. {
  312. MessageBox.Show("请勾选待检信息!");
  313. return;
  314. }
  315. foreach (UltraGridRow ugr1 in this.ultraGrid5.Rows)
  316. {
  317. if (ugr1.Cells["CHECK"].Text.ToString() == "True")
  318. {
  319. if (ugr1.Cells["THICK_TYPE"].Text.ToString().Trim() == "")
  320. {
  321. MessageBox.Show("请勾选测量实绩头中尾!");
  322. return;
  323. }
  324. }
  325. }
  326. int count = 0;
  327. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  328. {
  329. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  330. {
  331. count++;
  332. }
  333. }
  334. List<UltraGridRow> lists = new List<UltraGridRow>();
  335. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  336. {
  337. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  338. {
  339. if (count == 1)
  340. {
  341. ArrayList list1 = new ArrayList();
  342. List<ArrayList> list2 = new List<ArrayList>();
  343. List<ArrayList> list3 = new List<ArrayList>();
  344. list1.Add(ugr.Cells["DESIGN_KEY"].Value.ToString()); //0
  345. list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());//1
  346. if (comboBox1.Text.ToString() == "")
  347. {
  348. MessageBox.Show("请输入登记结果!");
  349. return;
  350. }
  351. else
  352. {
  353. if (comboBox1.Text.ToString() == "合格")
  354. {
  355. list1.Add("1");//2
  356. list1.Add("合格");//3
  357. }
  358. else if (comboBox1.Text.ToString() == "待判")
  359. {
  360. list1.Add("0");
  361. list1.Add("待判");
  362. }
  363. else
  364. {
  365. list1.Add("2");
  366. list1.Add("不合格");
  367. }
  368. }
  369. string is_zl = "";
  370. if (comboBox2.Text.ToString() == "正品")
  371. {
  372. is_zl = "512601";
  373. }
  374. else if (comboBox2.Text.ToString() == "次品")
  375. {
  376. is_zl = "512602";
  377. }
  378. else if (comboBox2.Text.ToString() == "废品")
  379. {
  380. is_zl = "512603";
  381. }
  382. else if (comboBox2.Text.ToString() == "协议品")
  383. {
  384. is_zl = "512604";
  385. }
  386. else if (comboBox2.Text.ToString() == "订单外")
  387. {
  388. is_zl = "512605";
  389. }
  390. list1.Add(textBox5.Text.Trim().ToString());//4
  391. list1.Add(this.UserInfo.GetUserName());//5
  392. list1.Add(this.UserInfo.GetUserOrderText());//6
  393. list1.Add(this.UserInfo.GetUserGroupText());//7
  394. list1.Add(is_zl);//质量等级代码 //8
  395. list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称 //9
  396. foreach (UltraGridRow ugrs in this.ultraGrid3.Rows)
  397. {
  398. ArrayList list = new ArrayList();
  399. list.Add(ugrs.Cells["bias_code"].Text.ToString());
  400. //if (ugrs.Cells["val"].Text.ToString() == "")
  401. //{
  402. // MessageBox.Show("请输入判定值");
  403. // return;
  404. //}
  405. list.Add(ugrs.Cells["val"].Text.ToString());
  406. list.Add(ugrs.Cells["bias_name"].Text.ToString());
  407. list.Add(ugrs.Cells["plan"].Text.ToString());
  408. list2.Add(list);
  409. }
  410. foreach (UltraGridRow ugr1 in this.ultraGrid5.Rows)
  411. {
  412. if (ugr1.Cells["CHECK"].Text.ToString() == "True")
  413. {
  414. ArrayList listc = new ArrayList();
  415. listc.Add(ugr1.Cells["THICK_TYPE"].Text.ToString().Trim());
  416. listc.Add(ugr1.Cells["THICK_VAL"].Text.ToString());
  417. listc.Add(ugr1.Cells["H_VAL"].Value.ToString());
  418. listc.Add(ugr1.Cells["M_VAL"].Value.ToString());
  419. listc.Add(ugr1.Cells["R_VAL"].Value.ToString());
  420. list3.Add(listc);
  421. }
  422. }
  423. CoreClientParam ccp = new CoreClientParam();
  424. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  425. ccp.MethodName = "judgeByHuman";
  426. ccp.ServerParams = new object[] { list1, list2, list3 };
  427. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  428. if (ccp.ReturnCode == -1)
  429. {
  430. return;
  431. }
  432. lists.Add(ugr);
  433. }
  434. else
  435. {
  436. ArrayList list1 = new ArrayList();
  437. List<ArrayList> list3 = new List<ArrayList>();
  438. list1.Add(ugr.Cells["DESIGN_KEY"].Value.ToString());
  439. list1.Add(ugr.Cells["MATERIAL_NO"].Value.ToString());
  440. if (comboBox1.Text.ToString() == "")
  441. {
  442. MessageBox.Show("请输入登记结果!");
  443. return;
  444. }
  445. else
  446. {
  447. if (comboBox1.Text.ToString() == "合格")
  448. {
  449. list1.Add("1");
  450. list1.Add("合格");
  451. }
  452. else if (comboBox1.Text.ToString() == "不合格")
  453. {
  454. list1.Add("2");
  455. list1.Add("不合格");
  456. }
  457. else
  458. {
  459. list1.Add("0");
  460. list1.Add("待判");
  461. }
  462. }
  463. string is_zl = "";
  464. if (comboBox2.Text.ToString() == "正品")
  465. {
  466. is_zl = "512601";
  467. }
  468. else if (comboBox2.Text.ToString() == "次品")
  469. {
  470. is_zl = "512602";
  471. }
  472. else if (comboBox2.Text.ToString() == "废品")
  473. {
  474. is_zl = "512603";
  475. }
  476. else if (comboBox2.Text.ToString() == "协议品")
  477. {
  478. is_zl = "512604";
  479. }
  480. else if (comboBox2.Text.ToString() == "订单外")
  481. {
  482. is_zl = "512605";
  483. }
  484. list1.Add(textBox5.Text.Trim().ToString());
  485. list1.Add(this.UserInfo.GetUserName());
  486. list1.Add(this.UserInfo.GetUserOrderText());
  487. list1.Add(this.UserInfo.GetUserGroupText());
  488. list1.Add(is_zl);//质量等级代码
  489. list1.Add(comboBox2.Text.Trim().ToString());//质量等级名称
  490. foreach (UltraGridRow ugr1 in this.ultraGrid5.Rows)
  491. {
  492. if (ugr1.Cells["CHECK"].Text.ToString() == "True")
  493. {
  494. ArrayList listc = new ArrayList();
  495. listc.Add(ugr1.Cells["THICK_TYPE"].Text.ToString().Trim());
  496. listc.Add(ugr1.Cells["THICK_VAL"].Text.ToString());
  497. listc.Add(ugr1.Cells["H_VAL"].Value.ToString());
  498. listc.Add(ugr1.Cells["M_VAL"].Value.ToString());
  499. listc.Add(ugr1.Cells["R_VAL"].Value.ToString());
  500. list3.Add(listc);
  501. }
  502. }
  503. CoreClientParam ccp = new CoreClientParam();
  504. ccp.ServerName = "QCM.QCM03.QCM0303.QcmJudgeMeasureServiceImpl";
  505. ccp.MethodName = "judgeByHuman1";
  506. ccp.ServerParams = new object[] { list1,list3 };
  507. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  508. if (ccp.ReturnCode == -1)
  509. {
  510. return;
  511. }
  512. lists.Add(ugr);
  513. }
  514. }
  515. }
  516. for (int i = 0; i < lists.Count; i++)
  517. {
  518. lists[i].Delete(false);
  519. }
  520. MessageBox.Show("检验登记成功!");
  521. }
  522. catch (Exception EX)
  523. {
  524. MessageBox.Show(EX.ToString());
  525. }
  526. //DoQuery();
  527. }
  528. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  529. {
  530. foreach (UltraGridRow ugr in this.ultraGrid2.Rows.Where(p => p.IsFilteredOut == false).ToList())
  531. {
  532. if (checkBox1.Checked)
  533. {
  534. ugr.Cells["CHECK"].Value = "True";
  535. }
  536. else
  537. {
  538. ugr.Cells["CHECK"].Value = "False";
  539. }
  540. }
  541. }
  542. private void ultraGrid3_KeyDown(object sender, KeyEventArgs e)
  543. {
  544. UltraGrid grid = (UltraGrid)sender;
  545. if (e.KeyCode == Keys.Enter)
  546. {
  547. //Go down one row
  548. grid.PerformAction(UltraGridAction.EnterEditMode);
  549. grid.PerformAction(UltraGridAction.BelowCell);
  550. foreach (UltraGridRow ugrs in this.ultraGrid3.Rows)
  551. {
  552. ArrayList list = new ArrayList();
  553. ugrs.Appearance.BackColor = Color.White;
  554. double val1 = Convert.ToDouble(ugrs.Cells["val"].Text.ToString()) - Convert.ToDouble(ugrs.Cells["plan"].Text.ToString());
  555. if (ugrs.Cells["std_min_val"].Text.ToString() != "" && Convert.ToDouble(ugrs.Cells["std_min_val"].Text.ToString()) - val1 > 0)
  556. {
  557. ugrs.Appearance.BackColor = Color.Yellow;
  558. this.comboBox1.SelectedIndex = 0;
  559. }
  560. if (ugrs.Cells["std_max_val"].Text.ToString() != "" && Convert.ToDouble(ugrs.Cells["std_max_val"].Text.ToString()) - val1 < 0)
  561. {
  562. ugrs.Appearance.BackColor = Color.Yellow;
  563. this.comboBox1.SelectedIndex = 0;
  564. }
  565. if (ugrs.Cells["std_min_val_k"].Text.ToString() != "" && Convert.ToDouble(ugrs.Cells["std_min_val_k"].Text.ToString()) - val1 > 0)
  566. {
  567. ugrs.Appearance.BackColor = Color.Yellow;
  568. this.comboBox1.SelectedIndex = 0;
  569. }
  570. if (ugrs.Cells["std_max_val_k"].Text.ToString() != "" && Convert.ToDouble(ugrs.Cells["std_max_val_k"].Text.ToString()) - val1 < 0)
  571. {
  572. ugrs.Appearance.BackColor = Color.Yellow;
  573. this.comboBox1.SelectedIndex = 0;
  574. }
  575. if (ugrs.Cells["std_min_val_n"].Text.ToString() != "" && Convert.ToDouble(ugrs.Cells["std_min_val_n"].Text.ToString()) - val1 > 0)
  576. {
  577. ugrs.Appearance.BackColor = Color.Yellow;
  578. this.comboBox1.SelectedIndex = 0;
  579. }
  580. if (ugrs.Cells["std_max_val_n"].Text.ToString() != "" && Convert.ToDouble(ugrs.Cells["std_max_val_n"].Text.ToString()) - val1 < 0)
  581. {
  582. ugrs.Appearance.BackColor = Color.Yellow;
  583. this.comboBox1.SelectedIndex = 0;
  584. }
  585. }
  586. }
  587. }
  588. private void ultraTabControl1_Click(object sender, EventArgs e)
  589. {
  590. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  591. {
  592. this.label11.Visible = false;
  593. this.comboBox4.Visible = false;
  594. this.label12.Text = "判定时间";
  595. }
  596. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  597. {
  598. this.label11.Visible = true;
  599. this.comboBox4.Visible = true;
  600. this.label12.Text = "生产时间";
  601. }
  602. }
  603. private void ultraGrid5_KeyDown(object sender, KeyEventArgs e)
  604. {
  605. switch (e.KeyCode)
  606. {
  607. case Keys.Up:
  608. this.ultraGrid5.PerformAction(UltraGridAction.ExitEditMode, false, false);
  609. this.ultraGrid5.PerformAction(UltraGridAction.AboveCell, false, false);
  610. e.Handled = true;
  611. this.ultraGrid5.PerformAction(UltraGridAction.EnterEditMode, false, false);
  612. break;
  613. case Keys.Down:
  614. this.ultraGrid5.PerformAction(UltraGridAction.ExitEditMode, false, false);
  615. this.ultraGrid5.PerformAction(UltraGridAction.BelowCell, false, false);
  616. e.Handled = true;
  617. this.ultraGrid5.PerformAction(UltraGridAction.EnterEditMode, false, false);
  618. break;
  619. case Keys.Right:
  620. this.ultraGrid5.PerformAction(UltraGridAction.ExitEditMode, false, false);
  621. this.ultraGrid5.PerformAction(UltraGridAction.NextCellByTab, false, false);
  622. e.Handled = true;
  623. this.ultraGrid5.PerformAction(UltraGridAction.EnterEditMode, false, false);
  624. break;
  625. case Keys.Left:
  626. this.ultraGrid5.PerformAction(UltraGridAction.ExitEditMode, false, false);
  627. this.ultraGrid5.PerformAction(UltraGridAction.PrevCellByTab, false, false);
  628. e.Handled = true;
  629. this.ultraGrid5.PerformAction(UltraGridAction.EnterEditMode, false, false);
  630. break;
  631. case Keys.Enter:
  632. this.ultraGrid5.PerformAction(UltraGridAction.ExitEditMode, false, false);
  633. this.ultraGrid5.PerformAction(UltraGridAction.BelowCell, false, false);
  634. e.Handled = true;
  635. this.ultraGrid5.PerformAction(UltraGridAction.EnterEditMode, false, false);
  636. break;
  637. }
  638. }
  639. private void DoExport()
  640. {
  641. try
  642. {
  643. if (this.ultraGrid4.Rows.Count == 0)
  644. {
  645. MessageBox.Show("没有可以导出的数据", "提示");
  646. return;
  647. }
  648. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  649. {
  650. string fName = this.saveFileDialog1.FileName;
  651. this.ultraGridExcelExporter2.Export(this.ultraGrid4, fName);
  652. Process.Start(fName);
  653. }
  654. }
  655. catch (Exception ex)
  656. {
  657. System.Diagnostics.Debug.WriteLine(ex.ToString());
  658. }
  659. }
  660. private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
  661. {
  662. if (this.comboBox1.SelectedIndex == 0)
  663. {
  664. ValueList vsflv = new ValueList();
  665. CoreClientParam ccp = new CoreClientParam();
  666. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  667. ccp.MethodName = "findSfLv1";
  668. ccp.ServerParams = new object[] { "2" };
  669. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  670. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  671. {
  672. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  673. }
  674. this.comboBox2.DataSource = vsflv.ValueListItems;
  675. }
  676. else if (this.comboBox1.SelectedIndex == 1)
  677. {
  678. ValueList vsflv = new ValueList();
  679. CoreClientParam ccp = new CoreClientParam();
  680. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  681. ccp.MethodName = "findSfLv1";
  682. ccp.ServerParams = new object[] { "0" };
  683. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  684. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  685. {
  686. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  687. }
  688. this.comboBox2.DataSource = vsflv.ValueListItems;
  689. }
  690. else if (this.comboBox1.SelectedIndex == 2)
  691. {
  692. ValueList vsflv = new ValueList();
  693. CoreClientParam ccp = new CoreClientParam();
  694. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  695. ccp.MethodName = "findSfLv1";
  696. ccp.ServerParams = new object[] { "1" };
  697. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  698. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  699. {
  700. vsflv.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  701. }
  702. this.comboBox2.DataSource = vsflv.ValueListItems;
  703. }
  704. }
  705. #region 条件 240902 技术中心王坚提出
  706. private String DoPlineCode()
  707. {
  708. try
  709. {
  710. String userid = this.UserInfo.GetUserID();//员工ID
  711. if (userid.Equals("X16943") || userid.Equals("X16937") || userid.Equals("X16947") || userid.Equals("X16953") || userid.Equals("X16954"))
  712. {
  713. return "厚板线";
  714. }
  715. else if (userid.Equals("X16821") || userid.Equals("X16814") || userid.Equals("X16792") || userid.Equals("X16806") )
  716. {
  717. return "中板线";
  718. }
  719. }
  720. catch (Exception ex)
  721. {
  722. System.Diagnostics.Debug.WriteLine(ex.ToString());
  723. MessageBox.Show("系统出错,请联系管理人员", "警告");
  724. }
  725. return "1";
  726. }
  727. #endregion
  728. }
  729. }