UcLfsPlanTime.cs 4.1 KB

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