ucBofTimeInfo.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 Core.LgMes.Client.Comm;
  10. namespace Core.LgMes.Client.LgJobMgt
  11. {
  12. public partial class ucBofTimeInfo : UserControl
  13. {
  14. public ucBofTimeInfo()
  15. {
  16. InitializeComponent();
  17. CStaticMethod.SetUltraGridStyle(ultraGrid1, 1); //设置样式
  18. }
  19. private void ucBofTimeInfo_Load(object sender, EventArgs e)
  20. {
  21. ultraDataSource1.Rows.Add(new object[] { null, null, null, null, "", null, null, "", null, null, "", null, null, "", null, null, "", "", "", "", "", "" });
  22. }
  23. public void ResetData()
  24. {
  25. try
  26. {
  27. for (int i = 0; i < this.ultraDataSource1.Band.Columns.Count; i++)
  28. {
  29. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  30. this.ultraDataSource1.Rows[0][i] = null;
  31. else
  32. this.ultraDataSource1.Rows[0][i] = "";
  33. }
  34. }
  35. catch { }
  36. }
  37. public void SetData(Hashtable ar)
  38. {
  39. if (ar == null || ar.Count == 0)
  40. return;
  41. int count = this.ultraDataSource1.Band.Columns.Count;
  42. string strKey = "";
  43. for (int i = 0; i < count; i++)
  44. {
  45. try
  46. {
  47. strKey = this.ultraDataSource1.Band.Columns[i].Key;
  48. if (ar.Contains(strKey))
  49. if(!string.IsNullOrEmpty(ar[strKey].ToString()))
  50. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  51. else if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  52. this.ultraDataSource1.Rows[0][i] = null;
  53. else
  54. this.ultraDataSource1.Rows[0][i] = "";
  55. else
  56. {
  57. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  58. this.ultraDataSource1.Rows[0][i] = null;
  59. else
  60. this.ultraDataSource1.Rows[0][i] = "";
  61. }
  62. }
  63. catch { }
  64. }
  65. try
  66. {
  67. //兑铁时间
  68. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CHANGESTARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CHANGEENDTIME"].ToString()))
  69. this.ultraDataSource1.Rows[0]["DTSJ"] =CStaticMethod.caculateSecondsTime( CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["CHANGESTARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["CHANGEENDTIME"])).ToString());
  70. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CHANGESTARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CHANGEENDTIME"].ToString()))
  71. this.ultraDataSource1.Rows[0]["DTSJ"] =CStaticMethod.caculateSecondsTime( CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["CHANGESTARTTIME"]), DateTime.Now).ToString());
  72. //一次吹炼
  73. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B1STARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B1ENDTIME"].ToString()))
  74. {
  75. if(!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B1TIME"].ToString()))
  76. this.ultraDataSource1.Rows[0]["B1TIME"] =CStaticMethod.caculateSecondsTime(ar["B1TIME"].ToString());
  77. else
  78. this.ultraDataSource1.Rows[0]["B1TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B1STARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B1ENDTIME"])).ToString());
  79. }
  80. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B1STARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B1ENDTIME"].ToString()))
  81. this.ultraDataSource1.Rows[0]["B1TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B1STARTTIME"]), DateTime.Now).ToString());
  82. //二次吹炼
  83. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B2STARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B2ENDTIME"].ToString()))
  84. {
  85. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B2TIME"].ToString()))
  86. this.ultraDataSource1.Rows[0]["B2TIME"] = CStaticMethod.caculateSecondsTime(ar["B2TIME"].ToString());
  87. else
  88. this.ultraDataSource1.Rows[0]["B2TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B2STARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B2ENDTIME"])).ToString());
  89. }
  90. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B2STARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B2ENDTIME"].ToString()))
  91. this.ultraDataSource1.Rows[0]["B2TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B2STARTTIME"]), DateTime.Now).ToString());
  92. //三次吹炼
  93. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B3STARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B3ENDTIME"].ToString()))
  94. {
  95. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B3TIME"].ToString()))
  96. this.ultraDataSource1.Rows[0]["B3TIME"] = CStaticMethod.caculateSecondsTime(ar["B3TIME"].ToString());
  97. else
  98. this.ultraDataSource1.Rows[0]["B3TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B3STARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B3ENDTIME"])).ToString());
  99. }
  100. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B3STARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B3ENDTIME"].ToString()))
  101. this.ultraDataSource1.Rows[0]["B3TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B3STARTTIME"]), DateTime.Now).ToString());
  102. //四次吹炼
  103. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B4STARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B4ENDTIME"].ToString()))
  104. {
  105. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B4TIME"].ToString()))
  106. this.ultraDataSource1.Rows[0]["B4TIME"] = CStaticMethod.caculateSecondsTime(ar["B4TIME"].ToString());
  107. else
  108. this.ultraDataSource1.Rows[0]["B4TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B4STARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B4ENDTIME"])).ToString());
  109. }
  110. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B4STARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B4ENDTIME"].ToString()))
  111. this.ultraDataSource1.Rows[0]["B4TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B4STARTTIME"]), DateTime.Now).ToString());
  112. //五次吹炼
  113. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B5STARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B5ENDTIME"].ToString()))
  114. {
  115. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B5TIME"].ToString()))
  116. this.ultraDataSource1.Rows[0]["B5TIME"] = CStaticMethod.caculateSecondsTime(ar["B5TIME"].ToString());
  117. else
  118. this.ultraDataSource1.Rows[0]["B5TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B5STARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B5ENDTIME"])).ToString());
  119. }
  120. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B5STARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["B5ENDTIME"].ToString()))
  121. this.ultraDataSource1.Rows[0]["B5TIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["B5STARTTIME"]), DateTime.Now).ToString());
  122. //出钢时间
  123. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["TAPPINGSTARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["TAPPINGENDTIME"].ToString()))
  124. this.ultraDataSource1.Rows[0]["TAPPINGTIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["TAPPINGSTARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["TAPPINGENDTIME"])).ToString());
  125. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["TAPPINGSTARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["TAPPINGENDTIME"].ToString()))
  126. this.ultraDataSource1.Rows[0]["TAPPINGTIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["TAPPINGSTARTTIME"]), DateTime.Now).ToString());
  127. //溅渣护炉
  128. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["PSSTARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["PSENDTIME"].ToString()))
  129. this.ultraDataSource1.Rows[0]["BRPSTIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["PSSTARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["PSENDTIME"])).ToString());
  130. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["PSSTARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["PSENDTIME"].ToString()))
  131. this.ultraDataSource1.Rows[0]["BRPSTIME"] = CStaticMethod.caculateSecondsTime(CStaticMethod.caculateTimeSeconds(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["PSSTARTTIME"]), DateTime.Now).ToString());
  132. }
  133. catch { }
  134. }
  135. }
  136. }