添加文件

This commit is contained in:
Diego
2025-09-18 17:54:29 +08:00
parent 4921642151
commit 35e1ffa3e9
25 changed files with 1622 additions and 194 deletions

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://thingsgateway.cn/
// QQ群605534569
//------------------------------------------------------------------------------
using Microsoft.AspNetCore.ResponseCompression;
using System.Runtime.InteropServices;
using System.Text;
using ThingsGateway.Admin.Application;
using ThingsGateway.DB;
using ThingsGateway.NewLife;
using ThingsGateway.NewLife.Log;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Server;
public class Program
{
public static async Task Main(string[] args)
{
await Task.Delay(2000).ConfigureAwait(false);
}
}

View File

@@ -0,0 +1,263 @@

//using Newtonsoft.Json.Linq;
//using ThingsGateway.Foundation;
//using ThingsGateway.Gateway.Application;
//namespace ThingsGateway.Server;
///// <summary>
///// 插件类,默认实现了<see cref="IDevice"/>接口,继承<see cref="CollectFoundationBase"/> 实现采集插件
///// </summary>
//public class TestCollectPlugin : CollectFoundationBase
//{
// /// <summary>
// /// 调试UI Type如果不存在无需重写
// /// </summary>
// public override Type DriverDebugUIType => base.DriverDebugUIType;
// /// <summary>
// /// 插件属性UI Type继承<see cref="IPropertyUIBase"/>如果不存在无需重写
// /// </summary>
// public override Type DriverPropertyUIType => base.DriverPropertyUIType;
// /// <summary>
// /// 插件UI Type继承<see cref="IDriverUIBase"/>如果不存在无需重写
// /// </summary>
// public override Type DriverUIType => base.DriverUIType;
// /// <summary>
// /// 插件变量寄存器UI Type继承<see cref="IAddressUIBase"/>如果不存在无需重写
// /// </summary>
// public override Type DriverVariableAddressUIType => base.DriverVariableAddressUIType;
// /// <summary>
// /// 插件配置项,继承<see cref="CollectPropertyBase"/> 返回类实例
// /// </summary>
// public override CollectPropertyBase CollectProperties => _property;
// private TestCollectProperty? _property = new();
// /// <summary>
// /// 在插件初始化时调用只会执行一次参数为插件默认的链路通道类如未实现可忽略l
// /// </summary>
// protected override Task InitChannelAsync(IChannel? channel, CancellationToken cancellationToken)
// {
// //做一些初始化操作
// return Task.CompletedTask;
// }
// /// <summary>
// /// 变量打包操作会在默认的AfterVariablesChangedAsync方法里执行参数为设备变量列表返回源读取变量列表
// /// </summary>
// protected override Task<List<VariableSourceRead>> ProtectedLoadSourceReadAsync(List<VariableRuntime> deviceVariables)
// {
// //实现将设备变量打包成源读取变量
// //比如如果需要实现MC中的字多读功能需将多个变量地址打包成一个源读取地址和读取长度根据一系列规则添加解析标识然后在返回的整个字节数组中解析出原来的变量地址代表的数据字节
// //一般可操作 VariableRuntime 类中的 index, thingsgatewaybitconvter 等属性
// //一般可操作 VariableSourceRead 类中的 address, length 等属性
// return Task.FromResult(new List<VariableSourceRead>());
// }
// /// <summary>
// /// 实现<see cref="IDevice"/>
// /// </summary>
// public override IDevice? FoundationDevice => base.FoundationDevice;
// /// <summary>
// /// 特殊方法,添加<see cref="DynamicMethodAttribute"/> 特性 返回IOperResult
// /// 支持<see cref="CancellationToken"/> 参数,需放到最后
// /// 默认解析方式为英文分号
// /// 比如rpc参数为 test1;test2解析query1="test1",query2="test2"
// /// 也可以在变量地址中填入test1rpc参数传入test2解析query1="test1",query2="test2"
// /// </summary>
// [DynamicMethod("测试特殊方法")]
// public IOperResult<string> TestMethod(string query1, string query2, CancellationToken cancellationToken)
// {
// return new OperResult<string>() { Content = "测试特殊方法" };
// }
//}
///// <summary>
///// 插件类配置
///// </summary>
//public class TestCollectProperty : CollectFoundationPackPropertyBase
//{
// /// <summary>
// /// 添加<see cref="DynamicPropertyAttribute"/> 特性如需多语言配置可添加json资源参考其他插件
// /// </summary>
// [DynamicProperty(Description = null, Remark = null)]
// public string TestString { get; set; }
//}
///// <summary>
///// 插件类,完全自定义
///// </summary>
//public class TestCollectPlugin1 : CollectBase
//{
// /// <summary>
// /// 调试UI Type如果不存在无需重写
// /// </summary>
// public override Type DriverDebugUIType => base.DriverDebugUIType;
// /// <summary>
// /// 插件属性UI Type继承<see cref="IPropertyUIBase"/>如果不存在无需重写
// /// </summary>
// public override Type DriverPropertyUIType => base.DriverPropertyUIType;
// /// <summary>
// /// 插件UI Type继承<see cref="IDriverUIBase"/>如果不存在无需重写
// /// </summary>
// public override Type DriverUIType => base.DriverUIType;
// /// <summary>
// /// 插件变量寄存器UI Type继承<see cref="IAddressUIBase"/>如果不存在无需重写
// /// </summary>
// public override Type DriverVariableAddressUIType => base.DriverVariableAddressUIType;
// /// <summary>
// /// 插件配置项,继承<see cref="CollectPropertyBase"/> 返回类实例
// /// </summary>
// public override CollectPropertyBase CollectProperties => _property;
// private TestCollectProperty1? _property = new();
// /// <summary>
// /// 在插件初始化时调用只会执行一次参数为插件默认的链路通道类如未实现可忽略l
// /// </summary>
// protected override Task InitChannelAsync(IChannel? channel, CancellationToken cancellationToken)
// {
// //做一些初始化操作
// return Task.CompletedTask;
// }
// /// <summary>
// /// 变量打包操作会在默认的AfterVariablesChangedAsync方法里执行参数为设备变量列表返回源读取变量列表
// /// </summary>
// protected override Task<List<VariableSourceRead>> ProtectedLoadSourceReadAsync(List<VariableRuntime> deviceVariables)
// {
// //实现将设备变量打包成源读取变量
// //比如如果需要实现MC中的字多读功能需将多个变量地址打包成一个源读取地址和读取长度根据一系列规则添加解析标识然后在返回的整个字节数组中解析出原来的变量地址代表的数据字节
// //一般可操作 VariableRuntime 类中的 index, thingsgatewaybitconvter 等属性
// //一般可操作 VariableSourceRead 类中的 address, length 等属性
// return Task.FromResult(new List<VariableSourceRead>());
// }
// /// <summary>
// /// 如果不实现ReadSourceAsync方法可以返回flase
// /// </summary>
// protected override bool VariableSourceReadsEnable => base.VariableSourceReadsEnable;
// /// <summary>
// /// 获取任务列表,默认会实现 TestOnline任务SetDeviceStatus任务以及 VariableSourceRead等任务VariableSourceRead任务启用条件为<see cref="VariableSourceReadsEnable"/> 为true。任务即是timer实现可通过<see cref="ScheduledTaskHelper.GetTask(string, Func{object?, CancellationToken, Task}, object?, TouchSocket.Core.ILog, CancellationToken)"/> 方法实现定时任务
// /// </summary>
// /// <param name="cancellationToken"></param>
// /// <returns></returns>
// protected override List<IScheduledTask> ProtectedGetTasks(CancellationToken cancellationToken)
// {
// return base.ProtectedGetTasks(cancellationToken);
// }
// /// <summary>
// /// 实现离线重连任务
// /// </summary>
// /// <param name="state"></param>
// /// <param name="cancellationToken"></param>
// /// <returns></returns>
// protected override Task TestOnline(object? state, CancellationToken cancellationToken)
// {
// return base.TestOnline(state, cancellationToken);
// }
// /// <summary>
// /// 返回是否成功连接设备
// /// </summary>
// /// <returns></returns>
// public override bool IsConnected()
// {
// return true;
// }
// /// <summary>
// /// 在变量发生组态变化后执行,默认会执行<see cref="ProtectedLoadSourceReadAsync"/> 方法重新获取源读取变量列表并且重新启动VariableSourceRead等任务
// /// </summary>
// /// <param name="cancellationToken"></param>
// /// <returns></returns>
// public override Task AfterVariablesChangedAsync(CancellationToken cancellationToken)
// {
// return base.AfterVariablesChangedAsync(cancellationToken);
// }
// /// <summary>
// /// 变量寄存器的字符串描述
// /// </summary>
// /// <returns></returns>
// public override string GetAddressDescription()
// {
// return base.GetAddressDescription();
// }
// /// <summary>
// /// 设备暂停时执行,默认会暂停所有任务
// /// </summary>
// /// <param name="pause"></param>
// public override void PauseThread(bool pause)
// {
// base.PauseThread(pause);
// }
// /// <summary>
// /// 开始前执行
// /// </summary>
// protected override Task ProtectedStartAsync(CancellationToken cancellationToken)
// {
// //一般实现PLC长连接
// return base.ProtectedStartAsync(cancellationToken);
// }
// /// <summary>
// /// 写入变量,实现设备写入操作,注意执行写锁, using var writeLock =await ReadWriteLock.WriterLockAsync(cancellationToken).ConfigureAwait(false);
// /// </summary>
// protected override ValueTask<Dictionary<string, OperResult>> WriteValuesAsync(Dictionary<VariableRuntime, JToken> writeInfoLists, CancellationToken cancellationToken)
// {
// return base.WriteValuesAsync(writeInfoLists, cancellationToken);
// }
// /// <summary>
// /// 读取源变量,在<see cref="VariableSourceReadsEnable"/> 为true时添加源读取任务任务启动时会执行
// /// 一般需要更新设备变量值,调用<see cref="VariableRuntime.SetValue(object?, DateTime, bool)"/>
// /// </summary>
// protected override ValueTask<OperResult<ReadOnlyMemory<byte>>> ReadSourceAsync(VariableSourceRead variableSourceRead, CancellationToken cancellationToken)
// {
// return base.ReadSourceAsync(variableSourceRead, cancellationToken);
// }
// protected override Task DisposeAsync(bool disposing)
// {
// return base.DisposeAsync(disposing);
// }
// /// <summary>
// /// 特殊方法,添加<see cref="DynamicMethodAttribute"/> 特性 返回IOperResult
// /// 支持<see cref="CancellationToken"/> 参数,需放到最后
// /// 默认解析方式为英文分号
// /// 比如rpc参数为 test1;test2解析query1="test1",query2="test2"
// /// 也可以在变量地址中填入test1rpc参数传入test2解析query1="test1",query2="test2"
// /// </summary>
// [DynamicMethod("测试特殊方法")]
// public IOperResult<string> TestMethod(string query1, string query2, CancellationToken cancellationToken)
// {
// return new OperResult<string>() { Content = "测试特殊方法" };
// }
//}
///// <summary>
///// 插件类配置
///// </summary>
//public class TestCollectProperty1 : CollectPropertyBase
//{
// /// <summary>
// /// 添加<see cref="DynamicPropertyAttribute"/> 特性如需多语言配置可添加json资源参考其他插件
// /// </summary>
// [DynamicProperty(Description = null, Remark = null)]
// public string TestString { get; set; }
//}

