frmInspector.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 Infragistics.Win.UltraWinGrid;
  10. using Core.Mes.Client.Comm.Server;
  11. using System.Collections;
  12. using CoreFS.CA06;
  13. using Core.Mes.Client.Comm.Control;
  14. namespace Core.StlMes.Client.ZGMil.Popup
  15. {
  16. public partial class frmInspector : Form
  17. {
  18. OpeBase ob = null;
  19. public frmInspector(OpeBase ob)
  20. {
  21. InitializeComponent();
  22. this.ob = ob;
  23. getMIL_BASE_INSPECTOR(ob);
  24. }
  25. //查询质检员信息
  26. public void getMIL_BASE_INSPECTOR(OpeBase ob)
  27. {
  28. DataTable dt =
  29. ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMIL_BASE_INSPECTOR", new object[] { }, ob);
  30. GridHelper.CopyDataToDatatable(ref dt, ref dt_Defect, true);
  31. ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand);
  32. }
  33. /// <summary>
  34. /// 删除
  35. /// </summary>
  36. /// <param name="sender"></param>
  37. /// <param name="e"></param>
  38. private void ultraBtn_delete_Click(object sender, EventArgs e)
  39. {
  40. UltraGridRow ulgr = ultraGrid1.ActiveRow;
  41. if (ulgr != null)
  42. {
  43. int retnum = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.DelMIL_BASE_INSPECTOR", new object[] { ulgr.Cells["INSPECTOR_CODE"].Value.ToString() }, this.ob);
  44. if (retnum > 0)
  45. {
  46. MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK);
  47. getMIL_BASE_INSPECTOR(this.ob);
  48. }
  49. }
  50. else
  51. {
  52. MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK);
  53. }
  54. }
  55. /// <summary>
  56. /// 增加
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. private void ultraBtn_add_Click(object sender, EventArgs e)
  61. {
  62. if (txtName.Text.Trim() == "")
  63. {
  64. MessageBox.Show("请输入一个有效的名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  65. return;
  66. }
  67. if (txtCode.Text.Trim() == "")
  68. {
  69. MessageBox.Show("请输入一个有效的代码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  70. return;
  71. }
  72. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  73. {
  74. if (ultraGrid1.Rows[i].Cells["INSPECTOR_CODE"].Value.ToString() == txtCode.Text)
  75. {
  76. MessageBox.Show("输入的产线代码已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  77. return;
  78. }
  79. }
  80. int retnum = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.AddMIL_BASE_INSPECTOR", new object[] { txtCode.Text, txtName.Text, ulCombShift.Value, ulCombGroup.Value, txtPlanCode.Text }, this.ob);
  81. if (retnum > 0)
  82. {
  83. MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK);
  84. getMIL_BASE_INSPECTOR(this.ob);
  85. }
  86. }
  87. /// <summary>
  88. /// 修改
  89. /// </summary>
  90. /// <param name="sender"></param>
  91. /// <param name="e"></param>
  92. private void ultrabtn_upd_Click(object sender, EventArgs e)
  93. {
  94. UltraGridRow ulgr = ultraGrid1.ActiveRow;
  95. if (ulgr == null)
  96. { MessageBox.Show("请选中一行数据进行更新", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }
  97. if (txtName.Text.Trim() == "")
  98. {
  99. MessageBox.Show("请输入一个有效的名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  100. return;
  101. }
  102. if (txtCode.Text.Trim() == "")
  103. {
  104. MessageBox.Show("请输入一个有效的代码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  105. return;
  106. }
  107. for (int i = 0; i < ultraGrid1.Rows.Count; i++)
  108. {
  109. if (ultraGrid1.Rows[i].Cells["INSPECTOR_CODE"].Value.ToString() == txtCode.Text && ultraGrid1.Rows[i] != ulgr)
  110. {
  111. MessageBox.Show("输入的产线代码已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  112. return;
  113. }
  114. }
  115. int retnum = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.UpdMIL_BASE_INSPECTOR", new object[] { txtCode.Text, txtName.Text, ulCombShift.Value, ulCombGroup.Value, txtPlanCode.Text, ulgr.Cells["INSPECTOR_CODE"].Value.ToString() }, this.ob);
  116. if (retnum > 0)
  117. {
  118. MessageBox.Show("更新成功", "提示", MessageBoxButtons.OK);
  119. getMIL_BASE_INSPECTOR(this.ob);
  120. }
  121. }
  122. /// <summary>
  123. /// 选中行激活事件
  124. /// </summary>
  125. /// <param name="sender"></param>
  126. /// <param name="e"></param>
  127. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  128. {
  129. UltraGridRow ugr = ultraGrid1.ActiveRow;
  130. txtCode.Text= ugr.Cells["INSPECTOR_CODE"].Value.ToString();
  131. txtName.Text= ugr.Cells["INSPECTOR_NAME"].Value.ToString();
  132. ulCombShift.Text = ugr.Cells["COL_SHIFT"].Value.ToString();
  133. ulCombGroup.Text = ugr.Cells["COL_GROUP"].Value.ToString();
  134. //txtPlanCode.Text = ugr.Cells["PLINE_CODE"].Value.ToString();
  135. }
  136. }
  137. }