using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Infragistics.Win.UltraWinGrid; using Core.Mes.Client.Comm.Server; using System.Collections; using CoreFS.CA06; using Core.Mes.Client.Comm.Control; namespace Core.StlMes.Client.ZGMil.Popup { public partial class frmInspector : Form { OpeBase ob = null; public frmInspector(OpeBase ob) { InitializeComponent(); this.ob = ob; getMIL_BASE_INSPECTOR(ob); } //查询质检员信息 public void getMIL_BASE_INSPECTOR(OpeBase ob) { DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.getMIL_BASE_INSPECTOR", new object[] { }, ob); GridHelper.CopyDataToDatatable(ref dt, ref dt_Defect, true); ultraGrid1.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.AllRowsInBand); } /// /// 删除 /// /// /// private void ultraBtn_delete_Click(object sender, EventArgs e) { UltraGridRow ulgr = ultraGrid1.ActiveRow; if (ulgr != null) { int retnum = ServerHelper.SetData("com.steering.mes.zgmil.coup.SurfaceInspectionResult.DelMIL_BASE_INSPECTOR", new object[] { ulgr.Cells["INSPECTOR_CODE"].Value.ToString() }, this.ob); if (retnum > 0) { MessageBox.Show("删除成功", "提示", MessageBoxButtons.OK); getMIL_BASE_INSPECTOR(this.ob); } } else { MessageBox.Show("请选择要删除的行!", "提示", MessageBoxButtons.OK); } } /// /// 增加 /// /// /// private void ultraBtn_add_Click(object sender, EventArgs e) { if (txtName.Text.Trim() == "") { MessageBox.Show("请输入一个有效的名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtCode.Text.Trim() == "") { MessageBox.Show("请输入一个有效的代码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (int i = 0; i < ultraGrid1.Rows.Count; i++) { if (ultraGrid1.Rows[i].Cells["INSPECTOR_CODE"].Value.ToString() == txtCode.Text) { MessageBox.Show("输入的产线代码已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } 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); if (retnum > 0) { MessageBox.Show("添加成功", "提示", MessageBoxButtons.OK); getMIL_BASE_INSPECTOR(this.ob); } } /// /// 修改 /// /// /// private void ultrabtn_upd_Click(object sender, EventArgs e) { UltraGridRow ulgr = ultraGrid1.ActiveRow; if (ulgr == null) { MessageBox.Show("请选中一行数据进行更新", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtName.Text.Trim() == "") { MessageBox.Show("请输入一个有效的名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (txtCode.Text.Trim() == "") { MessageBox.Show("请输入一个有效的代码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (int i = 0; i < ultraGrid1.Rows.Count; i++) { if (ultraGrid1.Rows[i].Cells["INSPECTOR_CODE"].Value.ToString() == txtCode.Text && ultraGrid1.Rows[i] != ulgr) { MessageBox.Show("输入的产线代码已存在,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } 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); if (retnum > 0) { MessageBox.Show("更新成功", "提示", MessageBoxButtons.OK); getMIL_BASE_INSPECTOR(this.ob); } } /// /// 选中行激活事件 /// /// /// private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow ugr = ultraGrid1.ActiveRow; txtCode.Text= ugr.Cells["INSPECTOR_CODE"].Value.ToString(); txtName.Text= ugr.Cells["INSPECTOR_NAME"].Value.ToString(); ulCombShift.Text = ugr.Cells["COL_SHIFT"].Value.ToString(); ulCombGroup.Text = ugr.Cells["COL_GROUP"].Value.ToString(); //txtPlanCode.Text = ugr.Cells["PLINE_CODE"].Value.ToString(); } } }