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