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);
}
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);
///
/// 热水秤A
///
public WaterEntity GetAHotWater => GetWater(3578);
///
/// 热水秤B
///
public WaterEntity GetBHotWater => GetWater(3588);
///
/// 冷水秤A
///
public WaterEntity GetAColWater => GetWater(3598);
///
/// 冷水秤B
///
public WaterEntity GetBColWater => GetWater(3608);
private WaterEntity GetWater(int start)
{
var instanceByteTransform = PlcConnect.Instance.ByteTransform;
var ls = bytes.Skip(start).Take(10).ToArray();
WaterEntity entity = new WaterEntity
{
Bin = instanceByteTransform.TransInt16(ls, 0),
Set = instanceByteTransform.TransSingle(ls, 2),
TolErance = instanceByteTransform.TransSingle(ls, 6)
};
return entity;
}
}
}