ComBasePhyMinChoice.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using CoreFS.CA06;
  4. using System;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Windows.Forms;
  8. namespace Core.StlMes.Client.Qcm
  9. {
  10. public partial class ComBasePhyMinChoice : FrmBase
  11. {
  12. private string _choicePhyMinCodes;
  13. public string ChoicePhyMinCodes
  14. {
  15. get { return _choicePhyMinCodes; }
  16. set { _choicePhyMinCodes = value; }
  17. }
  18. private string _choicePhyMinNames;
  19. public string ChoicePhyMinNames
  20. {
  21. get { return _choicePhyMinNames; }
  22. set { _choicePhyMinNames = value; }
  23. }
  24. //查询条件
  25. private string _phyMinCodes = "";
  26. public ComBasePhyMinChoice(string phyMinCodes, OpeBase ob)
  27. {
  28. InitializeComponent();
  29. this.ob = ob;
  30. _phyMinCodes = phyMinCodes;
  31. }
  32. private void Query(string phyMinCodes)
  33. {
  34. ultraGrid1.BeginUpdate();
  35. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreMaterialItemMng.getPhyMinInfo",
  36. new object[] { }, ob);
  37. string[] phyMinCodeArray = phyMinCodes.Split(';');
  38. foreach (DataRow row in dt.Rows)
  39. {
  40. if (phyMinCodeArray.Contains(row["PHY_CODE_MIN"].ToString()))
  41. {
  42. row["CHK"] = true;
  43. }
  44. }
  45. dt.DefaultView.Sort = "CHK DESC, PHY_NAME_MIN ASC";
  46. GridHelper.CopyDataToDatatable(dt.DefaultView.ToTable(), this.dataTable1, true);
  47. ultraGrid1.EndUpdate();
  48. ultraGrid1.UpdateData();
  49. }
  50. private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
  51. {
  52. e.Cell.Row.Update();
  53. }
  54. private void ultraButton1_Click(object sender, EventArgs e)
  55. {
  56. ultraGrid1.UpdateData();
  57. var rows = ultraGrid1.Rows.AsQueryable().Where(a => a.GetValue("CHK") == "True");
  58. var codeRows = rows.Select(a => a.GetValue("PHY_CODE_MIN"));
  59. _choicePhyMinCodes = string.Join(";", codeRows);
  60. var nameRows = rows.Select(a => a.GetValue("PHY_NAME_MIN"));
  61. _choicePhyMinNames = string.Join(";", nameRows);
  62. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  63. }
  64. private void ultraButton2_Click(object sender, EventArgs e)
  65. {
  66. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  67. }
  68. private void ComBaseStdChoice_Load(object sender, EventArgs e)
  69. {
  70. try
  71. {
  72. this.Cursor = Cursors.WaitCursor;
  73. Query(_phyMinCodes);
  74. }
  75. finally
  76. {
  77. this.Cursor = Cursors.Default;
  78. }
  79. }
  80. }
  81. }