|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DataBlockHelper.Entity.DB2105Entity
|
|
|
|
|
{
|
|
|
|
|
public class PlanEntity
|
|
|
|
|
{
|
|
|
|
|
public PlanEntity(byte[] content)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
RecipeCode = PlcConnect.Instance.ByteTransform.TransInt16(content, 0);
|
|
|
|
|
PlanCode = PlcConnect.Instance.ByteTransform.TransInt16(content, 2);
|
|
|
|
|
Batch = PlcConnect.Instance.ByteTransform.TransInt16(content, 4);
|
|
|
|
|
Start = PlcConnect.Instance.ByteTransform.TransInt16(content, 6);
|
|
|
|
|
Pause = PlcConnect.Instance.ByteTransform.TransInt16(content, 8);
|
|
|
|
|
Stop = PlcConnect.Instance.ByteTransform.TransInt16(content, 10);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int RecipeCode { get; private set; }
|
|
|
|
|
public int PlanCode { get; private set; }
|
|
|
|
|
public int Batch { get; private set; }
|
|
|
|
|
public int Start { get; private set; }
|
|
|
|
|
public int Pause { get; private set; }
|
|
|
|
|
public int Stop { get; private set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class PlanArrayManager
|
|
|
|
|
{
|
|
|
|
|
private int Length;
|
|
|
|
|
private int StartSet;
|
|
|
|
|
private 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 = 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 PlanEntity(singleBlock));
|
|
|
|
|
}
|
|
|
|
|
return ListE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|