From d667fd02c3ae7cb074e4298fc7245895dc8a73ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=84=E5=A4=B4?= Date: Wed, 12 Jun 2024 11:00:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E9=A3=8E=E6=9C=BA=E4=B8=8D=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/PlcAutoWriteHelper.cs | 42 +++++++++++++++ .../FreeDb/DBEntity/WaterDownloadEntity.cs | 32 +++++++++++ .../MainDetailControlAction.cs | 3 ++ .../Mesnac.Action.ChemicalWeighing.csproj | 1 + .../DBHelpers/DB2110WriteHelper.cs | 53 ++----------------- DataBlockHelper/DBHelpers/Db2110Help.cs | 18 +++---- 6 files changed, 90 insertions(+), 59 deletions(-) create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FreeDb/DBEntity/WaterDownloadEntity.cs diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs index b485521..dafe3a8 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs @@ -2,6 +2,8 @@ using DataBlockHelper.Entity.DB2104Entity; using Mesnac.Action.ChemicalWeighing.AutoControl.DB; using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; +using Mesnac.Action.ChemicalWeighing.FreeDb; +using Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity; using Mesnac.Action.ChemicalWeighing.LjMixManager; using Mesnac.Action.ChemicalWeighing.LjPlanning; using Mesnac.Action.ChemicalWeighing.MinAn; @@ -539,10 +541,50 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl ColdA.stand = Convert.ToInt16(ComboE.CALeftOrRight.MCValue); ColdB.stand = Convert.ToInt16(ComboE.CBLeftOrRight.MCValue); + WaterDownloadEntity entity = new WaterDownloadEntity(); + + //1 冷水a 2 冷水b 3 热水a 4 热水b + Db2104WriteHelper.WriteAHostWater(HotA); + entity.Id = 3; + entity.Tolerance=HotA.Tolerance; + entity.stand = HotA.stand; + entity.differ = HotA.differ; + entity.Set = HotA.Set; + entity.Bin=HotA.Bin; + + FreeSqlUnit.Instance.Update().SetSource(entity).ExecuteUpdated(); Db2104WriteHelper.WriteBHostWater(HotB); + + entity.Id = 4; + entity.Tolerance = HotB.Tolerance; + entity.stand = HotB.stand; + entity.differ = HotB.differ; + entity.Set = HotB.Set; + entity.Bin = HotB.Bin; + FreeSqlUnit.Instance.Update().SetSource(entity).ExecuteUpdated(); + + Db2104WriteHelper.WriteAColWater(ColdA); + + entity.Id = 1; + entity.Tolerance = ColdA.Tolerance; + entity.stand = ColdA.stand; + entity.differ = ColdA.differ; + entity.Set = ColdA.Set; + entity.Bin = ColdA.Bin; + FreeSqlUnit.Instance.Update().SetSource(entity).ExecuteUpdated(); + Db2104WriteHelper.WriteBColWater(ColdB); + + entity.Id = 2; + entity.Tolerance = ColdB.Tolerance; + entity.stand = ColdB.stand; + entity.differ = ColdB.differ; + entity.Set = ColdB.Set; + entity.Bin = ColdB.Bin; + FreeSqlUnit.Instance.Update().SetSource(entity).ExecuteUpdated(); + MesnacServiceManager.Instance.LoggingService.Info("水称数据下发成功!"); MessageBox.Show("水称数据下发成功"); } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FreeDb/DBEntity/WaterDownloadEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FreeDb/DBEntity/WaterDownloadEntity.cs new file mode 100644 index 0000000..902d263 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FreeDb/DBEntity/WaterDownloadEntity.cs @@ -0,0 +1,32 @@ +using FreeSql.DataAnnotations; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.FreeDb.DBEntity +{ + + [Table(Name = "WaterDownload")] + public class WaterDownloadEntity + { + + /// + /// 主键 + /// + [Column(IsPrimary = true, IsIdentity = false)] + public int Id { get; set; } + + public int Bin { get; set; } = 0; + + public float Set { get; set; } = 0; + + public float Tolerance { get; set; } = 0; + + public float differ { get; set; } = 0; + + public int stand { get; set; } = 0; + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs index 0197920..ea9f99f 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/MainDetailControl/MainDetailControlAction.cs @@ -1508,6 +1508,9 @@ namespace Mesnac.Action.ChemicalWeighing.MainDetailControl PlcReadTemp.DM1DRY3_Running_Set = DB2103.DM1DRY3.Running; PlcReadTemp.DM1DRY4_Running_Set = DB2103.DM1DRY4.Running; + PlcReadTemp.PM3ADF01_Set = DB2103.DMFILTER.Running; + + PlcReadTemp.DMWETER1_Set = DB2103.DMWETER1.Running; PlcReadTemp.DMWETER2_Set = DB2103.DMWETER2.Running; PlcReadTemp.DMWETER3_Set = DB2103.DMWETER3.Running; diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 2438540..4da5c17 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -283,6 +283,7 @@ + diff --git a/DataBlockHelper/DBHelpers/DB2110WriteHelper.cs b/DataBlockHelper/DBHelpers/DB2110WriteHelper.cs index 69db263..42e228a 100644 --- a/DataBlockHelper/DBHelpers/DB2110WriteHelper.cs +++ b/DataBlockHelper/DBHelpers/DB2110WriteHelper.cs @@ -13,25 +13,8 @@ namespace DataBlockHelper.DBHelpers public static void WriteA() { var siemensS7Net = PlcConnect.Instance; - int start = 3384; - ushort a = 0; - siemensS7Net.Write($"{DbName}.{start}.0", a); - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - - siemensS7Net.Write($"{DbName}.3412.0", a); - - siemensS7Net.Write($"{DbName}.3416.0",true); + + siemensS7Net.Write($"DB2107.11.1",true); } @@ -40,37 +23,7 @@ namespace DataBlockHelper.DBHelpers public static void WriteB() { var siemensS7Net = PlcConnect.Instance; - int start = 3394; - ushort a = 0; - - siemensS7Net.Write($"{DbName}.{start}.0",a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - start += 2; - siemensS7Net.Write($"{DbName}.{start}.0", a); - - siemensS7Net.Write($"{DbName}.3414.0", a); - siemensS7Net.Write($"{DbName}.3416.1", true); + siemensS7Net.Write($"DB2107.11.2", true); } } } diff --git a/DataBlockHelper/DBHelpers/Db2110Help.cs b/DataBlockHelper/DBHelpers/Db2110Help.cs index 37eb37c..0944b7c 100644 --- a/DataBlockHelper/DBHelpers/Db2110Help.cs +++ b/DataBlockHelper/DBHelpers/Db2110Help.cs @@ -68,15 +68,15 @@ namespace DataBlockHelper.DBHelpers public string GetB() { List list = new List(); - list.Add(GetAvalue(queB0)); - list.Add(GetAvalue(queB1)); - list.Add(GetAvalue(queB2)); - list.Add(GetAvalue(queB3)); - list.Add(GetAvalue(queB4)); - list.Add(GetAvalue(queB5)); - list.Add(GetAvalue(queB6)); - list.Add(GetAvalue(queB7)); - list.Add(GetAvalue(queB8)); + list.Add(GetBvalue(queB0)); + list.Add(GetBvalue(queB1)); + list.Add(GetBvalue(queB2)); + list.Add(GetBvalue(queB3)); + list.Add(GetBvalue(queB4)); + list.Add(GetBvalue(queB5)); + list.Add(GetBvalue(queB6)); + list.Add(GetBvalue(queB7)); + list.Add(GetBvalue(queB8)); if (list.Count == list.Where(x => x == "0").Count()) {