View File

@@ -0,0 +1,56 @@
//////------------------------------------------------------------------------------
//////此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
////// 此代码版权除特别声明外的代码归作者本人Diego所有
////// 源代码使用协议遵循本仓库的开源协议及附加协议
////// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
////// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
////// 使用文档https://thingsgateway.cn/
////// QQ群605534569
////// ------------------------------------------------------------------------------
//using System.Dynamic;
//using ThingsGateway.Foundation;
//using ThingsGateway.Gateway.Application;
//public class TestDynamicModel : IDynamicModel
//{
// public IEnumerable<dynamic> GetList(IEnumerable<object> datas)
// {
// if (datas == null) return null;
// List<ExpandoObject> deviceObjs = new List<ExpandoObject>();
// //按设备名称分组
// var groups = datas.Where(a => !string.IsNullOrEmpty(((AlarmVariable)a).DeviceName)).GroupBy(a => ((AlarmVariable)a).DeviceName, a => ((AlarmVariable)a));
// foreach (var group in groups)
// {
// //按采集时间分组
// var data = group.GroupBy(a => a.AlarmTime.DateTimeToUnixTimestamp());
// var deviceObj = new ExpandoObject();
// List<ExpandoObject> expandos = new List<ExpandoObject>();
// foreach (var item in data)
// {
// var expando = new ExpandoObject();
// expando.TryAdd("ts", item.Key);
// var variableObj = new ExpandoObject();
// foreach (var tag in item)
// {
// var alarmObj = new ExpandoObject();
// alarmObj.TryAdd(nameof(tag.AlarmCode), tag.AlarmCode);
// alarmObj.TryAdd(nameof(tag.AlarmText), tag.AlarmText);
// alarmObj.TryAdd(nameof(tag.AlarmType), tag.AlarmType);
// alarmObj.TryAdd(nameof(tag.AlarmLimit), tag.AlarmLimit);
// alarmObj.TryAdd(nameof(tag.EventTime), tag.EventTime);
// alarmObj.TryAdd(nameof(tag.EventType), tag.EventType);
// variableObj.TryAdd(tag.Name, alarmObj);
// }
// expando.TryAdd("alarms", variableObj);
// expandos.Add(expando);
// }
// deviceObj.TryAdd(group.Key, expandos);
// deviceObjs.Add(deviceObj);
// }
// return deviceObjs;
// }
//}

View File

@@ -0,0 +1,46 @@

//using System.Text;
//using ThingsGateway.Gateway.Application;
//public class TestExexcuteExpressions : IExexcuteExpressions
//{
// public TouchSocket.Core.ILog Logger { get; set; }
// public async System.Threading.Tasks.Task<NodeOutput> ExecuteAsync(NodeInput input, System.Threading.CancellationToken cancellationToken)
// {
// //想上传mqtt可以自己写mqtt上传代码或者通过mqtt插件的公开方法上传
// //直接获取mqttclient插件类型的第一个设备
// var mqttClient = GlobalData.ReadOnlyChannels.FirstOrDefault(a => a.Value.PluginName == "ThingsGateway.Plugin.Mqtt.MqttClient").Value?.ReadDeviceRuntimes?.FirstOrDefault().Value?.Driver as ThingsGateway.Plugin.Mqtt.MqttClient;
// if (mqttClient == null)
// throw new("mqttClient NOT FOUND");
// TopicArray topicArray = new()
// {
// Topic = "test",
// Payload = Encoding.UTF8.GetBytes("test")
// };
// var result = await mqttClient.MqttUpAsync(topicArray, default).ConfigureAwait(false);// 主题 和 负载
// if (!result.IsSuccess)
// throw new(result.ErrorMessage);
// return new NodeOutput() { Value = result };
// //通过设备名称找出mqttClient插件
// //var mqttClient = GlobalData.ReadOnlyDevices.FirstOrDefault(a => a.Value.Name == "mqttDevice1").Value?.Driver as ThingsGateway.Plugin.Mqtt.MqttClient;
// //if (mqttClient == null)
// // throw new("mqttClient NOT FOUND");
// //TopicArray topicArray = new()
// //{
// // Topic = "test",
// // Payload = Encoding.UTF8.GetBytes("test")
// //};
// //var result = await mqttClient.MqttUpAsync(topicArray, default).ConfigureAwait(false);// 主题 和 负载
// //if (!result.IsSuccess)
// // throw new(result.ErrorMessage);
// //return new NodeOutput() { Value = result };
// }
//}

View File

