FrmQASizeDetail.cs 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Infragistics.Win.UltraWinGrid;
  13. using Infragistics.Win;
  14. using com.steering.mes.zgmil.entity;
  15. using System.Collections;
  16. using Core.Mes.Client.Comm.Tool;
  17. using Core.StlMes.Client.ZGMil.Common;
  18. namespace Core.StlMes.Client.ZGMil.Popup
  19. {
  20. public partial class FrmQASizeDetail : FrmBase
  21. {
  22. private string _JudgeStoveNo = "";
  23. private string _LotNo = "";
  24. private string _ResultNo = "";
  25. private string _proPlanId = "";//轧管订单编号
  26. private string _gxPlanNo = "";//工序排产序号
  27. private string _PlineCode = "";
  28. private string Shift = "";
  29. private string Group = "";
  30. private string User = "";
  31. private DataTable _dtMatList = null;
  32. private OpeBase _ob = null;
  33. public FrmQASizeDetail(string JudgeStoveNo, string LotNo, string ResultNo, string proPlanId, string gxPlanNo, string PlineCode, OpeBase ob)
  34. {
  35. InitializeComponent();
  36. _JudgeStoveNo = JudgeStoveNo;
  37. _LotNo = LotNo;
  38. _ResultNo = ResultNo;
  39. _PlineCode = PlineCode;
  40. _proPlanId = proPlanId;
  41. _gxPlanNo = gxPlanNo;
  42. _ob = ob;
  43. ultraGrid3.ClickCellButton += new CellEventHandler(ultraGrid3_ClickCellButton); //添加缺陷项
  44. InitCol();
  45. if (!_PlineCode.Equals("C072"))
  46. {
  47. ultraGrid3.DisplayLayout.Bands[0].Columns["NON_ROUNDNESS"].Hidden = true;
  48. ultraGrid3.DisplayLayout.Bands[0].Columns["UNEVEN_DEGREE"].Hidden = true;
  49. }
  50. }
  51. /// <summary>
  52. /// 初始化控件
  53. /// </summary>
  54. private void InitCol()
  55. {
  56. txtHeatNo.Text = BaseMethod.getJudgeStoveNo(_JudgeStoveNo);
  57. txtLotNo.Text = _LotNo;
  58. //查询几何尺寸抽检
  59. SizeCheckQuery();
  60. GetCheckMatList();
  61. }
  62. /// <summary>
  63. /// 查询抽检管记录
  64. /// </summary>
  65. /// <param name="JudgeStoveNo"></param>
  66. private void SizeCheckQuery()
  67. {
  68. DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.sizeCheckQuery", new object[] { BaseMethod.getJudgeStoveNo(_JudgeStoveNo), _ResultNo, _proPlanId, _gxPlanNo }, this._ob);
  69. GridHelper.CopyDataToDatatable(ref dt, ref dtPipeSize, true);
  70. Infragistics.Win.ValueList valueList = new Infragistics.Win.ValueList();
  71. valueList.ValueListItems.Add("0", "管端");
  72. valueList.ValueListItems.Add("1", "管体");
  73. ultraGrid3.DisplayLayout.Bands[0].Columns["LOCATION"].ValueList = valueList;
  74. }
  75. /// <summary>
  76. /// 确认
  77. /// </summary>
  78. /// <param name="sender"></param>
  79. /// <param name="e"></param>
  80. private void btnOK_Click(object sender, EventArgs e)
  81. {
  82. this.ultraGrid3.UpdateData();
  83. //1、删除现有尺寸抽查记录
  84. //2、添加新的尺寸抽查记录
  85. ArrayList ListCehckSize = new ArrayList();
  86. for (int i = 0; i < ultraGrid3.Rows.Count; i++)
  87. {
  88. MilSizeCheckDeatilEntity CheckSizeEntity = new MilSizeCheckDeatilEntity();
  89. CheckSizeEntity.ResultNo = _ResultNo;
  90. CheckSizeEntity.SamplePipeSeq = ultraGrid3.Rows[i].Cells["SAMPLE_PIPE_SEQ"].Value.ToString();
  91. if (i+1 > _dtMatList.Rows.Count)
  92. {
  93. CheckSizeEntity.SamplePipeNo = "";
  94. }
  95. else
  96. {
  97. CheckSizeEntity.SamplePipeNo = _dtMatList.Rows[i]["MAT_NO"].ToString();
  98. }
  99. CheckSizeEntity.JudgeStoveNo = _JudgeStoveNo;
  100. CheckSizeEntity.D1 = ultraGrid3.Rows[i].Cells["D1"].Value.ToString();
  101. CheckSizeEntity.D2 = ultraGrid3.Rows[i].Cells["D2"].Value.ToString();
  102. CheckSizeEntity.S1 = ultraGrid3.Rows[i].Cells["S1"].Value.ToString();
  103. CheckSizeEntity.S2 = ultraGrid3.Rows[i].Cells["S2"].Value.ToString();
  104. CheckSizeEntity.S3 = ultraGrid3.Rows[i].Cells["S3"].Value.ToString();
  105. CheckSizeEntity.S4 = ultraGrid3.Rows[i].Cells["S4"].Value.ToString();
  106. CheckSizeEntity.NonRoundness = ultraGrid3.Rows[i].Cells["NON_ROUNDNESS"].Value.ToString();
  107. CheckSizeEntity.UnevenDegree = ultraGrid3.Rows[i].Cells["UNEVEN_DEGREE"].Value.ToString();
  108. string Location = ultraGrid3.Rows[i].Cells["LOCATION"].Value.ToString();
  109. //if (Location == "管端")
  110. //{
  111. // Location = "0";
  112. //}
  113. //else
  114. //{
  115. // Location = "1";
  116. //}
  117. CheckSizeEntity.Location = Location;
  118. CheckSizeEntity.ProPlanId = _proPlanId;
  119. CheckSizeEntity.GxPlanNo = _gxPlanNo;
  120. ListCehckSize.Add(CheckSizeEntity);
  121. }
  122. int count2 = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.insertMatSize", new object[] { ListCehckSize,_JudgeStoveNo,_ResultNo,_proPlanId,_gxPlanNo }, this._ob);
  123. if (count2 > 0)
  124. {
  125. //CoreClientParam ccp = new CoreClientParam();
  126. //ccp.ServerName = "com.steering.mes.zgmil.coup.SurfaceInspectionResult";
  127. //ccp.MethodName = "updateActWgt";
  128. //ccp.ServerParams = new object[] { _JudgeStoveNo.Substring(0,6) };
  129. //ccp = _ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  130. //if (ccp.ReturnCode != -1)
  131. //{
  132. // if (ccp.ReturnInfo.Equals("确认成功!"))
  133. // {
  134. // this.DialogResult = System.Windows.Forms.DialogResult.OK;
  135. // }
  136. // else
  137. // {
  138. // MessageUtil.ShowTips(ccp.ReturnInfo);
  139. // }
  140. //}
  141. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  142. }
  143. this.Close();
  144. }
  145. /// <summary>
  146. /// 查询抽检管管号队列信息
  147. /// </summary>
  148. private void GetCheckMatList()
  149. {
  150. DataTable dtMatList = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.checkMatNoQuery", new object[] { _JudgeStoveNo, _ResultNo, _proPlanId, _gxPlanNo }, this._ob);
  151. _dtMatList = dtMatList;
  152. if (_dtMatList.Rows.Count == 0)
  153. {
  154. MessageUtil.ShowTips("无管号队列信息,请联系系统管理员!");
  155. return;
  156. }
  157. }
  158. /// <summary>
  159. /// 取消
  160. /// </summary>
  161. /// <param name="sender"></param>
  162. /// <param name="e"></param>
  163. private void btnCancel_Click(object sender, EventArgs e)
  164. {
  165. this.Close();
  166. }
  167. /// <summary>
  168. /// 新增尺寸行记录时
  169. /// </summary>
  170. /// <param name="sender"></param>
  171. /// <param name="e"></param>
  172. private void ultraGrid3_AfterRowInsert(object sender, RowEventArgs e)
  173. {
  174. //if (ultraGrid3.Rows.Count > _dtMatList.Rows.Count)
  175. //{
  176. // MessageBox.Show("超过可抽检管支数,不能新增!!!");
  177. // return;
  178. //}
  179. e.Row.Cells["SAMPLE_PIPE_SEQ"].Value = dtPipeSize.Rows.Count +1;
  180. }
  181. //删除尺寸行记录
  182. void ultraGrid3_ClickCellButton(object sender, CellEventArgs e)
  183. {
  184. if (e.Cell.Column.Key == "BTN_DELETE")
  185. {
  186. for (int i = 0; i < dtPipeSize.Rows.Count; i++)
  187. {
  188. ultraGrid3.Rows[i].Cells["SAMPLE_PIPE_SEQ"].Value = i + 1;
  189. if (dtPipeSize.Rows[i]["SAMPLE_PIPE_SEQ"].ToString() == e.Cell.Row.Cells["SAMPLE_PIPE_SEQ"].Value.ToString())
  190. {
  191. dtPipeSize.Rows.RemoveAt(i);
  192. break;
  193. }
  194. }
  195. for (int i = 0; i < dtPipeSize.Rows.Count; i++)
  196. {
  197. ultraGrid3.Rows[i].Cells["SAMPLE_PIPE_SEQ"].Value = i + 1;
  198. }
  199. ultraGrid3.DataBind();
  200. }
  201. }
  202. /// <summary>
  203. /// 复制整行记录 (可编辑列)
  204. /// </summary>
  205. /// <param name="sender"></param>
  206. /// <param name="e"></param>
  207. private void ultraGrid3_KeyDown(object sender, KeyEventArgs e)
  208. {
  209. ultraGrid3.DisplayLayout.Bands[0].Override.AllowMultiCellOperations = AllowMultiCellOperation.Copy | AllowMultiCellOperation.Paste;
  210. if (e.Control && e.KeyCode == Keys.C)
  211. {
  212. ultraGrid3.PerformAction(UltraGridAction.Copy);
  213. }
  214. else if (e.Control && e.KeyCode == Keys.V)
  215. {
  216. ultraGrid3.PerformAction(UltraGridAction.Paste);
  217. }
  218. }
  219. private void ultraGrid3_Error(object sender, ErrorEventArgs e)
  220. {
  221. e.Cancel = true;
  222. }
  223. }
  224. }