UcCasPlanTime.cs 3.9 KB

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