ChoiceProcessPopup.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using Core.Mes.Client.Comm.Tool;
  4. using CoreFS.CA06;
  5. using Infragistics.Win.UltraWinGrid;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Linq;
  10. namespace Core.StlMes.Client.Qcm
  11. {
  12. public partial class ChoiceProcessPopup : FrmBase
  13. {
  14. private OpeBase _ob;
  15. private string _processCodes = "";
  16. private bool _isQuerying = false;
  17. public string ProcessCodes
  18. {
  19. get { return _processCodes; }
  20. set { _processCodes = value; }
  21. }
  22. private string _processDescs = "";
  23. public string ProcessDescs
  24. {
  25. get { return _processDescs; }
  26. set { _processDescs = value; }
  27. }
  28. public ChoiceProcessPopup(string processCodes, OpeBase ob)
  29. {
  30. InitializeComponent();
  31. _ob = ob;
  32. _processCodes = processCodes;
  33. }
  34. private void ChoiceProcessPopup_Load(object sender, EventArgs e)
  35. {
  36. GetAllProcess();
  37. }
  38. private void GetAllProcess()
  39. {
  40. _isQuerying = true;
  41. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreProcessBasics.getAllProcess",
  42. null, _ob);
  43. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  44. string[] processsCodes = _processCodes.Split(',');
  45. for (int i = 0; i < processsCodes.Length; i++)
  46. {
  47. processsCodes[i] = processsCodes[i].Trim();
  48. }
  49. foreach (UltraGridRow row in ultraGrid1.Rows)
  50. {
  51. if (processsCodes.Contains(row.GetValue("PROCESS_CODE")))
  52. {
  53. row.Cells["CHK"].Value = true;
  54. }
  55. }
  56. ultraGrid1.UpdateData();
  57. _isQuerying = false;
  58. }
  59. private void button1_Click(object sender, EventArgs e)
  60. {
  61. List<UltraGridRow> rows = ultraGrid1.Rows.AsQueryable().Where("CHK = 'True'").ToList();
  62. if (rows.Count() == 0)
  63. {
  64. MessageUtil.ShowWarning("请选择一条记录!");
  65. return;
  66. }
  67. for (int i = 0; i < rows.Count(); i++)
  68. {
  69. if (i == 0)
  70. {
  71. _processCodes = rows[i].GetValue("PROCESS_CODE");
  72. _processDescs = rows[i].GetValue("PROCESS_DESC");
  73. }
  74. else
  75. {
  76. _processCodes += "," + rows[i].GetValue("PROCESS_CODE");
  77. _processDescs += "," + rows[i].GetValue("PROCESS_DESC");
  78. }
  79. }
  80. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  81. }
  82. private void button2_Click(object sender, EventArgs e)
  83. {
  84. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  85. }
  86. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  87. {
  88. ultraGrid1.UpdateData();
  89. }
  90. private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
  91. {
  92. }
  93. }
  94. }