修改大仓电机震动时间

dep
杨威 5 months ago
parent 0c5a980cb6
commit 71bdbb9336

@ -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();
}

@ -140,4 +140,121 @@ namespace DataBlockHelper.DBHelpers
}
public class Db2108PlcSetTime: DBHelper
{
public Db2108PlcSetTime()
{
OperateResult<byte[]> db = PlcConnect.Instance.Read("DB2108.0.0", 1268);
bytes = db.Content;
var fm= PlcConnect.Instance.ByteTransform;
int startSet = 0;
var content = bytes.Skip(1208).Take(60).ToArray();
OpenA= fm.TransInt16(content, startSet);
startSet += 2;
OpenB = fm.TransInt16(content, startSet);
startSet += 2;
OpenC = fm.TransInt16(content, startSet);
startSet += 2;
OpenD = fm.TransInt16(content, startSet);
startSet += 2;
OpenE = fm.TransInt16(content, startSet);
startSet += 2;
OpenF = fm.TransInt16(content, startSet);
startSet += 2;
OpenG = fm.TransInt16(content, startSet);
startSet += 2;
OpenH = fm.TransInt16(content, startSet);
startSet += 2;
OpenI = fm.TransInt16(content, startSet);
startSet += 2;
OpenJ = fm.TransInt16(content, startSet);
startSet += 2;
OpenK = fm.TransInt16(content, startSet);
startSet += 2;
OpenL = fm.TransInt16(content, startSet);
startSet += 2;
OpenM = fm.TransInt16(content, startSet);
startSet += 2;
OpenN = fm.TransInt16(content, startSet);
startSet += 2;
OpenO = fm.TransInt16(content, startSet);
startSet += 2;
CloseA = fm.TransInt16(content, startSet);
startSet += 2;
CloseB = fm.TransInt16(content, startSet);
startSet += 2;
CloseC = fm.TransInt16(content, startSet);
startSet += 2;
CloseD = fm.TransInt16(content, startSet);
startSet += 2;
CloseE = fm.TransInt16(content, startSet);
startSet += 2;
CloseF = fm.TransInt16(content, startSet);
startSet += 2;
CloseG = fm.TransInt16(content, startSet);
startSet += 2;
CloseH = fm.TransInt16(content, startSet);
startSet += 2;
CloseI = fm.TransInt16(content, startSet);
startSet += 2;
CloseJ = fm.TransInt16(content, startSet);
startSet += 2;
CloseK = fm.TransInt16(content, startSet);
startSet += 2;
CloseL = fm.TransInt16(content, startSet);
startSet += 2;
CloseM = fm.TransInt16(content, startSet);
startSet += 2;
CloseN = fm.TransInt16(content, startSet);
startSet += 2;
CloseO = fm.TransInt16(content, startSet);
}
public short OpenA { get; set; }
public short OpenB { get; set; }
public short OpenC { get; set; }
public short OpenD { get; set; }
public short OpenE { get; set; }
public short OpenF { get; set; }
public short OpenG { get; set; }
public short OpenH { get; set; }
public short OpenI { get; set; }
public short OpenJ { get; set; }
public short OpenK { get; set; }
public short OpenL { get; set; }
public short OpenM { get; set; }
public short OpenN { get; set; }
public short OpenO { get; set; }
public short CloseA { get; set; }
public short CloseB { get; set; }
public short CloseC { get; set; }
public short CloseD { get; set; }
public short CloseE { get; set; }
public short CloseF { get; set; }
public short CloseG { get; set; }
public short CloseH { get; set; }
public short CloseI { get; set; }
public short CloseJ { get; set; }
public short CloseK { get; set; }
public short CloseL { get; set; }
public short CloseM { get; set; }
public short CloseN { get; set; }
public short CloseO { get; set; }
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save