FrmUtReport.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. using System.Collections.Generic;
  2. using com.steering.mes.mcp.entity;
  3. using Core.Mes.Client.Comm.Tool;
  4. using Core.StlMes.Client.Mcp.Control.Entity;
  5. using Infragistics.Win.UltraWinGrid;
  6. using Core.StlMes.Client.Mcp.Control.Common;
  7. using System.Windows.Forms;
  8. using CoreFS.CA06;
  9. using System.Linq;
  10. using System;
  11. using System.Drawing;
  12. using Core.Mes.Client.Comm.Server;
  13. namespace Core.StlMes.Client.Mcp.Mch.Report
  14. {
  15. public partial class FrmUtReport : FrmReportBase
  16. {
  17. public FrmUtReport()
  18. {
  19. NeedCheck = true;
  20. InitializeComponent();
  21. }
  22. protected override void LoadView()
  23. {
  24. DataBindingSource.DataSource = typeof(HttCrackDetectionEtEntityPlus);
  25. EntityHelper.ShowGridCaption<HttCrackDetectionEtEntityPlus>(CrackDetectGrid.DisplayLayout.Bands[0]);
  26. ProductionInfo = new List<string> { "ReportNo", "MachineNo", "TestingNum", "TestingWt", "ManualFtestingNum", "FinalNum", "RejectNum", "EwasteReason" };
  27. ResultNoPara = new List<string> { "TestingType", "TestingGrade", "WallThickness", "TestingStandard", "NotchLength", "NotchWidth", "NotchDepth", "Memo" };
  28. SumList = new List<string> { "TestingNum", "TestingWt", "ManualFtestingNum", "FinalNum", "RejectNum", "EwasteWt" };
  29. }
  30. protected override void ResetColumns(UltraGridColumn Columns)
  31. {
  32. base.ResetColumns(Columns);
  33. if (Columns.Key == "TestingPosition")
  34. Columns.EditorComponent = ucePosition;
  35. if (Columns.Key == "ReportNo")
  36. Columns.EditorComponent = uceReportNo;
  37. }
  38. protected override void QuerySinglePlan()
  39. {
  40. DataBindingSource.DataSource = EntityHelper.GetData<HttCrackDetectionEtEntityPlus>(
  41. "com.steering.mes.mcp.Mch.FrmJgxReport.doQueryUtResult",
  42. GetQueryCondition(),
  43. ob);
  44. var dt =
  45. ServerHelper.GetData(
  46. "com.steering.mes.mcp.Mch.FrmJgxReport.getHttEntrustInfo",
  47. new object[] {}, ob);
  48. List<string> lst = new List<string>();
  49. for (int i = 0; i < dt.Rows.Count; i++)
  50. {
  51. if (dt.Rows[i][0].ToString().Length > 6)
  52. {
  53. if( dt.Rows[i][0].ToString().Contains("-"))
  54. {
  55. string[] sArray = dt.Rows[i][0].ToString().Split('-');
  56. lst.Add(sArray[0]);
  57. }
  58. }
  59. else
  60. {
  61. // string[] sArray = s.Split('a')
  62. lst.Add(dt.Rows[i][0].ToString());
  63. }
  64. }
  65. if ((lst != null) && lst.Any())
  66. foreach (
  67. var ultraGridRow in
  68. CrackDetectGrid.Rows.Where(
  69. p => lst.Any(q => q == p.Cells["judgeStoveNo"].Value.ToString2())))
  70. ultraGridRow.Appearance.BackColor = Color.Red;
  71. }
  72. protected override void DoUpdate()
  73. {
  74. if (CrackDetectGrid.ActiveRow == null)
  75. {
  76. MessageBox.Show("请选择需求修改的实绩!");
  77. return;
  78. }
  79. HttCrackDetectionEtEntityPlus entity = CrackDetectGrid.ActiveRow.ListObject as HttCrackDetectionEtEntityPlus;
  80. using (CommonCrackParaUpdate CommonCrackParaUpdate = new CommonCrackParaUpdate(entity.ResultNo, ob))
  81. {
  82. if (CommonCrackParaUpdate.ShowDialog() == DialogResult.OK)
  83. {
  84. Query();
  85. }
  86. }
  87. // ConfrmFrim();
  88. // sendFrim();
  89. }
  90. protected override void Send()
  91. {
  92. SendFrim();
  93. }
  94. protected override void Confirm()
  95. {
  96. ConfrmFrim();
  97. //foreach (UltraGridRow p in CrackDetectGrid.Rows)
  98. //{
  99. // p.Appearance.BackColor = Color.Red;
  100. // // p.ultraGridRow.Cells["RecordDate"].Appearance.BackColor = Color.Red;
  101. //}
  102. }
  103. private void ConfrmFrim()
  104. {
  105. List<string> Lst = new List<string>();
  106. IQueryable<UltraGridRow> checkMagRows = this.CrackDetectGrid.Rows.AsQueryable().Where(" Chk = 'True'");
  107. if (checkMagRows.Count() > 0)
  108. {
  109. foreach (UltraGridRow p in checkMagRows)//Chk
  110. {
  111. HttCrackDetectionEtEntityPlus entity = p.ListObject as HttCrackDetectionEtEntityPlus;
  112. if (entity.FrimFlag == "已审核")
  113. {
  114. Lst.Add(entity.ResultNo.ToString());
  115. }
  116. else
  117. {
  118. MessageBox.Show("您的选择项有不是已审核的状态!", "提示!", MessageBoxButtons.OK);
  119. }
  120. }
  121. if (Lst.Count > 0)
  122. {
  123. CoreClientParam ccp = new CoreClientParam();
  124. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmJgxReport";
  125. ccp.MethodName = "doConfirmFrimResult";
  126. ccp.ServerParams = new object[] { Lst };
  127. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  128. if (ccp.ReturnCode != -1)
  129. {
  130. if (ccp.ReturnInfo.Equals("批准成功!"))
  131. {
  132. MessageUtil.ShowTips(ccp.ReturnInfo);
  133. }
  134. else
  135. {
  136. MessageUtil.ShowTips(ccp.ReturnInfo);
  137. }
  138. }
  139. Query();
  140. }
  141. }
  142. }
  143. private void SendFrim()
  144. {
  145. List<string> Lst = new List<string>();
  146. IQueryable<UltraGridRow> checkMagRows = this.CrackDetectGrid.Rows.AsQueryable().Where(" Chk = 'True'");
  147. if (checkMagRows.Count() > 0)
  148. {
  149. foreach (UltraGridRow p in checkMagRows)//Chk
  150. {
  151. HttCrackDetectionEtEntityPlus entity = p.ListObject as HttCrackDetectionEtEntityPlus;
  152. if (entity.FrimFlag == "未审核")
  153. {
  154. Lst.Add(entity.ResultNo.ToString());
  155. }
  156. else
  157. {
  158. MessageBox.Show("您的选择项有不是未审核的状态!", "提示!");
  159. }
  160. }
  161. if (Lst.Count > 0)
  162. {
  163. CoreClientParam ccp = new CoreClientParam();
  164. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmJgxReport";
  165. ccp.MethodName = "doSendFrimResult";
  166. ccp.ServerParams = new object[] { Lst };
  167. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  168. if (ccp.ReturnCode != -1)
  169. {
  170. if (ccp.ReturnInfo.Equals("审核成功!"))
  171. {
  172. MessageUtil.ShowTips(ccp.ReturnInfo);
  173. }
  174. else
  175. {
  176. MessageUtil.ShowTips(ccp.ReturnInfo);
  177. }
  178. }
  179. Query();
  180. }
  181. }
  182. }
  183. }
  184. }