88f30f405fb3d40a75b1dfc56037d920c9f7de83.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  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 Infragistics.Win;
  9. using System.Windows.Forms;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using System.Diagnostics;
  13. using System.Text.RegularExpressions;
  14. using Infragistics.Win.UltraWinEditors;
  15. using System.Collections;
  16. namespace Core.LZMes.Client.QCM
  17. {
  18. public partial class QCM030612 : FrmBase
  19. {
  20. public QCM030612()
  21. {
  22. InitializeComponent();
  23. }
  24. public override void ToolBar_Click(object sender, string ToolbarKey)
  25. {
  26. switch (ToolbarKey)
  27. {
  28. case "Query":
  29. this.DoQuery();
  30. break;
  31. case "Judge":
  32. this.Judge();
  33. break;
  34. case "Cancel":
  35. this.canceljudge();
  36. break;
  37. case "Exit":
  38. this.Close();
  39. break;
  40. case "Export":
  41. this.DoExport();
  42. break;
  43. }
  44. }
  45. private void Judge()
  46. {
  47. try
  48. {
  49. List<UltraGridRow> lists = new List<UltraGridRow>();
  50. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  51. {
  52. if (ugr.Cells["CHECK"].Text.ToString() == "True")
  53. {
  54. if (ultraComboEditor2.Text == "" || ultraComboEditor1.Text == "" || ultraComboEditor3.Text == "")
  55. {
  56. MessageBox.Show("请输入表面结果或者选择好缺陷!");
  57. return;
  58. }
  59. string material_no = ugr.Cells["MATERIAL_NO"].Value.ToString();
  60. string sflv_code = this.ultraComboEditor1.Value.ToString();
  61. string sflv_name = this.ultraComboEditor1.Text.ToString();
  62. string qx_ly = this.ultraComboEditor2.Value.ToString();
  63. string qx_ly_name = this.ultraComboEditor2.Text.ToString();
  64. string qx = this.ultraComboEditor3.Value.ToString();
  65. string qx_name = this.ultraComboEditor3.Text.ToString();
  66. string username = this.UserInfo.GetUserName();
  67. string wrk_ord = this.UserInfo.GetUserOrderText();
  68. string wrk_grp = this.UserInfo.GetUserGroupText();
  69. string memo = this.textBox3.Text.ToString();
  70. CoreClientParam ccp = new CoreClientParam();
  71. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  72. ccp.MethodName = "ultimateJudgeAutoJF";
  73. ccp.ServerParams = new object[] { material_no, username, sflv_code, sflv_name, qx_ly, qx_ly_name, qx, qx_name, wrk_ord, wrk_grp,memo };
  74. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  75. if (ccp.ReturnCode == -1)
  76. {
  77. return;
  78. }
  79. lists.Add(ugr);
  80. }
  81. }
  82. if (lists.Count == 0)
  83. {
  84. MessageBox.Show("请选择数据!");
  85. return;
  86. }
  87. for (int i = 0; i < lists.Count; i++)
  88. {
  89. lists[i].Delete(false);
  90. }
  91. MessageBox.Show("判定成功!");
  92. }
  93. catch (Exception EX)
  94. {
  95. MessageBox.Show(EX.ToString());
  96. }
  97. }
  98. private void canceljudge()
  99. {
  100. //try
  101. //{
  102. // QCM030607 frm = new QCM030607();
  103. // if (frm.ShowDialog() == DialogResult.OK)
  104. // {
  105. // string remark = frm._memo;
  106. // if (remark == "")
  107. // {
  108. // MessageBox.Show("请录入备注信息!");
  109. // return;
  110. // }
  111. // if (this.ultraGrid18.Selected.Rows.Count == 0)
  112. // this.ultraGrid18.ActiveRow.Selected = true;
  113. // foreach (UltraGridRow ugr in this.ultraGrid18.Rows)
  114. // {
  115. // if (ugr.Cells["CHECK"].Text.ToString() == "True")
  116. // {
  117. // string MATERIAL_NO = ugr.Cells["MATERIAL_NO"].Value.ToString();
  118. // string utm_id = ugr.Cells["UTM_ID"].Value.ToString();
  119. // string username = this.UserInfo.GetUserName();
  120. // CoreClientParam ccp = new CoreClientParam();
  121. // ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  122. // ccp.MethodName = "cancelUltimateJudge";
  123. // ccp.ServerParams = new object[] { username, MATERIAL_NO, utm_id,remark };
  124. // ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  125. // if (ccp.ReturnCode == -1)
  126. // {
  127. // return;
  128. // }
  129. // }
  130. // }
  131. // MessageBox.Show("取消判定成功!");
  132. // }
  133. //}
  134. //catch (Exception EX)
  135. //{
  136. // MessageBox.Show(EX.ToString());
  137. //}
  138. //DoQuery();
  139. }
  140. private void DoQuery()
  141. {
  142. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  143. {
  144. DoQueryMe();
  145. }
  146. if (this.ultraTabControl1.Tabs[1].Selected) //表面判定信息
  147. {
  148. DoQueryRe1();
  149. }
  150. if (this.ultraTabControl1.Tabs[2].Selected) //判定记录
  151. {
  152. DoQueryRe();
  153. }
  154. }
  155. //查询待判信息
  156. private void DoQueryMe()
  157. {
  158. try
  159. {
  160. if (comboBox4.SelectedIndex == 1)
  161. {
  162. MessageBox.Show("请选择入库时间!");
  163. return;
  164. }
  165. this.dataSet1.Clear();
  166. string ebatchno = "";
  167. string bbatchno = textBox4.Text.Trim();
  168. if (textBox2.Text.ToString() == "")
  169. {
  170. ebatchno = this.textBox4.Text.Trim();
  171. }
  172. else
  173. {
  174. ebatchno = textBox2.Text.Trim();
  175. }
  176. string starttime = this.dateTimePicker1.Value.ToString("yyyyMMdd");
  177. string endtime = this.dateTimePicker2.Value.ToString("yyyyMMdd");
  178. string design_key = textBox1.Text.Trim();
  179. CoreClientParam ccp = new CoreClientParam();
  180. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  181. ccp.MethodName = "GetUnjudgeInfoJF";
  182. ccp.ServerParams = new object[] { starttime, endtime, bbatchno, ebatchno, design_key };
  183. ccp.SourceDataTable = this.dataSet1.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. //查询判定记录
  193. private void DoQueryRe1()
  194. {
  195. try
  196. {
  197. if (comboBox4.SelectedIndex != 1)
  198. {
  199. MessageBox.Show("请选择判定时间!");
  200. return;
  201. }
  202. this.dataSet18.Clear();
  203. string ebatchno = "";
  204. string bbatchno = textBox4.Text.Trim();
  205. if (textBox2.Text.ToString() == "")
  206. {
  207. ebatchno = this.textBox4.Text.Trim();
  208. }
  209. else
  210. {
  211. ebatchno = textBox2.Text.Trim();
  212. }
  213. string design_key = textBox1.Text.Trim();
  214. CoreClientParam ccp = new CoreClientParam();
  215. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  216. ccp.MethodName = "GetSurfaceInfoK";
  217. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key ,"400JB1"};
  218. ccp.SourceDataTable = this.dataSet18.Tables[0];
  219. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  220. }
  221. catch (Exception ex)
  222. {
  223. System.Diagnostics.Debug.WriteLine(ex.ToString());
  224. MessageBox.Show("系统出错,请联系管理人员", "警告");
  225. }
  226. }
  227. //查询判定记录
  228. private void DoQueryRe()
  229. {
  230. try
  231. {
  232. if (comboBox4.SelectedIndex != 1)
  233. {
  234. MessageBox.Show("请选择判定时间!");
  235. return;
  236. }
  237. this.dataSet2.Clear();
  238. string ebatchno = "";
  239. string bbatchno = textBox4.Text.Trim();
  240. if (textBox2.Text.ToString() == "")
  241. {
  242. ebatchno = this.textBox4.Text.Trim();
  243. }
  244. else
  245. {
  246. ebatchno = textBox2.Text.Trim();
  247. }
  248. string design_key = textBox1.Text.Trim();
  249. CoreClientParam ccp = new CoreClientParam();
  250. ccp.ServerName = "QCM.QCM03.QCM0302.QcmJudgePhysicalServiceImpl";
  251. ccp.MethodName = "GetjudgeInfoJF";
  252. ccp.ServerParams = new object[] { this.dateTimePicker1.Value.ToString("yyyyMMdd"), this.dateTimePicker2.Value.ToString("yyyyMMdd"), bbatchno, ebatchno, design_key };
  253. ccp.SourceDataTable = this.dataSet2.Tables[0];
  254. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  255. }
  256. catch (Exception ex)
  257. {
  258. System.Diagnostics.Debug.WriteLine(ex.ToString());
  259. MessageBox.Show("系统出错,请联系管理人员", "警告");
  260. }
  261. }
  262. private void QCM030601_Load(object sender, EventArgs e)
  263. {
  264. this.comboBox4.SelectedIndex = 0;
  265. ValueList vsflv = new ValueList();
  266. CoreClientParam ccp = new CoreClientParam();
  267. this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  268. this.ultraGrid18.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  269. this.dateTimePicker1.Value = System.DateTime.Now.AddDays(-7);
  270. ValueList vsflv2 = new ValueList();
  271. ccp = new CoreClientParam();
  272. ccp.ServerName = "QCM.QCM03.QCM0305.QcmJudgeSurfaceServiceImpl";
  273. ccp.MethodName = "findSfLvBj";
  274. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  275. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  276. {
  277. vsflv2.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  278. }
  279. this.ultraComboEditor1.ValueList = vsflv2;
  280. //DoQuery();
  281. }
  282. public static bool SetUltraComboEditor(ref UltraComboEditor cbEdt, ref ValueList vlist, bool bNull)
  283. {
  284. if (cbEdt == null || vlist == null)
  285. return false;
  286. cbEdt.Items.Clear();
  287. if (bNull)
  288. cbEdt.Items.Add(null, "");
  289. for (int i = 0; i < vlist.ValueListItems.Count; i++)
  290. {
  291. try
  292. {
  293. cbEdt.Items.Add(vlist.ValueListItems[i].DataValue, vlist.ValueListItems[i].DisplayText);
  294. }
  295. catch { }
  296. }
  297. return true;
  298. }
  299. public static ValueList GeneralValuelist(ref DataTable table, string strKey, string strText)
  300. {
  301. if (table == null || !table.Columns.Contains(strKey) || !table.Columns.Contains(strText))
  302. return null;
  303. ArrayList alist = new ArrayList();
  304. ValueList vlist = new ValueList();
  305. for (int i = 0; i < table.Rows.Count; i++)
  306. {
  307. try
  308. {
  309. if (!alist.Contains(table.Rows[i][strKey]))
  310. {
  311. alist.Add(table.Rows[i][strKey]);
  312. vlist.ValueListItems.Add(table.Rows[i][strKey], Convert.ToString(table.Rows[i][strText]));
  313. }
  314. }
  315. catch { }
  316. }
  317. return vlist;
  318. }
  319. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  320. {
  321. SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
  322. SetFilterUIType(this.ultraGrid1, this.checkBox1.Checked);
  323. SetFilterUIType(this.ultraGrid16, this.checkBox1.Checked);
  324. SetFilterUIType(this.ultraGrid7, this.checkBox1.Checked);
  325. SetFilterUIType(this.ultraGrid11, this.checkBox1.Checked);
  326. SetFilterUIType(this.ultraGrid12, this.checkBox1.Checked);
  327. SetFilterUIType(this.ultraGrid13, this.checkBox1.Checked);
  328. SetFilterUIType(this.ultraGrid14, this.checkBox1.Checked);
  329. SetFilterUIType(this.ultraGrid15, this.checkBox1.Checked);
  330. }
  331. private void SetFilterUIType(UltraGrid grid, bool checkType)
  332. {
  333. if (checkType)
  334. {
  335. grid.DisplayLayout.Override.FilterUIType = FilterUIType.HeaderIcons;
  336. }
  337. else
  338. {
  339. grid.DisplayLayout.Bands[0].ColumnFilters.ClearAllFilters();
  340. grid.DisplayLayout.Override.FilterUIType = FilterUIType.Default;
  341. }
  342. }
  343. private void ultraTabControl1_Click(object sender, EventArgs e)
  344. {
  345. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  346. {
  347. this.comboBox4.SelectedIndex = 1;
  348. }
  349. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  350. {
  351. this.comboBox4.SelectedIndex = 0;
  352. }
  353. }
  354. private void DoExport()
  355. {
  356. try
  357. {
  358. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  359. {
  360. if (this.ultraGrid1.Rows.Count == 0)
  361. {
  362. MessageBox.Show("没有可以导出的数据", "提示");
  363. return;
  364. }
  365. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  366. {
  367. string fName = this.saveFileDialog1.FileName;
  368. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  369. Process.Start(fName);
  370. }
  371. }
  372. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  373. {
  374. if (this.ultraGrid18.Rows.Count == 0)
  375. {
  376. MessageBox.Show("没有可以导出的数据", "提示");
  377. return;
  378. }
  379. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  380. {
  381. string fName = this.saveFileDialog1.FileName;
  382. this.ultraGridExcelExporter1.Export(this.ultraGrid18, fName);
  383. Process.Start(fName);
  384. }
  385. }
  386. }
  387. catch (Exception ex)
  388. {
  389. System.Diagnostics.Debug.WriteLine(ex.ToString());
  390. }
  391. }
  392. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  393. {
  394. if (this.ultraTabControl1.Tabs[0].Selected) //待判信息
  395. {
  396. foreach (UltraGridRow ugr in this.ultraGrid1.Rows.Where(p => p.IsFilteredOut == false).ToList())
  397. {
  398. if (checkBox2.Checked)
  399. {
  400. ugr.Selected = true;
  401. }
  402. else
  403. {
  404. ugr.Selected = false;
  405. }
  406. }
  407. }
  408. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  409. {
  410. foreach (UltraGridRow ugr in this.ultraGrid18.Rows.Where(p => p.IsFilteredOut == false).ToList())
  411. {
  412. if (checkBox2.Checked)
  413. {
  414. ugr.Cells["CHECK"].Value = "True";
  415. }
  416. else
  417. {
  418. ugr.Cells["CHECK"].Value = "False";
  419. }
  420. }
  421. }
  422. }
  423. private void ultraComboEditor2_ValueChanged(object sender, EventArgs e)
  424. {
  425. string lb;
  426. if (this.ultraComboEditor2.Text.ToString() == "钢质次(A)")
  427. {
  428. lb = "钢质";
  429. }
  430. else if (this.ultraComboEditor2.Text.ToString() == "热轧次(B)")
  431. {
  432. lb = "轧质";
  433. }
  434. else
  435. {
  436. return;
  437. }
  438. ArrayList alt = new ArrayList();
  439. alt.Add("UIB030110_021N1.SELECT");
  440. alt.Add(lb);
  441. //alt.Add("UIB030110_022.SELECT");
  442. ValueList vsflv3 = new ValueList();
  443. CoreClientParam ccp = new CoreClientParam();
  444. ccp.ServerName = "QCM.COMMUNAL.ComDBQueryQCM";
  445. ccp.MethodName = "doSimpleQuery";
  446. ccp.ServerParams = new object[] { alt };
  447. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  448. for (int i = 0; i < ccp.SourceDataTable.Rows.Count; i++)
  449. {
  450. vsflv3.ValueListItems.Add(ccp.SourceDataTable.Rows[i]["SM_CD"].ToString(), ccp.SourceDataTable.Rows[i]["SM_CFNM"].ToString());
  451. }
  452. this.ultraComboEditor3.ValueList = vsflv3;
  453. }
  454. private void ultraTabControl1_Click_1(object sender, EventArgs e)
  455. {
  456. if (this.ultraTabControl1.Tabs[1].Selected) //判定记录
  457. {
  458. this.comboBox4.SelectedIndex = 1;
  459. }
  460. if (this.ultraTabControl1.Tabs[2].Selected) //判定记录
  461. {
  462. this.comboBox4.SelectedIndex = 1;
  463. }
  464. if (this.ultraTabControl1.Tabs[0].Selected) //判定记录
  465. {
  466. this.comboBox4.SelectedIndex = 0;
  467. }
  468. }
  469. }
  470. }