UcBofPlanTime.cs 4.0 KB

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