@@ -0,0 +1,223 @@
//////------------------------------------------------------------------------------
//////此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
////// 此代码版权除特别声明外的代码归作者本人Diego所有
////// 源代码使用协议遵循本仓库的开源协议及附加协议
////// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
////// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
////// 使用文档https://thingsgateway.cn/
////// QQ群605534569
////// ------------------------------------------------------------------------------
//using ThingsGateway.Foundation;
//using ThingsGateway.Gateway.Application;
//using ThingsGateway.NewLife.Extension;
//public class TestKafkaDynamicModel : DynamicModelBase
//{
// private Dictionary<string, VariableRuntime> variableRuntimes = new();
// private long id = 0;
// public TestKafkaDynamicModel()
// {
// var name = "kafka1";
// if (GlobalData.ReadOnlyDevices.TryGetValue(name, out var kafka1))
// {
// id = kafka1.Id;
// foreach (var item in kafka1.Driver?.IdVariableRuntimes)
// {
// //变量备注1作为Key(AE报警SourceId)
// var data1 = item.Value.GetPropertyValue(id, nameof(BusinessVariableProperty.Data1));
// if (!data1.IsNullOrEmpty())
// {
// variableRuntimes.Add(data1, item.Value);
// }
// }
// }
// else
// {
// throw new Exception($"找不到设备 {name}");
// }
// }
// public override IEnumerable<dynamic> GetList(IEnumerable<object> datas)
// {
// if (datas == null) return null;
// var pluginEventDatas = datas.Cast<PluginEventData>();
// var opcDatas = pluginEventDatas.Select(
// a =>
// {
// if (a.ObjectValue == null)
// {
// a.ObjectValue = a.Value.ToObject(Type.GetType(a.ValueType));
// }
// return a.ObjectValue is ThingsGateway.Plugin.OpcAe.OpcAeEventData opcData ? opcData : null;
// }
// ).Where(a => a != null).ToList();
// List<KafkaAlarmEntity> alarmEntities = new List<KafkaAlarmEntity>();
// if (opcDatas.Count == 0)
// {
// Logger?.LogInformation("没有OPCAE数据");
// return alarmEntities;
// }
// foreach (var opcAeEventData in opcDatas)
// {
// //一般只需要条件报警
// //if (opcAeEventData.EventType != Opc.Ae.EventType.Condition)
// // continue;
// //重连时触发的事件,可以跳过不处理
// //if(opcAeEventData.Refresh)
// // continue;
// var sourceName = opcAeEventData.SourceID;
// if (variableRuntimes.TryGetValue(sourceName, out var variableRuntime))
// {
// var ack = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : ((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Acknowledged);
// bool isRecover = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : !((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Active);
// //构建告警实体
// KafkaAlarmEntity alarmEntity = new KafkaAlarmEntity
// {
// AlarmCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data2)), //唯一编码
// ResourceCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data3)), //资源编码
// ResourceName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4)), //资源名称
// MetricCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data5)), //指标编码
// MetricName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data6)), //指标名称
// Content = $"{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4))}{opcAeEventData.Message}", //告警内容,设备名称+告警内容包含阈值信息可能opcae里没有带阈值信息那么就需要录入固定值可选Data10
// AlarmType = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data7)), // opcAeEventData.Severity 告警类型,子系统产生告警的类型,可能需要固定备注值
// ConfirmedTime = ack ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //告警确认时间
// FixTime = isRecover ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //解除告警时间
// LastTime = opcAeEventData.AlarmTime.DateTimeToUnixTimestamp(), //产生告警时间
// Status = isRecover ? "FIXED" : "UNFIXED", //告警状态
// AlarmLevel = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data8)), //opcAeEventData.Severity.ToString(), //告警等级,可能需要固定备注值
// SubSystemCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data9)), //子系统编码
// Type = "SUB_SYSTEM_ALARM", //默认填写字段
// ConfirmAccount = opcAeEventData.ActorID, //告警确认人
// ClearAccount = opcAeEventData.ActorID, //告警清除人
// ProcessInstruction = null //告警处理说明OPCAE不带有
// };
// alarmEntities.Add(alarmEntity);
// }
// else
// {
// Logger?.LogInformation($"找不到相关变量{sourceName}");
// }
// }
// return alarmEntities;
// }
//}
///// <summary>
///// 告警实体
///// </summary>
//public class KafkaAlarmEntity
//{
// /// <summary>
// /// 告警编码唯一 (非空)
// /// 示例:"8e8a118ac452fd04da8c26fa588a7cab"
// /// </summary>
// public string AlarmCode { get; set; }
// /// <summary>
// /// 资源编码,唯一编码,需要按照映射表上传 (非空)
// /// 示例:"RS_A6K9MUSG19V"
// /// </summary>
// public string ResourceCode { get; set; }
// /// <summary>
// /// 资源名称,需要按照映射表上传 (非空)
// /// 示例:"MB-A7"
// /// </summary>
// public string ResourceName { get; set; }
// /// <summary>
// /// 指标编码唯一,需要按照映射表上传 (非空)
// /// 示例:"ActivePowerPa"
// /// </summary>
// public string MetricCode { get; set; }
// /// <summary>
// /// 指标名称,需要按照映射表上传 (非空)
// /// 示例:"有功功率Pa"
// /// </summary>
// public string MetricName { get; set; }
// /// <summary>
// /// 告警内容:设备名称+告警内容(包含阈值信息) (非空)
// /// 示例:"MB-A7有功功率Pa > 30"
// /// </summary>
// public string Content { get; set; }
// /// <summary>
// /// 告警类型,子系统产生告警的类型 (非空)
// /// 示例:"0101" 表示高限报警
// /// </summary>
// public string AlarmType { get; set; }
// /// <summary>
// /// 告警确认时间 (可空,时间戳)
// /// 示例1586152800000
// /// </summary>
// public long? ConfirmedTime { get; set; }
// /// <summary>
// /// 解除告警时间 (可空,时间戳)
// /// 示例1586152800000
// /// </summary>
// public long? FixTime { get; set; }
// /// <summary>
// /// 产生告警时间 (非空,时间戳)
// /// 示例1586152800000
// /// </summary>
// public long LastTime { get; set; }
// /// <summary>
// /// 告警状态 (非空)
// /// 可选值UNFIXED新增告警、FIXED解除告警
// /// </summary>
// public string Status { get; set; }
// /// <summary>
// /// 告警等级,需要按照映射表上传 (非空)
// /// 示例:"1"
// /// </summary>
// public string AlarmLevel { get; set; }
// /// <summary>
// /// 子系统编码 (非空)
// /// 示例:"MS_NEW_PD_DCIM_001"
// /// </summary>
// public string SubSystemCode { get; set; }
// /// <summary>
// /// 默认填写字段 (非空)
// /// 固定值:"SUB_SYSTEM_ALARM"
// /// </summary>
// public string Type { get; set; }
// /// <summary>
// /// 告警确认人 (可空)
// /// 示例:"admin3"
// /// </summary>
// public string ConfirmAccount { get; set; }
// /// <summary>
// /// 告警清除人 (可空)
// /// 示例:"admin"
// /// </summary>
// public string ClearAccount { get; set; }
// /// <summary>
// /// 告警处理说明 (可空)
// /// 示例:"admin"
// /// </summary>
// public string ProcessInstruction { get; set; }
//}

View File

@@ -0,0 +1,46 @@
////------------------------------------------------------------------------------
////此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
//// 此代码版权除特别声明外的代码归作者本人Diego所有
//// 源代码使用协议遵循本仓库的开源协议及附加协议
//// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
//// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
//// 使用文档https://thingsgateway.cn/
//// QQ群605534569
//// ------------------------------------------------------------------------------
//using ThingsGateway.Gateway.Application;
//using ThingsGateway.NewLife.Json.Extension;
//using ThingsGateway.Plugin.DB;
//using ThingsGateway.SqlSugar;
//using TouchSocket.Core;
//public class TestSQL : DynamicSQLBase
//{
// public override Task DBInit(ISqlSugarClient db, CancellationToken cancellationToken)
// {
// db.DbMaintenance.CreateDatabase();
// db.CodeFirst.InitTables<ThingsGateway.Plugin.OpcAe.OpcAeEventData>();
// return Task.CompletedTask;
// }
// public override async Task DBInsertable(ISqlSugarClient db, IEnumerable<object> datas, CancellationToken cancellationToken)
// {
// var pluginEventDatas = datas.Cast<PluginEventData>();
// var opcDatas = pluginEventDatas.Select(
// a =>
// {
// if (a.ObjectValue == null)
// {
// a.ObjectValue = a.Value.ToObject(Type.GetType(a.ValueType));
// }
// return a.ObjectValue is ThingsGateway.Plugin.OpcAe.OpcAeEventData opcData ? opcData : null;
// }
// ).Where(a => a != null).ToList();
// if (opcDatas.Count == 0)
// return;
// Logger?.Info(opcDatas.ToSystemTextJsonString());
// await db.Insertable(opcDatas).ExecuteCommandAsync(cancellationToken).ConfigureAwait(false);
// }
//}

View File

