UcVdPlanTime.cs.svn-base 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. using System;
  2. using System.Data;
  3. using System.Windows.Forms;
  4. using System.Collections;
  5. using Core.Mes.Client.Common;
  6. using Core.LgMes.Client.Comm;
  7. namespace Core.LgMes.Client.LgJobMgt
  8. {
  9. public partial class UcVdPlanTime : UserControl
  10. {
  11. private Hashtable _htPlanFactTime; // 作业计划时间与实际时间
  12. public CoreFS.CA06.OpeBase ob = null;
  13. public UcVdPlanTime()
  14. {
  15. InitializeComponent();
  16. CStaticMethod.SetUltraGridStyle(ultraGrid1, 2); //设置样式
  17. }
  18. private void UcVdsPlanTime_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. string szOut = "", szWhere = "";
  72. if (_smeltingID == "")
  73. return;
  74. try
  75. {
  76. string strErr = "";
  77. ArrayList arry = new ArrayList();
  78. arry.Add("GetVdsPlanAndFactTime.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. }