|
|
|
@ -77,13 +77,60 @@ namespace Mesnac.Action.ChemicalWeighing.Qu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MCTextBox txtAOpen;
|
|
|
|
|
MCTextBox txtBOpen;
|
|
|
|
|
MCTextBox txtCOpen;
|
|
|
|
|
MCTextBox txtDOpen;
|
|
|
|
|
MCTextBox txtEOpen;
|
|
|
|
|
MCTextBox txtFOpen;
|
|
|
|
|
MCTextBox txtGOpen;
|
|
|
|
|
MCTextBox txtHOpen;
|
|
|
|
|
MCTextBox txtIOpen;
|
|
|
|
|
MCTextBox txtJOpen;
|
|
|
|
|
MCTextBox txtKOpen;
|
|
|
|
|
MCTextBox txtLOpen;
|
|
|
|
|
MCTextBox txtMOpen;
|
|
|
|
|
MCTextBox txtNOpen;
|
|
|
|
|
MCTextBox txtOOpen;
|
|
|
|
|
|
|
|
|
|
MCTextBox txtAClose;
|
|
|
|
|
MCTextBox txtBClose;
|
|
|
|
|
MCTextBox txtCClose;
|
|
|
|
|
MCTextBox txtDClose;
|
|
|
|
|
MCTextBox txtEClose;
|
|
|
|
|
MCTextBox txtFClose;
|
|
|
|
|
MCTextBox txtGClose;
|
|
|
|
|
MCTextBox txtHClose;
|
|
|
|
|
MCTextBox txtIClose;
|
|
|
|
|
MCTextBox txtJClose;
|
|
|
|
|
MCTextBox txtKClose;
|
|
|
|
|
MCTextBox txtLClose;
|
|
|
|
|
MCTextBox txtMClose;
|
|
|
|
|
MCTextBox txtNClose;
|
|
|
|
|
MCTextBox txtOClose;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MCButton MCButton2147483645;//同步
|
|
|
|
|
MCButton MCButton2147483644;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
base.RunIni(runtime); //必须调用
|
|
|
|
|
var controls = GetAllControls();
|
|
|
|
|
|
|
|
|
|
HslDa=controls.FirstOrDefault(x => x.Name == "HslDa") as HslLanternSimple;
|
|
|
|
|
|
|
|
|
|
MCButton2147483645= controls.FirstOrDefault(x => x.Name == "MCButton2147483645") as MCButton;
|
|
|
|
|
MCButton2147483645.Click += MCButton2147483644_Click;
|
|
|
|
|
|
|
|
|
|
MCButton2147483644_Click(new object(), new EventArgs());
|
|
|
|
|
|
|
|
|
|
MCButton2147483644 = controls.FirstOrDefault(x => x.Name == "MCButton2147483644") as MCButton;
|
|
|
|
|
|
|
|
|
|
MCButton2147483644.Click += MCButton2147483644_Click1;
|
|
|
|
|
|
|
|
|
|
HslDa =controls.FirstOrDefault(x => x.Name == "HslDa") as HslLanternSimple;
|
|
|
|
|
HslDb = controls.FirstOrDefault(x => x.Name == "HslDb") as HslLanternSimple;
|
|
|
|
|
HslDc = controls.FirstOrDefault(x => x.Name == "HslDc") as HslLanternSimple;
|
|
|
|
|
HslDd = controls.FirstOrDefault(x => x.Name == "HslDd") as HslLanternSimple;
|
|
|
|
@ -194,6 +241,159 @@ namespace Mesnac.Action.ChemicalWeighing.Qu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
txtAOpen = controls.FirstOrDefault(x => x.Name == "txtAOpen") as MCTextBox;
|
|
|
|
|
txtBOpen = controls.FirstOrDefault(x => x.Name == "txtBOpen") as MCTextBox;
|
|
|
|
|
txtCOpen = controls.FirstOrDefault(x => x.Name == "txtCOpen") as MCTextBox;
|
|
|
|
|
txtDOpen = controls.FirstOrDefault(x => x.Name == "txtDOpen") as MCTextBox;
|
|
|
|
|
txtEOpen = controls.FirstOrDefault(x => x.Name == "txtEOpen") as MCTextBox;
|
|
|
|
|
txtFOpen = controls.FirstOrDefault(x => x.Name == "txtFOpen") as MCTextBox;
|
|
|
|
|
txtGOpen = controls.FirstOrDefault(x => x.Name == "txtGOpen") as MCTextBox;
|
|
|
|
|
txtHOpen = controls.FirstOrDefault(x => x.Name == "txtHOpen") as MCTextBox;
|
|
|
|
|
txtIOpen = controls.FirstOrDefault(x => x.Name == "txtIOpen") as MCTextBox;
|
|
|
|
|
txtJOpen = controls.FirstOrDefault(x => x.Name == "txtJOpen") as MCTextBox;
|
|
|
|
|
txtKOpen = controls.FirstOrDefault(x => x.Name == "txtKOpen") as MCTextBox;
|
|
|
|
|
txtLOpen = controls.FirstOrDefault(x => x.Name == "txtLOpen") as MCTextBox;
|
|
|
|
|
txtMOpen = controls.FirstOrDefault(x => x.Name == "txtMOpen") as MCTextBox;
|
|
|
|
|
txtNOpen = controls.FirstOrDefault(x => x.Name == "txtNOpen") as MCTextBox;
|
|
|
|
|
txtOOpen = controls.FirstOrDefault(x => x.Name == "txtOOpen") as MCTextBox;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
txtAClose = controls.FirstOrDefault(x => x.Name == "txtAClose") as MCTextBox;
|
|
|
|
|
txtBClose = controls.FirstOrDefault(x => x.Name == "txtBClose") as MCTextBox;
|
|
|
|
|
txtCClose = controls.FirstOrDefault(x => x.Name == "txtCClose") as MCTextBox;
|
|
|
|
|
txtDClose = controls.FirstOrDefault(x => x.Name == "txtDClose") as MCTextBox;
|
|
|
|
|
txtEClose = controls.FirstOrDefault(x => x.Name == "txtEClose") as MCTextBox;
|
|
|
|
|
txtFClose = controls.FirstOrDefault(x => x.Name == "txtFClose") as MCTextBox;
|
|
|
|
|
txtGClose = controls.FirstOrDefault(x => x.Name == "txtGClose") as MCTextBox;
|
|
|
|
|
txtHClose = controls.FirstOrDefault(x => x.Name == "txtHClose") as MCTextBox;
|
|
|
|
|
txtIClose = controls.FirstOrDefault(x => x.Name == "txtIClose") as MCTextBox;
|
|
|
|
|
txtJClose = controls.FirstOrDefault(x => x.Name == "txtJClose") as MCTextBox;
|
|
|
|
|
txtKClose = controls.FirstOrDefault(x => x.Name == "txtKClose") as MCTextBox;
|
|
|
|
|
txtLClose = controls.FirstOrDefault(x => x.Name == "txtLClose") as MCTextBox;
|
|
|
|
|
txtMClose = controls.FirstOrDefault(x => x.Name == "txtMClose") as MCTextBox;
|
|
|
|
|
txtNClose = controls.FirstOrDefault(x => x.Name == "txtNClose") as MCTextBox;
|
|
|
|
|
txtOClose = controls.FirstOrDefault(x => x.Name == "txtOClose") as MCTextBox;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void MCButton2147483644_Click1(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var plc = PlcConnect.Instance;
|
|
|
|
|
int start = 1208;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtAOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtBOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtCOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtDOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtEOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtFOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtGOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtHOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtIOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtJOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtKOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtLOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtMOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtNOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtOOpen.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtAClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtBClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtCClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtDClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtEClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtFClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtGClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtHClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtIClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtJClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtKClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtLClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtMClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtNClose.MCValue.ToString()));
|
|
|
|
|
start += 2;
|
|
|
|
|
plc.Write($"DB2108.{start}.0", short.Parse(txtOClose.MCValue.ToString()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("下传数据成功");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 同步
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
private void MCButton2147483644_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Db2108PlcSetTime db=new Db2108PlcSetTime();
|
|
|
|
|
txtAOpen.Text=db.OpenA.ToString();
|
|
|
|
|
txtBOpen.Text = db.OpenB.ToString();
|
|
|
|
|
txtCOpen.Text = db.OpenC.ToString();
|
|
|
|
|
txtDOpen.Text = db.OpenD.ToString();
|
|
|
|
|
txtEOpen.Text = db.OpenE.ToString();
|
|
|
|
|
txtFOpen.Text = db.OpenF.ToString();
|
|
|
|
|
txtGOpen.Text = db.OpenG.ToString();
|
|
|
|
|
txtHOpen.Text = db.OpenH.ToString();
|
|
|
|
|
txtIOpen.Text = db.OpenI.ToString();
|
|
|
|
|
txtJOpen.Text = db.OpenJ.ToString();
|
|
|
|
|
txtKOpen.Text = db.OpenK.ToString();
|
|
|
|
|
txtLOpen.Text = db.OpenL.ToString();
|
|
|
|
|
txtMOpen.Text = db.OpenM.ToString();
|
|
|
|
|
txtNOpen.Text = db.OpenN.ToString();
|
|
|
|
|
txtOOpen.Text = db.OpenO.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
txtAClose.Text = db.CloseA.ToString();
|
|
|
|
|
txtBClose.Text = db.CloseB.ToString();
|
|
|
|
|
txtCClose.Text = db.CloseC.ToString();
|
|
|
|
|
txtDClose.Text = db.CloseD.ToString();
|
|
|
|
|
txtEClose.Text = db.CloseE.ToString();
|
|
|
|
|
txtFClose.Text = db.CloseF.ToString();
|
|
|
|
|
txtGClose.Text = db.CloseG.ToString();
|
|
|
|
|
txtHClose.Text = db.CloseH.ToString();
|
|
|
|
|
txtIClose.Text = db.CloseI.ToString();
|
|
|
|
|
txtJClose.Text = db.CloseJ.ToString();
|
|
|
|
|
txtKClose.Text = db.CloseK.ToString();
|
|
|
|
|
txtLClose.Text = db.CloseL.ToString();
|
|
|
|
|
txtMClose.Text = db.CloseM.ToString();
|
|
|
|
|
txtNClose.Text = db.CloseN.ToString();
|
|
|
|
|
txtOClose.Text = db.CloseO.ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|