@@ -0,0 +1,86 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\Version.props" />
<ItemGroup Condition=" '$(SolutionName)' != 'ThingsGatewayRelease'">
<ProjectReference Include="..\Gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj" />
<ProjectReference Include="..\Gateway\ThingsGateway.Gateway.Razor\ThingsGateway.Gateway.Razor.csproj" />
</ItemGroup>
<!--发布版-->
<Import Project="targets\Gateway.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayRelease' " />
<Import Project="targets\Admin.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayRelease' " />
<Import Project="targets\PluginContext.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayPro' AND '$(Configuration)' != 'Debug' " />
<!--nuget包解压复制文件上下文动态加载-->
<Import Project="targets\PluginContext.targets" Condition=" '$(SolutionName)' != 'ThingsGatewayPro' AND '$(Configuration)' != 'Debug' " />
<!--直接引用-->
<Import Project="targets\PluginDebug.targets" Condition=" '$(SolutionName)' != 'ThingsGatewayPro' AND '$(Configuration)' == 'Debug' " />
<!--nuget包解压复制文件插件域隔离动态加载-->
<!--<Import Project="targets\Plugin.targets" />-->
<!--nuget包解压复制文件上下文动态加载Pro插件-->
<Import Project="targets\Pro2.targets" Condition=" '$(SolutionName)' != 'ThingsGatewayPro' OR '$(Configuration)' != 'Debug'" />
<!--直接引用Pro-->
<Import Project="targets\PluginDebug.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayPro' AND '$(Configuration)' == 'Debug'" />
<Import Project="targets\ProPluginDebug.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayPro' AND '$(Configuration)' == 'Debug'" />
<!--<Import Project="targets\Pro3.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayPro' " />
<Import Project="targets\Pro5.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayPro' " />-->
<!--<Import Project="targets\Pro6.targets" Condition=" '$(SolutionName)' == 'ThingsGatewayPro' AND '$(Configuration)' != 'Debug'" />-->
<!--nuget包解压复制文件上下文动态加载Pro插件-->
<Import Project="targets\Pro7.targets" Condition=" '$(SolutionName)' != 'ThingsGatewayPro' OR '$(Configuration)' != 'Debug'" />
<!--打包复制-->
<Import Project="targets\PluginPublish.targets" />
<PropertyGroup>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
<CustomTargetFramework>$(TargetFramework)</CustomTargetFramework>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
<SatelliteResourceLanguages>zh-Hans;en-US</SatelliteResourceLanguages>
<PublishReadyToRunComposite>true</PublishReadyToRunComposite>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<!--动态适用GC-->
<GarbageCollectionAdaptationMode>1</GarbageCollectionAdaptationMode>
<CETCompat>false</CETCompat>
<!--<TieredCompilation>false</TieredCompilation>-->
<!--使用自托管线程池-->
<!--<UseWindowsThreadPool>false</UseWindowsThreadPool> -->
<!--使用工作站GC-->
<!--<ServerGarbageCollection>true</ServerGarbageCollection>-->
<!--<PlatformTarget>x86</PlatformTarget>-->
<!--editbin /LARGEADDRESSAWARE:NO ThingsGateway.Server.exe-->
</PropertyGroup>
<ItemGroup>
<Content Include="favicon.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,7 @@
{
"ConfigurationScanDirectories": [ "Configuration", "" ], // 扫描配置文件json文件夹自动合并该文件夹里面所有json文件
"IgnoreConfigurationFiles": [ "" ],
"ExternalAssemblies": [ "" ],
"DetailedErrors": true
}

View File

@@ -0,0 +1,9 @@
{
"urls": "http://*:5000",
"ConfigurationScanDirectories": [ "Configuration", "" ], // 扫描配置文件json文件夹自动合并该文件夹里面所有json文件
"IgnoreConfigurationFiles": [ "" ],
"ExternalAssemblies": [ "" ],
"DetailedErrors": true
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -0,0 +1,43 @@
<Project>
<!--Admin-->
<ItemGroup>
<PackageReference Include="ThingsGateway.Admin.Razor" Version="$(Version)" />
<PackageReference Include="ThingsGateway.Admin.Application" Version="$(Version)" GeneratePathProperty="true"/>
</ItemGroup>
<Target Name="_ResolveCopyAdminLocalNuGetPkgXmls" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)'=='ThingsGateway.Admin.Application' and Exists('%(RootDir)%(Directory)%(Filename).xml')" />
</ItemGroup>
</Target>
<Target Name="CopyAdminNugetPackages" AfterTargets="Build">
<ItemGroup>
<!-- setting up the variable for convenience -->
<AdminApplicationPackageFiles Include="$(PkgThingsGateway_Admin_Application)\Content\SeedData\Admin\*.*" />
</ItemGroup>
<PropertyGroup>
<AdminApplicationFolder>$(TargetDir)SeedData\Admin\</AdminApplicationFolder>
</PropertyGroup>
<RemoveDir Directories="$(AdminApplicationFolder)" />
<Copy SourceFiles="@(AdminApplicationPackageFiles)" DestinationFolder="$(AdminApplicationFolder)%(RecursiveDir)" />
</Target>
<Target Name="AdminPostPublish" AfterTargets="Publish">
<ItemGroup>
<!-- setting up the variable for convenience -->
<AdminFiles Include="bin\$(Configuration)\$(TargetFramework)\SeedData\**" />
</ItemGroup>
<PropertyGroup>
</PropertyGroup>
<Copy SourceFiles="@(AdminFiles)" DestinationFolder="$(PublishDir)SeedData\%(RecursiveDir)" />
</Target>
<!--Admin-->
</Project>

View File

@@ -0,0 +1,55 @@
<Project>
<!--Gateway-->
<ItemGroup>
<PackageReference Include="ThingsGateway.Gateway.Razor" Version="$(Version)" />
<PackageReference Include="ThingsGateway.Gateway.Application" Version="$(Version)" GeneratePathProperty="true"/>
</ItemGroup>
<Target Name="_ResolveCopyGatewayLocalNuGetPkgXmls" AfterTargets="ResolveReferences">
<ItemGroup>
<ReferenceCopyLocalPaths Include="@(ReferenceCopyLocalPaths->'%(RootDir)%(Directory)%(Filename).xml')" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)'=='ThingsGateway.Gateway.Application' and Exists('%(RootDir)%(Directory)%(Filename).xml')" />
</ItemGroup>
</Target>
<Target Name="CopyGatewayNugetPackages" AfterTargets="Build">
<ItemGroup>
<!-- setting up the variable for convenience -->
<RulesEngineApplicationPackageFiles Include="$(PkgThingsGateway_Gateway_Application)\Content\SeedData\RulesEngine\*.*" />
<ManagementApplicationPackageFiles Include="$(PkgThingsGateway_Gateway_Application)\Content\SeedData\Management\*.*" />
<GatewayApplicationPackageFiles Include="$(PkgThingsGateway_Gateway_Application)\Content\SeedData\Gateway\*.*" />
</ItemGroup>
<PropertyGroup>
<RulesEngineApplicationFolder>$(TargetDir)SeedData\RulesEngine\</RulesEngineApplicationFolder>
<ManagementApplicationFolder>$(TargetDir)SeedData\Management\</ManagementApplicationFolder>
<GatewayApplicationFolder>$(TargetDir)SeedData\Gateway\</GatewayApplicationFolder>
</PropertyGroup>
<RemoveDir Directories="$(RulesEngineApplicationFolder)" />
<RemoveDir Directories="$(ManagementApplicationFolder)" />
<RemoveDir Directories="$(GatewayApplicationFolder)" />
<Copy SourceFiles="@(RulesEngineApplicationPackageFiles)" DestinationFolder="$(RulesEngineApplicationFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(ManagementApplicationPackageFiles)" DestinationFolder="$(ManagementApplicationFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(GatewayApplicationPackageFiles)" DestinationFolder="$(GatewayApplicationFolder)%(RecursiveDir)" />
</Target>
<Target Name="GatewayPostPublish" AfterTargets="Publish">
<ItemGroup>
<!-- setting up the variable for convenience -->
<GatewayFiles Include="bin\$(Configuration)\$(TargetFramework)\SeedData\**" />
</ItemGroup>
<PropertyGroup>
</PropertyGroup>
<Copy SourceFiles="@(GatewayFiles)" DestinationFolder="$(PublishDir)SeedData\%(RecursiveDir)" />
</Target>
<!--Gateway-->
</Project>

View File

