MscChoicePopup.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 System;
  6. using System.Data;
  7. using System.Linq;
  8. namespace Core.StlMes.Client.Qcm
  9. {
  10. public partial class MscChoicePopup : FrmBase
  11. {
  12. private string _stdCode = "";
  13. private string _steelCode = "";
  14. private string _msc = "";
  15. private string _pscBl = "";
  16. private string _mscSet = "";
  17. public MscChoicePopup(OpeBase ob, string stdCode, string steelCode, string msc,
  18. string pscBl, string mscSet)
  19. {
  20. InitializeComponent();
  21. this.ob = ob;
  22. _stdCode = stdCode;
  23. _steelCode = steelCode;
  24. _msc = msc;
  25. _pscBl = pscBl;
  26. _mscSet = mscSet;
  27. query();
  28. }
  29. private void query()
  30. {
  31. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.MscChoicePopup.getChoiceMsc",
  32. new object[] { _stdCode, _steelCode }, ob);
  33. ultraGrid1.BeginUpdate();
  34. GridHelper.CopyDataToDatatable(dt, dataTable1, true);
  35. foreach (var row in ultraGrid1.Rows)
  36. {
  37. if (_mscSet.Contains(row.GetValue("MSC")))
  38. {
  39. row.Cells["Chk"].Value = true;
  40. row.Update();
  41. }
  42. }
  43. SortRows();
  44. ultraGrid1.EndUpdate();
  45. ultraGrid1.UpdateData();
  46. }
  47. private void SortRows()
  48. {
  49. DataTable sortDt = dataTable1.Copy();
  50. sortDt.DefaultView.Sort = "Chk DESC, MSC ASC";
  51. GridHelper.CopyDataToDatatable(sortDt.DefaultView.ToTable(), dataTable1, true);
  52. }
  53. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  54. {
  55. switch (e.Tool.Key)
  56. {
  57. case "查询":
  58. query();
  59. break;
  60. case "确认":
  61. Submit();
  62. break;
  63. case "关闭":
  64. this.Close();
  65. break;
  66. }
  67. }
  68. private void Submit()
  69. {
  70. var rows = ultraGrid1.Rows.Where(a => a.GetValue("Chk") == "True");
  71. string mscSet = string.Join(";", rows.Select(a => a.GetValue("MSC")).ToArray());
  72. string mscDescSet = string.Join(";", rows.Select(a => a.GetValue("MSC_DESC")).ToArray());
  73. ServerHelper.SetData("com.steering.pss.qcm.MscChoicePopup.updateMscSet",
  74. new object[] { mscSet, mscDescSet, _msc, _pscBl }, ob);
  75. MessageUtil.ShowTips("操作成功!");
  76. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  77. }
  78. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  79. {
  80. e.Cell.Row.Update();
  81. }
  82. }
  83. }