UcBofPlanTime.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using System.Collections;
  3. using System.Data;
  4. using System.Windows.Forms;
  5. using Core.LgMes.Client.Comm;
  6. using Core.Mes.Client.Common;
  7. namespace Core.LgMes.Client.LgJobMgt
  8. {
  9. public partial class UcBofPlanTime : UserControl
  10. {
  11. private Hashtable _htPlanFactTime; // 作业计划时间与实际时间
  12. public CoreFS.CA06.OpeBase ob=null;
  13. public UcBofPlanTime()
  14. {
  15. InitializeComponent();
  16. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  17. }
  18. private void UcBofPlanTime_Load(object sender, EventArgs e)
  19. {
  20. ultdsPlanTime.Rows.Add(new object[] { null});
  21. _htPlanFactTime = new Hashtable();
  22. }
  23. public void ResetData()
  24. {
  25. try
  26. {
  27. for (int i = 0; i < this.ultdsPlanTime.Band.Columns.Count; i++)
  28. {
  29. if (this.ultdsPlanTime.Band.Columns[i].DataType == typeof(System.DateTime))
  30. this.ultdsPlanTime.Rows[0][i] = null;
  31. else
  32. this.ultdsPlanTime.Rows[0][i] = "";
  33. }
  34. }
  35. catch { }
  36. }
  37. public void SetData()
  38. {
  39. if (_htPlanFactTime == null || _htPlanFactTime.Count == 0)
  40. return;
  41. int count = this.ultdsPlanTime.Band.Columns.Count;
  42. string strKey = "";
  43. for (int i = 0; i < count; i++)
  44. {
  45. try
  46. {
  47. strKey = this.ultdsPlanTime.Band.Columns[i].Key;
  48. if (_htPlanFactTime.Contains(strKey))
  49. if (!string.IsNullOrEmpty(_htPlanFactTime[strKey].ToString()))
  50. this.ultdsPlanTime.Rows[0][i] = _htPlanFactTime[strKey];
  51. else if (this.ultdsPlanTime.Band.Columns[i].DataType == typeof(System.DateTime))
  52. this.ultdsPlanTime.Rows[0][i] = null;
  53. else
  54. this.ultdsPlanTime.Rows[0][i] = "";
  55. else
  56. {
  57. if (this.ultdsPlanTime.Band.Columns[i].DataType == typeof(System.DateTime))
  58. this.ultdsPlanTime.Rows[0][i] = null;
  59. else
  60. this.ultdsPlanTime.Rows[0][i] = "";
  61. }
  62. }
  63. catch { }
  64. }
  65. }
  66. /// <summary>
  67. /// 获取作业计划时间与实际时间
  68. /// </summary>
  69. public void GetPlanAndFactTime(string _smeltingID)
  70. {
  71. if (_smeltingID == "")
  72. return;
  73. try
  74. {
  75. string strErr = "";
  76. ArrayList arry = new ArrayList();
  77. arry.Add("GetPlanAndFactTime.Select");//此ID为XML文件ID
  78. arry.Add(_smeltingID);
  79. CommonClientToServer ccs = new CommonClientToServer();
  80. ccs.ob = ob;
  81. //查询转炉作业采样信息
  82. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.LgJobMgt.ClassBofJob",
  83. "GetPlanAndFactTime", arry, out strErr);
  84. if (strErr == "" && ds != null)
  85. {
  86. DataTable tb = ds.Tables[0];
  87. if (tb.Rows.Count > 0)
  88. {
  89. for (int i = 0; i < tb.Columns.Count; i++)
  90. {
  91. if (_htPlanFactTime.Contains(tb.Columns[i].ColumnName))
  92. _htPlanFactTime.Remove(tb.Columns[i].ColumnName);
  93. _htPlanFactTime.Add(tb.Columns[i].ColumnName, tb.Rows[0][i].ToString());
  94. }
  95. }
  96. }
  97. }
  98. catch { }
  99. }
  100. }
  101. }