@@ -0,0 +1,110 @@
<Project>
<!--插件隔离-->
<ItemGroup>
<!--Modbus 插件-->
<PackageReference Include="ThingsGateway.Plugin.Modbus" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--SiemensS7 插件-->
<PackageReference Include="ThingsGateway.Plugin.SiemensS7" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--Dlt645 插件-->
<PackageReference Include="ThingsGateway.Plugin.Dlt645" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--OpcDa 插件-->
<PackageReference Include="ThingsGateway.Plugin.OpcDa" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--OpcUa 插件-->
<PackageReference Include="ThingsGateway.Plugin.OpcUa" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--DB 插件-->
<PackageReference Include="ThingsGateway.Plugin.DB" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--Kafka 插件-->
<PackageReference Include="ThingsGateway.Plugin.Kafka" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--Mqtt 插件-->
<PackageReference Include="ThingsGateway.Plugin.Mqtt" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--RabbitMQ 插件-->
<PackageReference Include="ThingsGateway.Plugin.RabbitMQ" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--webhook 插件-->
<PackageReference Include="ThingsGateway.Plugin.Http" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="CopyPluginNugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginFolder>$(TargetDir)Plugins\</PluginFolder>
<GatewayPluginFolder>$(TargetDir)GatewayPlugins\</GatewayPluginFolder>
</PropertyGroup>
<RemoveDir Directories="$(PluginFolder)" />
<RemoveDir Directories="$(GatewayPluginFolder)" />
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_ModbusPackageFiles Include="$(PkgThingsGateway_Plugin_Modbus)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_SiemensS7PackageFiles Include="$(PkgThingsGateway_Plugin_SiemensS7)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_Dlt645PackageFiles Include="$(PkgThingsGateway_Plugin_Dlt645)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_DBPackageFiles Include="$(PkgThingsGateway_Plugin_DB)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_KafkaPackageFiles Include="$(PkgThingsGateway_Plugin_Kafka)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_MqttPackageFiles Include="$(PkgThingsGateway_Plugin_Mqtt)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_OpcDaPackageFiles Include="$(PkgThingsGateway_Plugin_OpcDa)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_OpcUaPackageFiles Include="$(PkgThingsGateway_Plugin_OpcUa)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_RabbitMQPackageFiles Include="$(PkgThingsGateway_Plugin_RabbitMQ)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_HttpPackageFiles Include="$(PkgThingsGateway_Plugin_Http)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<Message Text="将开源插件复制到插件目录 $(GatewayPluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_ModbusPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.Modbus%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_SiemensS7PackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.SiemensS7%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_Dlt645PackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.Dlt645%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_DBPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.DB%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_KafkaPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.Kafka%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_MqttPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.Mqtt%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_OpcDaPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.OpcDa%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_OpcUaPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.OpcUa%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_RabbitMQPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.RabbitMQ%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_HttpPackageFiles)" DestinationFolder="$(GatewayPluginFolder)ThingsGateway.Plugin.Http%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,114 @@
<Project>
<!--插件直接加载到程序上下文,不隔离-->
<ItemGroup>
<!--Modbus 插件-->
<PackageReference Include="ThingsGateway.Plugin.Modbus" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--SiemensS7 插件-->
<PackageReference Include="ThingsGateway.Plugin.SiemensS7" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--Dlt645 插件-->
<PackageReference Include="ThingsGateway.Plugin.Dlt645" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--OpcDa 插件-->
<PackageReference Include="ThingsGateway.Plugin.OpcDa" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--OpcUa 插件-->
<PackageReference Include="ThingsGateway.Plugin.OpcUa" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--DB 插件-->
<PackageReference Include="ThingsGateway.Plugin.DB" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--Kafka 插件-->
<PackageReference Include="ThingsGateway.Plugin.Kafka" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--Mqtt 插件-->
<PackageReference Include="ThingsGateway.Plugin.Mqtt" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--RabbitMQ 插件-->
<PackageReference Include="ThingsGateway.Plugin.RabbitMQ" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<!--webhook 插件-->
<PackageReference Include="ThingsGateway.Plugin.Http" Version="$(PluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="CopyPluginNugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginFolder>$(TargetDir)Plugins\</PluginFolder>
<GatewayPluginFolder>$(TargetDir)GatewayPlugins\</GatewayPluginFolder>
</PropertyGroup>
<RemoveDir Directories="$(PluginFolder)" />
<RemoveDir Directories="$(GatewayPluginFolder)" />
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_ModbusPackageFiles Include="$(PkgThingsGateway_Plugin_Modbus)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_SiemensS7PackageFiles Include="$(PkgThingsGateway_Plugin_SiemensS7)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_Dlt645PackageFiles Include="$(PkgThingsGateway_Plugin_Dlt645)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_DBPackageFiles Include="$(PkgThingsGateway_Plugin_DB)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_KafkaPackageFiles Include="$(PkgThingsGateway_Plugin_Kafka)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_MqttPackageFiles Include="$(PkgThingsGateway_Plugin_Mqtt)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_OpcDaPackageFiles Include="$(PkgThingsGateway_Plugin_OpcDa)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_OpcUaPackageFiles Include="$(PkgThingsGateway_Plugin_OpcUa)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_RabbitMQPackageFiles Include="$(PkgThingsGateway_Plugin_RabbitMQ)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_HttpPackageFiles Include="$(PkgThingsGateway_Plugin_Http)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<Message Text="将开源插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_ModbusPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_SiemensS7PackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_Dlt645PackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_DBPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_KafkaPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_MqttPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_OpcDaPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_OpcUaPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_RabbitMQPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_HttpPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,17 @@
<Project>
<ItemGroup>
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.Modbus\ThingsGateway.Plugin.Modbus.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.Dlt645\ThingsGateway.Plugin.Dlt645.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.SiemensS7\ThingsGateway.Plugin.SiemensS7.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.DB\ThingsGateway.Plugin.DB.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.Kafka\ThingsGateway.Plugin.Kafka.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.Mqtt\ThingsGateway.Plugin.Mqtt.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.OpcDa\ThingsGateway.Plugin.OpcDa.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.OpcUa\ThingsGateway.Plugin.OpcUa.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.RabbitMQ\ThingsGateway.Plugin.RabbitMQ.csproj" />
<ProjectReference Include="..\Plugin\ThingsGateway.Plugin.Http\ThingsGateway.Plugin.Http.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,32 @@
<Project>
<Target Name="PostPublish" AfterTargets="Publish">
<ItemGroup>
<!-- setting up the variable for convenience -->
<PluginsFiles Include="bin\$(Configuration)\$(TargetFramework)\Plugins\**" />
<GatewayPluginsFiles Include="bin\$(Configuration)\$(TargetFramework)\GatewayPlugins\**" />
</ItemGroup>
<PropertyGroup>
</PropertyGroup>
<Copy SourceFiles="@(PluginsFiles)" DestinationFolder="$(PublishDir)Plugins\%(RecursiveDir)" />
<Copy SourceFiles="@(GatewayPluginsFiles)" DestinationFolder="$(PublishDir)GatewayPlugins\%(RecursiveDir)" />
</Target>
<Target Name="RemoveXmlDocs1" AfterTargets="Build" Condition=" '$(Configuration)' != 'Debug' ">
<ItemGroup>
<XmlFilesToDelete Include="$(TargetDir)*.xml" />
</ItemGroup>
<Delete Files="@(XmlFilesToDelete)" />
</Target>
<Target Name="RemoveXmlDocs2" AfterTargets="Publish" Condition=" '$(Configuration)' != 'Debug' ">
<ItemGroup>
<XmlFilesToDelete Include="$(PublishDir)*.xml" />
</ItemGroup>
<Delete Files="@(XmlFilesToDelete)" />
</Target>
</Project>

View File

