ucCasTimeInfo.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 ucCasTimeInfo : UserControl
  13. {
  14. public ucCasTimeInfo()
  15. {
  16. InitializeComponent();
  17. CStaticMethod.SetUltraGridStyle(ultraGrid1, 1); //设置样式
  18. }
  19. private void ucCasTimeInfo_Load(object sender, EventArgs e)
  20. {
  21. ultraDataSource1.Rows.Add(new object[] { 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. {
  50. if(!string.IsNullOrEmpty(ar[strKey].ToString()))
  51. this.ultraDataSource1.Rows[0][i] = ar[strKey];
  52. else if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  53. this.ultraDataSource1.Rows[0][i] = null;
  54. else
  55. this.ultraDataSource1.Rows[0][i] = "";
  56. }
  57. else
  58. {
  59. if (this.ultraDataSource1.Band.Columns[i].DataType == typeof(System.DateTime))
  60. this.ultraDataSource1.Rows[0][i] = null;
  61. else
  62. this.ultraDataSource1.Rows[0][i] = "";
  63. }
  64. }
  65. catch { }
  66. }
  67. try
  68. {
  69. //在站时间
  70. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ARRIVETIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["LEAVETIME"].ToString()))
  71. this.ultraDataSource1.Rows[0]["REFINETIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ARRIVETIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["LEAVETIME"]));
  72. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["ARRIVETIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["LEAVETIME"].ToString()))
  73. this.ultraDataSource1.Rows[0]["REFINETIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["ARRIVETIME"]), DateTime.Now);
  74. //吹氩时间
  75. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BLOWARENDTIME"].ToString()))
  76. this.ultraDataSource1.Rows[0]["BLOWARTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARENDTIME"]));
  77. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["BLOWARENDTIME"].ToString()))
  78. this.ultraDataSource1.Rows[0]["BLOWARTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["BLOWARSTARTTIME"]), DateTime.Now);
  79. //喂丝时间
  80. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"].ToString()))
  81. this.ultraDataSource1.Rows[0]["FEEDSILKTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"]));
  82. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["FEEDSILKCLOSETIME"].ToString()))
  83. this.ultraDataSource1.Rows[0]["FEEDSILKTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["FEEDSILKBEGINTIME"]), DateTime.Now);
  84. //CAS罩时间
  85. if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CASSTARTTIME"].ToString()) && !string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CASENDTIME"].ToString()))
  86. this.ultraDataSource1.Rows[0]["CASTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["CASSTARTTIME"]), Convert.ToDateTime(this.ultraDataSource1.Rows[0]["CASENDTIME"]));
  87. else if (!string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CASSTARTTIME"].ToString()) && string.IsNullOrEmpty(this.ultraDataSource1.Rows[0]["CASENDTIME"].ToString()))
  88. this.ultraDataSource1.Rows[0]["CASTIME"] = CStaticMethod.caculateTime(Convert.ToDateTime(this.ultraDataSource1.Rows[0]["CASSTARTTIME"]), DateTime.Now);
  89. }
  90. catch { }
  91. }
  92. }
  93. }