ucHmpInInfo.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 ucHmpInInfo : UserControl
  8. {
  9. public ucHmpInInfo()
  10. {
  11. InitializeComponent();
  12. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  13. }
  14. private void ucHmpInInfo_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))
  44. {
  45. if (strKey == "IRONSOURCE")
  46. {
  47. if (!string.IsNullOrEmpty(ar[strKey].ToString()))
  48. {
  49. // string[] Iron = ar[strKey].ToString().Split('_');
  50. this.ultraDataSource1.Rows[0][i] = ar[strKey];//Iron[1] + "#鱼雷罐-" + Iron[0] + "#工位-" + Iron[2] + "#铁包";
  51. }
  52. }
  53. else
  54. {
  55. if (!string.IsNullOrEmpty(ar[strKey].ToString()))
  56. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  57. else
  58. {
  59. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  60. this.ultraDataSource1.Rows[0][i] = null;
  61. else
  62. this.ultraDataSource1.Rows[0][i] = "";
  63. }
  64. }
  65. }
  66. else
  67. {
  68. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  69. this.ultraDataSource1.Rows[0][i] = null;
  70. else
  71. this.ultraDataSource1.Rows[0][i] = "";
  72. }
  73. }
  74. catch { }
  75. }
  76. }
  77. }
  78. }