@@ -0,0 +1,97 @@
<Project>
<ItemGroup>
<PackageReference Include="ThingsGateway.Plugin.SyncBridge" Version="$(ProPluginVersion)" GeneratePathProperty="true">
<Private>false</Private>
<IncludeAssets> native;</IncludeAssets>
</PackageReference>
<PackageReference Include="ThingsGateway.Plugin.Inovance" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<PackageReference Include="ThingsGateway.Plugin.TIANXIN" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<PackageReference Include="ThingsGateway.Plugin.HJ212" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<PackageReference Include="ThingsGateway.Plugin.BACnet" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--AllenBradleyCip 插件-->
<PackageReference Include="ThingsGateway.Plugin.AllenBradleyCip" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--DCON 插件-->
<PackageReference Include="ThingsGateway.Plugin.DCON" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--EDPF_NT 插件-->
<PackageReference Include="ThingsGateway.Plugin.EDPF_NT" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--KELID2008 插件-->
<PackageReference Include="ThingsGateway.Plugin.KELID2008" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--LKSIS 插件-->
<PackageReference Include="ThingsGateway.Plugin.LKSIS" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--Melsec 插件-->
<PackageReference Include="ThingsGateway.Plugin.Melsec" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--Omron 插件-->
<PackageReference Include="ThingsGateway.Plugin.Omron" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<!--DKQ_A16D 插件-->
<!--<PackageReference Include="ThingsGateway.Plugin.DKQ_A16D" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />-->
<!--IDR210 插件-->
<!--<PackageReference Include="ThingsGateway.Plugin.IDR210" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />-->
<!--URF_R330 插件-->
<!--<PackageReference Include="ThingsGateway.Plugin.URF_R330" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />-->
<!--USBScaner 插件-->
<PackageReference Include="ThingsGateway.Plugin.USBScaner" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<PackageReference Include="ThingsGateway.Plugin.SECS" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<PackageReference Include="ThingsGateway.Plugin.TS550" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
<PackageReference Include="ThingsGateway.Plugin.Vigor" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets=" native;" />
</ItemGroup>
<Target Name="CopyCustomPluginNugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_InovancePackageFiles Include="$(PkgThingsGateway_Plugin_Inovance)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_TIANXINPackageFiles Include="$(PkgThingsGateway_Plugin_TIANXIN)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_HJ212PackageFiles Include="$(PkgThingsGateway_Plugin_HJ212)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_BACnetPackageFiles Include="$(PkgThingsGateway_Plugin_BACnet)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_AllenBradleyCipPackageFiles Include="$(PkgThingsGateway_Plugin_AllenBradleyCip)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_DCONPackageFiles Include="$(PkgThingsGateway_Plugin_DCON)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_EDPF_NTPackageFiles Include="$(PkgThingsGateway_Plugin_EDPF_NT)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_KELID2008PackageFiles Include="$(PkgThingsGateway_Plugin_KELID2008)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_LKSISPackageFiles Include="$(PkgThingsGateway_Plugin_LKSIS)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_MelsecPackageFiles Include="$(PkgThingsGateway_Plugin_Melsec)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_OmronPackageFiles Include="$(PkgThingsGateway_Plugin_Omron)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_DKQ_A16DPackageFiles Include="$(PkgThingsGateway_Plugin_DKQ_A16D)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_IDR210PackageFiles Include="$(PkgThingsGateway_Plugin_IDR210)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_URF_R330PackageFiles Include="$(PkgThingsGateway_Plugin_URF_R330)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_USBScanerPackageFiles Include="$(PkgThingsGateway_Plugin_USBScaner)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_SECSPackageFiles Include="$(PkgThingsGateway_Plugin_SECS)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_TS550PackageFiles Include="$(PkgThingsGateway_Plugin_TS550)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_VigorPackageFiles Include="$(PkgThingsGateway_Plugin_Vigor)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_SyncBridgePackageFiles Include="$(PkgThingsGateway_Plugin_SyncBridge)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<PropertyGroup>
<PluginFolder>$(TargetDir)GatewayPlugins\</PluginFolder>
</PropertyGroup>
<Message Text="将PRO插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_InovancePackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.Inovance%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_TIANXINPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.TIANXIN%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_HJ212PackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.HJ212%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_BACnetPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.BACnet%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_AllenBradleyCipPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.AllenBradleyCip%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_DCONPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.DCON%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_EDPF_NTPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.EDPF_NT%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_KELID2008PackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.KELID2008%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_LKSISPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.LKSIS%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_MelsecPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.Melsec%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_OmronPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.Omron%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_DKQ_A16DPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.DKQ_A16D%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_IDR210PackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.IDR210%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_URF_R330PackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.URF_R330%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_USBScanerPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.USBScaner%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_SECSPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.SECS%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_TS550PackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.TS550%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_VigorPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.Vigor%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_SyncBridgePackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.SyncBridge%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,32 @@
<Project>
<ItemGroup>
<!--HUANANSFSK 插件-->
<PackageReference Include="ThingsGateway.Plugin.HUANANSFSK" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
<!--YPSFSK 插件-->
<PackageReference Include="ThingsGateway.Plugin.YPSFSK" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
</ItemGroup>
<Target Name="CopyOtherPlugin3NugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_HUANANSFSKPackageFiles Include="$(PkgThingsGateway_Plugin_HUANANSFSK)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_YPSFSKPackageFiles Include="$(PkgThingsGateway_Plugin_YPSFSK)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<PropertyGroup>
<PluginFolder>$(TargetDir)Plugins\</PluginFolder>
</PropertyGroup>
<Message Text="将SFSK插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_HUANANSFSKPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_YPSFSKPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,28 @@
<Project>
<ItemGroup>
<PackageReference Include="ThingsGateway.Plugin.ModbusC1" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
<PackageReference Include="ThingsGateway.Plugin.ModbusGY" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
</ItemGroup>
<Target Name="CopyOtherPlugin1NugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_ModbusC1PackageFiles Include="$(PkgThingsGateway_Plugin_ModbusC1)\Content\$(PluginTargetFramework)\**\*.*" />
<PkgThingsGateway_Plugin_ModbusGYPackageFiles Include="$(PkgThingsGateway_Plugin_ModbusGY)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<PropertyGroup>
<PluginFolder>$(TargetDir)Plugins\</PluginFolder>
</PropertyGroup>
<Message Text="将Modbus定制插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_ModbusC1PackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_ModbusGYPackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,28 @@
<Project>
<ItemGroup>
<!--MqttYINGKE 插件-->
<PackageReference Include="ThingsGateway.Plugin.MqttYINGKE" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
</ItemGroup>
<Target Name="CopyOtherPlugin5NugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_MqttYINGKEPackageFiles Include="$(PkgThingsGateway_Plugin_MqttYINGKE)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<PropertyGroup>
<PluginFolder>$(TargetDir)GatewayPlugins\</PluginFolder>
</PropertyGroup>
<Message Text="将MQTTYINGKE插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_MqttYINGKEPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.MqttYINGKE%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,28 @@
<Project>
<ItemGroup>
<!--MqttYINGKE 插件-->
<PackageReference Include="ThingsGateway.Plugin.IXCom29s" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
</ItemGroup>
<Target Name="CopyOtherPlugin6NugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_IXCom29sPackageFiles Include="$(PkgThingsGateway_Plugin_IXCom29s)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<PropertyGroup>
<PluginFolder>$(TargetDir)GatewayPlugins\</PluginFolder>
</PropertyGroup>
<Message Text="将IXCom29s插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_IXCom29sPackageFiles)" DestinationFolder="$(PluginFolder)ThingsGateway.Plugin.IXCom29s%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,28 @@
<Project>
<ItemGroup>
<!--MqttYINGKE 插件-->
<PackageReference Include="ThingsGateway.Plugin.OpcAe" Version="$(ProPluginVersion)" GeneratePathProperty="true" Private="false" IncludeAssets="native;" />
</ItemGroup>
<Target Name="CopyOtherPlugin7NugetPackages" AfterTargets="Build">
<PropertyGroup>
<PluginTargetFramework>net8.0</PluginTargetFramework>
</PropertyGroup>
<ItemGroup>
<!-- setting up the variable for convenience -->
<PkgThingsGateway_Plugin_OpcAePackageFiles Include="$(PkgThingsGateway_Plugin_OpcAe)\Content\$(PluginTargetFramework)\**\*.*" />
</ItemGroup>
<PropertyGroup>
<PluginFolder>$(TargetDir)Plugins\</PluginFolder>
</PropertyGroup>
<Message Text="将OpcAe插件复制到插件目录 $(PluginFolder)" Importance="high" />
<Copy SourceFiles="@(PkgThingsGateway_Plugin_OpcAePackageFiles)" DestinationFolder="$(PluginFolder)%(RecursiveDir)" />
</Target>
</Project>

View File

