change - PLC读取机制更改为一次读取整个数据块,性能优化成功 add - 黑粉统计报表添加最近班次统计功能

dep_nodyang
wangsr 1 year ago
parent 23b27f9eb8
commit 5b089e9709

@ -26,16 +26,23 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
private RuntimeParameter _runtime;
MCButton btnOk;
MCButton selectButton;
MCButton WhiteWork;
MCButton NightWork;
MCDateTimePicker mCDateTimePicker;
MCDateTimePicker startDate;
MCDateTimePicker startTime;
MCDateTimePicker endDate;
MCDateTimePicker endTime;
MCDataGridView dataGridView;
MCDataGridView moreData;
DataTable dt;
DataTable MoreDataTable;
List<DayWhiteEmbryoEntity> list;
List<DayWhiteEmbryoEntity> listMore;
public void Run(RuntimeParameter runtime)
{
@ -47,6 +54,8 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
btnOk = control.FirstOrDefault(x => x.Name == "MCButton1") as MCButton;
dataGridView = control.FirstOrDefault(x => x.Name == "MCDataGridView1") as MCDataGridView;
selectButton = control.FirstOrDefault(x => x.Name == "SelectButton") as MCButton;
WhiteWork = control.FirstOrDefault(x => x.Name == "WhiteWork") as MCButton;
NightWork = control.FirstOrDefault(x => x.Name == "NightWork") as MCButton;
moreData = control.FirstOrDefault(x => x.Name == "MoreData") as MCDataGridView;
startDate = control.FirstOrDefault(x => x.Name == "startDate") as MCDateTimePicker;
startTime = control.FirstOrDefault(x => x.Name == "startTime") as MCDateTimePicker;
@ -56,10 +65,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
mCDateTimePicker.Value = DateTime.Now.AddDays(0);
startDate.Value = DateTime.Now.AddDays(-1);
startTime.Value = Convert.ToDateTime(DateTime.Now.ToString("08:00:00"));
//startTime.Value = Convert.ToDateTime(DateTime.Now.ToString("08:00:00"));
endTime.Value = Convert.ToDateTime(DateTime.Now.ToString("20:00:00"));
//endTime.Value = Convert.ToDateTime(DateTime.Now.ToString("20:00:00"));
dt = new DataTable();
dt.Columns.Add("机台", typeof(string));
@ -72,7 +80,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
btnOk.Click += BtnOk_Click;
selectButton.Click += SelectButton_Click;
dataGridView.CellClick += MoreData_Click;
dataGridView.CellValueChanged += MoreData_Click;
WhiteWork.Click += WhiteWork_Click;
NightWork.Click += NightWork_Click;
}
private void BtnOk_Click(object sender, EventArgs e)
@ -81,19 +91,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
string time = mCDateTimePicker.Value.ToString("yyyyMMdd");
list = FreeSqlUnit.Instance.Select<DayWhiteEmbryoEntity>().Where(x => x.CreateDate == time).ToList();
for (int i = 1; i <= 8; i++)
{
var dr = dt.NewRow();
dr[0] = "糊化机" + i;
var totalWeight = list.Where(x => x.DeviceId == i).Sum(x => x.Weight);
dr[1] = totalWeight.ToString();
dt.Rows.Add(dr);
}
dataGridView.DataSource = null;
dataGridView.DataSource = dt;
DataTableSum();
}
private void SelectButton_Click(object sender, EventArgs e)
@ -102,21 +100,9 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
DateTime starttime = startDate.Value.Date.AddHours(startTime.Value.Hour).AddMinutes(startTime.Value.Minute).AddSeconds(startTime.Value.Second);
DateTime endtime = endDate.Value.Date.AddHours(endTime.Value.Hour).AddMinutes(endTime.Value.Minute).AddSeconds(endTime.Value.Second);
list = FreeSqlUnit.Instance.Select<DayWhiteEmbryoEntity>().Where(x => (x.CreateTime >= starttime && x.CreateTime <= endtime)).ToList();
for(int i = 1; i <= 8; i++)
{
var dr = dt.NewRow();
dr[0] = "糊化机" + i;
var totalWeight = list.Where(x => x.DeviceId == i).Sum(x => x.Weight);
dr[1] = totalWeight.ToString();
dt.Rows.Add(dr);
}
dataGridView.DataSource = null;
dataGridView.DataSource = dt;
DataTableSum();
}
private void MoreData_Click(object sender, EventArgs e)
@ -127,6 +113,10 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
char[] a = dID.ToCharArray();
char chr = a[3];
if (chr == '和')
{
return;
}
int num = int.Parse(chr.ToString());
listMore = list.Where(x => x.DeviceId == num).ToList();
@ -142,5 +132,77 @@ namespace Mesnac.Action.ChemicalWeighing.LjReport.DayWhiteEmbryo
moreData.DataSource = MoreDataTable;
}
private void WhiteWork_Click(object sender, EventArgs e)
{
dt.Rows.Clear();
DateTime nowTime = DateTime.Now;
DateTime starttime;
DateTime endtime;
//如果大于当天8点 就展示当天的白班 否则展示上一个白班
if (nowTime >= DateTime.Now.Date.AddHours(8))
{
starttime = DateTime.Now.Date.AddHours(8);
endtime = DateTime.Now.Date.AddHours(20);
}
else
{
starttime = DateTime.Now.Date.AddHours(-16);
endtime = DateTime.Now.Date.AddHours(-4);
}
list = FreeSqlUnit.Instance.Select<DayWhiteEmbryoEntity>().Where(x => (x.CreateTime >= starttime && x.CreateTime <= endtime)).ToList();
DataTableSum();
}
private void NightWork_Click(Object sender, EventArgs e)
{
dt.Rows.Clear();
DateTime nowTime = DateTime.Now;
DateTime starttime;
DateTime endtime;
//如果小于当天20点 就展示当天的前一个晚班
if (nowTime <= DateTime.Now.Date.AddHours(20))
{
starttime = DateTime.Now.Date.AddHours(-4);
endtime = DateTime.Now.Date.AddHours(8);
}
else
{
starttime = DateTime.Now.Date.AddHours(20);
endtime = DateTime.Now.Date.AddHours(32);
}
list = FreeSqlUnit.Instance.Select<DayWhiteEmbryoEntity>().Where(x => (x.CreateTime >= starttime && x.CreateTime <= endtime)).ToList();
DataTableSum();
}
private void DataTableSum()
{
for (int i = 1; i <= 8; i++)
{
var dr = dt.NewRow();
dr[0] = "糊化机" + i;
var totalWeight = list.Where(x => x.DeviceId == i).Sum(x => x.Weight);
dr[1] = totalWeight.ToString();
dt.Rows.Add(dr);
}
var edr = dt.NewRow();
edr[0] = "生产总和";
edr[1] = list.Sum(x => x.Weight).ToString();
dt.Rows.Add(edr);
dataGridView.DataSource = null;
dataGridView.DataSource = dt;
}
}
}

