From 5a2b9e5c2b2993f8c9e14241d7c1111dadf5890f Mon Sep 17 00:00:00 2001 From: nodyang Date: Fri, 27 Oct 2023 13:10:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B0=B4=E7=A7=A4=E7=9A=84bu?= =?UTF-8?q?g=20=E5=8F=98=E5=BC=82=E9=87=8F=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataBlockHelper/DBHelpers/DB2104Helper.cs | 33 ++++--------------- .../DBHelpers/DB2104WriteHelper.cs | 8 ++--- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/DataBlockHelper/DBHelpers/DB2104Helper.cs b/DataBlockHelper/DBHelpers/DB2104Helper.cs index 38fe00c..fb39326 100644 --- a/DataBlockHelper/DBHelpers/DB2104Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2104Helper.cs @@ -29,60 +29,39 @@ namespace DataBlockHelper.DBHelpers 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); + public WaterEntity GetAHotWater => GetWater(3738); /// /// 热水秤B /// - public WaterEntity GetBHotWater => GetWater(3588); + public WaterEntity GetBHotWater => GetWater(3748); /// /// 冷水秤A /// - public WaterEntity GetAColWater => GetWater(3598); + public WaterEntity GetAColWater => GetWater(3758); /// /// 冷水秤B /// - public WaterEntity GetBColWater => GetWater(3608); + public WaterEntity GetBColWater => GetWater(3768); private WaterEntity GetWater(int start) { var instanceByteTransform = PlcConnect.Instance.ByteTransform; - var ls = bytes.Skip(start).Take(10).ToArray(); + var ls = this.bytes = PlcConnect.Instance.Read($"DB2104.{start}.0", 10).Content; WaterEntity entity = new WaterEntity { Bin = instanceByteTransform.TransInt16(ls, 0), diff --git a/DataBlockHelper/DBHelpers/DB2104WriteHelper.cs b/DataBlockHelper/DBHelpers/DB2104WriteHelper.cs index 976be37..5155ae4 100644 --- a/DataBlockHelper/DBHelpers/DB2104WriteHelper.cs +++ b/DataBlockHelper/DBHelpers/DB2104WriteHelper.cs @@ -29,7 +29,7 @@ namespace DataBlockHelper.DBHelpers public static void WriteAHostWater(WaterEntity entity) { - Write(3578, entity); + Write(3738, entity); } /// /// B热水 @@ -37,7 +37,7 @@ namespace DataBlockHelper.DBHelpers /// public static void WriteBHostWater(WaterEntity entity) { - Write(3588, entity); + Write(3748, entity); } /// /// 冷水A @@ -45,7 +45,7 @@ namespace DataBlockHelper.DBHelpers /// public static void WriteAColWater(WaterEntity entity) { - Write(3598, entity); + Write(3758, entity); } /// /// 冷水B @@ -53,7 +53,7 @@ namespace DataBlockHelper.DBHelpers /// public static void WriteBColWater(WaterEntity entity) { - Write(3608, entity); + Write(3768, entity); }