From 9a0faaf3de068313f3ea9f994942d852eed82de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=91=E5=8F=AB=E9=94=84=E5=A4=B4?= Date: Mon, 8 Jan 2024 14:56:46 +0800 Subject: [PATCH] =?UTF-8?q?2106=20=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainDetailControlAction.cs | 1 + .../Report/ReportReadDb.cs | 3 + DataBlockHelper/DBHelpers/DB2106Helper.cs | 8 +-- .../Entity/DB2106Entity/DryReportEntity.cs | 60 +++++++++++++++---- 4 files changed, 55 insertions(+), 17 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs index 55f86f3..084dc7e 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs @@ -289,6 +289,7 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl Timer1_Tick(); try { + ReportReadDb.ReadReport(); if (UserJudge.IsNormalUser()) { ReportReadDb.ReadReport(); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ReportReadDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ReportReadDb.cs index bb63d6a..c4074f3 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ReportReadDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/ReportReadDb.cs @@ -148,7 +148,10 @@ namespace Mesnac.Action.ChemicalWeighing.Report public static void ReadReport() { + + + DB2107Helper dB2107Helper = new DB2107Helper(); NormalStatusEntity normal = dB2107Helper.NormalStatus; if (normal.RdyRpt_D1) diff --git a/DataBlockHelper/DBHelpers/DB2106Helper.cs b/DataBlockHelper/DBHelpers/DB2106Helper.cs index a38f725..b51d3fd 100644 --- a/DataBlockHelper/DBHelpers/DB2106Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2106Helper.cs @@ -12,10 +12,10 @@ namespace DataBlockHelper.DBHelpers { public DB2106Helper() { - this.bytes = PlcConnect.Instance.Read("DB2106.0.0", 5648).Content; + this.bytes = PlcConnect.Instance.Read("DB2106.0.0", 6440).Content; } - public DryerReportEntity DryReport => new DryerReportEntity(0, bytes); - public GelReportEntity GelReport => new GelReportEntity(1072, bytes); - public WetMixingEntity WetReport => new WetMixingEntity(3568, bytes); + public DryerReportEntity DryReport => new DryerReportEntity(bytes); + public GelReportEntity GelReport => new GelReportEntity(1864, bytes); + public WetMixingEntity WetReport => new WetMixingEntity(4360, bytes); } } diff --git a/DataBlockHelper/Entity/DB2106Entity/DryReportEntity.cs b/DataBlockHelper/Entity/DB2106Entity/DryReportEntity.cs index 31a8d29..6f61a39 100644 --- a/DataBlockHelper/Entity/DB2106Entity/DryReportEntity.cs +++ b/DataBlockHelper/Entity/DB2106Entity/DryReportEntity.cs @@ -11,31 +11,63 @@ namespace DataBlockHelper.Entity.DB2106Entity { public class DryerReportEntity { - private int StartSet; + byte[] Bytes; - public DryerReportEntity(int startSet, byte[] bytes) + public DryerReportEntity( byte[] bytes) { - this.StartSet = startSet; + this.Bytes = bytes; } - public Dryer_ Dryer_A => new Dryer_(StartSet, Bytes); - public Dryer_ Dryer_B => new Dryer_(StartSet + 268, Bytes); - public Dryer_ Dryer_C => new Dryer_(StartSet + 536, Bytes); - public Dryer_ Dryer_D => new Dryer_(StartSet + 804, Bytes); + public Dryer_ Dryer_A => new Dryer_(0, Bytes); + + public Dryer_ Dryer_B => new Dryer_(466, Bytes); + public Dryer_ Dryer_C => new Dryer_(932, Bytes); + public Dryer_ Dryer_D => new Dryer_(1398, Bytes); } public class Dryer_ { - private int StartSet; + private byte[] Bytes; - public Dryer_(int startSet, byte[] bytes) + int start; + public Dryer_(int start, byte[] bytes) { - this.StartSet = startSet; + this.start = start; this.Bytes = bytes; } - public List Dos => new ReportArrayManager(4, StartSet, 22, Bytes).GetReport_DosEList(); - public List Mix => new ReportArrayManager(10, StartSet + 88, 18, Bytes).GetReport_MixEList(); + public List Dos + { + get + { + List ListE = new List(); + + var content = Bytes.Skip(start).Take(286).ToArray(); + + for (int i = 0; i < 13; i++) + { + var singleBlock = content.Skip(i*22).Take(22).ToArray(); + ListE.Add(new Report_DosE(singleBlock)); + } + return ListE; + } + } + public List Mix + { + get + { + List ListE = new List(); + + var content = Bytes.Skip(start).Take(180).ToArray(); + + for (int i = 0; i < 10; i++) + { + var singleBlock = content.Skip(i * 18).Take(18).ToArray(); + ListE.Add(new Report_MixE(singleBlock)); + } + return ListE; + } + } } public class Report_DosE @@ -65,6 +97,8 @@ namespace DataBlockHelper.Entity.DB2106Entity ActToler = PlcConnect.Instance.ByteTransform.TransSingle(content, 18); } + + public short EqNo { get; private set; } public short Batch { get; private set; } public short MatCode { get; private set; } @@ -114,7 +148,7 @@ namespace DataBlockHelper.Entity.DB2106Entity public List GetReport_MixEList() { - List ListE = new List(Length); + List ListE = new List(); //var getListE = PlcConnect.Instance.Read("DB2106." + StartSet + ".0", Convert.ToUInt16(Length * SLength)); var content = Bytes.Skip(StartSet).Take(Length * SLength).ToArray();