lixun 2 gadi atpakaļ
vecāks
revīzija
1e0cfa92c1

+ 6 - 0
src/YSAI.DAQ/YSAI.DAQ.sln

@@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.TestConsole", "YSAI.Te
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.RabbitMQ", "YSAI.RabbitMQ\YSAI.RabbitMQ.csproj", "{8CE7E64C-7A6A-4581-A9B3-C05214986B4F}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YSAI.Manage", "YSAI.Manage\YSAI.Manage.csproj", "{25525A20-C60D-4B98-BD61-8CCA83BB45BB}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -89,6 +91,10 @@ Global
 		{8CE7E64C-7A6A-4581-A9B3-C05214986B4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{8CE7E64C-7A6A-4581-A9B3-C05214986B4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{8CE7E64C-7A6A-4581-A9B3-C05214986B4F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{25525A20-C60D-4B98-BD61-8CCA83BB45BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{25525A20-C60D-4B98-BD61-8CCA83BB45BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{25525A20-C60D-4B98-BD61-8CCA83BB45BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{25525A20-C60D-4B98-BD61-8CCA83BB45BB}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 33 - 0
src/YSAI.DAQ/YSAI.Manage/Controllers/WeatherForecastController.cs

@@ -0,0 +1,33 @@
+using Microsoft.AspNetCore.Mvc;
+
+namespace YSAI.Manage.Controllers
+{
+    [ApiController]
+    [Route("[controller]")]
+    public class WeatherForecastController : ControllerBase
+    {
+        private static readonly string[] Summaries = new[]
+        {
+        "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
+    };
+
+        private readonly ILogger<WeatherForecastController> _logger;
+
+        public WeatherForecastController(ILogger<WeatherForecastController> logger)
+        {
+            _logger = logger;
+        }
+
+        [HttpGet(Name = "GetWeatherForecast")]
+        public IEnumerable<WeatherForecast> Get()
+        {
+            return Enumerable.Range(1, 5).Select(index => new WeatherForecast
+            {
+                Date = DateTime.Now.AddDays(index),
+                TemperatureC = Random.Shared.Next(-20, 55),
+                Summary = Summaries[Random.Shared.Next(Summaries.Length)]
+            })
+            .ToArray();
+        }
+    }
+}

+ 35 - 0
src/YSAI.DAQ/YSAI.Manage/Program.cs

@@ -0,0 +1,35 @@
+namespace YSAI.Manage
+{
+    public class Program
+    {
+        public static void Main(string[] args)
+        {
+            var builder = WebApplication.CreateBuilder(args);
+
+            // Add services to the container.
+
+            builder.Services.AddControllers();
+            // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
+            builder.Services.AddEndpointsApiExplorer();
+            builder.Services.AddSwaggerGen();
+
+            var app = builder.Build();
+
+            // Configure the HTTP request pipeline.
+            if (app.Environment.IsDevelopment())
+            {
+                app.UseSwagger();
+                app.UseSwaggerUI();
+            }
+
+            app.UseHttpsRedirection();
+
+            app.UseAuthorization();
+
+
+            app.MapControllers();
+
+            app.Run();
+        }
+    }
+}

+ 31 - 0
src/YSAI.DAQ/YSAI.Manage/Properties/launchSettings.json

@@ -0,0 +1,31 @@
+{
+  "$schema": "https://json.schemastore.org/launchsettings.json",
+  "iisSettings": {
+    "windowsAuthentication": false,
+    "anonymousAuthentication": true,
+    "iisExpress": {
+      "applicationUrl": "http://localhost:51710",
+      "sslPort": 44373
+    }
+  },
+  "profiles": {
+    "YSAI.Manage": {
+      "commandName": "Project",
+      "dotnetRunMessages": true,
+      "launchBrowser": true,
+      "launchUrl": "swagger",
+      "applicationUrl": "https://localhost:7098;http://localhost:5231",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    },
+    "IIS Express": {
+      "commandName": "IISExpress",
+      "launchBrowser": true,
+      "launchUrl": "swagger",
+      "environmentVariables": {
+        "ASPNETCORE_ENVIRONMENT": "Development"
+      }
+    }
+  }
+}

+ 13 - 0
src/YSAI.DAQ/YSAI.Manage/WeatherForecast.cs

@@ -0,0 +1,13 @@
+namespace YSAI.Manage
+{
+    public class WeatherForecast
+    {
+        public DateTime Date { get; set; }
+
+        public int TemperatureC { get; set; }
+
+        public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
+
+        public string? Summary { get; set; }
+    }
+}

+ 13 - 0
src/YSAI.DAQ/YSAI.Manage/YSAI.Manage.csproj

@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk.Web">
+
+  <PropertyGroup>
+    <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
+    <ImplicitUsings>enable</ImplicitUsings>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
+  </ItemGroup>
+
+</Project>

+ 8 - 0
src/YSAI.DAQ/YSAI.Manage/appsettings.Development.json

@@ -0,0 +1,8 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  }
+}

+ 9 - 0
src/YSAI.DAQ/YSAI.Manage/appsettings.json

@@ -0,0 +1,9 @@
+{
+  "Logging": {
+    "LogLevel": {
+      "Default": "Information",
+      "Microsoft.AspNetCore": "Warning"
+    }
+  },
+  "AllowedHosts": "*"
+}

+ 17 - 12
src/YSAI.DAQ/YSAI.Mqtt/client/MqttClientData.cs

@@ -20,6 +20,10 @@ namespace YSAI.Mqtt.client
         /// </summary>
         public class Basics
         {
+            /// <summary>
+            /// 唯一标识符
+            /// </summary>
+            public string? SN { get; set; }
             /// <summary>
             /// IP地址
             /// </summary>
@@ -68,18 +72,19 @@ namespace YSAI.Mqtt.client
                 }
                 else
                 {
-                    if (ServerIPAddress == Obj.ServerIPAddress &&
-                    ServerPort == Obj.ServerPort &&
-                    ServerLoginID == Obj.ServerLoginID &&
-                    ClientID == Obj.ClientID &&
-                    ServerLoginPassword == Obj.ServerLoginPassword)
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        return false;
-                    }
+                    if (SN == Obj.SN &&
+                        ServerIPAddress == Obj.ServerIPAddress &&
+                        ServerPort == Obj.ServerPort &&
+                        ServerLoginID == Obj.ServerLoginID &&
+                        ClientID == Obj.ClientID &&
+                        ServerLoginPassword == Obj.ServerLoginPassword)
+                        {
+                            return true;
+                        }
+                        else
+                        {
+                            return false;
+                        }
                 }
             }
         }

+ 2 - 2
src/YSAI.DAQ/YSAI.Opc/da/client/OpcDaClientData.cs

@@ -22,11 +22,11 @@ namespace YSAI.Opc.da.client
             /// <summary>
             /// 唯一标识符
             /// </summary>
-            public string SN { get; set; }
+            public string? SN { get; set; }
             /// <summary>
             /// 服务名
             /// </summary>
-            public string ServiceName { get; set; }
+            public string? ServiceName { get; set; }
             /// <summary>
             /// 接口版本
             /// </summary>

+ 1 - 1
src/YSAI.DAQ/YSAI.Opc/da/http/OpcDaHttpData.cs

@@ -21,7 +21,7 @@ namespace YSAI.Opc.da.http
             /// <summary>
             /// 唯一标识
             /// </summary>
-            public string SN { get; set; }
+            public string? SN { get; set; }
             /// <summary>
             /// 服务IP
             /// </summary>

+ 2 - 2
src/YSAI.DAQ/YSAI.Opc/ua/client/OpcUaClientData.cs

@@ -45,10 +45,10 @@ namespace YSAI.Opc.ua.client
             public string? ServerUrl { get; set; }
 
             /// <summary>
-            /// 序列号
+            /// 唯一标识符
             /// </summary>
             public string? SN { get; set; }
-            
+
 
             /// <summary>
             /// 自定义的名称空间

+ 5 - 0
src/YSAI.DAQ/YSAI.RabbitMQ/RabbitMQData.cs

@@ -16,6 +16,10 @@ namespace YSAI.RabbitMQ
         /// </summary>
         public class Basics
         {
+            /// <summary>
+            /// 唯一标识符
+            /// </summary>
+            public string? SN { get; set; }
             /// <summary>
             /// 交换机名称
             /// </summary>
@@ -47,6 +51,7 @@ namespace YSAI.RabbitMQ
                 Basics? obj = Obj as Basics;
                 if (obj == null) return false;
                 if (obj.ExChangeName == this.ExChangeName &&
+                    obj.SN == this.SN &&
                     obj.HostName == this.HostName&&
                     obj.Port == this.Port &&
                     obj.UserName == this.UserName &&

+ 0 - 3
src/YSAI.DAQ/YSAI.RabbitMQ/RabbitMQPublisherOperate.cs

@@ -208,8 +208,5 @@ namespace YSAI.RabbitMQ
         {
             return Task.Run(() => Publish(MessageHead, MessageContent, Type, Durable, Exclusive, AutoDelete));
         }
-
-
-       
     }
 }

+ 6 - 1
src/YSAI.DAQ/YSAI.S7/client/S7ClientData.cs

@@ -15,6 +15,10 @@ namespace YSAI.S7.client
         /// </summary>
         public class Basics
         {
+            /// <summary>
+            /// 唯一标识符
+            /// </summary>
+            public string? SN { get; set; }
             /// <summary>
             /// ip地址
             /// </summary>
@@ -48,7 +52,8 @@ namespace YSAI.S7.client
             {
                 Basics? obj = Obj as Basics;
                 if (obj == null) return false;
-                if (obj.Ip == Ip &&
+                if (obj.SN == SN && 
+                    obj.Ip == Ip &&
                     obj.Port == Port &&
                     obj.S7CpuType == S7CpuType &&
                     obj.Rack == Rack &&