UserNameControl.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 UserNameControl : 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. }
  28. private string _plineCode;
  29. private List<HttSignatureEntity> Names = new List<HttSignatureEntity>();
  30. public HttLoadingResultEntity Value
  31. {
  32. get
  33. {
  34. List<HttLoadingResultEntity> list =
  35. httLoadingResultEntityBindingSource.DataSource as List<HttLoadingResultEntity>;
  36. return list==null || !list.Any()?new HttLoadingResultEntity(): list.FirstOrDefault();
  37. }
  38. set
  39. {
  40. if (value == null)
  41. {
  42. httLoadingResultEntityBindingSource.DataSource = new List<HttLoadingResultEntity>()
  43. {
  44. new HttLoadingResultEntity()
  45. };
  46. }
  47. else
  48. {
  49. httLoadingResultEntityBindingSource.DataSource = new List<HttLoadingResultEntity>() {value.Clone()};
  50. if (ob == null || ob.MainUrl == "") return;
  51. if (_plineCode != Value.PlineCode)
  52. {
  53. Names = EntityHelper.GetData<HttSignatureEntity>(
  54. "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign",
  55. new object[] { Value.PlineCode, "2" }, 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 UserNameControl()
  84. {
  85. InitializeComponent();
  86. EntityHelper.ShowGridCaption<HttLoadingResultEntity>(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. this.ultraGrid1.UpdateData();
  113. }
  114. catch (Exception)
  115. {
  116. }
  117. }
  118. }
  119. }