FrmMaterialAdministrationSub.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.Data;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. namespace Core.StlMes.Client.Qcm
  11. {
  12. public partial class FrmMaterialAdministrationSub : FrmBase
  13. {
  14. public FrmMaterialAdministrationSub()
  15. {
  16. InitializeComponent();
  17. }
  18. public FrmMaterialAdministrationSub(OpeBase _ob)
  19. {
  20. InitializeComponent();
  21. this.ob = _ob;
  22. }
  23. private string deptId;
  24. /// <summary>
  25. /// 部门ID集合
  26. /// </summary>
  27. public string DeptId
  28. {
  29. get { return deptId; }
  30. set { deptId = value; }
  31. }
  32. private string deptName;
  33. /// <summary>
  34. /// 部门名称集合
  35. /// </summary>
  36. public string DeptName
  37. {
  38. get { return deptName; }
  39. set { deptName = value; }
  40. }
  41. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  42. {
  43. switch (e.Tool.Key)
  44. {
  45. case "Query":
  46. Init();
  47. break;
  48. case "Confirm":
  49. Confirm();
  50. break;
  51. case "Cancel":
  52. this.Close();
  53. break;
  54. }
  55. }
  56. private void Init()
  57. {
  58. DataTable dt = ServerHelper.GetData("com.steering.pss.qcm.CoreMaterialAdministrationSub.query", null, this.ob);
  59. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  60. if (deptId != "")
  61. {
  62. string[] dept = deptId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
  63. foreach (UltraGridRow row in gdDept.Rows)
  64. {
  65. if (dept.Contains(row.Cells["PHY_DEPTID"].Value.ToString()))
  66. {
  67. row.Cells["CHK"].Value = true;
  68. }
  69. }
  70. gdDept.UpdateData();
  71. }
  72. }
  73. private void FrmMaterialAdministrationSub_Load(object sender, EventArgs e)
  74. {
  75. Init();
  76. }
  77. private void Confirm()
  78. {
  79. gdDept.UpdateData();
  80. UltraGridRow[] row = gdDept.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString().ToUpper() == "TRUE").ToArray();
  81. if (row.Length <= 0)
  82. {
  83. MessageUtil.ShowWarning("请选择科室!");
  84. return;
  85. }
  86. string deptCode = "";
  87. string deptDesc = "";
  88. foreach (var uRow in row)
  89. {
  90. deptCode = deptCode + "," + uRow.Cells["PHY_DEPTID"].Value.ToString();
  91. deptDesc = deptDesc + "," + uRow.Cells["PHY_DEPTNAME"].Value.ToString();
  92. }
  93. deptCode = deptCode.Remove(0, 1);
  94. deptDesc = deptDesc.Remove(0, 1);
  95. this.DeptId = deptCode;
  96. this.DeptName = deptDesc;
  97. DialogResult = DialogResult.OK;
  98. }
  99. }
  100. }