UserNameControlNew.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Windows.Forms;
  7. using Infragistics.Win.UltraWinGrid;
  8. using com.steering.mes.mcp.entity;
  9. using Core.Mes.Client.Comm.Server;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Core.StlMes.Client.Mcp.Control.Entity;
  13. using Infragistics.Win;
  14. namespace Core.StlMes.Client.Mcp.Control
  15. {
  16. public partial class UserNameControlNew : UserControl
  17. {
  18. private OpeBase ob;
  19. public OpeBase Ob
  20. {
  21. get { return ob; }
  22. set { ob = value; }
  23. }
  24. public void DisableFiltering()
  25. {
  26. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
  27. ultraGrid1.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default;
  28. }
  29. private string _plineCode;
  30. private List<HttSignatureEntity> Names= new List<HttSignatureEntity>();
  31. public HttHeatCommEntity Value
  32. {
  33. get
  34. {
  35. List<HttHeatCommEntity> list =
  36. httHeatCommEntityBindingSource.DataSource as List<HttHeatCommEntity>;
  37. return list == null || !list.Any() ? new HttHeatCommEntity() : list.FirstOrDefault();
  38. }
  39. set
  40. {
  41. if (value == null)
  42. {
  43. httHeatCommEntityBindingSource.DataSource = new List<HttHeatCommEntity>()
  44. {
  45. new HttHeatCommEntity()
  46. };
  47. }
  48. else
  49. {
  50. httHeatCommEntityBindingSource.DataSource = new List<HttHeatCommEntity>() {value.Clone()};
  51. if (_plineCode != Value.PlineCode)
  52. {
  53. Names = EntityHelper.GetData<HttSignatureEntity>(
  54. "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign",
  55. new object[] { Value.PlineCode, "1" }, Ob);
  56. name.DataSource = Names.Where(p => p.ColGroup == value.LoadGroup).ToList();
  57. name.DisplayMember = "UserName";
  58. name.ValueMember = "UserName";
  59. YdmBaseClass.SetComboItemHeight(name);
  60. _plineCode = Value.PlineCode;
  61. }
  62. }
  63. ultraGrid1.Refresh();
  64. }
  65. }
  66. /// <summary>
  67. /// 上料炉号
  68. /// </summary>
  69. public string FeedStoveNo { get; set; }
  70. public decimal ActCount { get; set; }
  71. public string BatchNo { get; set; }
  72. public string GroupNo { get; set; }
  73. public void SetFont(Font f1)
  74. {
  75. ultraGrid1.Font = f1;
  76. foreach (UltraGridColumn UltraGridColumn in ultraGrid1.DisplayLayout.Bands[0].Columns)
  77. {
  78. UltraGridColumn.Header.Appearance.FontData.Bold = f1.Bold ? DefaultableBoolean.True : DefaultableBoolean.False;
  79. UltraGridColumn.Header.Appearance.FontData.Name = f1.Name;
  80. UltraGridColumn.Header.Appearance.FontData.SizeInPoints = f1.SizeInPoints;
  81. }
  82. }
  83. public UserNameControlNew()
  84. {
  85. InitializeComponent();
  86. EntityHelper.ShowGridCaption<HttHeatCommEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  87. }
  88. public void ChangeName(string PlineCode)
  89. {
  90. }
  91. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  92. {
  93. try
  94. {
  95. ultraGrid1.UpdateData();
  96. /* if (e.Cell.Column.Key.Equals("LoadGroup"))
  97. {
  98. DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getPerson", new object[] { e.Cell.Row.Cells["LoadGroup"].Text, Value.PlineName }, this.ob);//如果是“”里面添加的是条件
  99. name.DataSource = dt1;
  100. name.DisplayMember = "NAME";
  101. //name.ValueMember = "ID";
  102. YdmBaseClass.SetComboItemHeight(name);
  103. }*/
  104. if (e.Cell.Column.Key.Equals("LoadTime"))
  105. {
  106. Value.LoadTime = e.Cell.Text;
  107. }
  108. if (e.Cell.Column.Key.Equals("LoadGroup") && Value.LoadGroup != null)
  109. {
  110. name.DataSource = Names.Where(p => p.ColGroup == Value.LoadGroup).ToList();
  111. }
  112. if (e.Cell.Column.Key.Equals("HheatExitTemp") || e.Cell.Column.Key.Equals("TotalTimeH") || e.Cell.Column.Key.Equals("CoolingTypeH") || e.Cell.Column.Key.Equals("HttTypeH") ||
  113. e.Cell.Column.Key.Equals("LheatExitTemp") || e.Cell.Column.Key.Equals("TotalTimeL") || e.Cell.Column.Key.Equals("CoolingTypeL") || e.Cell.Column.Key.Equals("HttTypeL"))
  114. {
  115. string technology = "";
  116. if (e.Cell.Row.Cells["HheatExitTemp"].Value.ToString2() != "")
  117. {
  118. int a;
  119. string unit = int.TryParse(e.Cell.Row.Cells["TotalTimeH"].Value.ToString2(), out a) ? "min" : "";
  120. technology += e.Cell.Row.Cells["HheatExitTemp"].Value.ToString2() + "℃×" +
  121. e.Cell.Row.Cells["TotalTimeH"].Value.ToString2() + unit +
  122. e.Cell.Row.Cells["HttTypeH"].Value.ToString2() + " " +
  123. e.Cell.Row.Cells["CoolingTypeH"].Value.ToString2();
  124. }
  125. if (e.Cell.Row.Cells["LheatExitTemp"].Value.ToString2() != "")
  126. {
  127. int a;
  128. string unit = int.TryParse(e.Cell.Row.Cells["TotalTimeL"].Value.ToString2(), out a) ? "min" : "";
  129. technology += (technology==""?"":"+") + e.Cell.Row.Cells["LheatExitTemp"].Value.ToString2() + "℃×" +
  130. e.Cell.Row.Cells["TotalTimeL"].Value.ToString2() + unit +
  131. e.Cell.Row.Cells["HttTypeL"].Value.ToString2() + " " +
  132. e.Cell.Row.Cells["CoolingTypeL"].Value.ToString2();
  133. }
  134. e.Cell.Row.Cells["HttTechnology"].Value = technology;
  135. }
  136. this.ultraGrid1.UpdateData();
  137. }
  138. catch (Exception)
  139. {
  140. }
  141. }
  142. }
  143. }