Zixuan 5 days ago
parent
commit
204d6e9b24

+ 6 - 0
Communicatror/KeplerCommunicator_DB/Class1.cs

@@ -0,0 +1,6 @@
+namespace KeplerCommunicator_DB;
+
+public class Class1
+{
+
+}

+ 9 - 0
Communicatror/KeplerCommunicator_DB/KeplerCommunicator_DB.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 80 - 0
Data/DataService/DBProcessData.cs

@@ -0,0 +1,80 @@
+namespace DataService;
+
+public class DBProcessData<T_Output, T_PrimaryKey, T_DicValue>(Func<object, T_PrimaryKey?> KeyConverter, char spilter, string keyName)
+    where T_PrimaryKey : unmanaged
+    where T_Output : IDictionary<string, object>, new()
+    where T_DicValue : IDictionary<T_PrimaryKey, object>, new()
+{
+
+    public bool ToDictionary(IEnumerable<dynamic> inputs, out T_Output? output)
+    {
+        output = default;
+
+        if (inputs is null)
+            return false;
+
+        T_Output cache = [];
+
+        foreach (dynamic input in inputs)
+        {
+            if (input is null)
+                return false;
+
+            if ((input as IDictionary<string, object>)?.TryGetValue(keyName, out object? primaryKeyValue) != true || primaryKeyValue is null)
+                return false;
+
+            if (KeyConverter?.Invoke(primaryKeyValue) is not T_PrimaryKey primaryKey)
+                return false;
+
+            (input as IDictionary<string, object>)?.Remove(keyName);
+
+            foreach (KeyValuePair<string, object> rawData in input)
+                ColumAnalizer(cache, rawData.Key.Split(spilter), primaryKey, rawData.Value);
+        }
+
+        output = cache;
+        return true;
+    }
+
+    private static bool ColumAnalizer(/*ref*/ T_Output cache, Span<string> seprated, T_PrimaryKey key, object value)
+    {
+        cache = TryGetValueElseCreateNew<T_Output>(cache, seprated[0]);
+
+        _ = seprated.Length switch
+        {
+            1 => TryGetValueElseCreateNew<T_DicValue>(cache, seprated[0]).TryAdd(key, value),//Recursion End
+            _ => ColumAnalizer(cache, seprated[1..], key, value),//Recursion
+        };
+
+        return true;
+    }
+
+
+    private static T TryGetValueElseCreateNew<T>(T_Output cache, string key) where T : new()
+    {
+        if (!cache.TryGetValue(key, out object? output) || output is not T dic)
+        {
+            dic = new();
+            cache[key] = dic;
+        }
+
+        return dic;
+    }
+}
+
+class GeneralHeaderAnalizer
+{
+    public static DateTime? LongToDateTime(object o)
+    {
+        if (o is not long l)
+            return null;
+        return new(l);
+    }
+}
+
+public class GeneralProcessData : DBProcessData<Dictionary<string, object>, DateTime, Dictionary<DateTime, object>>
+{
+    public GeneralProcessData() : base(GeneralHeaderAnalizer.LongToDateTime, '.', "time")
+    {
+    }
+}

+ 9 - 0
Data/DataService/DataService.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 14 - 14
DataBase/SqlSugarORM/SqlSugarCustom.cs

@@ -4,7 +4,7 @@ using System.Linq.Expressions;
 using Universal;
 
 namespace SqlSugarORM;
