|
|
|
|
namespace WorkerSynReport.Plc;
|
|
|
|
|
|
|
|
|
|
public class DryerReportEntity
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
byte[] Bytes;
|
|
|
|
|
public DryerReportEntity( byte[] bytes)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
this.Bytes = bytes;
|
|
|
|
|
}
|
|
|
|
|
public Dryer_ Dryer_A => new Dryer_(0, Bytes);
|
|
|
|
|
|
|
|
|
|
public Dryer_ Dryer_B => new Dryer_(466, Bytes);
|
|
|
|
|
public Dryer_ Dryer_C => new Dryer_(932, Bytes);
|
|
|
|
|
public Dryer_ Dryer_D => new Dryer_(1398, Bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Dryer_
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private byte[] Bytes;
|
|
|
|
|
int start;
|
|
|
|
|
int mixStart;
|
|
|
|
|
public Dryer_(int start, byte[] bytes)
|
|
|
|
|
{
|
|
|
|
|
this.start = start;
|
|
|
|
|
mixStart = start + 286;
|
|
|
|
|
this.Bytes = bytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Report_DosE> Dos
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
List<Report_DosE> ListE = new List<Report_DosE>();
|
|
|
|
|
|
|
|
|
|
var content = Bytes.Skip(start).Take(286).ToArray();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 13; i++)
|
|
|
|
|
{
|
|
|
|
|
var singleBlock = content.Skip(i*22).Take(22).ToArray();
|
|
|
|
|
ListE.Add(new Report_DosE(singleBlock));
|
|
|
|
|
}
|
|
|
|
|
return ListE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public List<Report_MixE> Mix
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
List<Report_MixE> ListE = new List<Report_MixE>();
|
|
|
|
|
|
|
|
|
|
var content = Bytes.Skip(mixStart).Take(180).ToArray();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
var singleBlock = content.Skip(i * 18).Take(18).ToArray();
|
|
|
|
|
ListE.Add(new Report_MixE(singleBlock));
|
|
|
|
|
}
|
|
|
|
|
return ListE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Report_DosE
|
|
|
|
|
{
|
|
|
|
|
public Report_DosE(byte[] content)
|
|
|
|
|
{
|
|
|
|
|
EqNo = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
Batch = PlcConnect.Instance.ByteTransform.TransInt16(content, 2);
|
|
|
|
|
MatCode = PlcConnect.Instance.ByteTransform.TransInt16(content, 4);
|
|
|
|
|
SetValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 6);
|
|
|
|
|
SetToler = PlcConnect.Instance.ByteTransform.TransSingle(content, 10);
|
|
|
|
|
ActValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 14);
|
|
|
|
|
ActToler = PlcConnect.Instance.ByteTransform.TransSingle(content, 18);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Report_DosE(ushort startSet, byte[] bytes)
|
|
|
|
|
{
|
|
|
|
|
//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);
|
|
|
|
|
MatCode = PlcConnect.Instance.ByteTransform.TransInt16(content, 4);
|
|
|
|
|
SetValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 6);
|
|
|
|
|
SetToler = PlcConnect.Instance.ByteTransform.TransSingle(content, 10);
|
|
|
|
|
ActValue = PlcConnect.Instance.ByteTransform.TransSingle(content, 14);
|
|
|
|
|
ActToler = PlcConnect.Instance.ByteTransform.TransSingle(content, 18);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public short EqNo { get; private set; }
|
|
|
|
|
public short Batch { get; private set; }
|
|
|
|
|
public short MatCode { get; private set; }
|
|
|
|
|
public float SetValue { get; private set; }
|
|
|
|
|
public float SetToler { get; private set; }
|
|
|
|
|
public float ActValue { get; private set; }
|
|
|
|
|
public float ActToler { get; private set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class Report_MixE
|
|
|
|
|
{
|
|
|
|
|
public Report_MixE(byte[] content)
|
|
|
|
|
{
|
|
|
|
|
EqNo = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
MixBatch = PlcConnect.Instance.ByteTransform.TransInt16(content, 2);
|
|
|
|
|
MixStep = PlcConnect.Instance.ByteTransform.TransInt16(content, 4);
|
|
|
|
|
ActCode = PlcConnect.Instance.ByteTransform.TransInt16(content, 6);
|
|
|
|
|
MixTime = PlcConnect.Instance.ByteTransform.TransInt16(content, 8);
|
|
|
|
|
MixTemp = PlcConnect.Instance.ByteTransform.TransSingle(content, 10);
|
|
|
|
|
MixSpeed = PlcConnect.Instance.ByteTransform.TransSingle(content, 14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public short EqNo { get; private set; }
|
|
|
|
|
public short MixBatch { get; private set; }
|
|
|
|
|
public short MixStep { get; private set; }
|
|
|
|
|
public short ActCode { get; private set; }
|
|
|
|
|
public short MixTime { get; private set; }
|
|
|
|
|
public float MixTemp { get; private set; }
|
|
|
|
|
public float MixSpeed { get; private set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ReportArrayManager
|
|
|
|
|
{
|
|
|
|
|
private int Length;
|
|
|
|
|
private int StartSet;
|
|
|
|
|
private 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>();
|
|
|
|
|
//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++)
|
|
|
|
|
{
|
|
|
|
|
var singleBlock = content.Skip(SLength * i).Take(SLength).ToArray();
|
|
|
|
|
ListE.Add(new Report_MixE(singleBlock));
|
|
|
|
|
}
|
|
|
|
|
return ListE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < Length; i++)
|
|
|
|
|
{
|
|
|
|
|
var singleBlock = content.Skip(SLength * i).Take(SLength).ToArray();
|
|
|
|
|
ListE.Add(new Report_DosE(singleBlock));
|
|
|
|
|
}
|
|
|
|
|
return ListE;
|
|
|
|
|
}
|
|
|
|
|
}
|