From c021fccbf3293186dc6ad78200986f7033125716 Mon Sep 17 00:00:00 2001 From: nodyang Date: Wed, 25 Oct 2023 16:31:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?DB2105WriteHelper=20=E4=BF=AE=E5=A4=8D2105?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E8=BF=90=E8=A1=8C=20=20=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=20=20=E8=AE=BE=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DBHelpers/DB2105WriteHelper.cs | 159 ++++++++++++++++-- 1 file changed, 142 insertions(+), 17 deletions(-) diff --git a/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs b/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs index a5c9538..0e6244d 100644 --- a/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs +++ b/DataBlockHelper/DBHelpers/DB2105WriteHelper.cs @@ -7,48 +7,173 @@ namespace DataBlockHelper.DBHelpers private static readonly string DbName = "DB2105"; - - public static void WriteSetValueH1(SetValue setValue) + public static void WriteStartJob1() { - WriteSetValue(54, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.0",true); + } + public static void WriteStopJob1() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.0",false); } - public static void WriteSetValueH2(SetValue setValue) + public static void WriteStartJob2() { - WriteSetValue(62, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.1",true); } - public static void WriteSetValueH3(SetValue setValue) + public static void WriteStopJob2() { - WriteSetValue(70, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.1",false); } - public static void WriteSetValueH4(SetValue setValue) + public static void WriteStartJob3() { - WriteSetValue(78, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.2",true); + } + + + public static void WriteStopJob3() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.2",false); + } + + public static void WriteStartJob4() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.3",true); + } + + public static void WriteStopJob4() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.3",false); + } + + public static void WriteStartJob5() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.4",true); + } + + public static void WriteStopJob5() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.4",false); + } + + public static void WriteStartJob6() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.5",true); + } + + public static void WriteStopJob6() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.5",false); + } + + public static void WriteStartJob7() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.6",true); + } + + public static void WriteStopJob7() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.6",false); + } + + public static void WriteStartJob8() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.7",true); + } + + public static void WriteStopJob8() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:52.7",false); + } + + + public static void WriteManScrewH1() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.0",true); } - public static void WriteSetValueH5(SetValue setValue) + public static void WriteManScrewH2() { - WriteSetValue(86, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.1",true); } - public static void WriteSetValueH6(SetValue setValue) + public static void WriteManScrewH3() { - WriteSetValue(86, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.2",true); } - public static void WriteSetValueH7(SetValue setValue) + public static void WriteManScrewH4() { - WriteSetValue(94, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.3",true); } - public static void WriteSetValueH8(SetValue setValue) + public static void WriteManScrewH5() { - WriteSetValue(102, setValue); + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.4",true); + } + + public static void WriteManScrewH6() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.5",true); + } + + public static void WriteManScrewH7() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.6",true); + } + + public static void WriteManScrewH8() + { + var siemensS7Net = PlcConnect.Instance; + siemensS7Net.Write($"{DbName}:53.7",true); } + public static void WriteSetValueH1(SetValue setValue) + { + WriteSetValue(54, setValue); + } + + public static void WriteSetValueH2(SetValue setValue) + { + WriteSetValue(62, setValue); + } + + public static void WriteSetValueH3(SetValue setValue) + { + WriteSetValue(70, setValue); + } + + public static void WriteSetValueH4(SetValue setValue) + { + WriteSetValue(78, setValue); + } + + private static void WriteSetValue(int start,SetValue setValue) { From e31425205ee80949a8ca352a3a59347b43a08110 Mon Sep 17 00:00:00 2001 From: nodyang Date: Wed, 25 Oct 2023 16:31:45 +0800 Subject: [PATCH 2/4] merge --- .../Mesnac.Action.ChemicalWeighing.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 3106213..28ceacd 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -176,6 +176,9 @@ False ..\..\..\PlugInPlatform\Mesnac.PlugIn.dll + + ..\..\Microsoft.Office.Interop.Excel.dll + @@ -219,6 +222,8 @@ + + From 15497c35fe8b88e149e24fc23f713d8167ad39dc Mon Sep 17 00:00:00 2001 From: nodyang Date: Wed, 25 Oct 2023 16:34:46 +0800 Subject: [PATCH 3/4] GetManScrew --- DataBlockHelper/DBHelpers/DB2105Helper.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DataBlockHelper/DBHelpers/DB2105Helper.cs b/DataBlockHelper/DBHelpers/DB2105Helper.cs index 1bbe765..2cccf1d 100644 --- a/DataBlockHelper/DBHelpers/DB2105Helper.cs +++ b/DataBlockHelper/DBHelpers/DB2105Helper.cs @@ -54,7 +54,7 @@ namespace DataBlockHelper.DBHelpers List ls = new List(); var b = bytes.Skip(53).Take(1).First(); - for (int i = 0; i <4; i++) + for (int i = 0; i <8; i++) { int no = i + 1; ls.Add(new NoVal() @@ -88,7 +88,7 @@ namespace DataBlockHelper.DBHelpers int start = 54; List ls = new List(); - for (int i = 0; i < 8; i++) + for (int i = 0; i < 4; i++) { int no = i + 1; var b = bytes.Skip(start).Take(8).ToArray(); From bb594c19b0e60214a103215efcd4a5d81f77c611 Mon Sep 17 00:00:00 2001 From: nodyang Date: Wed, 25 Oct 2023 16:38:52 +0800 Subject: [PATCH 4/4] =?UTF-8?q?StockMaterrialDbHelp=20=E6=94=B9=E6=88=90?= =?UTF-8?q?=E9=9D=99=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/DB/DeviceMaterrial.cs | 4 ++-- .../AutoControl/DB/StockMaterrialDBHelp.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs index d2b868e..f321192 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs @@ -35,7 +35,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB { - public void Save(List materrials) + public static void Save(List materrials) { var deviceMaterrial = materrials.First(); @@ -47,7 +47,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB } - public List GetByTypeId(int type, int deviceId) + public static List GetByTypeId(int type, int deviceId) { return FreeSqlUnit.Instance.Select() .Where(x => x.Type == type && x.DeviceId == deviceId) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs index 1b4b57b..5767f26 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs @@ -15,7 +15,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB /// 获取干混机物料 /// /// - public List GetDryerMaterrial() + public static List GetDryerMaterrial() { var list = GetStockMaterrial(1); list.RemoveAll(x => x.Id == 5); @@ -27,7 +27,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB /// 获取糊化机物料 /// /// - public List GetSiloMaterrial() + public static List GetSiloMaterrial() { var list1 = GetStockMaterrial(1); list1 = list1.Where(x => x.Id == 5 || x.Id == 6).ToList(); @@ -40,7 +40,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB /// /// - public int GetCodeById(int id) + public static int GetCodeById(int id) { string sql = $"select Code from lj_stock_material where Id={id}"; var dataTable = DBHelp.GetTable(sql); @@ -50,7 +50,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB - private List GetStockMaterrial(int mtypId) + private static List GetStockMaterrial(int mtypId) { string sql = "select Id, Code, StockName, MTypeId, MTypeName, MId, MName, Remark from lj_stock_material";