UcCcmPlanTime.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 UcCcmPlanTime : UserControl
  14. {
  15. private Hashtable _htPlanFactTime; // 作业计划时间与实际时间
  16. public CoreFS.CA06.OpeBase ob = null;
  17. public UcCcmPlanTime()
  18. {
  19. InitializeComponent();
  20. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  21. }
  22. private void UcCcmPlanTime_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. string szOut = "", szWhere = "";
  76. if (_smeltingID == "")
  77. return;
  78. try
  79. {
  80. string strErr = "";
  81. ArrayList arry = new ArrayList();
  82. arry.Add("GetCcmPlanAndFactTime.Select");//此ID为XML文件ID
  83. arry.Add(_smeltingID);
  84. CommonClientToServer ccs = new CommonClientToServer();
  85. ccs.ob = ob;
  86. //查询转炉作业采样信息
  87. DataSet ds = ccs.ExecuteQueryFunctions("Core.LgMes.Server.LgJobMgt.ClassBofJob",
  88. "GetPlanAndFactTime", arry, out strErr);
  89. if (strErr == "" && ds != null)
  90. {
  91. DataTable tb = ds.Tables[0];
  92. if (tb.Rows.Count > 0)
  93. {
  94. for (int i = 0; i < tb.Columns.Count; i++)
  95. {
  96. if (_htPlanFactTime.Contains(tb.Columns[i].ColumnName))
  97. _htPlanFactTime.Remove(tb.Columns[i].ColumnName);
  98. _htPlanFactTime.Add(tb.Columns[i].ColumnName, tb.Rows[0][i].ToString());
  99. }
  100. }
  101. }
  102. }
  103. catch { }
  104. }
  105. }
  106. }