称量参数设置

dep_deliver
我叫锄头 12 months ago
parent 82676238e8
commit e791f1fd0d

@ -11,6 +11,11 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting.Entity
{
public MCButton Download { get; set; }
public MCButton Refresh { get; set; }
public MCButton MCButtonA { get; set; }
public MCButton MCButtonB { get; set; }
public MCButton MCButtonD { get; set; }
public MCButton MCButtonC { get; set; }
}
public class MCTextboxEntity
@ -47,4 +52,49 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting.Entity
public MCTextBox CTimeSetValue2 { get; set; }
}
public class SlioEntity
{
public MCTextBox TxtA { get; set; }
public MCTextBox TxtB { get; set; }
public MCTextBox TxtC { get; set; }
public MCTextBox TxtD { get; set; }
public MCTextBox TxtE { get; set; }
public MCTextBox TxtF { get; set; }
public MCTextBox TxtG { get; set; }
public MCTextBox TxtH { get; set; }
public MCTextBox TxtI { get; set; }
public MCTextBox TxtJ { get; set; }
public MCTextBox TxtK { get; set; }
public MCTextBox TxtL { get; set; }
public MCTextBox TxtM { get; set; }
public MCTextBox TxtN { get; set; }
public MCTextBox TxtO { get; set; }
public MCTextBox TxtDelay1 { get; set; }
public MCTextBox TxtDelay2 { get; set; }
public MCTextBox TxtDelay3 { get; set; }
}
public class PipeEntity
{
public MCTextBox MainA { get; set; }
public MCTextBox AuxA { get; set; }
public MCTextBox MainB { get; set; }
public MCTextBox AuxB { get; set; }
public MCTextBox MainC { get; set; }
public MCTextBox AuxC { get; set; }
public MCTextBox Upper { get; set; }
public MCTextBox Lower { get; set; }
}
}

@ -1,4 +1,7 @@
using DataBlockHelper.DBHelpers;
using DevExpress.Utils.Extensions;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting.Entity;
using Mesnac.Controls.Default;
@ -16,6 +19,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
DB112Helper DB122 = new DB112Helper();
MCTextboxEntity BoxE = new MCTextboxEntity();
SlioEntity slioEntity = new SlioEntity();
PipeEntity pipe=new PipeEntity();
List<Control> Controls;
public void Run(RuntimeParameter runtime)
{
@ -25,7 +32,13 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
ControlsHelper.ControlImport<MCTextBox>(BoxE, Controls);
ControlsHelper.ControlImport<MCTextBox>(slioEntity, Controls);
ControlsHelper.ControlImport<MCTextBox>(pipe, Controls);
SetValueFromPlc();
SetValue();
SetDb92Value();
}
private void SetValueFromPlc()
@ -61,5 +74,53 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
BoxE.CTimeSetValue1.MCValue = DB122.LineTimeC.SetValue1;
BoxE.CTimeSetValue2.MCValue = DB122.LineTimeC.SetValue2;
}
private void SetValue()
{
DB120Help dB120Help = new DB120Help();
var hd = dB120Help.GetUhd;
slioEntity.TxtA.MCValue = hd.A.ToString();
slioEntity.TxtB.MCValue = hd.B.ToString();
slioEntity.TxtC.MCValue = hd.C.ToString();
slioEntity.TxtD.MCValue = hd.D.ToString();
slioEntity.TxtE.MCValue = hd.E.ToString();
slioEntity.TxtF.MCValue = hd.F.ToString();
slioEntity.TxtG.MCValue = hd.G.ToString();
slioEntity.TxtH.MCValue = hd.H.ToString();
slioEntity.TxtI.MCValue = hd.I.ToString();
slioEntity.TxtJ.MCValue = hd.J.ToString();
slioEntity.TxtK.MCValue = hd.K.ToString();
slioEntity.TxtL.MCValue = hd.L.ToString();
slioEntity.TxtM.MCValue = hd.M.ToString();
slioEntity.TxtN.MCValue = hd.N.ToString();
slioEntity.TxtO.MCValue = hd.O.ToString();
slioEntity.TxtDelay1.MCValue = hd.Delay1.ToString();
slioEntity.TxtDelay2.MCValue = hd.Delay2.ToString();
slioEntity.TxtDelay3.MCValue = hd.Delay3.ToString();
}
private void SetDb92Value()
{
DB92Help dB=new DB92Help();
var p = dB.GetPipe;
pipe.MainA.MCValue=p.MainPipieA.ToString();
pipe.AuxA.MCValue = p.AuxPipieA.ToString();
pipe.MainB.MCValue = p.MainPipieB.ToString();
pipe.AuxB.MCValue = p.AuxPipieB.ToString();
pipe.MainC.MCValue = p.MainPipieC.ToString();
pipe.AuxC.MCValue = p.AuxPipieC.ToString();
pipe.Upper.MCValue=p.UpperPressure.ToString();
pipe.Lower.MCValue=p.LowerPressure.ToString();
}
}
}

