192 lines
7.1 KiB
C#
192 lines
7.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using BaseFunction;
|
|
using System.Text.RegularExpressions;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Xml;
|
|
|
|
using Telerik.WinControls.UI;
|
|
using DAL;
|
|
|
|
namespace NSAnalysis
|
|
{
|
|
public partial class FEditRange : Telerik.WinControls.UI.ShapedForm
|
|
{
|
|
#region 全局变量
|
|
//private TMeasureSQLiteDAL tmdal = new TMeasureSQLiteDAL();
|
|
private TMeasureMSSQLDAL tmdal = new TMeasureMSSQLDAL();
|
|
private FRangeSetup gFTS;
|
|
|
|
#endregion 全局变量
|
|
|
|
#region 鼠标事件
|
|
|
|
private void btn_MouseHover(object sender, EventArgs e)
|
|
{
|
|
RadButton btn = sender as RadButton;
|
|
btn.BackColor = Color.FromArgb(0, 151, 186);
|
|
}
|
|
|
|
private void btn_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
RadButton btn = sender as RadButton;
|
|
btn.BackColor = Color.FromArgb(19, 46, 53);
|
|
}
|
|
|
|
#endregion 鼠标事件
|
|
|
|
private void InitLanguage()
|
|
{
|
|
if (!ConfigDfn.bLanguage)
|
|
{
|
|
this.Text = "Edit CNC";
|
|
labTitle.Text = "Edit CNC";
|
|
radLabel5.Text = "CNC ID : ";
|
|
radLabel2.Text = "CNC Name : ";
|
|
radLabel4.Text = "CNC Location : ";
|
|
radLabel3.Text = "CNC Type : ";
|
|
radLabel7.Text = "CNC IP : ";
|
|
|
|
radLabel1.Text = "Remark : ";
|
|
|
|
rbtnOK.Text = "Edit";
|
|
rbtnCancel.Text = "Cancel";
|
|
}
|
|
}
|
|
|
|
public FEditRange(FRangeSetup fts)
|
|
{
|
|
InitializeComponent();
|
|
InitLanguage();
|
|
gFTS = fts;
|
|
}
|
|
|
|
private void SFAddCNC_Load(object sender, EventArgs e)
|
|
{
|
|
rtbCarType.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["CarType"].Value.ToString();
|
|
rtbMesPointName.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["MeasurePointName"].Value.ToString();
|
|
rtbRangePointName.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["DimensionName"].Value.ToString();
|
|
rtbLower.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["TolLower"].Value.ToString();
|
|
rtbUpper.Text = gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["TolUpper"].Value.ToString();
|
|
|
|
rtbRemark.Text = (gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["Remark"].Value.ToString());
|
|
}
|
|
|
|
private void rbtnOK_Click(object sender, EventArgs e)
|
|
{
|
|
#region 防愚操作
|
|
|
|
string strCarType = rtbCarType.Text.Trim();
|
|
string strMesPointName = rtbMesPointName.Text.Trim();
|
|
|
|
string strRangePoint = rtbRangePointName.Text.Trim();
|
|
if (string.IsNullOrEmpty(rtbCarType.Text.Trim()))
|
|
{
|
|
MessageBox.Show("车身类型不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(rtbMesPointName.Text.Trim()))
|
|
{
|
|
MessageBox.Show("极差编号名称不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(rtbRangePointName.Text.Trim()))
|
|
{
|
|
MessageBox.Show("极差包含点位不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (!rtbRangePointName.Text.Trim().Contains(","))
|
|
{
|
|
MessageBox.Show("极差包含点位必须用英文逗号隔开,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(rtbLower.Text.Trim()))
|
|
{
|
|
MessageBox.Show("下限值不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(rtbUpper.Text.Trim()))
|
|
{
|
|
MessageBox.Show("上限值不能为空,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
if (!string.IsNullOrEmpty(rtbLower.Text.Trim()))
|
|
{
|
|
try
|
|
{
|
|
double dtemp = double.Parse(rtbLower.Text.Trim());
|
|
}
|
|
catch (Exception)
|
|
{
|
|
MessageBox.Show("下限值必须是数字,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(rtbUpper.Text.Trim()))
|
|
{
|
|
try
|
|
{
|
|
double dtemp = double.Parse(rtbUpper.Text.Trim());
|
|
}
|
|
catch (Exception)
|
|
{
|
|
MessageBox.Show("上限值必须是数字,请重新输入! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
}
|
|
if (rtbCarType.Text != gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["CarType"].Value.ToString() || rtbMesPointName.Text != gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["MeasurePointName"].Value.ToString())
|
|
{
|
|
if (tmdal.CheckRangeNameExit(strCarType, strMesPointName))
|
|
{
|
|
MessageBox.Show("该车身类型下,已经存在该极差编号,请修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
#endregion 防愚操作
|
|
|
|
try
|
|
{
|
|
TRangeModel ttm = new TRangeModel();
|
|
ttm.Id = int.Parse(gFTS.dgvTolList.Rows[gFTS.idgvSelectRowNumber].Cells["Id"].Value.ToString());
|
|
ttm.CarType = strCarType;
|
|
ttm.RangeName = strMesPointName;
|
|
ttm.RangePoint = strRangePoint;
|
|
ttm.RangeLower = double.Parse(rtbLower.Text.Trim());
|
|
ttm.RangeUpper = double.Parse(rtbUpper.Text.Trim());
|
|
ttm.Remark = rtbRemark.Text.Trim();
|
|
ttm.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
tmdal.UpdateTRange(ttm);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("修改极差带信息失败,原因:" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
return;
|
|
}
|
|
|
|
MessageBox.Show("修改极差带信息成功! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
gFTS.rtbnSearch_Click(null, null);
|
|
|
|
this.Close();
|
|
}
|
|
|
|
private void rbtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
} |