-public class SqlSugarCustom : IORM
+public class SqlSugarCustom
 {
     public SqlSugarCustom()
     {
@@ -13,7 +13,7 @@ public class SqlSugarCustom : IORM
 
     #region Internal
     private IOrmProvider? _provider;
-    private SqlSugarClient? _Client;
+    public SqlSugarClient? _Client;
     private bool disposedValue;
     private readonly EventQueue<(string, DateTime, LogLevel)> _logQueue;
     private void LogQueueHandler((string log, DateTime time, LogLevel level) logItem)
@@ -31,7 +31,7 @@ public class SqlSugarCustom : IORM
     }
     #endregion
 
-    bool IORM.Initialize(IOrmProvider? notify)
+    public bool Initialize(IOrmProvider? notify)
     {
         if (_provider is not null)
             return false;
@@ -41,7 +41,7 @@ public class SqlSugarCustom : IORM
         return true;
     }
 
-    bool IORM.Open(string connectionString, ORM.DbType dbType, bool isAutoConnection)
+    public bool Open(string connectionString, SqlSugar.DbType dbType, bool isAutoConnection)
     {
         if (this._Client is not null)
             return false;
@@ -49,7 +49,7 @@ public class SqlSugarCustom : IORM
         ConnectionConfig config = new()
         {
             ConnectionString = connectionString,
-            DbType = (SqlSugar.DbType)dbType,
+            DbType = dbType,
             IsAutoCloseConnection = isAutoConnection
         };
         try
@@ -65,7 +65,7 @@ public class SqlSugarCustom : IORM
         return true;
     }
 
-    bool IORM.CreateDataBase(string dbName)
+    public bool CreateDataBase(string dbName)
     {
         if (this._Client is null)
             return false;
@@ -86,7 +86,7 @@ public class SqlSugarCustom : IORM
         return true;
     }
 
-    bool IORM.CreateTable<T>(string? tableName)
+    public bool CreateTable<T>(string? tableName)
     {
         if (this._Client is null)
             return false;
@@ -108,7 +108,7 @@ public class SqlSugarCustom : IORM
         return true;
     }
 
-    bool IORM.Insert<T>(T data)
+    public bool Insert<T>(T data) where T : class, new()
     {
         if (this._Client is null)
             return false;
@@ -126,7 +126,7 @@ public class SqlSugarCustom : IORM
         return true;
     }
 
-    bool IORM.Insert<T>(string tablename, T data)
+    public bool Insert<T>(string tablename, T data) where T : class, new()
     {
         if (this._Client is null)
             return false;
@@ -150,7 +150,7 @@ public class SqlSugarCustom : IORM
     }
 
 
-    async Task<bool> IORM.Query<T>(Action<List<T>> results)
+    public async Task<bool> Query<T>(Action<List<T>> results)
     {
         if (this._Client is null)
             return false;
@@ -170,7 +170,7 @@ public class SqlSugarCustom : IORM
         });
     }
 
-    async Task<bool> IORM.Query<T>(string tableName, Action<List<T>> results)
+    public async Task<bool> Query<T>(string tableName, Action<List<T>> results)
     {
         if (this._Client is null)
             return false;
@@ -193,7 +193,7 @@ public class SqlSugarCustom : IORM
         });
     }
 
-    async Task<bool> IORM.Query<T>(Expression<Func<T, bool>> expression, Action<List<T>> results)
+    public async Task<bool> Query<T>(Expression<Func<T, bool>> expression, Action<List<T>> results)
     {
         if (this._Client is null)
             return false;
@@ -213,7 +213,7 @@ public class SqlSugarCustom : IORM
             });
     }
 
-    async Task<bool> IORM.Query<T>(string tableName, Expression<Func<T, bool>> expression, Action<List<T>> results)
+    public async Task<bool> Query<T>(string tableName, Expression<Func<T, bool>> expression, Action<List<T>> results)
     {
         if (this._Client is null)
             return false;
@@ -240,7 +240,7 @@ public class SqlSugarCustom : IORM
           });
     }
 