@@ -0,0 +1,40 @@
<Project>
<ItemGroup>
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.SyncBridge\ThingsGateway.Plugin.SyncBridge.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.AllenBradleyCip\ThingsGateway.Plugin.AllenBradleyCip.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.BACnet\ThingsGateway.Plugin.BACnet.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.DCON\ThingsGateway.Plugin.DCON.csproj" />
<!--<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.DKQ_A16D\ThingsGateway.Plugin.DKQ_A16D.csproj" />-->
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.EDPF_NT\ThingsGateway.Plugin.EDPF_NT.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.HJ212\ThingsGateway.Plugin.HJ212.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.HUANANSFSK\ThingsGateway.Plugin.HUANANSFSK.csproj" />
<!--<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.IDR210\ThingsGateway.Plugin.IDR210.csproj" />-->
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.KELID2008\ThingsGateway.Plugin.KELID2008.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.LEIDIAN\ThingsGateway.Plugin.LEIDIANAPI.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.LKSIS\ThingsGateway.Plugin.LKSIS.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.Melsec\ThingsGateway.Plugin.Melsec.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.ModbusC1\ThingsGateway.Plugin.ModbusC1.csproj" />
<!--<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.MqttSZJYZ\ThingsGateway.Plugin.MqttSZJYZ.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.MqttYINGKE\ThingsGateway.Plugin.MqttYINGKE.csproj" />-->
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.Omron\ThingsGateway.Plugin.Omron.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.SECS\ThingsGateway.Plugin.SECS.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.TS550\ThingsGateway.Plugin.TS550.csproj" />
<!--<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.URF_R330\ThingsGateway.Plugin.URF_R330.csproj" />-->
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.USBScaner\ThingsGateway.Plugin.USBScaner.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.Vigor\ThingsGateway.Plugin.Vigor.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.YPSFSK\ThingsGateway.Plugin.YPSFSK.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.TIANXIN\ThingsGateway.Plugin.TIANXIN.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.Inovance\ThingsGateway.Plugin.Inovance.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.ModbusGY\ThingsGateway.Plugin.ModbusGY.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.IXCom29s\ThingsGateway.Plugin.IXCom29s.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Plugin.OpcAe\ThingsGateway.Plugin.OpcAe.csproj" />
<ProjectReference Include="..\PluginPro\ThingsGateway.Foundation.OpcAe\ThingsGateway.Foundation.OpcAe.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,223 +1,223 @@
////------------------------------------------------------------------------------
////此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
//// 此代码版权除特别声明外的代码归作者本人Diego所有
//// 源代码使用协议遵循本仓库的开源协议及附加协议
//// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
//// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
//// 使用文档https://thingsgateway.cn/
//// QQ群605534569
//// ------------------------------------------------------------------------------
//////------------------------------------------------------------------------------
//////此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
////// 此代码版权除特别声明外的代码归作者本人Diego所有
////// 源代码使用协议遵循本仓库的开源协议及附加协议
////// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
////// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
////// 使用文档https://thingsgateway.cn/
////// QQ群605534569
////// ------------------------------------------------------------------------------
using ThingsGateway.Foundation;
using ThingsGateway.Gateway.Application;
using ThingsGateway.NewLife.Extension;
public class TestKafkaDynamicModel : DynamicModelBase
{
private Dictionary<string, VariableRuntime> variableRuntimes = new();
//using ThingsGateway.Foundation;
//using ThingsGateway.Gateway.Application;
//using ThingsGateway.NewLife.Extension;
//public class TestKafkaDynamicModel : DynamicModelBase
//{
// private Dictionary<string, VariableRuntime> variableRuntimes = new();
private long id = 0;
// private long id = 0;
public TestKafkaDynamicModel()
{
var name = "kafka1";
if (GlobalData.ReadOnlyDevices.TryGetValue(name, out var kafka1))
{
id = kafka1.Id;
// public TestKafkaDynamicModel()
// {
// var name = "kafka1";
// if (GlobalData.ReadOnlyDevices.TryGetValue(name, out var kafka1))
// {
// id = kafka1.Id;
foreach (var item in kafka1.Driver?.IdVariableRuntimes)
{
//变量备注1作为Key(AE报警SourceId)
var data1 = item.Value.GetPropertyValue(id, nameof(BusinessVariableProperty.Data1));
if (!data1.IsNullOrEmpty())
{
variableRuntimes.Add(data1, item.Value);
}
}
// foreach (var item in kafka1.Driver?.IdVariableRuntimes)
// {
// //变量备注1作为Key(AE报警SourceId)
// var data1 = item.Value.GetPropertyValue(id, nameof(BusinessVariableProperty.Data1));
// if (!data1.IsNullOrEmpty())
// {
// variableRuntimes.Add(data1, item.Value);
// }
// }
}
else
{
throw new Exception($"找不到设备 {name}");
}
// }
// else
// {
// throw new Exception($"找不到设备 {name}");
// }
}
public override IEnumerable<dynamic> GetList(IEnumerable<object> datas)
{
if (datas == null) return null;
var pluginEventDatas = datas.Cast<PluginEventData>();
var opcDatas = pluginEventDatas.Select(
a =>
{
if (a.ObjectValue == null)
{
a.ObjectValue = a.Value.ToObject(Type.GetType(a.ValueType));
}
return a.ObjectValue is ThingsGateway.Plugin.OpcAe.OpcAeEventData opcData ? opcData : null;
}
).Where(a => a != null).ToList();
// }
// public override IEnumerable<dynamic> GetList(IEnumerable<object> datas)
// {
// if (datas == null) return null;
// var pluginEventDatas = datas.Cast<PluginEventData>();
// var opcDatas = pluginEventDatas.Select(
// a =>
// {
// if (a.ObjectValue == null)
// {
// a.ObjectValue = a.Value.ToObject(Type.GetType(a.ValueType));
// }
// return a.ObjectValue is ThingsGateway.Plugin.OpcAe.OpcAeEventData opcData ? opcData : null;
// }
// ).Where(a => a != null).ToList();
List<KafkaAlarmEntity> alarmEntities = new List<KafkaAlarmEntity>();
if (opcDatas.Count == 0)
{
Logger?.LogInformation("没有OPCAE数据");
return alarmEntities;
}
// List<KafkaAlarmEntity> alarmEntities = new List<KafkaAlarmEntity>();
// if (opcDatas.Count == 0)
// {
// Logger?.LogInformation("没有OPCAE数据");
// return alarmEntities;
// }
foreach (var opcAeEventData in opcDatas)
{
//一般只需要条件报警
//if (opcAeEventData.EventType != Opc.Ae.EventType.Condition)
// continue;
//重连时触发的事件,可以跳过不处理
//if(opcAeEventData.Refresh)
// continue;
var sourceName = opcAeEventData.SourceID;
if (variableRuntimes.TryGetValue(sourceName, out var variableRuntime))
{
var ack = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : ((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Acknowledged);
// foreach (var opcAeEventData in opcDatas)
// {
// //一般只需要条件报警
// //if (opcAeEventData.EventType != Opc.Ae.EventType.Condition)
// // continue;
// //重连时触发的事件,可以跳过不处理
// //if(opcAeEventData.Refresh)
// // continue;
// var sourceName = opcAeEventData.SourceID;
// if (variableRuntimes.TryGetValue(sourceName, out var variableRuntime))
// {
// var ack = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : ((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Acknowledged);
bool isRecover = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : !((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Active);
// bool isRecover = opcAeEventData.EventType != Opc.Ae.EventType.Condition ? false : !((Opc.Ae.ConditionState)opcAeEventData.NewState).HasFlag(Opc.Ae.ConditionState.Active);
//构建告警实体
KafkaAlarmEntity alarmEntity = new KafkaAlarmEntity
{
AlarmCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data2)), //唯一编码
ResourceCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data3)), //资源编码
ResourceName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4)), //资源名称
MetricCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data5)), //指标编码
MetricName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data6)), //指标名称
Content = $"{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4))}{opcAeEventData.Message}", //告警内容,设备名称+告警内容包含阈值信息可能opcae里没有带阈值信息那么就需要录入固定值可选Data10
AlarmType = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data7)), // opcAeEventData.Severity 告警类型,子系统产生告警的类型,可能需要固定备注值
// //构建告警实体
// KafkaAlarmEntity alarmEntity = new KafkaAlarmEntity
// {
// AlarmCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data2)), //唯一编码
// ResourceCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data3)), //资源编码
// ResourceName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4)), //资源名称
// MetricCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data5)), //指标编码
// MetricName = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data6)), //指标名称
// Content = $"{variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data4))}{opcAeEventData.Message}", //告警内容,设备名称+告警内容包含阈值信息可能opcae里没有带阈值信息那么就需要录入固定值可选Data10
// AlarmType = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data7)), // opcAeEventData.Severity 告警类型,子系统产生告警的类型,可能需要固定备注值
ConfirmedTime = ack ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //告警确认时间
FixTime = isRecover ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //解除告警时间
LastTime = opcAeEventData.AlarmTime.DateTimeToUnixTimestamp(), //产生告警时间
Status = isRecover ? "FIXED" : "UNFIXED", //告警状态
AlarmLevel = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data8)), //opcAeEventData.Severity.ToString(), //告警等级,可能需要固定备注值
SubSystemCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data9)), //子系统编码
Type = "SUB_SYSTEM_ALARM", //默认填写字段
ConfirmAccount = opcAeEventData.ActorID, //告警确认人
ClearAccount = opcAeEventData.ActorID, //告警清除人
ProcessInstruction = null //告警处理说明OPCAE不带有
};
alarmEntities.Add(alarmEntity);
}
else
{
Logger?.LogInformation($"找不到相关变量{sourceName}");
}
}
// ConfirmedTime = ack ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //告警确认时间
// FixTime = isRecover ? opcAeEventData.Time.DateTimeToUnixTimestamp() : null, //解除告警时间
// LastTime = opcAeEventData.AlarmTime.DateTimeToUnixTimestamp(), //产生告警时间
// Status = isRecover ? "FIXED" : "UNFIXED", //告警状态
// AlarmLevel = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data8)), //opcAeEventData.Severity.ToString(), //告警等级,可能需要固定备注值
// SubSystemCode = variableRuntime.GetPropertyValue(id, nameof(BusinessVariableProperty.Data9)), //子系统编码
// Type = "SUB_SYSTEM_ALARM", //默认填写字段
// ConfirmAccount = opcAeEventData.ActorID, //告警确认人
// ClearAccount = opcAeEventData.ActorID, //告警清除人
// ProcessInstruction = null //告警处理说明OPCAE不带有
// };
// alarmEntities.Add(alarmEntity);
// }
// else
// {
// Logger?.LogInformation($"找不到相关变量{sourceName}");
// }
// }
return alarmEntities;
}
}
// return alarmEntities;
// }
//}
/// <summary>
/// 告警实体
/// </summary>
public class KafkaAlarmEntity
{
/// <summary>
/// 告警编码唯一 (非空)
/// 示例:"8e8a118ac452fd04da8c26fa588a7cab"
/// </summary>
public string AlarmCode { get; set; }
///// <summary>
///// 告警实体
///// </summary>
//public class KafkaAlarmEntity
//{
// /// <summary>
// /// 告警编码唯一 (非空)
// /// 示例:"8e8a118ac452fd04da8c26fa588a7cab"
// /// </summary>
// public string AlarmCode { get; set; }
/// <summary>
/// 资源编码,唯一编码,需要按照映射表上传 (非空)
/// 示例:"RS_A6K9MUSG19V"
/// </summary>
public string ResourceCode { get; set; }
// /// <summary>
// /// 资源编码,唯一编码,需要按照映射表上传 (非空)
// /// 示例:"RS_A6K9MUSG19V"
// /// </summary>
// public string ResourceCode { get; set; }
/// <summary>
/// 资源名称,需要按照映射表上传 (非空)
/// 示例:"MB-A7"
/// </summary>
public string ResourceName { get; set; }
// /// <summary>
// /// 资源名称,需要按照映射表上传 (非空)
// /// 示例:"MB-A7"
// /// </summary>
// public string ResourceName { get; set; }
/// <summary>
/// 指标编码唯一,需要按照映射表上传 (非空)
/// 示例:"ActivePowerPa"
/// </summary>
public string MetricCode { get; set; }
// /// <summary>
// /// 指标编码唯一,需要按照映射表上传 (非空)
// /// 示例:"ActivePowerPa"
// /// </summary>
// public string MetricCode { get; set; }
/// <summary>
/// 指标名称,需要按照映射表上传 (非空)
/// 示例:"有功功率Pa"
/// </summary>
public string MetricName { get; set; }
// /// <summary>
// /// 指标名称,需要按照映射表上传 (非空)
// /// 示例:"有功功率Pa"
// /// </summary>
// public string MetricName { get; set; }
/// <summary>
/// 告警内容:设备名称+告警内容(包含阈值信息) (非空)
/// 示例:"MB-A7有功功率Pa > 30"
/// </summary>
public string Content { get; set; }
// /// <summary>
// /// 告警内容:设备名称+告警内容(包含阈值信息) (非空)
// /// 示例:"MB-A7有功功率Pa > 30"
// /// </summary>
// public string Content { get; set; }
/// <summary>
/// 告警类型,子系统产生告警的类型 (非空)
/// 示例:"0101" 表示高限报警
/// </summary>
public string AlarmType { get; set; }
// /// <summary>
// /// 告警类型,子系统产生告警的类型 (非空)
// /// 示例:"0101" 表示高限报警
// /// </summary>
// public string AlarmType { get; set; }
/// <summary>
/// 告警确认时间 (可空,时间戳)
/// 示例1586152800000
/// </summary>
public long? ConfirmedTime { get; set; }
// /// <summary>
// /// 告警确认时间 (可空,时间戳)
// /// 示例1586152800000
// /// </summary>
// public long? ConfirmedTime { get; set; }
/// <summary>
/// 解除告警时间 (可空,时间戳)
/// 示例1586152800000
/// </summary>
public long? FixTime { get; set; }
// /// <summary>
// /// 解除告警时间 (可空,时间戳)
// /// 示例1586152800000
// /// </summary>
// public long? FixTime { get; set; }
/// <summary>
/// 产生告警时间 (非空,时间戳)
/// 示例1586152800000
/// </summary>
public long LastTime { get; set; }
// /// <summary>
// /// 产生告警时间 (非空,时间戳)
// /// 示例1586152800000
// /// </summary>
// public long LastTime { get; set; }
/// <summary>
/// 告警状态 (非空)
/// 可选值UNFIXED新增告警、FIXED解除告警
/// </summary>
public string Status { get; set; }
// /// <summary>
// /// 告警状态 (非空)
// /// 可选值UNFIXED新增告警、FIXED解除告警
// /// </summary>
// public string Status { get; set; }
/// <summary>
/// 告警等级,需要按照映射表上传 (非空)
/// 示例:"1"
/// </summary>
public string AlarmLevel { get; set; }
// /// <summary>
// /// 告警等级,需要按照映射表上传 (非空)
// /// 示例:"1"
// /// </summary>
// public string AlarmLevel { get; set; }
/// <summary>
/// 子系统编码 (非空)
/// 示例:"MS_NEW_PD_DCIM_001"
/// </summary>
public string SubSystemCode { get; set; }
// /// <summary>
// /// 子系统编码 (非空)
// /// 示例:"MS_NEW_PD_DCIM_001"
// /// </summary>
// public string SubSystemCode { get; set; }
/// <summary>
/// 默认填写字段 (非空)
/// 固定值:"SUB_SYSTEM_ALARM"
/// </summary>
public string Type { get; set; }
// /// <summary>
// /// 默认填写字段 (非空)
// /// 固定值:"SUB_SYSTEM_ALARM"
// /// </summary>
// public string Type { get; set; }
/// <summary>
/// 告警确认人 (可空)
/// 示例:"admin3"
/// </summary>
public string ConfirmAccount { get; set; }
// /// <summary>
// /// 告警确认人 (可空)
// /// 示例:"admin3"
// /// </summary>
// public string ConfirmAccount { get; set; }
/// <summary>
/// 告警清除人 (可空)
/// 示例:"admin"
/// </summary>
public string ClearAccount { get; set; }
// /// <summary>
// /// 告警清除人 (可空)
// /// 示例:"admin"
// /// </summary>
// public string ClearAccount { get; set; }
/// <summary>
/// 告警处理说明 (可空)
/// 示例:"admin"
/// </summary>
public string ProcessInstruction { get; set; }
}
// /// <summary>
// /// 告警处理说明 (可空)
// /// 示例:"admin"
// /// </summary>
// public string ProcessInstruction { get; set; }
//}

View File

@@ -115,6 +115,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.Foundation.De
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.Foundation.Benchmark", "Plugin\ThingsGateway.Foundation.Benchmark\ThingsGateway.Foundation.Benchmark.csproj", "{B0957BD6-CF77-36E7-B657-2D0DB85F386F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThingsGateway.ScriptDebug", "ThingsGateway.ScriptDebug\ThingsGateway.ScriptDebug.csproj", "{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -293,6 +295,10 @@ Global
{B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0957BD6-CF77-36E7-B657-2D0DB85F386F}.Release|Any CPU.Build.0 = Release|Any CPU
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4AC662F-BE2C-6E1C-4BAF-370B968B3554}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -343,8 +349,8 @@ Global
{B0957BD6-CF77-36E7-B657-2D0DB85F386F} = {1D9CD7A3-9700-A851-0ABD-183347D9CC33}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {199B1B96-4F56-4828-9531-813BA02DB282}
RESX_NeutralResourcesLanguage = zh-Hans
RESX_Rules = {"EnabledRules":[]}
RESX_NeutralResourcesLanguage = zh-Hans
SolutionGuid = {199B1B96-4F56-4828-9531-813BA02DB282}
EndGlobalSection
EndGlobal