FrmBundingResult.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. 
  2. using System;
  3. using System.Linq;
  4. using System.Windows.Forms;
  5. using com.steering.mes.mcp.entity;
  6. using Core.Mes.Client.Comm.Format;
  7. using Core.Mes.Client.Comm.Server;
  8. using Core.Mes.Client.Comm.Tool;
  9. using Core.StlMes.Client.Mcp.Control;
  10. using Core.StlMes.Client.Mcp.Control.Common;
  11. using Core.StlMes.Client.Mcp.Control.Entity;
  12. using Core.StlMes.Client.Mcp.Mch.MchResult;
  13. using CoreFS.CA06;
  14. using Infragistics.Win;
  15. using Infragistics.Win.UltraWinGrid;
  16. namespace Core.StlMes.Client.Mcp.Mch
  17. {
  18. public partial class FrmBundingResult : FrmMchBase
  19. {
  20. public FrmBundingResult()
  21. {
  22. InitializeComponent();
  23. mchControlBase1 = new BundingControl()
  24. {
  25. Dock = DockStyle.Fill
  26. };
  27. plnEdit.Controls.Add(mchControlBase1);
  28. }
  29. protected override UltraGridRow ActitveResultRow { get { return CrackDetectGrid.ActiveRow; } }
  30. protected override object Value { get { return (mchControlBase1 as BundingControl).Value; } }
  31. protected override void OnLoad(EventArgs e)
  32. {
  33. base.OnLoad(e);
  34. EntityHelper.ShowGridCaption<MchBundlingResultEntity>(CrackDetectGrid.DisplayLayout.Bands[0]);
  35. base.ultraGrid1.DisplayLayout.Bands[0].Columns["ActCount"].Hidden = true;
  36. base.ultraGrid1.DisplayLayout.Bands[0].Columns["ActWeight"].Hidden = true;
  37. base.ultraGrid1.DisplayLayout.Bands[0].Columns["BatchGroudNo"].Hidden = true;
  38. CrackDetectGrid.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
  39. CrackDetectGrid.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default;
  40. ultraOptionSet2.Visible = false;
  41. var dt1 = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmBundingType.query",
  42. new object[] { }, ob);
  43. (mchControlBase1 as BundingControl).uceBundingType.DataSource = dt1;
  44. (mchControlBase1 as BundingControl).uceBundingType.DisplayMember = "BASE_NAME";
  45. (mchControlBase1 as BundingControl).uceBundingType.ValueMember = "BASE_CODE";
  46. }
  47. protected override void DoAdd()
  48. {
  49. if (ActiveRow != null)
  50. {
  51. if (MessageUtil.ShowYesNoAndQuestion("是否增加打捆实绩?") == DialogResult.No)
  52. return;
  53. var ccp = new CoreClientParam();
  54. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmBundingResult";
  55. ccp.MethodName = "DoAdd";
  56. ccp.ServerParams = new object[]
  57. {
  58. JSONFormat.Format(Value),
  59. Gx,
  60. mchControlBase1.ScrappedList.Select(JSONFormat.Format).ToList(),
  61. mchControlBase1.SuspiciousList.Select(JSONFormat.Format).ToList()
  62. };
  63. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  64. if (ccp.ReturnCode != -1)
  65. {
  66. MessageUtil.ShowTips(ccp.ReturnInfo);
  67. if (ccp.ReturnInfo.Equals("新增成功!"))
  68. {
  69. Query();
  70. }
  71. }
  72. }
  73. }
  74. protected override void DoDelete()
  75. {
  76. {
  77. if (ActiveRow != null && ActitveResultRow != null)
  78. {
  79. if (MessageUtil.ShowYesNoAndQuestion("是否删除打捆实绩?") == DialogResult.No)
  80. return;
  81. var ccp = new CoreClientParam();
  82. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmBundingResult";
  83. ccp.MethodName = "DoDelete";
  84. ccp.ServerParams = new object[]
  85. {
  86. JSONFormat.Format(ActitveResultRow.ListObject), Gx
  87. };
  88. ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  89. if (ccp.ReturnCode != -1)
  90. {
  91. MessageUtil.ShowTips(ccp.ReturnInfo);
  92. if (ccp.ReturnInfo.Equals("删除成功!"))
  93. Query();
  94. }
  95. }
  96. }
  97. }
  98. protected override void GetResultData()
  99. {
  100. base.GetResultData();
  101. MchBundlingResultEntityBindingSource.DataSource = EntityHelper.GetData<MchBundlingResultEntity>(
  102. "com.steering.mes.mcp.Mch.FrmBundingResult.getQueryExpandResult",
  103. new object[] { ActiveRow.HeatPlanNo, ActiveRow.BatchNo },
  104. ob);
  105. commHelper.RefreshAndAutoSize(CrackDetectGrid);
  106. if (ActiveRow == null) return;
  107. var BundingControl = mchControlBase1 as BundingControl;
  108. if(BundingControl==null) return;
  109. var result = new MchBundlingResultEntity
  110. {
  111. HeatPlanNo = ActiveRow.HeatPlanNo,
  112. JudgeStoveNo = ActiveRow.JudgeStoveNo,
  113. BatchNo = ActiveRow.BatchNo,
  114. PlineCode = ActiveRow.PlineCode,
  115. PlineName = ActiveRow.PlineName,
  116. ProNum = BundingControl.OkPort.Count > (ActiveRow.OperateCount ?? 0) ? BundingControl.OkPort.Count - (ActiveRow.OperateCount ?? 0) : 0,
  117. FailNum = 0,
  118. FailWt = 0,
  119. ProShift = UserInfo.GetUserOrder(),
  120. ProGroup = UserInfo.GetUserGroup(),
  121. ProUser = UserInfo.GetUserName(),
  122. ProTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
  123. };
  124. if (result.ProNum <= 0)
  125. {
  126. int OffNum = GetReturnNum();
  127. result.ProNum = BundingControl.OkPort.Count - (ActiveRow.OperateCount ?? 0)+ result.ProNum + OffNum;
  128. if (result.ProNum < 0)
  129. {
  130. result.ProNum = 0;
  131. }
  132. }
  133. BundingControl.Value = result;
  134. }
  135. }
  136. }