182 lines
6.1 KiB
C#
182 lines
6.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 DAL;
|
|
using Telerik.WinControls.UI;
|
|
|
|
namespace NSAnalysis
|
|
{
|
|
public partial class FAddRange : 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 = "Add Tolerance";
|
|
labTitle.Text = "Add Tolerance";
|
|
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 = "Add";
|
|
rbtnCancel.Text = "Cancel";
|
|
}
|
|
}
|
|
|
|
public FAddRange(FRangeSetup fts)
|
|
{
|
|
InitializeComponent();
|
|
InitLanguage();
|
|
gFTS = fts;
|
|
}
|
|
|
|
private void SFAddCNC_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void rbtnOK_Click(object sender, EventArgs e)
|
|
{
|
|
#region 防愚操作
|
|
|
|
string strCarType = rtbCarType.Text.Trim();
|
|
string strMesPointName = rtbMesPointName.Text.Trim();
|
|
|
|
string strDimensionName = 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 (tmdal.CheckRangeNameExit(strCarType, strMesPointName))
|
|
{
|
|
MessageBox.Show("该车身类型下,已经存在该极差编号,请修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
return;
|
|
}
|
|
|
|
#endregion 防愚操作
|
|
|
|
TRangeModel ttm = new TRangeModel();
|
|
ttm.CarType = strCarType;
|
|
ttm.RangeName = strMesPointName;
|
|
ttm.RangePoint = strDimensionName;
|
|
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");
|
|
|
|
try
|
|
{
|
|
tmdal.InsertNewRange(ttm);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("添加极差带信息失败,原因:" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
MyBase.TraceWriteLine("添加极差带信息失败,原因:" + ex.ToString());
|
|
return;
|
|
}
|
|
|
|
MessageBox.Show("添加极差带信息成功! ", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
gFTS.rtbnSearch_Click(null, null);
|
|
}
|
|
|
|
private void rbtnCancel_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
} |