#001 初版提交
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
using BaseFunction;
|
||||
using DAL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using Telerik.WinControls.UI;
|
||||
|
||||
namespace NSAnalysis
|
||||
{
|
||||
public partial class FAddTolerance : Telerik.WinControls.UI.ShapedForm
|
||||
{
|
||||
#region 全局变量
|
||||
|
||||
//private TMeasureSQLiteDAL tmdal = new TMeasureSQLiteDAL();
|
||||
|
||||
private TMeasureMSSQLDAL tmdal = new TMeasureMSSQLDAL();
|
||||
private FToleranceSetup 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 FAddTolerance(FToleranceSetup fts)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitLanguage();
|
||||
gFTS = fts;
|
||||
}
|
||||
|
||||
private void SFAddCNC_Load(object sender, EventArgs e)
|
||||
{
|
||||
rddlDimensionName.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void rbtnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
#region 防愚操作
|
||||
|
||||
string strCarType = rtbCarType.Text.Trim();
|
||||
string strMesPointName = rtbMesPointName.Text.Trim();
|
||||
|
||||
string strDimensionName = rddlDimensionName.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(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.CheckMeaPointNameExit(strCarType, strMesPointName, strDimensionName))
|
||||
{
|
||||
MessageBox.Show("该车身类型下,已经存在该测量点位名称和尺寸名称,请修改!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion 防愚操作
|
||||
|
||||
TToleranceModel ttm = new TToleranceModel();
|
||||
ttm.CarType = strCarType;
|
||||
ttm.MeasurePointName = strMesPointName;
|
||||
ttm.DimensionName = strDimensionName;
|
||||
ttm.TolLower = double.Parse(rtbLower.Text.Trim());
|
||||
ttm.TolUpper = double.Parse(rtbUpper.Text.Trim());
|
||||
ttm.Remark = rtbRemark.Text.Trim();
|
||||
ttm.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
try
|
||||
{
|
||||
tmdal.InsertTTolerance(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user