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.Globalization;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjProportional
|
|
|
|
|
{
|
|
|
|
|
public partial class FrmProportional : Form
|
|
|
|
|
{
|
|
|
|
|
public FrmProportional()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int _id = 0;
|
|
|
|
|
|
|
|
|
|
public FrmProportional(int id):this()
|
|
|
|
|
{
|
|
|
|
|
this._id = id;
|
|
|
|
|
SV.MaxLength = 5;
|
|
|
|
|
SV.Enabled = true;
|
|
|
|
|
var view = ProportionalPlc.UpFromPlc(id);
|
|
|
|
|
if (view != null)
|
|
|
|
|
{
|
|
|
|
|
SV.Text = view.SV.ToString(CultureInfo.InvariantCulture);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string sv = SV.Text.Trim();
|
|
|
|
|
if(!float.TryParse(sv,out var rs))
|
|
|
|
|
{
|
|
|
|
|
SV.Focus();
|
|
|
|
|
MessageBox.Show("请输入正确的值");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var watchDoy = LjHelp.WatchDog;
|
|
|
|
|
if (watchDoy == 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("PLC通讯失败");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProportionalSettingView view = new ProportionalSettingView();
|
|
|
|
|
view.Id = _id;
|
|
|
|
|
view.SV = Convert.ToSingle(sv);
|
|
|
|
|
|
|
|
|
|
var i = LjHelp.WatchDog;
|
|
|
|
|
if (i == 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("PLC通讯失败");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProportionalPlc.DownToPlc(new []{view});
|
|
|
|
|
ProportionalDB.Update(view);
|
|
|
|
|
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|