MchCutControl.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. 
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using com.steering.mes.mcp.entity;
  5. using Core.Mes.Client.Comm.Tool;
  6. using Core.StlMes.Client.Mcp.Control.Entity;
  7. using Core.StlMes.Client.Mcp.Control.Machining;
  8. namespace Core.StlMes.Client.Mcp.Control
  9. {
  10. public partial class MchCutControl : MchControlBase
  11. {
  12. public MchCutControl()
  13. {
  14. InitializeComponent();
  15. EntityHelper.ShowGridCaption<MchCutResultEntity>(ultraGrid1.DisplayLayout.Bands[0]);
  16. gx = "701303";
  17. Value = null;
  18. }
  19. protected override string ScrapCode { get { return "701503"; } }
  20. public MchCutResultEntity Value
  21. {
  22. get
  23. {
  24. var list =
  25. mchCutResultEntityBindingSource.DataSource as List<MchCutResultEntity>;
  26. return (list == null) || !list.Any() ? new MchCutResultEntity() : list.FirstOrDefault();
  27. }
  28. set
  29. {
  30. if (value == null)
  31. {
  32. mchCutResultEntityBindingSource.DataSource = new List<MchCutResultEntity>
  33. {
  34. new MchCutResultEntity()
  35. };
  36. ScrappedList = new List<MchBugDEntity>();
  37. }
  38. else
  39. {
  40. value.ProWt = comm.GetWeight(PortHttBatchSampleResultEntitys, gx, (int)(value.ProNum ?? 0),
  41. (int)(PlnZyJgxCEntity.ProCount ?? 0));
  42. mchCutResultEntityBindingSource.DataSource = new List<MchCutResultEntity> { value.Clone() };
  43. if (_plineCode != Value.PlineCode)
  44. {
  45. Names = EntityHelper.GetData<HttSignatureEntity>(
  46. "com.steering.mes.mcp.heatTreatment.FrmHttCrackDetectResult.getHttSign",
  47. new object[] { Value.PlineCode, "2" }, Ob);
  48. name.DataSource = Names.Where(p => p.ColGroup == value.ProGroup).ToList();
  49. name.DisplayMember = "UserName";
  50. name.ValueMember = "UserName";
  51. YdmBaseClass.SetComboItemHeight(name);
  52. _plineCode = Value.PlineCode;
  53. }
  54. if (value.FailNum == 0)
  55. ScrappedList = new List<MchBugDEntity>();
  56. }
  57. }
  58. }
  59. protected override void EditScrapped()
  60. {
  61. Value.FailNum = ScrappedList.Sum(p => p.FailNum);
  62. Value.FailWt = ScrappedList.Sum(p => p.FailWt);
  63. ultraGrid1.Refresh();
  64. }
  65. }
  66. }