@ -1266,17 +1266,19 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
if (DB2103.DM2ASF01.Running)
{
if (DB2103.DM2ASF01.Polarity)
{
//if (DB2103.DM2ASF01.Polarity)
//{
// DM2ASF01L_Set = true;
// DM2ASF01R_Set = false;
//}
//else
//{
// DM2ASF01L_Set = false;
// DM2ASF01R_Set = true;
//}
DM2ASF01L_Set = true;
DM2ASF01R_Set = false;
}
else
{
DM2ASF01L_Set = false;
DM2ASF01R_Set = true;
}
}
else
{
DM2ASF01L_Set = false;
@ -1285,17 +1287,19 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
if (DB2103.DM2BSF01.Running)
{
if (DB2103.DM2BSF01.Polarity)
{
//if (DB2103.DM2BSF01.Polarity)
//{
// DM2BSF01L_Set = true;
// DM2BSF01R_Set = false;
//}
//else
//{
// DM2BSF01L_Set = false;
// DM2BSF01R_Set = true;
//}
DM2BSF01L_Set = true;
DM2BSF01R_Set = false;
}
else
{
DM2BSF01L_Set = false;
DM2BSF01R_Set = true;
}
}
else
{
DM2BSF01L_Set = false;
@ -1304,17 +1308,19 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
if (DB2103.DM2CSF01.Running)
{
if (DB2103.DM2CSF01.Polarity)
{
//if (DB2103.DM2CSF01.Polarity)
//{
// DM2CSF01L_Set = true;
// DM2CSF01R_Set = false;
//}
//else
//{
// DM2CSF01L_Set = false;
// DM2CSF01R_Set = true;
//}
DM2CSF01L_Set = true;
DM2CSF01R_Set = false;
}
else
{
DM2CSF01L_Set = false;
DM2CSF01R_Set = true;
}
}
else
{
DM2CSF01L_Set = false;
@ -1323,17 +1329,19 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
if (DB2103.DM2DSF01.Running)
{
if (DB2103.DM2DSF01.Polarity)
{
//if (DB2103.DM2DSF01.Polarity)
//{
// DM2DSF01L_Set = true;
// DM2DSF01R_Set = false;
//}
//else
//{
// DM2DSF01L_Set = false;
// DM2DSF01R_Set = true;
//}
DM2DSF01L_Set = true;
DM2DSF01R_Set = false;
}
else
{
DM2DSF01L_Set = false;
DM2DSF01R_Set = true;
}
}
else
{
DM2DSF01L_Set = false;
@ -1774,9 +1782,9 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
if (conCurrentCache.Count == 0)
{
MesnacServiceManager.Instance.LoggingService.Info("开始");
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
//MesnacServiceManager.Instance.LoggingService.Info("开始");
//Stopwatch stopwatch = new Stopwatch();
//stopwatch.Start();
conCurrentCache.TryAdd("plc", DateTime.Now);
@ -1785,30 +1793,27 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
// NewThreadDb2103();
// NewThreadDb2107();
OperateResult<byte[]> db2102All=PlcConnect.Instance.Read("DB2102.0.0", 214);
OperateResult<byte[]> db2103All=PlcConnect.Instance.Read("DB2103.0.0", 418);
OperateResult<byte[]> db2107All = PlcConnect.Instance.Read("DB2107.0.0", 2057);
DB2102 = new DB2102Helper(db2102All.Content);
DB2103 = new DB2103Helper(db2103All.Content);
DB2102 = new DB2102Helper();
DB2103 = new DB2103Helper();
// DB2107 = new DB2107Helper();
NewThreadDb2102();
NewThreadDb2103();
// DB2103 = new DB2103Helper();
// DB2107 = new DB2107Helper();
DB2107 = new DB2107Helper();
NewThreadDb2107();
conCurrentCache.Clear();
stopwatch.Stop();
var send = stopwatch.ElapsedMilliseconds;
MesnacServiceManager.Instance.LoggingService.Info("线束"+ send);
//stopwatch.Stop();
//var send = stopwatch.ElapsedMilliseconds;
//MesnacServiceManager.Instance.LoggingService.Info("结束"+ send);
conCurrentCache.Clear();
}
else
{
MesnacServiceManager.Instance.LoggingService.Info("被过滤");
MesnacServiceManager.Instance.LoggingService.Info("设备细节画面读数线程被过滤");
}
}
catch(Exception ex)
@ -2169,8 +2174,8 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl
timer.Dispose();
}
NewThread("");
// ThreadPool.QueueUserWorkItem(new WaitCallback());
ThreadPool.QueueUserWorkItem(new WaitCallback(NewThread));
}

@ -17,6 +17,12 @@ namespace DataBlockHelper.DBHelpers
_bytes = bytes;
}
public DB2102Helper()
{
OperateResult<byte[]> db2102All = PlcConnect.Instance.Read("DB2102.0.0", 214);
_bytes = db2102All.Content;
}
public FOR_VALVE_DoubleEntity DV2PCP01 => new FOR_VALVE_DoubleEntity(130, _bytes);
public FOR_VALVE_DoubleEntity DV2PCP02 => new FOR_VALVE_DoubleEntity(132, _bytes);
public FOR_VALVE_DoubleEntity DV2PCP03 => new FOR_VALVE_DoubleEntity(134, _bytes);

@ -17,6 +17,11 @@ namespace DataBlockHelper.DBHelpers
_bytes = bytes;
}
public DB2103Helper()
{
OperateResult<byte[]> db2103All = PlcConnect.Instance.Read("DB2103.0.0", 418);
_bytes = db2103All.Content;
}
// public OperateResult<byte[]> GetAll=>PlcConnect.Instance.Read("DB2103.0.0", 418,_bytes);

