From 366640bdcaa1ee44c60bdfc8c814691416f56b75 Mon Sep 17 00:00:00 2001 From: nodyang Date: Wed, 25 Oct 2023 18:00:07 +0800 Subject: [PATCH] DeviceMaterrial --- .../AutoControl/DB/DeviceMaterrial.cs | 33 +--------------- .../AutoControl/DB/DeviceMaterrialService.cs | 38 +++++++++++++++++++ .../LjPlanning/LjPlanningPlcHelp.cs | 1 + .../Mesnac.Action.ChemicalWeighing.csproj | 1 + 4 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrialService.cs diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs index f321192..3b52274 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrial.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using FreeSql.DataAnnotations; -using Mesnac.Action.ChemicalWeighing.FreeDb; +using FreeSql.DataAnnotations; namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB { @@ -28,33 +25,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB public int Type { get; set; } - } - - - public class DeviceMaterrialService - { - - - public static void Save(List materrials) - { - var deviceMaterrial = materrials.First(); - - FreeSqlUnit.Instance.Delete() - .Where(x => x.Type == deviceMaterrial.Type && x.DeviceId == deviceMaterrial.DeviceId) - .ExecuteDeleted(); - - FreeSqlUnit.Instance.Insert(materrials).ExecuteAffrows(); - } - - - public static List GetByTypeId(int type, int deviceId) - { - return FreeSqlUnit.Instance.Select() - .Where(x => x.Type == type && x.DeviceId == deviceId) - .ToList(); - } - - + public int Code { get; set; } } } \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrialService.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrialService.cs new file mode 100644 index 0000000..4d9923f --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/DeviceMaterrialService.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Mesnac.Action.ChemicalWeighing.FreeDb; + +namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB +{ + public class DeviceMaterrialService + { + + + public static void Save(List materrials) + { + var deviceMaterrial = materrials.First(); + + FreeSqlUnit.Instance.Delete() + .Where(x => x.Type == deviceMaterrial.Type && x.DeviceId == deviceMaterrial.DeviceId) + .ExecuteDeleted(); + + foreach (var materrial in materrials) + { + materrial.Code = StockMaterrialDbHelp.GetCodeById(materrial.MaterrialId); + } + + FreeSqlUnit.Instance.Insert(materrials).ExecuteAffrows(); + } + + + public static List GetByTypeId(int type, int deviceId) + { + return FreeSqlUnit.Instance.Select() + .Where(x => x.Type == type && x.DeviceId == deviceId) + .ToList(); + } + + + + } +} \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs index 5ad27b6..b421302 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjPlanning/LjPlanningPlcHelp.cs @@ -463,6 +463,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjPlanning public static DryerView GetGelatG7 => GetGelatView(1858); public static DryerView GetGelatG8 => GetGelatView(1998); + public static List GetWeterM1 = GetWeterView(2138); public static List GetWeterM2 = GetWeterView(2338); public static List GetWeterM3 = GetWeterView(2538); diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 28ceacd..a3c3fa4 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -223,6 +223,7 @@ +