using DataBlockHelper.Entity.DB2107Entity; using DataBlockHelper.Entity.DB2104Entity; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DataBlockHelper.DBHelpers { public class DB2104Helper : DBHelper { public DB2104Helper() { this.bytes = PlcConnect.Instance.Read("DB2104.0.0", 3618).Content; } public RecipeCommEntity RecipeComm => RecipeCom(bytes); private RecipeCommEntity RecipeCom(byte[] bytes) { return new RecipeCommEntity(bytes); } public EnableStatusEntity EnableStatus => EnableS(bytes); private EnableStatusEntity EnableS(byte[] bytes) { return new EnableStatusEntity(bytes); } /// /// 热水秤A /// public WaterEntity GetAHotWater => GetWater(3738); /// /// 热水秤B /// public WaterEntity GetBHotWater => GetWater(3748); /// /// 冷水秤A /// public WaterEntity GetAColWater => GetWater(3758); /// /// 冷水秤B /// public WaterEntity GetBColWater => GetWater(3768); private WaterEntity GetWater(int start) { var instanceByteTransform = PlcConnect.Instance.ByteTransform; var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 10).Content; WaterEntity entity = new WaterEntity { Bin = instanceByteTransform.TransInt16(ls, 0), Set = instanceByteTransform.TransSingle(ls, 2), Tolerance = instanceByteTransform.TransSingle(ls, 6) }; return entity; } } }