CommonCrackHeadControl.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 CommonCrackHeadControl : UserControl
  17. {
  18. private OpeBase ob;
  19. public OpeBase Ob
  20. {
  21. get { return ob; }
  22. set { ob = value; }
  23. }
  24. public string gx { get; set; }
  25. public void DisableFiltering()
  26. {
  27. ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
  28. foreach (var ugc in ultraGrid1.DisplayLayout.Bands[0].Columns)
  29. ugc.SortIndicator = SortIndicator.Disabled;
  30. }
  31. public void BandName(List<HttSignatureEntity> names)
  32. {
  33. name.DataSource = names;
  34. name.DisplayMember = "userName";
  35. name.ValueMember = "userName";
  36. name.DataBind();
  37. }
  38. public void setBatchNo(List<string> datas)
  39. {
  40. ucBatchs.DataSource = datas;
  41. ucBatchs.DataBind();
  42. }
  43. public void getWorkUnit(List<string> datas)
  44. {
  45. ucWorkUnit.DataSource = datas;
  46. ucWorkUnit.DataBind();
  47. }
  48. public List<PortHttBatchSampleResultEntity> PortHttBatchSampleResultEntitys { get; set; }
  49. public List<HttCrackDetectionEtEntity> ListAll { get; set; }
  50. public HttCrackDetectionEtEntity Value
  51. {
  52. get
  53. {
  54. ultraGrid1.UpdateData();
  55. List<HttCrackDetectionEtEntity> list =
  56. httCrackDetectionEtEntityBindingSource.DataSource as List<HttCrackDetectionEtEntity>;
  57. if (list != null && list.Any())
  58. {
  59. list[0].ColTime = ultraGrid1.Rows[0].Cells["ColTime"].Text;
  60. list[0].ColEndTime = ultraGrid1.Rows[0].Cells["ColEndTime"].Text;
  61. }
  62. return list==null || !list.Any()?new HttCrackDetectionEtEntity(): list.FirstOrDefault();
  63. }
  64. set
  65. {
  66. List<HttCrackDetectionEtEntity> list =new List<HttCrackDetectionEtEntity>();
  67. if (value == null)
  68. {
  69. list = new List<HttCrackDetectionEtEntity>()
  70. {
  71. new HttCrackDetectionEtEntity(){}
  72. };
  73. }
  74. else
  75. {
  76. list = new List<HttCrackDetectionEtEntity>() { value };
  77. }
  78. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchInfo"].Hidden = true;
  79. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchLength"].Hidden = false;
  80. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchWidth"].Hidden = false;
  81. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchDepth"].Hidden = false;
  82. if (list[0].PlineCode == "C092" || list[0].PlineCode == "C091")
  83. {
  84. if (list[0].ReportNo == "12")
  85. {
  86. list[0].NotchLength = "";
  87. list[0].NotchWidth = "";
  88. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchLength"].Hidden = true;
  89. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchWidth"].Hidden = true;
  90. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchDepth"].Hidden = true;
  91. }
  92. else
  93. {
  94. list[0].NotchLength = "≤40mm";
  95. list[0].NotchWidth = "≤1mm";
  96. ultraGrid1.DisplayLayout.Bands[0].Columns["NotchInfo"].Hidden = false;
  97. }
  98. }
  99. httCrackDetectionEtEntityBindingSource.DataSource = list;
  100. httCrackDetectionEtEntityBindingSource.ResetBindings(false);
  101. ultraGrid1.Refresh();
  102. }
  103. }
  104. public bool WorkUnitbool
  105. {
  106. get
  107. {
  108. return workUnitbool;
  109. }
  110. set
  111. {
  112. if (value == false)//64
  113. {
  114. ultraGrid1.DisplayLayout.Bands[0].Columns["WorkUnit"].Hidden = true;
  115. // ultraGrid1.UltraGridColumns Columns["WorkUnit"].
  116. workUnitbool = value;
  117. // ultraGrid1.Refresh();
  118. }
  119. else {
  120. ultraGrid1.DisplayLayout.Bands[0].Columns["WorkUnit"].Hidden = false;
  121. // ultraGrid1.Refresh();
  122. }
  123. }
  124. }
  125. public void SetFont(Font f1)
  126. {
  127. ultraGrid1.Font = f1;
  128. foreach (UltraGridColumn UltraGridColumn in ultraGrid1.DisplayLayout.Bands[0].Columns)
  129. {
  130. UltraGridColumn.Header.Appearance.FontData.Bold = f1.Bold ? DefaultableBoolean.True : DefaultableBoolean.False;
  131. UltraGridColumn.Header.Appearance.FontData.Name = f1.Name;
  132. UltraGridColumn.Header.Appearance.FontData.SizeInPoints = f1.SizeInPoints;
  133. }
  134. }
  135. public CommonCrackHeadControl()
  136. {
  137. InitializeComponent();
  138. WorkUnitbool = false;
  139. EntityHelper.ShowGridCaption<HttCrackDetectionEtEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  140. }
  141. private void ultraGrid1_CellChange(object sender, CellEventArgs e)
  142. {
  143. try
  144. {
  145. if (e.Cell.Column.Key.Equals("ColTime") || e.Cell.Column.Key.Equals("ColEndTime"))
  146. {
  147. return;
  148. }
  149. ultraGrid1.UpdateData();
  150. }
  151. catch (Exception)
  152. {
  153. }
  154. }
  155. private void ultraGrid1_CellDataError(object sender, CellDataErrorEventArgs e)
  156. {
  157. e.RestoreOriginalValue = true;
  158. e.RaiseErrorEvent = false;
  159. }
  160. private bool workUnitbool;
  161. }
  162. }