-    bool IORM.Delete<T>(string tableName, Expression<Func<T, bool>> expression)
+    public bool Delete<T>(string tableName, Expression<Func<T, bool>> expression) where T : class, new()
     {
         if (this._Client is null)
             return false;

+ 12 - 7
Data_ViewModel/GlobalData/DeviceData.cs

@@ -2,6 +2,7 @@
 using System.Net.NetworkInformation;
 using CommunityToolkit.Mvvm.ComponentModel;
 using GeneralData;
+using UICommon.DataType;
 
 namespace GlobalData;
 
@@ -13,10 +14,11 @@ public partial class DeviceData_VM : ObservableObject
     private DeviceModel _DeviceModel;
 
     [ObservableProperty]
-    private DeviceStatus _DeviceStatus;
+    private string? _DeviceStatus;
 
     [ObservableProperty]
-    private PMCMode _PMCMode;
+    public ObservableDictionary<string, object> _OtherInfo = [];
+
 
     [ObservableProperty]
     private RecipeInfo_VM? _RecipeInfo;
@@ -122,14 +124,17 @@ public partial class RecipeInfo_VM : ObservableObject
 {
     public Guid DeviceId { get; set; }
 
-    [ObservableProperty]
-    private RecipeType _RecipeType;
+    //[ObservableProperty]
+    //private RecipeType _RecipeType;
 
-    [ObservableProperty]
-    private string? _PJobID;
+    //[ObservableProperty]
+    //private string? _PJobID;
+
+    //[ObservableProperty]
+    //private string? _CJboID;
 
     [ObservableProperty]
-    private string? _CJboID;
+    public ObservableDictionary<string, object> _RecipeInfo = [];
 
     [ObservableProperty]
     private string? _CurrentStepName;

+ 16 - 0
EEMSMain.sln

@@ -47,6 +47,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SqlSugarORM", "DataBase\Sql
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntryFrameworkORM", "DataBase\EntryFrameworkORM\EntryFrameworkORM.csproj", "{3696975D-6327-4EBB-ABE5-8CE26DB699A6}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Communicator", "Communicator", "{2225F0CF-790B-4C48-A9F3-247DF1B8DE1C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeplerCommunicator_DB", "Communicatror\KeplerCommunicator_DB\KeplerCommunicator_DB.csproj", "{BE3A768B-A520-4DB9-91FD-3B1C1B79145A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataService", "Data\DataService\DataService.csproj", "{DC93F4C8-DCF1-42FD-9373-DA7121BDAD2C}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -121,6 +127,14 @@ Global
 		{3696975D-6327-4EBB-ABE5-8CE26DB699A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{3696975D-6327-4EBB-ABE5-8CE26DB699A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{3696975D-6327-4EBB-ABE5-8CE26DB699A6}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BE3A768B-A520-4DB9-91FD-3B1C1B79145A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BE3A768B-A520-4DB9-91FD-3B1C1B79145A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BE3A768B-A520-4DB9-91FD-3B1C1B79145A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BE3A768B-A520-4DB9-91FD-3B1C1B79145A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DC93F4C8-DCF1-42FD-9373-DA7121BDAD2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DC93F4C8-DCF1-42FD-9373-DA7121BDAD2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DC93F4C8-DCF1-42FD-9373-DA7121BDAD2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DC93F4C8-DCF1-42FD-9373-DA7121BDAD2C}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -139,6 +153,8 @@ Global
 		{E01EF058-A268-B0AE-ACE3-A67E6C7C1981} = {664E8B6F-4E97-4592-B7CA-F608871592CD}
 		{EA1B249C-B1A9-30E4-3598-68B82121C8AF} = {664E8B6F-4E97-4592-B7CA-F608871592CD}
 		{3696975D-6327-4EBB-ABE5-8CE26DB699A6} = {664E8B6F-4E97-4592-B7CA-F608871592CD}
+		{BE3A768B-A520-4DB9-91FD-3B1C1B79145A} = {2225F0CF-790B-4C48-A9F3-247DF1B8DE1C}
+		{DC93F4C8-DCF1-42FD-9373-DA7121BDAD2C} = {F81EF7E9-27B9-4DE0-95C9-CD1E7B58BA89}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {331844F6-59F5-4D02-BFA4-2329C0EAB6EF}

+ 16 - 12
EEMSMain/ViewModels/MainWindowViewModel.cs

@@ -53,9 +53,6 @@ public partial class MainWindowViewModel : ObservableObject
             RecipeInfo_VM recipe = new()
             {
                 DeviceId = guid,
-                PJobID = "TestPJob",
-                CJboID = "TestCJob",
-                RecipeType = (RecipeType)r.Next(0, 8),
                 CurrentStepName = "Step 1",
                 NextStepName = "Step 2",
                 CurrentStepTotalTime = r.Next(50, 100),
@@ -64,16 +61,21 @@ public partial class MainWindowViewModel : ObservableObject
                 TotalRemainTime = r.Next(100, 200),
             };
 
+            //recipe.RecipeInfo["PJobID"] = "TestPJob";
+            //recipe.RecipeInfo["CJboID"] = "TestCJob";
+            //recipe.RecipeInfo["RecipeType"] = (RecipeType)r.Next(0, 8);
+
             DeviceData_VM deviceData = new()
             {
                 DeviceId = guid,
-
                 DeviceModel = DeviceModel.JetKepler,
-                DeviceStatus = (DeviceStatus)r.Next(0, 12),
-                PMCMode = PMCMode.Running,
+                DeviceStatus = ((DeviceStatus)r.Next(0, 12)).ToString(),
                 RecipeInfo = recipe,
                 Alarms = []
             };
+            deviceData.OtherInfo.Add("子型号", KeplerSubModel.JetKepler_2200A);
+
+            //deviceData.OtherInfo["PMC Mode"] = PMCMode.Running.ToString();
 
             if (r.Next(1, 4) > 1)
             {
@@ -116,9 +118,6 @@ public partial class MainWindowViewModel : ObservableObject
             RecipeInfo_VM recipe = new()
             {
                 DeviceId = guid,
-                PJobID = "TestPJob",
-                CJboID = "TestCJob",
-                RecipeType = (RecipeType)r.Next(0, 8),
                 CurrentStepName = "Step 1",
                 NextStepName = "Step 2",
                 CurrentStepTotalTime = r.Next(50, 100),
@@ -126,16 +125,21 @@ public partial class MainWindowViewModel : ObservableObject
                 TotalTime = r.Next(200, 400),
                 TotalRemainTime = r.Next(100, 200),
             };
-
+            recipe.RecipeInfo.Add("PJobID", "TestPJob");
+            recipe.RecipeInfo.Add("CJboID", "TestCJob");
+            recipe.RecipeInfo.Add("RecipeType", (RecipeType)r.Next(0, 8));
             DeviceData_VM deviceData = new()
             {
                 DeviceId = guid,
                 DeviceModel = DeviceModel.Proxima,
-                DeviceStatus = (DeviceStatus)r.Next(0, 12),
-                PMCMode = PMCMode.Running,
+                DeviceStatus = ((DeviceStatus)r.Next(0, 12)).ToString(),
+                //PMCMode = PMCMode.Running,
                 RecipeInfo = recipe,
                 Alarms = []
             };
+            deviceData.OtherInfo.Add("子型号", ProximaSubModel.Proxima_ELK);
+            deviceData.OtherInfo.Add(nameof(PMCMode), PMCMode.Running);
+
             _deviceCollection.DeviceDataList.Add(guid, deviceData);
             _deviceCollection.DeviceList.Add(guid, device);
         }

+ 37 - 37
Module/DashBoard/Controls/DeviceInfoPlot.xaml

@@ -17,13 +17,13 @@
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid>
-        <Border BorderBrush="{StaticResource DarkBorderColor}" Background="#f2f2f2" BorderThickness="1" Width="360" Margin="8" CornerRadius="8">
+        <Border BorderBrush="{StaticResource DarkBorderColor}" Background="#f2f2f2" BorderThickness="1" Width="380" MinHeight="200" Margin="8" CornerRadius="8">
             <Grid Margin="12,8">
                 <Grid.RowDefinitions>
                     <RowDefinition Height="auto"/>
-                    <RowDefinition Height="12"/>
+                    <RowDefinition Height="8"/>
                     <RowDefinition Height="auto"/>
-                    <RowDefinition Height="12"/>
+                    <RowDefinition Height="*"/>
                     <RowDefinition Height="auto"/>
                 </Grid.RowDefinitions>
 
@@ -55,45 +55,45 @@
                 </Grid>
 
                 <Grid Grid.Row="2">
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="auto"/>
-                        <RowDefinition Height="4"/>
-                        <RowDefinition Height="auto"/>
-                        <RowDefinition Height="4"/>
-                        <RowDefinition Height="auto"/>
-                    </Grid.RowDefinitions>
+
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width="auto"/>
-                        <ColumnDefinition Width="16"/>
-                        <ColumnDefinition />
-                        <ColumnDefinition Width="12"/>
-
+                        <ColumnDefinition Width="*"/>
                         <ColumnDefinition Width="auto"/>
-                        <ColumnDefinition Width="16"/>
-                        <ColumnDefinition />
                     </Grid.ColumnDefinitions>
+                    <ItemsControl ItemsSource="{Binding ElementName=This, Path=DeviceData.OtherInfo}">
+                        <ItemsControl.ItemTemplate>
+                            <DataTemplate>
+                                <Grid>
+                                    <Grid.ColumnDefinitions>
+                                        <ColumnDefinition Width="72"/>
+                                        <ColumnDefinition Width="16"/>
+                                        <ColumnDefinition />
+                                    </Grid.ColumnDefinitions>
+                                    <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Key}"></TextBlock>
+                                    <TextBlock Grid.Row="0" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
+                                    <TextBlock Grid.Row="0" Grid.Column="2"  Text="{Binding Value}" TextWrapping="Wrap"/>
+                                </Grid>
+                            </DataTemplate>
+                        </ItemsControl.ItemTemplate>
+                    </ItemsControl>
 
-                    <TextBlock Grid.Row="0" Grid.Column="0">型号</TextBlock>
-                    <TextBlock Grid.Row="0" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
-                    <TextBlock Grid.Row="0" Grid.Column="2"  Text="{Binding ElementName=This, Path=DeviceInfo.DeviceSubModel}" TextWrapping="Wrap"/>
-
-                    <TextBlock Grid.Row="2" Grid.Column="0">PMC</TextBlock>
-                    <TextBlock Grid.Row="2" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
-                    <TextBlock Grid.Row="2" Grid.Column="2" Text="{Binding ElementName=This, Path=DeviceData.PMCMode}"/>
-
-             
-
-                    <TextBlock Grid.Row="0" Grid.Column="4">PJobID</TextBlock>
-                    <TextBlock Grid.Row="0" Grid.Column="5" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
-                    <TextBlock Grid.Row="0" Grid.Column="6" Text="{Binding ElementName=This, Path=DeviceData.RecipeInfo.PJobID}" TextWrapping="Wrap"/>
-
-                    <TextBlock Grid.Row="2" Grid.Column="4">CJobID</TextBlock>
-                    <TextBlock Grid.Row="2" Grid.Column="5" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
-                    <TextBlock Grid.Row="2" Grid.Column="6" Text="{Binding ElementName=This, Path=DeviceData.RecipeInfo.CJboID}" TextWrapping="Wrap"/>
-
-                    <TextBlock Grid.Row="4" Grid.Column="4">Recipe</TextBlock>
-                    <TextBlock Grid.Row="4" Grid.Column="5" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
-                    <TextBlock Grid.Row="4" Grid.Column="6" Text="{Binding ElementName=This, Path=DeviceData.RecipeInfo.RecipeType}" TextWrapping="Wrap"/>
+                    <ItemsControl Grid.Column="2" ItemsSource="{Binding ElementName=This, Path=DeviceData.RecipeInfo.RecipeInfo}">
+                        <ItemsControl.ItemTemplate>
+                            <DataTemplate>
+                                <Grid>
+                                    <Grid.ColumnDefinitions>
+                                        <ColumnDefinition Width="72"/>
+                                        <ColumnDefinition Width="16"/>
+                                        <ColumnDefinition />
+                                    </Grid.ColumnDefinitions>
+                                    <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Key}"></TextBlock>
+                                    <TextBlock Grid.Row="0" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center">:</TextBlock>
+                                    <TextBlock Grid.Row="0" Grid.Column="2"  Text="{Binding Value}" TextWrapping="Wrap"/>
+                                </Grid>
+                            </DataTemplate>
+                        </ItemsControl.ItemTemplate>
+                    </ItemsControl>
                 </Grid>
 
                 <Grid Grid.Row="4">

+ 9 - 0
Test/DBAnalizer.cs

@@ -0,0 +1,9 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace Test;
+

+ 147 - 0
Test/KeplerData.cs

@@ -0,0 +1,147 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection.Metadata.Ecma335;
+using System.Security.Principal;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Test;
+
+internal class DataCollection<T>
+{
+    public Guid UID { get; set; }
+    public DateTime Time { get; set; }
+    public Dictionary<string, T> ValueCollection { get; set; }
+}
+
+internal class PairValue<T>
+{
+    public T SetPoint { get; set; }
+    public T Value { get; set; }
+}
+
+
+internal class PM
+{
+    public Guid UID { get; set; }
+    public DateTime Time { get; set; }
+
+    public DataCollection<float> OnTime { get; set; }
+    public DataCollection<float> Pressure { get; set; }
+    public DataCollection<float> Mfcs { get; set; }
+    public DataCollection<bool> IoSensor { get; set; }
+    public DataCollection<PairValue<bool>> IoValve { get; set; }
+    public DataCollection<Heater> IoHeater { get; set; }
+
+    public HighTemperatureHeater HighTemperatureHeater { get; set; }
+    public Lid Lid { get; set; }
+    public MainPump MainPump { get; set; }
+    public Match Match { get; set; }
+    public PendulumValve pendulumValve { get; set; }
+
+    public PV PV { get; set; }
+    public RF RF { get; set; }
+    public RFBox RFBox { get; set; }
+    public SlitDoor SlitDoor { get; set; }
+    public TurboPump TurboPump { get; set; }
+}
+
+internal class HighTemperatureHeater
+{
+    public bool IsOn { get; set; }
+    public bool HeaterDriverAlarm { get; set; }
+    public float InnerCurrent { get; set; }
+    public float InnerPower { get; set; }
+    public float InnerResistance { get; set; }
+    public float InnerVoltage { get; set; }
+    public float MaxPower { get; set; }
+    public float MinPower { get; set; }
+    public float OuterCurrent { get; set; }
+    public float OuterPower { get; set; }
+    public float OuterResistance { get; set; }
+    public float OuterVoltage { get; set; }
+    public float Posi_Mm { get; set; }
+    public float Position { get; set; }
+    public float Power_Output { get; set; }
+    public float PurgeN2Flow { get; set; }
+    public float Ratio { get; set; }
+    public float ShaftTCTemp { get; set; }
+    public float SourceTCTemp { get; set; }
+    public float Speed { get; set; }
+    public float Temperature { get; set; }
+    public float TemperatureSetPoint { get; set; }
+    public float TM_Temp { get; set; }
+}
+
+internal class Heater
+{
+    public PairValue<float> ControlTc { get; set; }
+    public PairValue<bool> IsPowerOn { get; set; }
+}
+
+internal class Lid
+{
+    public bool IsClosed { get; set; }
+}
+
+internal class MainPump
+{
+    public bool IsError { get; set; }
+    public bool IsRunning { get; set; }
+}
+
+internal class Match
+{
+    public float C1 { get; set; }
+    public float C2 { get; set; }
+    public float DCBias { get; set; }
+    public float Vpp { get; set; }
+}
+
+internal class PendulumValve
+{
+    public bool IsOpen { get; set; }
+    public PairValue<float> Position { get; set; }
+    public PairValue<float> Pressure { get; set; }
+}
+
+internal class PV
+{
+    public float ForwardPower { get; set; }
+    public float GetPVPosition { get; set; }
+
+    public Dictionary<string, float> Pressure { get; set; }
+    public Dictionary<string, float> Flow { get; set; }
+}
+
+internal class RF
+{
+    public float ForwardPower { get; set; }
+    public float Frequency { get; set; }
+    public bool IsPowerOn { get; set; }
+    public float PowerSetPoint { get; set; }
+    public float PulsingDutyCycle { get; set; }
+    public float PulsingFrequency { get; set; }
+    public float ReflectPower { get; set; }
+}
+
+internal class RFBox
+{
+    public float C1 { get; set; }
+    public float C2 { get; set; }
+    public float DCBias { get; set; }
+    public float Vpp { get; set; }
+
+}
+
+internal class SlitDoor
+{
+    public bool IsClosed { get; set; }
+}
+
+internal class TurboPump
+{
+    public float Temperature { get; set; }
+    public bool IsTurboPumpAtSpeed { get; set; }
+}

+ 40 - 2
Test/Program.cs

@@ -1,9 +1,47 @@
-namespace Test;
+
+using SqlSugar;
+using SqlSugarORM;
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Text.Json;
+using Universal;
+using Universal.IO;
+
+namespace Test;
 
 internal class Program
 {
     static void Main()
     {
+        SqlSugarCustom orm = new();
+
+        orm.Initialize(null);
+        string dbString = "Database=thermaldb;Password=123456;Host=localhost;Username=postgres;Persist Security Info=True";
+        //string dbString = "Database=Kepler;Password=123456;Host=localhost;Username=postgres;Persist Security Info=True";
+        if (!orm.Open(dbString, DbType.PostgreSQL, true))
+        {
+            Console.WriteLine("Connect Failed");
+            return;
+        }
 
+        dynamic[] t = orm._Client!.Queryable<dynamic>().AS("\"20250627.PM1\"").Take(10).ToArray();
+        //dynamic[] t = orm._Client!.Queryable<dynamic>().AS("\"20250626.Data\"").Take(1).ToArray();
+        //KeplerData processData = new();
+        GeneralProcessData processData = new();
+        processData.ToDictionary(t, out Dictionary<string, object>? outputs);
+        foreach (var item in outputs)
+        {
+            string s = JsonSerializer.Serialize(item);
+            Console.WriteLine(s);
+            Console.WriteLine();
+        }
+        //int totalCount = 0;
+        //int totalPages = 0;
+        //dynamic[] page = orm._Client!.Queryable<dynamic>().AS("\"20250626.Data\"").ToPageList(1, 1000, ref totalCount, ref totalPages).ToArray();
     }
-}
+}
+
+

+ 9 - 1
Test/Test.csproj

@@ -7,8 +7,16 @@
     <Nullable>enable</Nullable>
   </PropertyGroup>
 
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+    <WarningLevel>0</WarningLevel>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
+    <WarningLevel>0</WarningLevel>
+  </PropertyGroup>
+
   <ItemGroup>
-    <ProjectReference Include="..\Universal\Universal.csproj" />
+    <ProjectReference Include="..\DataBase\SqlSugarORM\SqlSugarORM.csproj" />
   </ItemGroup>
 
 </Project>

+ 1 - 0
Universal/Extensions.cs

@@ -99,6 +99,7 @@ public static class Extensions
 
         return Encoding.ASCII.GetString(bytes);
     }
+
 }
 #endif
 

