|
|
using DataBlockHelper.DBHelpers;
|
|
|
using DevExpress.Utils.Taskbar;
|
|
|
using ICSharpCode.Core;
|
|
|
using Mesnac.Action.Base;
|
|
|
using Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting.Entity;
|
|
|
using Mesnac.Controls.Default;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
|
|
|
{
|
|
|
public class PressureSettingButtonAction : ChemicalWeighingAction, IAction
|
|
|
{
|
|
|
MCButtonEntity ButtonE = new MCButtonEntity();
|
|
|
MCTextboxEntity BoxE = new MCTextboxEntity();
|
|
|
SlioEntity slioEntity = new SlioEntity();
|
|
|
|
|
|
PipeEntity pipe = new PipeEntity();
|
|
|
|
|
|
SpeedEntity speed = new SpeedEntity();
|
|
|
List<Control> Controls;
|
|
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
|
{
|
|
|
base.RunIni(runtime);
|
|
|
|
|
|
Controls = GetAllControls();
|
|
|
|
|
|
SetAllControus();
|
|
|
|
|
|
ButtonAction(runtime);
|
|
|
}
|
|
|
|
|
|
public void SetAllControus()
|
|
|
{
|
|
|
ControlsHelper.ControlImport<MCButton>(ButtonE, Controls);
|
|
|
ControlsHelper.ControlImport<MCTextBox>(BoxE, Controls);
|
|
|
ControlsHelper.ControlImport<MCTextBox>(slioEntity, Controls);
|
|
|
|
|
|
ControlsHelper.ControlImport<MCTextBox>(pipe, Controls);
|
|
|
|
|
|
ControlsHelper.ControlImport<MCTextBox>(speed, Controls);
|
|
|
}
|
|
|
|
|
|
public void ButtonAction(RuntimeParameter runtime)
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(ButtonE.MCButtonA == runtime.Sender)
|
|
|
{
|
|
|
if (MessageBox.Show("确定要下传数据到PLC?", "下传数据确认", MessageBoxButtons.YesNo) == DialogResult.No)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
PlcDownload.DownPipe(pipe);
|
|
|
PlcDownload.DownSlio(slioEntity);
|
|
|
PlcDownload.PressureSettingDownload(BoxE);
|
|
|
|
|
|
DB137WriterHelper.AddSpeed(new List<float>()
|
|
|
{
|
|
|
Convert.ToSingle(speed.TxtSpeedA.MCValue),
|
|
|
Convert.ToSingle(speed.TxtSpeedB.MCValue),
|
|
|
Convert.ToSingle(speed.TxtSpeedC.MCValue),
|
|
|
});
|
|
|
|
|
|
|
|
|
DB91WriterHelper.AddSpeed(new List<float>()
|
|
|
{
|
|
|
Convert.ToSingle(speed.TxtSpeedMA.MCValue),
|
|
|
Convert.ToSingle(speed.TxtSpeedMB.MCValue),
|
|
|
Convert.ToSingle(speed.TxtSpeedMC.MCValue),
|
|
|
});
|
|
|
|
|
|
DB91WriterHelper.AddSpeed(Convert.ToSingle(speed.SetSpeedA.MCValue), Convert.ToSingle(speed.SetSpeedM.MCValue));
|
|
|
|
|
|
|
|
|
MessageBox.Show("下传成功");
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("下传失败 参数异常");
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|