FrmMesureData.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Drawing;
  5. using System.Linq;
  6. using System.Windows.Forms;
  7. using Core.Mes.Client.Comm;
  8. using Core.Mes.Client.Comm.Control;
  9. using Core.Mes.Client.Comm.Server;
  10. using Core.Mes.Client.Comm.Tool;
  11. using Core.StlMes.Client.Mcp.Control;
  12. using Core.StlMes.Client.Mcp.Control.Common;
  13. using Core.StlMes.Client.Mcp.Control.Entity;
  14. using Core.StlMes.Client.Mcp.Control.Machining;
  15. using CoreFS.CA06;
  16. using Infragistics.Win.UltraWinEditors;
  17. using Infragistics.Win.UltraWinGrid;
  18. using System.Threading;
  19. using com.steering.mes.mcp.entity;
  20. using Infragistics.Win;
  21. using Core.StlMes.Client.Mcp.Mch.Entity;
  22. using Core.Mes.Client.Comm.Format;
  23. using System.Collections;
  24. namespace Core.StlMes.Client.Mcp.Mch
  25. {
  26. public partial class FrmMesureData : FrmBase
  27. {
  28. public FrmMesureData()
  29. {
  30. InitializeComponent();
  31. }
  32. private string _judgeStove = "";
  33. List<String> _ls = new List<String>();
  34. private string _batchNo = "";
  35. public List<RtdMeasurePosdataEntityZJ> list = new List<RtdMeasurePosdataEntityZJ>();
  36. protected override void OnLoad(EventArgs e)
  37. {
  38. base.OnLoad(e);
  39. EntityHelper.ShowGridCaption<RtdMeasurePosdataEntityZJ>(ugData.DisplayLayout.Bands[0]);
  40. ugData.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.False;
  41. ugData.DisplayLayout.Override.HeaderClickAction = HeaderClickAction.Default;
  42. EntityHelper.ShowGridCaption<RtdMeasurePosdataEntityZJ>(ugData.DisplayLayout.Bands[0]);
  43. }
  44. public FrmMesureData(string judgeStoveNo, string batcjNo ,OpeBase _ob, string userName, bool ShowAdd, List<String> ls)
  45. {
  46. // _jgxPlan = JgxPlan;
  47. _judgeStove = judgeStoveNo;
  48. _batchNo = batcjNo;
  49. this.ob = _ob;
  50. _ls = ls;
  51. InitializeComponent();
  52. Query();
  53. }
  54. private void Query() {
  55. list = EntityHelper.GetData<RtdMeasurePosdataEntityZJ>(
  56. "com.steering.mes.mcp.Mch.FrmZjResult.geRtdMeasurePosdataAll",
  57. new object[] { _judgeStove, _batchNo},
  58. ob);
  59. for (int i = 0; i < list.Count; i++ )
  60. {
  61. for (int k = 0; k < _ls.Count; k++)
  62. {
  63. if (_ls[k].Equals(list[i].MatNo))
  64. {
  65. list[i].Check = true;
  66. }
  67. }
  68. }
  69. rtdMeasurePosdataEntityBindingSource.DataSource = list;
  70. var WasteList = list.Where(p => p.Flag == "10").ToList();
  71. string message = "共" + list.Where(p => p.Flag == "00").Select(p => p.MatNo).Distinct().Count() + "支";
  72. string messageW = " ";
  73. if (WasteList.Any())
  74. messageW = " 已剔除" + WasteList.Count + "条";
  75. ugData.DisplayLayout.Bands[0].Summaries[0].DisplayFormat = message;
  76. ugData.DisplayLayout.Bands[0].Summaries[1].DisplayFormat =
  77. list.Where(p => p.Flag == "00" && p.Rk == "1").Sum(p => p.ActLen).ToString3();
  78. ugData.DisplayLayout.Bands[0].Summaries[2].DisplayFormat =
  79. list.Where(p => p.Flag == "00" && p.Rk == "1").Sum(p => p.ActWeight).ToString3();
  80. ugData.DisplayLayout.Bands[0].Summaries["Waste"].DisplayFormat = messageW;
  81. }
  82. private void isCheked_Click(object sender, EventArgs e)
  83. {
  84. List<RtdMeasurePosdataEntityZJ> list = rtdMeasurePosdataEntityBindingSource.DataSource as List<RtdMeasurePosdataEntityZJ>;
  85. if (list == null) return;
  86. list = list.Where(p => p.Check).ToList();
  87. if (!list.Any()) { MessageUtil.ShowTips("请勾选要保存的数据!"); return; }
  88. if (MessageUtil.ShowYesNoAndQuestion("是否要保存?") == DialogResult.No)
  89. return;
  90. CoreClientParam ccp = new CoreClientParam();
  91. try
  92. {
  93. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult";
  94. ccp.MethodName = "addZjc";
  95. ccp.ServerParams = new Object[] { list.Select(JSONFormat.Format).ToList() };
  96. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  97. }
  98. catch (Exception ex)
  99. {
  100. this.Cursor = Cursors.Default;
  101. Constant.WaitingForm.ShowToUser = false;
  102. Constant.WaitingForm.Close();
  103. Constant.WaitingForm = null;
  104. }
  105. if (ccp.ReturnCode != -1)
  106. {
  107. // MessageUtil.ShowTips(ccp.ReturnInfo);
  108. // query();
  109. this.Close();
  110. }
  111. }
  112. private void ultraButton1_Click(object sender, EventArgs e)
  113. {
  114. List<RtdMeasurePosdataEntityZJ> list = rtdMeasurePosdataEntityBindingSource.DataSource as List<RtdMeasurePosdataEntityZJ>;
  115. if (list == null) return;
  116. list = list.Where(p => p.Check).ToList();
  117. if (!list.Any()) { MessageUtil.ShowTips("请勾选要保存的数据!"); return; }
  118. if (MessageUtil.ShowYesNoAndQuestion("是否要取消?") == DialogResult.No)
  119. return;
  120. CoreClientParam ccp = new CoreClientParam();
  121. try
  122. {
  123. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmZjResult";
  124. ccp.MethodName = "DZjc";
  125. ccp.ServerParams = new Object[] { list.Select(JSONFormat.Format).ToList() };
  126. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  127. }
  128. catch (Exception ex)
  129. {
  130. this.Cursor = Cursors.Default;
  131. Constant.WaitingForm.ShowToUser = false;
  132. Constant.WaitingForm.Close();
  133. Constant.WaitingForm = null;
  134. }
  135. this.Close();
  136. }
  137. }
  138. }