高低料位

dep_deliver
我叫锄头 10 months ago
parent 512797cdf8
commit 9c0b8000e6

@ -198,8 +198,61 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver
DBOtherSetData();
AlarmControl();
SetSilo();
}
/// <summary>
/// 显示高低料位
/// </summary>
public void SetSilo()
{
var db139 = new DB139Helper();
// ControlsImprot.SetSwitchLight
var obj = SwitchlightE.HSiloA;
var list= db139.LowLevel;
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloA, list[0]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloB, list[1]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloC, list[2]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloD, list[3]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloE, list[4]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloF, list[5]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloG, list[6]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloH, list[7]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloI, list[8]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloJ, list[9]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloK, list[10]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloL, list[11]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloM, list[12]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloM, list[13]);
ControlsImprot.SetSwitchLight(SwitchlightE.LSiloO, list[14]);
list = db139.HowLevel;
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloA, list[0]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloB, list[1]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloC, list[2]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloD, list[3]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloE, list[4]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloF, list[5]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloG, list[6]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloH, list[7]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloI, list[8]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloJ, list[9]);
//ControlsImprot.SetSwitchLight(SwitchlightE.LSiloK, list[10]);
//ControlsImprot.SetSwitchLight(SwitchlightE.LSiloL, list[11]);
//ControlsImprot.SetSwitchLight(SwitchlightE.LSiloM, list[12]);
//ControlsImprot.SetSwitchLight(SwitchlightE.LSiloM, list[13]);
ControlsImprot.SetSwitchLight(SwitchlightE.HSiloO, list[10]);
}
#region plc读取前端控件值写入
private void DB1GetData()

@ -191,7 +191,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjDeliver.Entity
public SwitchLight HSiloB { get; set; }
public SwitchLight HSiloC { get; set; }
public SwitchLight HSiloD { get; set; }
public SwitchLight HSiloE { get; set; }
public SwitchLight HSiloE { get; set; }
public SwitchLight HSiloF { get; set; }
public SwitchLight HSiloG { get; set; }
public SwitchLight HSiloH { get; set; }

@ -0,0 +1,81 @@
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.DBHelpers
{
public class DB139Helper: DBHelper
{
public DB139Helper()
{
OperateResult<byte[]> db = PlcConnect.Instance.Read("DB139.0.0", 32);
bytes = db.Content;
}
public List<bool> LowLevel
{
get
{
List<bool> result = new List<bool>();
byte[] content = bytes.Skip(0).Take(2).ToArray();
var con = content[0];
result.Add(con.GetBit(0));
result.Add(con.GetBit(1));
result.Add(con.GetBit(2));
result.Add(con.GetBit(3));
result.Add(con.GetBit(4));
result.Add(con.GetBit(5));
result.Add(con.GetBit(6));
result.Add(con.GetBit(7));
con = content[1];
result.Add(con.GetBit(0));
result.Add(con.GetBit(1));
result.Add(con.GetBit(2));
result.Add(con.GetBit(3));
result.Add(con.GetBit(4));
result.Add(con.GetBit(5));
result.Add(con.GetBit(6));
return result;
}
}
public List<bool> HowLevel
{
get
{
OperateResult<byte[]> db = PlcConnect.Instance.Read("M1023.0", 2);
List<bool> result = new List<bool>();
byte[] content = db.Content.ToArray();
var con = content[0];
result.Add(con.GetBit(0));
result.Add(con.GetBit(1));
result.Add(con.GetBit(2));
result.Add(con.GetBit(3));
result.Add(con.GetBit(4));
result.Add(con.GetBit(5));
result.Add(con.GetBit(6));
result.Add(con.GetBit(7));
con = content[1];
result.Add(con.GetBit(0));
result.Add(con.GetBit(1));
result.Add(con.GetBit(2));
return result;
}
}
}
}

@ -54,6 +54,7 @@
<Compile Include="DBHelpers\DB120WriteHelp.cs" />
<Compile Include="DBHelpers\DB137Helper.cs" />
<Compile Include="DBHelpers\DB137WriterHelper.cs" />
<Compile Include="DBHelpers\DB139Helper.cs" />
<Compile Include="DBHelpers\DB141Helper.cs" />
<Compile Include="DBHelpers\DB191Helper.cs" />
<Compile Include="DBHelpers\DB191WriteHelper.cs" />

Loading…
Cancel
Save