You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjWeight
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmWeight : Form
|
|
|
|
|
{
|
|
|
|
|
public FrmWeight()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _id = 0;
|
|
|
|
|
|
|
|
|
|
public FrmWeight(int id) : this()
|
|
|
|
|
{
|
|
|
|
|
this._id = id;
|
|
|
|
|
SetUpdateFromPlc();
|
|
|
|
|
LowWeight.MaxLength = 5;
|
|
|
|
|
HighWeight.MaxLength = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetUpdateFromPlc()
|
|
|
|
|
{
|
|
|
|
|
WeightSettingView view = WeightSettingPlc.UpFromPlc(_id);
|
|
|
|
|
this.HighWeight.Text = view.HighWeight.ToString();
|
|
|
|
|
this.LowWeight.Text = view.LowWeight.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string lowWeight = LowWeight.Text.Trim();
|
|
|
|
|
string highWeight = HighWeight.Text.Trim();
|
|
|
|
|
|
|
|
|
|
if (!float.TryParse(lowWeight, out var low))
|
|
|
|
|
{
|
|
|
|
|
LowWeight.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确的低料位重量");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!float.TryParse(highWeight, out var high))
|
|
|
|
|
{
|
|
|
|
|
HighWeight.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确的高料位重量");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WeightSettingView view = new WeightSettingView()
|
|
|
|
|
{
|
|
|
|
|
Id = _id,
|
|
|
|
|
HighWeight = high,
|
|
|
|
|
LowWeight = low
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
WeightSettingPlc.DownToPlc(new []{view});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void label1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|