using HslCommunication; using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; namespace DataBlockHelper.Entity.DB2104Entity { public class RecipeCommEntity { public RecipeCommEntity(byte[] bytes) { //OperateResult read = PlcConnect.Instance.Read("DB2104.2.0", 50); var content = bytes.Skip(2).Take(50).ToArray(); var instanceByteTransform = PlcConnect.Instance.ByteTransform; RecpieCode = instanceByteTransform.TransUInt16(content, 0); PlanCode = instanceByteTransform.TransUInt16(content, 2); RecipeName =instanceByteTransform.TransString(content, 4, 21, Encoding.ASCII); PlanName = instanceByteTransform.TransString(content, 26, 21, Encoding.ASCII); Batch = instanceByteTransform.TransInt16(content, 48); } public ushort RecpieCode { get; private set; } public ushort PlanCode { get; private set; } public string RecipeName { get; private set; } public string PlanName { get; private set; } public short Batch { get; private set; } } }