+ 51 - 0
Universal/ReflectionHelper.cs

@@ -14,4 +14,55 @@ public class ReflectionHelper
         foreach (PropertyInfo propertyInfo in model.GetType().GetRuntimeProperties())
             yield return new(propertyInfo.Name, propertyInfo.PropertyType, propertyInfo.GetValue(model));
     }
+
+    public static Dictionary<string, object?>? GetProperties<T>(T t)
+    {
+        if (t == null)
+            return default;
+        PropertyInfo[] properties = t.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
+        if (properties.Length <= 0)
+            return default;
+
+        Dictionary<string, object?> ListStr = [];
+
+        foreach (PropertyInfo item in properties)
+        {
+            string name = item.Name; //名称
+            object? value = item.GetValue(t, null);  //值
+
+            if (item.PropertyType.IsValueType || item.PropertyType.Name.StartsWith("String"))
+                ListStr.Add(name, value);
+            else
+                GetProperties(value);
+
+        }
+        return ListStr;
+    }
+
+    public static Dictionary<string, object?>? GetFields<T>(T t)
+    {
+
+        if (t == null)
+            return default;
+
+        FieldInfo[] fields = t.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
+
+        if (fields.Length <= 0)
+            return default;
+
+        Dictionary<string, object?> ListStr = [];
+        foreach (FieldInfo item in fields)
+        {
+            string name = item.Name; //名称
+            object? value = item.GetValue(t);  //值
+
+            if (item.FieldType.IsValueType || item.FieldType.Name.StartsWith("String"))
+                ListStr.Add(name, value);
+            else
+                GetFields(value);
+        }
+        return ListStr;
+
+
+    }
 }