DriftDiameterControl.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. 
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using com.steering.mes.mcp.entity;
  6. using Core.Mes.Client.Comm.Tool;
  7. using Core.StlMes.Client.Mcp.Control.Entity;
  8. using Core.StlMes.Client.Mcp.Control.Machining;
  9. using Infragistics.Win.UltraWinGrid;
  10. namespace Core.StlMes.Client.Mcp.Control
  11. {
  12. public partial class DriftDiameterControl : MchControlBase
  13. {
  14. public DriftDiameterControl()
  15. {
  16. InitializeComponent();
  17. EntityHelper.ShowGridCaption<MchPathResultEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  18. Detail = new List<MchPathResultDEntity>();
  19. gx = "701307";
  20. Value = null;
  21. }
  22. public List<MchPathResultDEntity> Detail { get; set; }
  23. protected override string ScrapCode { get { return "701507"; } }
  24. public MchPathResultEntity Value
  25. {
  26. get
  27. {
  28. var list =
  29. mchPathResultEntityBindingSource.DataSource as List<MchPathResultEntity>;
  30. return (list == null) || !list.Any() ? new MchPathResultEntity() : list.FirstOrDefault();
  31. }
  32. set
  33. {
  34. if (value == null)
  35. {
  36. mchPathResultEntityBindingSource.DataSource = new List<MchPathResultEntity>
  37. {
  38. new MchPathResultEntity()
  39. };
  40. ScrappedList = new List<MchBugDEntity>();
  41. Detail = new List<MchPathResultDEntity>();
  42. }
  43. else
  44. {
  45. value.ProWt = comm.GetWeight(PortHttBatchSampleResultEntitys, gx, (int)(value.ProNum ?? 0),
  46. (int)(PlnZyJgxCEntity.ProCount ?? 0));
  47. value.QualifiedWt = comm.GetWeight(PortHttBatchSampleResultEntitys, gx, (int)(value.QualifiedNum ?? 0),
  48. (int)(PlnZyJgxCEntity.ProCount ?? 0));
  49. value.FinalQualifiedWt = comm.GetWeight(PortHttBatchSampleResultEntitys, gx, (int)(value.FinalQualifiedNum ?? 0),
  50. (int)(PlnZyJgxCEntity.ProCount ?? 0));
  51. mchPathResultEntityBindingSource.DataSource = new List<MchPathResultEntity> { value.Clone() };
  52. if (_plineCode != Value.PlineCode)
  53. {
  54. Names = EntityHelper.GetData<HttSignatureEntity>(
  55. "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign",
  56. new object[] { Value.PlineCode, "6" }, Ob);
  57. name.DisplayMember = "UserName";
  58. name.ValueMember = "UserName";
  59. YdmBaseClass.SetComboItemHeight(name);
  60. _plineCode = Value.PlineCode;
  61. }
  62. name.DataSource = Names.Where(p => p.ColGroup == value.ProGroup).ToList();
  63. if (value.TestRecord == null || value.TestRecord == 0)
  64. Detail = new List<MchPathResultDEntity>();
  65. if (value.FailNum == 0)
  66. ScrappedList = new List<MchBugDEntity>();
  67. // ultraGrid1.DisplayLayout.Bands[0].Columns["ProNum"].MaxValue = value.ProNum;
  68. }
  69. }
  70. }
  71. protected override void EditScrapped()
  72. {
  73. Value.FailNum = ScrappedList.Sum(p => p.FailNum);
  74. Value.FailWt = ScrappedList.Sum(p => p.FailWt);
  75. ultraGrid1.Refresh();
  76. }
  77. private void TestRecord_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  78. {
  79. if (PlnZyJgxCEntity==null) return;
  80. if (PlnZyJgxCEntity.HeatPlanNo == null)
  81. return;
  82. if (PlnZyJgxCEntity.PlineCode == null)
  83. return;
  84. var matfrm = new TestRecord(Detail);
  85. matfrm.ShowDialog();
  86. if (matfrm.DialogResult == DialogResult.OK)
  87. {
  88. Detail = matfrm.Detail;
  89. Value.TestRecord = Detail.Count();
  90. }
  91. ultraGrid1.PerformAction(UltraGridAction.ExitEditMode);
  92. ultraGrid1.UpdateData();
  93. }
  94. }
  95. }