@ -10,42 +10,48 @@ namespace DataBlockHelper.DBHelpers
{
public class DB2104Helper
{
public RecipeCommEntity RecipeComm => RecipeCom();
byte[] bytes;
private RecipeCommEntity RecipeCom()
public DB2104Helper()
{
return new RecipeCommEntity();
this.bytes = PlcConnect.Instance.Read("DB2104.0.0", 3578).Content;
}
public RecipeCommEntity RecipeComm => RecipeCom(bytes);
public EnableStatusEntity EnableStatus => EnableS();
private RecipeCommEntity RecipeCom(byte[] bytes)
{
return new RecipeCommEntity(bytes);
}
public EnableStatusEntity EnableStatus => EnableS(bytes);
private EnableStatusEntity EnableS()
private EnableStatusEntity EnableS(byte[] bytes)
{
return new EnableStatusEntity();
return new EnableStatusEntity(bytes);
}
public DryerEntity Dryer_D1 => new DryerEntity(58);
public DryerEntity Dryer_D2 => new DryerEntity(218);
public DryerEntity Dryer_D3 => new DryerEntity(378);
public DryerEntity Dryer_D4 => new DryerEntity(538);
public GelatEntity Gelat_G1 => new GelatEntity(698);
public GelatEntity Gelat_G2 => new GelatEntity(858);
public GelatEntity Gelat_G3 => new GelatEntity(1018);
public GelatEntity Gelat_G4 => new GelatEntity(1178);
public GelatEntity Gelat_G5 => new GelatEntity(1338);
public GelatEntity Gelat_G6 => new GelatEntity(1498);
public GelatEntity Gelat_G7 => new GelatEntity(1658);
public GelatEntity Gelat_G8 => new GelatEntity(1818);
public WeterEntity Weter_M1 => new WeterEntity(1978);
public WeterEntity Weter_M2 => new WeterEntity(2178);
public WeterEntity Weter_M3 => new WeterEntity(2378);
public WeterEntity Weter_M4 => new WeterEntity(2578);
public WeterEntity Weter_M5 => new WeterEntity(2778);
public WeterEntity Weter_M6 => new WeterEntity(2978);
public WeterEntity Weter_M7 => new WeterEntity(3178);
public WeterEntity Weter_M8 => new WeterEntity(3378);
public DryerEntity Dryer_D1 => new DryerEntity(58, bytes);
public DryerEntity Dryer_D2 => new DryerEntity(218, bytes);
public DryerEntity Dryer_D3 => new DryerEntity(378, bytes);
public DryerEntity Dryer_D4 => new DryerEntity(538, bytes);
public GelatEntity Gelat_G1 => new GelatEntity(698, bytes);
public GelatEntity Gelat_G2 => new GelatEntity(858, bytes);
public GelatEntity Gelat_G3 => new GelatEntity(1018, bytes);
public GelatEntity Gelat_G4 => new GelatEntity(1178, bytes);
public GelatEntity Gelat_G5 => new GelatEntity(1338, bytes);
public GelatEntity Gelat_G6 => new GelatEntity(1498, bytes);
public GelatEntity Gelat_G7 => new GelatEntity(1658, bytes);
public GelatEntity Gelat_G8 => new GelatEntity(1818, bytes);
public WeterEntity Weter_M1 => new WeterEntity(1978, bytes);
public WeterEntity Weter_M2 => new WeterEntity(2178, bytes);
public WeterEntity Weter_M3 => new WeterEntity(2378, bytes);
public WeterEntity Weter_M4 => new WeterEntity(2578, bytes);
public WeterEntity Weter_M5 => new WeterEntity(2778, bytes);
public WeterEntity Weter_M6 => new WeterEntity(2978, bytes);
public WeterEntity Weter_M7 => new WeterEntity(3178, bytes);
public WeterEntity Weter_M8 => new WeterEntity(3378, bytes);
}

@ -10,9 +10,14 @@ namespace DataBlockHelper.DBHelpers
{
public class DB2105Helper
{
public List<PlanEntity> Plan => new PlanArrayManager(4, 0, 12).GetList();
public bool[] Status => new FourBoolArrayManager(48).GetList();
public bool[] End => new FourBoolArrayManager(50).GetList();
byte[] bytes;
public DB2105Helper()
{
this.bytes = PlcConnect.Instance.Read("DB2105.0.0", 52).Content;
}
public List<PlanEntity> Plan => new PlanArrayManager(4, 0, 12, bytes).GetList();
public bool[] Status => new FourBoolArrayManager(48, bytes).GetList();
public bool[] End => new FourBoolArrayManager(50, bytes).GetList();
}
}

@ -10,8 +10,13 @@ namespace DataBlockHelper.DBHelpers
{
public class DB2106Helper
{
public DryerReportEntity DryReport => new DryerReportEntity(0);
public GelReportEntity GelReport => new GelReportEntity(1072);
public WetMixingEntity WetReport => new WetMixingEntity(3568);
byte[] bytes;
public DB2106Helper()
{
this.bytes = PlcConnect.Instance.Read("DB2106.0.0", 5648).Content;
}
public DryerReportEntity DryReport => new DryerReportEntity(0, bytes);
public GelReportEntity GelReport => new GelReportEntity(1072, bytes);
public WetMixingEntity WetReport => new WetMixingEntity(3568, bytes);
}
}

@ -10,77 +10,81 @@ namespace DataBlockHelper.DBHelpers
{
public class DB2107Helper
{
private byte[] _bytes;
public DB2107Helper()
{
_bytes = PlcConnect.Instance.Read("DB2107.0.0", 2063).Content;
}
// public OperateResult<byte[]> GetAll=>PlcConnect.Instance.Read("DB2107.0.0", 2057);
public NormalStatusEntity NormalStatus => NormalS();
public NormalStatusEntity NormalStatus => NormalS(_bytes);
private NormalStatusEntity NormalS()
private NormalStatusEntity NormalS(byte[] bytes)
{
return new NormalStatusEntity();
return new NormalStatusEntity(bytes);
}
public ControlSignEntity ControlSign => ControlS();
public ControlSignEntity ControlSign => ControlS(_bytes);
private ControlSignEntity ControlS()
private ControlSignEntity ControlS(byte[] bytes)
{
return new ControlSignEntity();
return new ControlSignEntity(bytes);
}
public PressureEntity Pressure => Press();
public PressureEntity Pressure => Press(_bytes);
private PressureEntity Press()
private PressureEntity Press(byte[] bytes)
{
return new PressureEntity();
return new PressureEntity(bytes);
}
public PIDEntity PID => Pid();
public PIDEntity PID => Pid(_bytes);
private PIDEntity Pid()
private PIDEntity Pid(byte[] bytes)
{
return new PIDEntity();
return new PIDEntity(bytes);
}
public WeightEntity Weight => Weigh();
public WeightEntity Weight => Weigh(_bytes);
private WeightEntity Weigh()
private WeightEntity Weigh(byte[] bytes)
{
return new WeightEntity();
return new WeightEntity(bytes);
}
public WeightPraEntity WeightPra => WeightP();
public WeightPraEntity WeightPra => WeightP(_bytes);
private WeightPraEntity WeightP()
private WeightPraEntity WeightP(byte[] bytes)
{
return new WeightPraEntity();
return new WeightPraEntity(bytes);
}
public SpeedEntity Speed => Spee();
public SpeedEntity Speed => Spee(_bytes);
private SpeedEntity Spee()
private SpeedEntity Spee(byte[] bytes)
{
return new SpeedEntity();
return new SpeedEntity(bytes);
}
public List<UntiStatusHMIArrayEntity> Dryer => new UntiStatusHMIArrayManager(4, 1408, 32).GetList();
public List<UntiStatusHMIArrayEntity> Gelater => new UntiStatusHMIArrayManager(8, 1536, 32).GetList();
public List<UntiStatusHMIArrayEntity> Weter => new UntiStatusHMIArrayManager(8, 1792, 32).GetList();
public List<UntiStatusHMIArrayEntity> Dryer => new UntiStatusHMIArrayManager(4, 1408, 32, _bytes).GetList();
public List<UntiStatusHMIArrayEntity> Gelater => new UntiStatusHMIArrayManager(8, 1536, 32, _bytes).GetList();
public List<UntiStatusHMIArrayEntity> Weter => new UntiStatusHMIArrayManager(8, 1792, 32, _bytes).GetList();
public ValveEntity Valve => Val();
public ValveEntity Valve => Val(_bytes);
private ValveEntity Val()
private ValveEntity Val(byte[] bytes)
{
return new ValveEntity();
return new ValveEntity(bytes);
}
public LevelEntity Level => Lev();
public LevelEntity Level => Lev(_bytes);
private LevelEntity Lev()
private LevelEntity Lev(byte[] bytes)
{
return new LevelEntity();
return new LevelEntity(bytes);
}

@ -54,9 +54,9 @@
<Compile Include="DBHelpers\DB2104Helper.cs" />
<Compile Include="DBHelpers\DB2105Helper.cs" />
<Compile Include="DBHelpers\DB2106Helper.cs" />
<Compile Include="DBHelpers\DB2107Helper.cs" />
<Compile Include="DBHelpers\DB90Helper.cs" />
<Compile Include="DBHelpers\DB91Helper.cs" />
<Compile Include="DBHelpers\DB2107Helper.cs" />
<Compile Include="DbWrite\PlcWriteUtil.cs" />
<Compile Include="Entity\ClickEntity.cs" />
<Compile Include="Entity\DB1Entity\ForAoaLogInFC3005Entity.cs" />
@ -75,6 +75,12 @@
<Compile Include="Entity\DB2106Entity\DryReportEntity.cs" />
<Compile Include="Entity\DB2106Entity\GelReportEntity.cs" />
<Compile Include="Entity\DB2106Entity\WetReportEntity.cs" />
<Compile Include="Entity\DB2108Helper.cs" />
<Compile Include="Entity\DB90Entity\ForValveDoubleEntity.cs" />
<Compile Include="Entity\DB90Entity\ForValveSingleEntity.cs" />
<Compile Include="Entity\DB91Entity\ForMotorEntity.cs" />
<Compile Include="Entity\DB91Entity\ForMotorSToTEntity.cs" />
<Compile Include="Entity\DB91Entity\ForMotorVFD.cs" />
<Compile Include="Entity\DB2107Entity\ControlSignEntity.cs" />
<Compile Include="Entity\DB2107Entity\LevelEntity.cs" />
<Compile Include="Entity\DB2107Entity\NormalStatusEntity.cs" />
@ -85,18 +91,13 @@
<Compile Include="Entity\DB2107Entity\ValveEntity.cs" />
<Compile Include="Entity\DB2107Entity\WeightEntity.cs" />
<Compile Include="Entity\DB2107Entity\WeightPraEntity.cs" />
<Compile Include="Entity\DB2108Helper.cs" />
<Compile Include="Entity\DB90Entity\ForValveDoubleEntity.cs" />
<Compile Include="Entity\DB90Entity\ForValveSingleEntity.cs" />
<Compile Include="Entity\DB91Entity\ForMotorEntity.cs" />
<Compile Include="Entity\DB91Entity\ForMotorSToTEntity.cs" />
<Compile Include="Entity\DB91Entity\ForMotorVFD.cs" />
<Compile Include="PlcConnect.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

@ -10,7 +10,7 @@ namespace DataBlockHelper.Entity.DB2102Entity
{
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
byte[] content = { bytes[startSet], bytes[startSet + 1] };
byte[] content = bytes.Skip(startSet).Take(2).ToArray();
byte byt = content[0];

@ -1,5 +1,5 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2102Entity
{
@ -9,7 +9,7 @@ namespace DataBlockHelper.Entity.DB2102Entity
{
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2102." + startSet + ".0", 2);
byte[] content = { bytes[startSet], bytes[startSet + 1] };
byte[] content = bytes.Skip(startSet).Take(2).ToArray();
byte byt = content[0];

@ -1,5 +1,6 @@
using HslCommunication;
using System.Linq;
using System.Security.Cryptography;
namespace DataBlockHelper.Entity.DB2103Entity
{
@ -10,7 +11,7 @@ namespace DataBlockHelper.Entity.DB2103Entity
// OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2103." + startSet + ".0", 2);
byte[] content = { bytes[startSet], bytes[startSet + 1] };
byte[] content = bytes.Skip(startSet).Take(2).ToArray();
//var content = read.Content;

@ -8,12 +8,9 @@ namespace DataBlockHelper.Entity.DB2103Entity
{
public FOR_MOTOR_VFDEntity(ushort startSet,byte []bytes)
{
byte[] content = new byte[14];
for (int i = 0; i < 14; i++)
{
content[i] = bytes[startSet + i];
}
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2103." + startSet + ".0", 14);
var content = bytes.Skip(startSet).Take(14).ToArray();
byte byt = content[0];
@ -34,12 +31,9 @@ namespace DataBlockHelper.Entity.DB2103Entity
Enable = byt.GetBit(3);
Polarity = byt.GetBit(4);
// bt.Skip(2).Take(4).ToArray()
var con = content.Skip(2).Take(12).ToArray();
SetSpeed_A = PlcConnect.Instance.ByteTransform.TransSingle(con, 0);
SetSpeed_M = PlcConnect.Instance.ByteTransform.TransSingle(con, 4);
ACT_Speed = PlcConnect.Instance.ByteTransform.TransSingle(con, 8);
SetSpeed_A = PlcConnect.Instance.ByteTransform.TransSingle(content, 2);
SetSpeed_M = PlcConnect.Instance.ByteTransform.TransSingle(content, 6);
ACT_Speed = PlcConnect.Instance.ByteTransform.TransSingle(content, 10);
}

@ -9,23 +9,27 @@ namespace DataBlockHelper.Entity.DB2104Entity
public class DryerEntity
{
private int StartSet;
public DryerEntity(int startSet)
private byte[] Bytes;
public DryerEntity(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public DaybinE Daybin => new DaybinE(StartSet);
public List<Recipe_GmixE> Step => new RecipeArrayManager(10, StartSet + 40, 12).GetRecipe_GmixEList();
public DaybinE Daybin => new DaybinE(StartSet, Bytes);
public List<Recipe_GmixE> Step => new RecipeArrayManager(10, StartSet + 40, 12, Bytes).GetRecipe_GmixEList();
}
public class DaybinE
{
private int StartSet;
public DaybinE(int startSet)
private byte[] Bytes;
public DaybinE(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public List<Recipe_DosE> Recipe => new RecipeArrayManager(4, StartSet, 10).GetRecipe_DosEList();
public List<Recipe_DosE> Recipe => new RecipeArrayManager(4, StartSet, 10, Bytes).GetRecipe_DosEList();
}
public class Recipe_DosE
@ -64,19 +68,20 @@ namespace DataBlockHelper.Entity.DB2104Entity
private int Length;
private int StartSet;
private int SLength;
public RecipeArrayManager(ushort length, int startSet, int sLength)
private byte[] Bytes;
public RecipeArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
Bytes = bytes;
}
public List<Recipe_GmixE> GetRecipe_GmixEList()
{
List<Recipe_GmixE> ListE = new List<Recipe_GmixE>(Length);
var getListE = PlcConnect.Instance.Read("DB2104." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2104." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{
@ -89,8 +94,8 @@ namespace DataBlockHelper.Entity.DB2104Entity
public List<Recipe_DosE> GetRecipe_DosEList()
{
List<Recipe_DosE> ListE = new List<Recipe_DosE>(Length);
var getListE = PlcConnect.Instance.Read("DB2104." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2104." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -1,15 +1,15 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2104Entity
{
public class EnableStatusEntity
{
public EnableStatusEntity()
public EnableStatusEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2104.52.0", 5);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2104.52.0", 5);
var content = read.Content;
var content = bytes.Skip(52).Take(5).ToArray(); ;
byte byt = content[0];

@ -9,36 +9,43 @@ namespace DataBlockHelper.Entity.DB2104Entity
public class GelatEntity
{
private int StartSet;
public GelatEntity(int startSet)
private byte[] Bytes;
public GelatEntity(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public WDaybinE Daybin => new WDaybinE(StartSet);
public WaterSCE WaterSC => new WaterSCE(StartSet);
public List<Recipe_GmixE> Step => new RecipeArrayManager(10, StartSet + 40, 12).GetRecipe_GmixEList();
public WDaybinE Daybin => new WDaybinE(StartSet, Bytes);
public WaterSCE WaterSC => new WaterSCE(StartSet, Bytes);
public List<Recipe_GmixE> Step => new RecipeArrayManager(10, StartSet + 40, 12, Bytes).GetRecipe_GmixEList();
}
public class WDaybinE
{
private int StartSet;
public WDaybinE(int startSet)
private byte[] Bytes;
public WDaybinE(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public List<Recipe_DosE> Recipe => new RecipeArrayManager(2, StartSet, 10).GetRecipe_DosEList();
public List<Recipe_DosE> Recipe => new RecipeArrayManager(2, StartSet, 10, Bytes).GetRecipe_DosEList();
}
public class WaterSCE
{
private int StartSet;
public WaterSCE(int startSet)
private byte[] Bytes;
public WaterSCE(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public List<Recipe_DosE> Recipe => new RecipeArrayManager(2, StartSet + 20, 10).GetRecipe_DosEList();
public List<Recipe_DosE> Recipe => new RecipeArrayManager(2, StartSet + 20, 10, Bytes).GetRecipe_DosEList();
}

@ -10,11 +10,11 @@ namespace DataBlockHelper.Entity.DB2104Entity
{
public class RecipeCommEntity
{
public RecipeCommEntity()
public RecipeCommEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2104.2.0", 50);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2104.2.0", 50);
var content = read.Content;
var content = bytes.Skip(2).Take(50).ToArray();
var instanceByteTransform = PlcConnect.Instance.ByteTransform;

@ -10,11 +10,13 @@ namespace DataBlockHelper.Entity.DB2104Entity
public class WeterEntity
{
int StartSet;
public WeterEntity(int startSet)
byte[] Bytes;
public WeterEntity(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public List<Recipe_WMixE> Step => new WeterArrayManager(10, StartSet, 20).GetList();
public List<Recipe_WMixE> Step => new WeterArrayManager(10, StartSet, 20, Bytes).GetList();
}
@ -46,19 +48,21 @@ namespace DataBlockHelper.Entity.DB2104Entity
private int Length;
private int StartSet;
private int SLength;
private byte[] Bytes;
public WeterArrayManager(ushort length, int startSet, int sLength)
public WeterArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
Bytes = bytes;
}
public List<Recipe_WMixE> GetList()
{
List<Recipe_WMixE> ListE = new List<Recipe_WMixE>(Length);
var getListE = PlcConnect.Instance.Read("DB2104." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2104." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -1,21 +1,25 @@

using System.Linq;
namespace DataBlockHelper.Entity.DB2105Entity
{
public class FourBoolArrayManager
{
private int StartSet;
public FourBoolArrayManager(int startSet)
private byte[] Bytes;
public FourBoolArrayManager(int startSet, byte[] bytes)
{
StartSet = startSet;
Bytes = bytes;
}
public bool[] GetList()
{
bool[] ListE = new bool[4];
var getListE = PlcConnect.Instance.Read("DB2105." + StartSet + ".0", 1);
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2105." + StartSet + ".0", 1);
var content = Bytes.Skip(StartSet).Take(1).ToArray();
byte byt = content[0];

@ -37,18 +37,20 @@ namespace DataBlockHelper.Entity.DB2105Entity
private int Length;
private int StartSet;
private int SLength;
public PlanArrayManager(ushort length, int startSet, int sLength)
private byte[] Bytes;
public PlanArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
Bytes = bytes;
}
public List<PlanEntity> GetList()
{
List<PlanEntity> ListE = new List<PlanEntity>(Length);
var getListE = PlcConnect.Instance.Read("DB2105." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2105." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -12,26 +12,30 @@ namespace DataBlockHelper.Entity.DB2106Entity
public class DryerReportEntity
{
private int StartSet;
public DryerReportEntity(int startSet)
byte[] Bytes;
public DryerReportEntity(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public Dryer_ Dryer_A => new Dryer_(StartSet);
public Dryer_ Dryer_B => new Dryer_(StartSet + 268);
public Dryer_ Dryer_C => new Dryer_(StartSet + 536);
public Dryer_ Dryer_D => new Dryer_(StartSet + 804);
public Dryer_ Dryer_A => new Dryer_(StartSet, Bytes);
public Dryer_ Dryer_B => new Dryer_(StartSet + 268, Bytes);
public Dryer_ Dryer_C => new Dryer_(StartSet + 536, Bytes);
public Dryer_ Dryer_D => new Dryer_(StartSet + 804, Bytes);
}
public class Dryer_
{
private int StartSet;
public Dryer_(int startSet)
private byte[] Bytes;
public Dryer_(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.Bytes = bytes;
}
public List<Report_DosE> Dos => new ReportArrayManager(4, StartSet, 22).GetReport_DosEList();
public List<Report_MixE> Mix => new ReportArrayManager(10, StartSet + 88, 18).GetReport_MixEList();
public List<Report_DosE> Dos => new ReportArrayManager(4, StartSet, 22, Bytes).GetReport_DosEList();
public List<Report_MixE> Mix => new ReportArrayManager(10, StartSet + 88, 18, Bytes).GetReport_MixEList();
}
public class Report_DosE
@ -47,10 +51,10 @@ namespace DataBlockHelper.Entity.DB2106Entity
ActToler = PlcConnect.Instance.ByteTransform.TransSingle(content, 18);
}
public Report_DosE(ushort startSet)
public Report_DosE(ushort startSet, byte[] bytes)
{
var read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 22);
var content = read.Content;
//var read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 22);
var content = bytes.Skip(startSet).Take(22).ToArray();
EqNo = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
Batch = PlcConnect.Instance.ByteTransform.TransInt16(content, 2);
@ -99,19 +103,20 @@ namespace DataBlockHelper.Entity.DB2106Entity
private int Length;
private int StartSet;
private int SLength;
public ReportArrayManager(ushort length, int startSet, int sLength)
private byte[] Bytes;
public ReportArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
Bytes = bytes;
}
public List<Report_MixE> GetReport_MixEList()
{
List<Report_MixE> ListE = new List<Report_MixE>(Length);
var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{
@ -124,8 +129,8 @@ namespace DataBlockHelper.Entity.DB2106Entity
public List<Report_DosE> GetReport_DosEList()
{
List<Report_DosE> ListE = new List<Report_DosE>(Length);
var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -9,32 +9,36 @@ namespace DataBlockHelper.Entity.DB2106Entity
public class GelReportEntity
{
private int StartSet;
public GelReportEntity(int startSet)
private byte[] bytes;
public GelReportEntity(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.bytes = bytes;
}
public Gel_ Gel_A => new Gel_(StartSet);
public Gel_ Gel_B => new Gel_(StartSet + 312);
public Gel_ Gel_C => new Gel_(StartSet + 624);
public Gel_ Gel_D => new Gel_(StartSet + 936);
public Gel_ Gel_E => new Gel_(StartSet + 1248);
public Gel_ Gel_F => new Gel_(StartSet + 1560);
public Gel_ Gel_G => new Gel_(StartSet + 1872);
public Gel_ Gel_H => new Gel_(StartSet + 2184);
public Gel_ Gel_A => new Gel_(StartSet, bytes);
public Gel_ Gel_B => new Gel_(StartSet + 312, bytes);
public Gel_ Gel_C => new Gel_(StartSet + 624, bytes);
public Gel_ Gel_D => new Gel_(StartSet + 936, bytes);
public Gel_ Gel_E => new Gel_(StartSet + 1248, bytes);
public Gel_ Gel_F => new Gel_(StartSet + 1560, bytes);
public Gel_ Gel_G => new Gel_(StartSet + 1872, bytes);
public Gel_ Gel_H => new Gel_(StartSet + 2184, bytes);
}
public class Gel_
{
private int StartSet;
public Gel_(int startSet)
private byte[] bytes;
public Gel_(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.bytes = bytes;
}
public List<Report_DosE> GelDosing => new ReportArrayManager(4, StartSet, 22).GetReport_DosEList();
public Report_DosE HotWater => new Report_DosE(Convert.ToUInt16(StartSet + 88));
public Report_DosE CoolWater => new Report_DosE(Convert.ToUInt16(StartSet + 110));
public List<Report_MixE> GelMixing => new ReportArrayManager(10, StartSet + 132, 18).GetReport_MixEList();
public List<Report_DosE> GelDosing => new ReportArrayManager(4, StartSet, 22, bytes).GetReport_DosEList();
public Report_DosE HotWater => new Report_DosE(Convert.ToUInt16(StartSet + 88), bytes);
public Report_DosE CoolWater => new Report_DosE(Convert.ToUInt16(StartSet + 110), bytes);
public List<Report_MixE> GelMixing => new ReportArrayManager(10, StartSet + 132, 18, bytes).GetReport_MixEList();
}

@ -9,19 +9,21 @@ namespace DataBlockHelper.Entity.DB2106Entity
public class WetMixingEntity
{
private int StartSet;
public WetMixingEntity(int startSet)
private byte[] bytes;
public WetMixingEntity(int startSet, byte[] bytes)
{
this.StartSet = startSet;
this.bytes = bytes;
}
public List<Report_WMixE> WetMixing_A => new WetReportArrayManager(10, StartSet, 26).GetList();
public List<Report_WMixE> WetMixing_B => new WetReportArrayManager(10, StartSet + 260, 26).GetList();
public List<Report_WMixE> WetMixing_C => new WetReportArrayManager(10, StartSet + 520, 26).GetList();
public List<Report_WMixE> WetMixing_D => new WetReportArrayManager(10, StartSet + 780, 26).GetList();
public List<Report_WMixE> WetMixing_E => new WetReportArrayManager(10, StartSet + 1040, 26).GetList();
public List<Report_WMixE> WetMixing_F => new WetReportArrayManager(10, StartSet + 1300, 26).GetList();
public List<Report_WMixE> WetMixing_G => new WetReportArrayManager(10, StartSet + 1560, 26).GetList();
public List<Report_WMixE> WetMixing_H => new WetReportArrayManager(10, StartSet + 1820, 26).GetList();
public List<Report_WMixE> WetMixing_A => new WetReportArrayManager(10, StartSet, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_B => new WetReportArrayManager(10, StartSet + 260, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_C => new WetReportArrayManager(10, StartSet + 520, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_D => new WetReportArrayManager(10, StartSet + 780, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_E => new WetReportArrayManager(10, StartSet + 1040, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_F => new WetReportArrayManager(10, StartSet + 1300, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_G => new WetReportArrayManager(10, StartSet + 1560, 26, bytes).GetList();
public List<Report_WMixE> WetMixing_H => new WetReportArrayManager(10, StartSet + 1820, 26, bytes).GetList();
}
@ -61,19 +63,21 @@ namespace DataBlockHelper.Entity.DB2106Entity
private int Length;
private int StartSet;
private int SLength;
private byte[] Bytes;
public WetReportArrayManager(ushort length, int startSet, int sLength)
public WetReportArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
Bytes = bytes;
}
public List<Report_WMixE> GetList()
{
List<Report_WMixE> ListE = new List<Report_WMixE>(Length);
var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -1,15 +1,15 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class ControlSignEntity
{
public ControlSignEntity()
public ControlSignEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.10.0", 2);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.10.0", 2);
var content = read.Content;
var content = bytes.Skip(10).Take(2).ToArray();
byte byt = content[0];

@ -1,16 +1,15 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class LevelEntity
{
public LevelEntity()
public LevelEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2060.0", 3);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2060.0", 3);
var content = read.Content;
var content = bytes.Skip(2060).Take(3).ToArray();
byte byt = content[0];

@ -1,15 +1,15 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class NormalStatusEntity
{
public NormalStatusEntity()
public NormalStatusEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2.0", 7);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2.0", 7);
var content = read.Content;
var content = bytes.Skip(2).Take(7).ToArray();
WatchDog = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);

@ -1,29 +1,37 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class PIDEntity
{
public PID_HMI Convey_V1 => new PID_HMI(614);
public PID_HMI Purge_V1 => new PID_HMI(622);
public PID_HMI Convey_V2 => new PID_HMI(630);
public PID_HMI Purge_V2 => new PID_HMI(638);
public PID_HMI Convey_V3 => new PID_HMI(646);
public PID_HMI Purge_V3 => new PID_HMI(654);
public PID_HMI Convey_V4 => new PID_HMI(662);
public PID_HMI Purge_V4 => new PID_HMI(670);
public PID_HMI Convey_V5 => new PID_HMI(678);
public PID_HMI Purge_V5 => new PID_HMI(686);
byte[] bytes;
public PIDEntity(byte[] bytes)
{
this.bytes = bytes;
}
public PID_HMI Convey_V1 => new PID_HMI(614, bytes);
public PID_HMI Purge_V1 => new PID_HMI(622, bytes);
public PID_HMI Convey_V2 => new PID_HMI(630, bytes);
public PID_HMI Purge_V2 => new PID_HMI(638, bytes);
public PID_HMI Convey_V3 => new PID_HMI(646, bytes);
public PID_HMI Purge_V3 => new PID_HMI(654, bytes);
public PID_HMI Convey_V4 => new PID_HMI(662, bytes);
public PID_HMI Purge_V4 => new PID_HMI(670, bytes);
public PID_HMI Convey_V5 => new PID_HMI(678, bytes);
public PID_HMI Purge_V5 => new PID_HMI(686, bytes);
}
public class PID_HMI
{
public PID_HMI(ushort startSet)
public PID_HMI(ushort startSet, byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 8);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 8);
var content = read.Content;
var content = bytes.Skip(startSet).Take(8).ToArray();
PV = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
SV = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);

@ -1,51 +1,58 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class PressureEntity
{
public Pressure_HMI MainPress_V1 => new Pressure_HMI(12);
public Pressure_HMI TopPressure_V1 => new Pressure_HMI(26);
public Pressure_HMI LinePressure_V1 => new Pressure_HMI(40);
public Pressure_HMI MainPress_V2 => new Pressure_HMI(54);
public Pressure_HMI TopPressure_V2 => new Pressure_HMI(68);
public Pressure_HMI LinePressure_V2 => new Pressure_HMI(82);
public Pressure_HMI MainPress_V3 => new Pressure_HMI(96);
public Pressure_HMI TopPressure_V3 => new Pressure_HMI(110);
public Pressure_HMI LinePressure_V3 => new Pressure_HMI(124);
public Pressure_HMI MainPress_V4 => new Pressure_HMI(138);
public Pressure_HMI TopPressure_V4 => new Pressure_HMI(152);
public Pressure_HMI LinePressure_V4 => new Pressure_HMI(166);
public Pressure_HMI MainPress_V5 => new Pressure_HMI(180);
public Pressure_HMI TopPressure_V5 => new Pressure_HMI(194);
public Pressure_HMI LinePressure_V5 => new Pressure_HMI(208);
public Pressure_HMI PressDaybin_B1 => new Pressure_HMI(222);
public Pressure_HMI PressDaybin_B2 => new Pressure_HMI(236);
public Pressure_HMI PressDaybin_B3 => new Pressure_HMI(250);
public Pressure_HMI PressDaybin_B4 => new Pressure_HMI(264);
public Pressure_HMI PressDaybin_B5 => new Pressure_HMI(278);
public Pressure_HMI PressDaybin_B6 => new Pressure_HMI(292);
public Pressure_HMI PressDaybin_B7 => new Pressure_HMI(306);
public Pressure_HMI PressDaybin_B8 => new Pressure_HMI(320);
public Pressure_HMI PressDaybin_B9 => new Pressure_HMI(334);
public Pressure_HMI PressDaybin_B10 => new Pressure_HMI(348);
public Pressure_HMI PressDaybin_B11 => new Pressure_HMI(362);
public Pressure_HMI PressDaybin_B12 => new Pressure_HMI(376);
public Pressure_HMI PR2PCP01 => new Pressure_HMI(390);
public Pressure_HMI PR2PCP02 => new Pressure_HMI(404);
public Pressure_HMI PR2PCP03 => new Pressure_HMI(418);
byte[] bytes;
public PressureEntity(byte[] bytes)
{
this.bytes = bytes;
}
public Pressure_HMI MainPress_V1 => new Pressure_HMI(12, bytes);
public Pressure_HMI TopPressure_V1 => new Pressure_HMI(26, bytes);
public Pressure_HMI LinePressure_V1 => new Pressure_HMI(40, bytes);
public Pressure_HMI MainPress_V2 => new Pressure_HMI(54, bytes);
public Pressure_HMI TopPressure_V2 => new Pressure_HMI(68, bytes);
public Pressure_HMI LinePressure_V2 => new Pressure_HMI(82, bytes);
public Pressure_HMI MainPress_V3 => new Pressure_HMI(96, bytes);
public Pressure_HMI TopPressure_V3 => new Pressure_HMI(110, bytes);
public Pressure_HMI LinePressure_V3 => new Pressure_HMI(124, bytes);
public Pressure_HMI MainPress_V4 => new Pressure_HMI(138, bytes);
public Pressure_HMI TopPressure_V4 => new Pressure_HMI(152, bytes);
public Pressure_HMI LinePressure_V4 => new Pressure_HMI(166, bytes);
public Pressure_HMI MainPress_V5 => new Pressure_HMI(180, bytes);
public Pressure_HMI TopPressure_V5 => new Pressure_HMI(194, bytes);
public Pressure_HMI LinePressure_V5 => new Pressure_HMI(208, bytes);
public Pressure_HMI PressDaybin_B1 => new Pressure_HMI(222, bytes);
public Pressure_HMI PressDaybin_B2 => new Pressure_HMI(236, bytes);
public Pressure_HMI PressDaybin_B3 => new Pressure_HMI(250, bytes);
public Pressure_HMI PressDaybin_B4 => new Pressure_HMI(264, bytes);
public Pressure_HMI PressDaybin_B5 => new Pressure_HMI(278, bytes);
public Pressure_HMI PressDaybin_B6 => new Pressure_HMI(292, bytes);
public Pressure_HMI PressDaybin_B7 => new Pressure_HMI(306, bytes);
public Pressure_HMI PressDaybin_B8 => new Pressure_HMI(320, bytes);
public Pressure_HMI PressDaybin_B9 => new Pressure_HMI(334, bytes);
public Pressure_HMI PressDaybin_B10 => new Pressure_HMI(348, bytes);
public Pressure_HMI PressDaybin_B11 => new Pressure_HMI(362, bytes);
public Pressure_HMI PressDaybin_B12 => new Pressure_HMI(376, bytes);
public Pressure_HMI PR2PCP01 => new Pressure_HMI(390, bytes);
public Pressure_HMI PR2PCP02 => new Pressure_HMI(404, bytes);
public Pressure_HMI PR2PCP03 => new Pressure_HMI(418, bytes);
}
public class Pressure_HMI
{
public Pressure_HMI(ushort startSet)
public Pressure_HMI(ushort startSet, byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14);
var content = read.Content;
var content = bytes.Skip(startSet).Take(14).ToArray();
ActualValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
LowLimit = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);

@ -9,11 +9,11 @@ namespace DataBlockHelper.Entity.DB2107Entity
{
public class SpeedEntity
{
public SpeedEntity()
public SpeedEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.1324.0", 84);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.1324.0", 84);
var content = read.Content;
var content = bytes.Skip(1324).Take(84).ToArray();
ManSpeed_D1 = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
ManSpeed_D2 = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);

@ -46,22 +46,32 @@ namespace DataBlockHelper.Entity.DB2107Entity
private int Length;
private int StartSet;
private int SLength;
public UntiStatusHMIArrayManager(ushort length, int startSet, int sLength)
private byte[] Bytes;
/// <summary>
/// 数组处理
/// </summary>
/// <param name="length">数组长度</param>
/// <param name="startSet">数组起始偏移量</param>
/// <param name="sLength">数组单个元素长度</param>
public UntiStatusHMIArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
Bytes = bytes;
}
public List<UntiStatusHMIArrayEntity> GetList()
{
List<UntiStatusHMIArrayEntity> ListE = new List<UntiStatusHMIArrayEntity>(Length);
var getListE = PlcConnect.Instance.Read("DB2107." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
if (!getListE.IsSuccess)
{
throw new Exception(getListE.Message);
}
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2107." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
//if (!getListE.IsSuccess)
//{
// throw new Exception(getListE.Message);
//}
var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -1,15 +1,16 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class ValveEntity
{
public ValveEntity()
public ValveEntity(byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2048.0", 11);
var content = read.Content;
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2048.0", 11);
var content = bytes.Skip(2048).Take(11).ToArray();
byte byt = content[0];

@ -1,33 +1,41 @@
using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class WeightEntity
{
public Silo_HMI Hopper_1 => new Silo_HMI(432);
public Silo_HMI Hopper_2 => new Silo_HMI(446);
public Silo_HMI Hopper_3 => new Silo_HMI(460);
public Silo_HMI Hopper_4 => new Silo_HMI(474);
public Silo_HMI Vessel_1 => new Silo_HMI(488);
public Silo_HMI Vessel_2 => new Silo_HMI(502);
public Silo_HMI Vessel_3 => new Silo_HMI(516);
public Silo_HMI Vessel_4 => new Silo_HMI(530);
public Silo_HMI Vessel_5 => new Silo_HMI(544);
public Silo_HMI WScale_1 => new Silo_HMI(558);
public Silo_HMI WScale_2 => new Silo_HMI(572);
public Silo_HMI WScale_3 => new Silo_HMI(586);
public Silo_HMI WScale_4 => new Silo_HMI(600);
byte[] bytes;
public WeightEntity(byte[] bytes)
{
this.bytes = bytes;
}
public Silo_HMI Hopper_1 => new Silo_HMI(432, bytes);
public Silo_HMI Hopper_2 => new Silo_HMI(446, bytes);
public Silo_HMI Hopper_3 => new Silo_HMI(460, bytes);
public Silo_HMI Hopper_4 => new Silo_HMI(474, bytes);
public Silo_HMI Vessel_1 => new Silo_HMI(488, bytes);
public Silo_HMI Vessel_2 => new Silo_HMI(502, bytes);
public Silo_HMI Vessel_3 => new Silo_HMI(516, bytes);
public Silo_HMI Vessel_4 => new Silo_HMI(530, bytes);
public Silo_HMI Vessel_5 => new Silo_HMI(544, bytes);
public Silo_HMI WScale_1 => new Silo_HMI(558, bytes);
public Silo_HMI WScale_2 => new Silo_HMI(572, bytes);
public Silo_HMI WScale_3 => new Silo_HMI(586, bytes);
public Silo_HMI WScale_4 => new Silo_HMI(600, bytes);
}
public class Silo_HMI
{
public Silo_HMI(ushort startSet)
public Silo_HMI(ushort startSet, byte[] bytes)
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14);
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107." + startSet + ".0", 14);
var content = read.Content;
var content = bytes.Skip(startSet).Take(14).ToArray();
ActWeight = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
HighWeight = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);

@ -8,10 +8,17 @@ namespace DataBlockHelper.Entity.DB2107Entity
{
public class WeightPraEntity
{
public List<WeightParaE> Silo => new WeightParaArrayManager(15, 694, 18).GetList();
public List<WeightParaE> Daybin => new WeightParaArrayManager(12, 964, 18).GetList();
public List<WeightParaE> Hoper => new WeightParaArrayManager(4, 1180, 18).GetList();
public List<WeightParaE> Water => new WeightParaArrayManager(4, 1252, 18).GetList();
byte[] bytes;
public WeightPraEntity(byte[] bytes)
{
this.bytes = bytes;
}
public List<WeightParaE> Silo => new WeightParaArrayManager(15, 694, 18, bytes).GetList();
public List<WeightParaE> Daybin => new WeightParaArrayManager(12, 964, 18, bytes).GetList();
public List<WeightParaE> Hoper => new WeightParaArrayManager(4, 1180, 18, bytes).GetList();
public List<WeightParaE> Water => new WeightParaArrayManager(4, 1252, 18, bytes).GetList();
}
@ -41,19 +48,21 @@ namespace DataBlockHelper.Entity.DB2107Entity
private int Length;
private int StartSet;
private int SLength;
byte[] bytes;
public WeightParaArrayManager(ushort length, int startSet, int sLength)
public WeightParaArrayManager(ushort length, int startSet, int sLength, byte[] bytes)
{
Length = length;
StartSet = startSet;
SLength = sLength;
this.bytes = bytes;
}
public List<WeightParaE> GetList()
{
List<WeightParaE> ListE = new List<WeightParaE>(Length);
var getListE = PlcConnect.Instance.Read("DB2107." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = getListE.Content;
//var getListE = PlcConnect.Instance.Read("DB2107." + StartSet + ".0", Convert.ToUInt16(Length * SLength));
var content = bytes.Skip(StartSet).Take(Length * SLength).ToArray();
for (int i = 0; i < Length; i++)
{

@ -25,14 +25,101 @@
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property>
<Property name="Location">349, 12</Property>
<Property name="Name">MoreData</Property>
<Property name="Size">330, 623</Property>
<Property name="TabIndex">5</Property>
<Property name="Size">330, 622</Property>
<Property name="TabIndex">4</Property>
</Object>
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox1" children="Controls">
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="NightWork" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">夜班统计</Property>
<Property name="Location">188, 171</Property>
<Property name="Name">NightWork</Property>
<Property name="Size">120, 31</Property>
<Property name="TabIndex">12</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="WhiteWork" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">白班统计</Property>
<Property name="Location">22, 171</Property>
<Property name="Name">WhiteWork</Property>
<Property name="Size">120, 31</Property>
<Property name="TabIndex">11</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCLabel, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCLabel1" children="Controls">
<Property name="Format">
</Property>
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="Text">当前或最近一次班次统计</Property>
<Property name="Location">22, 146</Property>
<Property name="Name">MCLabel1</Property>
<Property name="Size">137, 12</Property>
</Object>
<Object type="Mesnac.Controls.Default.SpecialLabelBlue, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="SpecialLabelBlue2" children="Controls">
<Property name="Format" />
<Property name="TextName" />
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="TextAlign">MiddleCenter</Property>
<Property name="BackColor">224, 224, 224</Property>
<Property name="Location">22, 139</Property>
<Property name="Name">SpecialLabelBlue2</Property>
<Property name="Size">287, 1</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCDateTimePicker, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="endTime" children="Controls">
<Property name="ValueChangedList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
@ -199,7 +286,7 @@
<Property name="Text">统计查询</Property>
<Property name="Location">12, 12</Property>
<Property name="Name">GroupBox1</Property>
<Property name="Size">330, 145</Property>
<Property name="Size">330, 221</Property>
<Property name="TabIndex">3</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCDataGridView, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCDataGridView1" children="Controls">
@ -229,9 +316,9 @@
<Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property>
<Property name="Location">12, 163</Property>
<Property name="Location">12, 239</Property>
<Property name="Name">MCDataGridView1</Property>
<Property name="Size">330, 472</Property>
<Property name="Size">330, 395</Property>
<Property name="TabIndex">2</Property>
</Object>
<Property name="LoadActionList">

Loading…
Cancel
Save