ucHmpOutInfo.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Collections;
  4. using Core.LgMes.Client.Comm;
  5. namespace Core.LgMes.Client.LgJobMgt
  6. {
  7. public partial class ucHmpOutInfo : UserControl
  8. {
  9. public ucHmpOutInfo()
  10. {
  11. InitializeComponent();
  12. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  13. }
  14. private void ucHmpOutInfo_Load(object sender, EventArgs e)
  15. {
  16. ultraDataSource1.Rows.Add(new object[] { null, "", "", "", "" });
  17. }
  18. public void ResetData()
  19. {
  20. try
  21. {
  22. for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++)
  23. {
  24. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  25. this.ultraDataSource1.Rows[0][i] = null;
  26. else
  27. this.ultraDataSource1.Rows[0][i] = "";
  28. }
  29. }
  30. catch { }
  31. }
  32. public void SetData(Hashtable ar)
  33. {
  34. if (ar == null || ar.Count == 0)
  35. return;
  36. int count = this.ultraDataSource1.Band.Columns.Count;
  37. string strKey = "";
  38. for (int i = 0; i < count; i++)
  39. {
  40. try
  41. {
  42. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  43. if (ar.Contains(strKey) && !string.IsNullOrEmpty(ar[strKey].ToString()))
  44. if(strKey == "MOLIRNLEAVE")
  45. {
  46. if (!string.IsNullOrEmpty(ar[strKey].ToString()))
  47. {
  48. string molirnleave = "";
  49. switch (ar[strKey].ToString())
  50. {
  51. case "BOF01":
  52. molirnleave = "1#转炉";
  53. break;
  54. case "BOF02":
  55. molirnleave = "2#转炉";
  56. break;
  57. case "BOF03":
  58. molirnleave = "3#转炉";
  59. break;
  60. default :
  61. break;
  62. }
  63. this.ultraDataSource1.Rows[0][i] = molirnleave;
  64. }
  65. }
  66. else
  67. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  68. else
  69. {
  70. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  71. this.ultraDataSource1.Rows[0][i] = null;
  72. else
  73. this.ultraDataSource1.Rows[0][i] = "";
  74. }
  75. }
  76. catch { }
  77. }
  78. }
  79. }
  80. }