ComBasePlineChoice.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. namespace Core.StlMes.Client.Qcm
  8. {
  9. public partial class ComBasePlineChoice : FrmBase
  10. {
  11. private string _plineCodes = "";
  12. public string PlineCodes
  13. {
  14. get { return _plineCodes; }
  15. set { _plineCodes = value; }
  16. }
  17. private string _plineNames = "";
  18. public string PlineNames
  19. {
  20. get { return _plineNames; }
  21. set { _plineNames = value; }
  22. }
  23. private string _processCode = "";
  24. public ComBasePlineChoice(string plineCodes, string processCode, OpeBase ob)
  25. {
  26. InitializeComponent();
  27. this._plineCodes = plineCodes;
  28. _processCode = processCode;
  29. this.ob = ob;
  30. Query();
  31. }
  32. private void Query()
  33. {
  34. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.ProductionLineInfo.QueryAll",
  35. new object[] { _processCode }, ob);
  36. string[] plineCodes = _plineCodes.Split(',');
  37. foreach (DataRow row in dt.Rows)
  38. {
  39. if (plineCodes.Contains(row["PLINE_CODE"].ToString()))
  40. {
  41. row["CHK"] = true;
  42. }
  43. }
  44. dt.DefaultView.Sort = "CHK DESC, PLINE_NAME ASC";
  45. GridHelper.CopyDataToDatatable(dt.DefaultView.ToTable(), dataTable1, true);
  46. ultraGrid1.UpdateData();
  47. }
  48. private void ultraButton1_Click(object sender, EventArgs e)
  49. {
  50. ultraGrid1.UpdateData();
  51. var rows = ultraGrid1.Rows.Where(a => a.GetValue("CHK") == "True");
  52. _plineCodes = string.Join(",", rows.Select(a => a.GetValue("PLINE_CODE")));
  53. _plineNames = string.Join(",", rows.Select(a => a.GetValue("PLINE_NAME")));
  54. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  55. }
  56. private void ultraButton2_Click(object sender, EventArgs e)
  57. {
  58. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  59. }
  60. }
  61. }