@ -147,5 +147,54 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
}
}
public static void DownSlio(SlioEntity entity)
{
var d = new Uhd()
{
A = Convert.ToSingle(entity.TxtA.MCValue.ToString()),
B = Convert.ToSingle(entity.TxtB.MCValue.ToString()),
C = Convert.ToSingle(entity.TxtC.MCValue.ToString()),
D = Convert.ToSingle(entity.TxtD.MCValue.ToString()),
E = Convert.ToSingle(entity.TxtE.MCValue.ToString()),
F = Convert.ToSingle(entity.TxtF.MCValue.ToString()),
G = Convert.ToSingle(entity.TxtG.MCValue.ToString()),
H = Convert.ToSingle(entity.TxtH.MCValue.ToString()),
I = Convert.ToSingle(entity.TxtI.MCValue.ToString()),
J = Convert.ToSingle(entity.TxtJ.MCValue.ToString()),
K = Convert.ToSingle(entity.TxtK.MCValue.ToString()),
L = Convert.ToSingle(entity.TxtL.MCValue.ToString()),
M = Convert.ToSingle(entity.TxtM.MCValue.ToString()),
N = Convert.ToSingle(entity.TxtN.MCValue.ToString()),
O = Convert.ToSingle(entity.TxtO.MCValue.ToString()),
Delay1=Convert.ToUInt16(entity.TxtDelay1.MCValue.ToString()),
Delay2 = Convert.ToUInt16(entity.TxtDelay2.MCValue.ToString()),
Delay3 = Convert.ToUInt16(entity.TxtDelay3.MCValue.ToString()),
};
DB120WriteHelp.AddABCDEF(d);
}
public static void DownPipe(PipeEntity pipe)
{
var y = new Pipe()
{
MainPipieA = Convert.ToSingle(pipe.MainA.MCValue),
AuxPipieA = Convert.ToSingle(pipe.AuxA.MCValue),
MainPipieB = Convert.ToSingle(pipe.MainB.MCValue),
AuxPipieB = Convert.ToSingle(pipe.AuxB.MCValue),
MainPipieC = Convert.ToSingle(pipe.MainC.MCValue),
AuxPipieC = Convert.ToSingle(pipe.AuxC.MCValue),
UpperPressure = Convert.ToSingle(pipe.Upper.MCValue),
LowerPressure = Convert.ToSingle(pipe.Lower.MCValue)
};
DB92WriterHelp.Add(y) ;
}
}
}

@ -17,7 +17,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
{
MCButtonEntity ButtonE = new MCButtonEntity();
MCTextboxEntity BoxE = new MCTextboxEntity();
SlioEntity slioEntity = new SlioEntity();
PipeEntity pipe = new PipeEntity();
List<Control> Controls;
public void Run(RuntimeParameter runtime)
@ -35,6 +37,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
{
ControlsHelper.ControlImport<MCButton>(ButtonE, Controls);
ControlsHelper.ControlImport<MCTextBox>(BoxE, Controls);
ControlsHelper.ControlImport<MCTextBox>(slioEntity, Controls);
ControlsHelper.ControlImport<MCTextBox>(pipe, Controls);
}
public void ButtonAction(RuntimeParameter runtime)
@ -50,6 +55,32 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliverPressureSetting
PlcDownload.PressureSettingDownload(BoxE);
}
if(ButtonE.MCButtonA == runtime.Sender)
{
if (MessageBox.Show("确定要下传数据到PLC", "下传数据确认", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
PlcDownload.DownSlio(slioEntity);
MessageBox.Show("下传成功");
}
if (ButtonE.MCButtonC == runtime.Sender)
{
if (MessageBox.Show("确定要下传数据到PLC", "下传数据确认", MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
PlcDownload.DownPipe(pipe);
MessageBox.Show("下传成功");
}
}
}

Loading…
Cancel
Save