ucBofTimeInfo.cs 11 KB

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