FrmReason.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using Core.Mes.Client.Comm.Control;
  11. using Core.Mes.Client.Comm.Tool;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Core.StlMes.Client.Mcp.Mch.Entity;
  14. using com.steering.mes.mcp.entity;
  15. using Core.Mes.Client.Comm.Server;
  16. using Core.StlMes.Client.Mcp.Control;
  17. namespace Core.StlMes.Client.Mcp.Mch.MchResult
  18. {
  19. public partial class FrmReason : FrmBase
  20. {
  21. UltraGridRow uge = null;
  22. string gx = "";
  23. public FrmReason()
  24. {
  25. InitializeComponent();
  26. }
  27. public FrmReason(OpeBase ob, UltraGridRow ugr,string GX)
  28. {
  29. InitializeComponent();
  30. this.ob = ob;
  31. uge = ugr;
  32. gx = GX;
  33. }
  34. /// <summary>
  35. /// 查询废品原因
  36. /// </summary>
  37. /// <param name="configureMEntity"></param>
  38. public void Query()
  39. {
  40. string startTim = "";
  41. string endTim = "";
  42. string heatid = "";
  43. string judgeno = "";
  44. if (chkTim.Checked)
  45. {
  46. if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
  47. {
  48. MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
  49. return;
  50. }
  51. else
  52. {
  53. startTim = this.StartTime.Value.ToString("yyyy-MM-dd 00:00:00");
  54. endTim = this.EndTime.Value.ToString("yyyy-MM-dd 23:59:59");
  55. }
  56. }
  57. if (!string.IsNullOrEmpty(planid.Text.Trim()))
  58. {
  59. heatid = planid.Text.ToString().Trim();
  60. }
  61. if(!string.IsNullOrEmpty(judgeNo.Text.Trim()))
  62. {
  63. judgeno = judgeNo.Text.ToString().Trim();
  64. }
  65. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmReason.doQuery", new object[] { startTim,endTim,heatid,judgeno }, this.ob);
  66. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  67. if(dt.Rows.Count<=0)
  68. {
  69. dataTable2.Clear();
  70. }
  71. }
  72. private void FrmReason_Load(object sender, EventArgs e)
  73. {
  74. if (uge == null)
  75. {
  76. return;
  77. }
  78. else
  79. {
  80. init();
  81. }
  82. }
  83. //界面初始化
  84. private void init()
  85. {
  86. try
  87. {
  88. this.Cursor = Cursors.WaitCursor;
  89. String heatplanno = uge.Cells["HEAT_PLAN_NO"].Value.ToString();
  90. String lotno = uge.Cells["BATCH_NO"].Value.ToString();
  91. String plinename = uge.Cells["PLINE_NAME"].Value.ToString();
  92. }
  93. catch (Exception ex)
  94. {
  95. MessageUtil.ShowTips("加载数据失败:" + ex.Message);
  96. }
  97. finally
  98. {
  99. this.Cursor = Cursors.Default;
  100. }
  101. }
  102. ///// <summary>
  103. ///// 删除废品原因
  104. ///// </summary>
  105. ///// <param name="configureMEntity"></param>
  106. public void Delete()
  107. {
  108. if (ultraGrid1.ActiveRow != null)
  109. {
  110. UltraGridRow urg = ultraGrid1.ActiveRow;
  111. if (urg != null)
  112. {
  113. CoreClientParam ccp = new CoreClientParam();
  114. ccp.ServerName = "com.steering.mes.mcp.Mch.FrmReason";
  115. ccp.MethodName = "deletePerson";
  116. ccp.ServerParams = new Object[] { urg.Cells["FAIL_REASON"].Value.ToString() };
  117. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  118. if (ccp.ReturnCode != -1)
  119. {
  120. MessageUtil.ShowTips(ccp.ReturnInfo);
  121. if (ccp.ReturnInfo.Equals("删除成功!"))
  122. {
  123. Query();
  124. }
  125. }
  126. }
  127. else
  128. {
  129. MessageUtil.ShowTips("请选择一条数据");
  130. return;
  131. }
  132. }
  133. }
  134. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  135. {
  136. switch (e.Tool.Key.ToString())
  137. {
  138. case "Query":
  139. Query();
  140. break;
  141. //case "Add":
  142. // Add();
  143. // break;
  144. //case "Delete":
  145. // Delete();
  146. // break;
  147. case "Close":
  148. this.Close();
  149. break;
  150. }
  151. }
  152. private void ultraGrid4_AfterRowActivate(object sender, EventArgs e)
  153. {
  154. string heatno = "";
  155. UltraGridRow urg = ultraGrid4.ActiveRow;
  156. if(urg!=null)
  157. {
  158. heatno = urg.Cells["HEAT_PLAN_NO"].Value.ToString();
  159. DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmReason.queryfail", new object[] { heatno }, this.ob);
  160. GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
  161. foreach(UltraGridRow row in ultraGrid2.Rows)
  162. {
  163. if(row.Cells["FAIL_SORT"].Text.ToString()=="绝废")
  164. {
  165. row.Cells["FAIL_SORT"].Appearance.BackColor = Color.Red;
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }