|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjTanNum
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmTankNum : Form
|
|
|
|
|
{
|
|
|
|
|
public FrmTankNum()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TankNumCodingView _tankNumCodingView;
|
|
|
|
|
public FrmTankNum(TankNumCodingView view) : this()
|
|
|
|
|
{
|
|
|
|
|
_tankNumCodingView = view;
|
|
|
|
|
Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Init()
|
|
|
|
|
{
|
|
|
|
|
var nameValueCollection = MaterialInfoTypeHelp.GetALL();
|
|
|
|
|
this.comboBox1.DataSource = nameValueCollection;
|
|
|
|
|
comboBox1.ValueMember = "Id";
|
|
|
|
|
comboBox1.DisplayMember = "Name";
|
|
|
|
|
foreach (MyNameValue combo in comboBox1.Items)
|
|
|
|
|
{
|
|
|
|
|
if (combo.Id == _tankNumCodingView.MTypeId)
|
|
|
|
|
{
|
|
|
|
|
comboBox1.SelectedItem = combo;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (null != _tankNumCodingView)
|
|
|
|
|
{
|
|
|
|
|
this.TankCode.Text = _tankNumCodingView.TankCode;
|
|
|
|
|
this.TankName.Text = _tankNumCodingView.TankName;
|
|
|
|
|
this.High.Text = _tankNumCodingView.High.ToString();
|
|
|
|
|
this.Slow.Text = _tankNumCodingView.Slow.ToString();
|
|
|
|
|
this.SlowScale.Text = _tankNumCodingView.SlowScale.ToString();
|
|
|
|
|
this.Lead.Text = _tankNumCodingView.Lead.ToString();
|
|
|
|
|
this.Jog.Text = _tankNumCodingView.Jog.ToString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void label6_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
#region check
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(High.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
High.Focus();
|
|
|
|
|
MessageBox.Show("请输入高速称量速度");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (float.TryParse(High.Text.Trim(),out float a))
|
|
|
|
|
{
|
|
|
|
|
if (a < 0 || a > 50)
|
|
|
|
|
{
|
|
|
|
|
High.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确高速称量速度[0.0~50.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
High.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确高速称量速度[0.0~50.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(Slow.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
Slow.Focus();
|
|
|
|
|
MessageBox.Show("请输入慢速称量速度");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (float.TryParse(Slow.Text.Trim(),out float b))
|
|
|
|
|
{
|
|
|
|
|
if (b < 0 || b > 50)
|
|
|
|
|
{
|
|
|
|
|
Slow.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~50.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Slow.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~50.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(SlowScale.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
SlowScale.Focus();
|
|
|
|
|
MessageBox.Show("请输入慢称值");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (float.TryParse(SlowScale.Text.Trim(),out float b))
|
|
|
|
|
{
|
|
|
|
|
if (b < 0 || b > 10)
|
|
|
|
|
{
|
|
|
|
|
SlowScale.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~10.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SlowScale.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~10.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(Lead.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
Lead.Focus();
|
|
|
|
|
MessageBox.Show("请输入提前量");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (float.TryParse(Lead.Text.Trim(),out float b))
|
|
|
|
|
{
|
|
|
|
|
if (b < 0 || b > 10)
|
|
|
|
|
{
|
|
|
|
|
Lead.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~10.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Lead.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~10.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(Jog.Text.Trim()))
|
|
|
|
|
{
|
|
|
|
|
Jog.Focus();
|
|
|
|
|
MessageBox.Show("请输入点动值");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (float.TryParse(Lead.Text.Trim(),out float b))
|
|
|
|
|
{
|
|
|
|
|
if (b < 0 || b > 20)
|
|
|
|
|
{
|
|
|
|
|
Jog.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~20.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Jog.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确低速称量速度[0.0~20.0]");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_tankNumCodingView.MTypeId = Convert.ToInt32(this.comboBox1.SelectedValue);
|
|
|
|
|
_tankNumCodingView.High = Convert.ToSingle(High.Text);
|
|
|
|
|
_tankNumCodingView.Slow = Convert.ToSingle(Slow.Text);
|
|
|
|
|
_tankNumCodingView.SlowScale = Convert.ToSingle(SlowScale.Text);
|
|
|
|
|
_tankNumCodingView.Lead = Convert.ToSingle(Lead.Text);
|
|
|
|
|
_tankNumCodingView.Jog = Convert.ToSingle(Jog.Text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TankNumCodingDbHelp.Update(_tankNumCodingView);
|
|
|
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|