change - 框架搭建

master
WenJY 3 months ago
parent 659cf27c22
commit a345b7a618

@ -0,0 +1,83 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Cache
* C61D97E2-2108-46A3-974C-AFE6C83258BA
*
* WenJY
*
* 2025-09-05 11:29:42
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Sln.Imm.Daemon.Model.dao;
using Sln.Imm.Daemon.Repository.service;
using Sln.Imm.Daemon.Serilog;
using ZiggyCreatures.Caching.Fusion;
namespace Sln.Imm.Daemon.Cache;
public class BaseDeviceInfoCacheService
{
private readonly SerilogHelper _logger;
private readonly IFusionCache _fusionCache;
private readonly IBaseDeviceInfoService _service;
public BaseDeviceInfoCacheService(SerilogHelper logger, IFusionCache fusionCache, IBaseDeviceInfoService service)
{
_logger = logger;
_fusionCache = fusionCache;
_service = service;
}
/// <summary>
/// 通过缓存获取值
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public async Task<List<BaseDeviceInfo>> GetValueAsync(string key)
{
var cachedValue = await _fusionCache.GetOrDefaultAsync<List<BaseDeviceInfo>>(key).ConfigureAwait(false);
if (cachedValue != null)
{
_logger.Info($"通过Cache获取数据:{cachedValue.Count};条");
return cachedValue;
}
else
{
var value = _service.Query();
//将值存入缓存,设置过期时间等
await _fusionCache.SetAsync(key, value, TimeSpan.FromSeconds(5)).ConfigureAwait(false);
_logger.Info($"通过ORM获取数据:{value.Count};条");
return value;
}
}
public async Task<bool> SetValueAsync(string key, BaseDeviceInfo deviceInfo)
{
var isRes = _service.Update(deviceInfo);
if (isRes)
{
var value = _service.Query();
await _fusionCache.SetAsync(key, value, TimeSpan.FromSeconds(5)).ConfigureAwait(false);
}
return isRes;
}
}

@ -0,0 +1,280 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Common
* CE4BD2CC-E101-4CF0-BB9C-C3325F54C8FE
*
* WenJY
*
* 2025-09-05 11:10:34
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using System.Text;
namespace Sln.Imm.Daemon.Common;
public class StringChange
{
/// <summary>
/// 将字符串强制转换成int转换失败则返回0
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public int ParseToInt(string str)
{
int returnInt = 0;
if (str == null || str.Trim().Length < 1)
{
return returnInt;
}
if (int.TryParse(str, out returnInt))
{
return returnInt;
}
else
{
return 0;
}
}
/// <summary>
/// char数组转Array
/// </summary>
/// <param name="cha"></param>
/// <param name="len"></param>
/// <returns></returns>
public string CharArrayToString(char[] cha, int len)
{
string str = "";
for (int i = 0; i < len; i++)
{
str += string.Format("{0}", cha[i]);
}
return str;
}
public byte[] HexStrTorbytes(string strHex)//e.g. " 01 01" ---> { 0x01, 0x01}
{
strHex = strHex.Replace(" ", "");
if ((strHex.Length % 2) != 0)
strHex += " ";
byte[] returnBytes = new byte[strHex.Length / 2];
for (int i = 0; i < returnBytes.Length; i++)
returnBytes[i] = Convert.ToByte(strHex.Substring(i * 2, 2), 16);
return returnBytes;
}
public string StringToHexString(string s, Encoding encode)
{
byte[] b = encode.GetBytes(s); //按照指定编码将string编程字节数组
string result = string.Empty;
for (int i = 0; i < b.Length; i++) //逐字节变为16进制字符以%隔开
{
result += "%" + Convert.ToString(b[i], 16);
}
return result;
}
public string HexStringToString(string hs, Encoding encode)
{
//以%分割字符串,并去掉空字符
string[] chars = hs.Split(new char[] { '%' }, StringSplitOptions.RemoveEmptyEntries);
byte[] b = new byte[chars.Length];
//逐个字符变为16进制字节数据
for (int i = 0; i < chars.Length; i++)
{
b[i] = Convert.ToByte(chars[i], 16);
}
//按照指定编码将字节数组变为字符串
return encode.GetString(b);
}
public byte[] Swap16Bytes(byte[] OldU16)
{
byte[] ReturnBytes = new byte[2];
ReturnBytes[1] = OldU16[0];
ReturnBytes[0] = OldU16[1];
return ReturnBytes;
}
/// <summary>
/// 获取时间戳
/// </summary>
/// <returns></returns>
public long GetTimeStamp()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalSeconds);
}
public byte[] ConvertFloatToINt(byte[] floatBytes)
{
byte[] intBytes = new byte[floatBytes.Length / 2];
for (int i = 0; i < intBytes.Length; i++)
{
intBytes[i] = floatBytes[i * 2];
}
return intBytes;
}
//CRC异或校验
public byte CalculateVerify(byte[] pMessage, int iLength)
{
UInt16 i;
byte iVerify = 0;
iVerify = pMessage[0];
for (i = 1; i < iLength; i++)
{
iVerify = (byte)(iVerify ^ pMessage[i]);
}
return iVerify;
}
public int HexStringToNegative(string strNumber)
{
int iNegate = 0;
int iNumber = Convert.ToInt32(strNumber, 16);
if (iNumber > 127)
{
int iComplement = iNumber - 1;
string strNegate = string.Empty;
char[] binchar = Convert.ToString(iComplement, 2).PadLeft(8, '0').ToArray();
foreach (char ch in binchar)
{
if (Convert.ToInt32(ch) == 48)
{
strNegate += "1";
}
else
{
strNegate += "0";
}
}
iNegate = -Convert.ToInt32(strNegate, 2);
}
return iNegate;
}
/// <summary>
/// Byte[] 转 uint16
/// </summary>
/// <param name="buffer"></param>
/// <param name="falg"></param>
/// <exception cref="ArgumentException"></exception>
public void ConvertBytesToUInt16(byte[] buffer,out uint falg)
{
if (buffer == null || buffer.Length < 2)
{
throw new ArgumentException("Input array length must be at least 2.");
}
var input = buffer.Reverse().ToArray();
falg = (uint) ((input[1] << 8) | input[0]);
}
/// <summary>
/// Byte[] 移位转换
/// </summary>
/// <param name="input"></param>
/// <exception cref="ArgumentException"></exception>
public void SwapBytes(ref byte[] input)
{
if (input == null || input.Length % 2 != 0)
{
throw new ArgumentException("Input array length must be a multiple of 2.");
}
byte[] result = new byte[input.Length];
for (int j = 0; j < input.Length; j += 2)
{
ushort swapped = (ushort)((input[j + 1] << 8) | input[j]);
result[j] = (byte)(swapped >> 8);
result[j + 1] = (byte)swapped;
}
input = result;
}
/// <summary>
/// Byte[] 转string
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public string ConverToString(byte[] data)
{
string str;
StringBuilder stb = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
if ((int)data[i] > 15)
{
stb.Append(Convert.ToString(data[i], 16).ToUpper()); //添加字符串
}
else //如果是小于0F需要加个零
{
stb.Append("0" + Convert.ToString(data[i], 16).ToUpper());
}
}
str = stb.ToString();
return str;
}
/// <summary>
/// Byte[] 转 Hex
/// </summary>
/// <param name="bytes"></param>
/// <param name="iLen"></param>
/// <returns></returns>
public string bytesToHexStr(byte[] bytes, int iLen)
{
StringBuilder sb = new StringBuilder();
if (bytes != null)
{
for (int i = 0; i < iLen; i++)
{
sb.Append(bytes[i].ToString("X2"));
}
}
return sb.ToString();
}
/// <summary>
/// 校验计算
/// </summary>
/// <param name="pMessage"></param>
/// <param name="iLength"></param>
/// <returns></returns>
public byte[] CalculateVerifyToArray(byte[] pMessage, int iLength)
{
UInt16 i;
int iVerify = 0;
iVerify = pMessage[0];
for (i = 0; i < iLength - 1; i++)
{
iVerify = iVerify + pMessage[i + 1];
}
return BitConverter.GetBytes(Convert.ToUInt16(iVerify));
}
}

@ -0,0 +1,43 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Config
* 8304972C-4A1D-402B-8997-1E95920777C0
*
* WenJY
*
* 2025-09-05 10:50:20
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Microsoft.Extensions.Options;
namespace Sln.Imm.Daemon.Config;
public class AppConfig: IOptions<AppConfig>
{
/// <summary>
/// 日志文件路径
/// </summary>
public string logPath { get; set; }
/// <summary>
/// Sql连接配置
/// </summary>
public List<SqlConfig> sqlConfig { get; set; }
public AppConfig Value => this;
}

@ -0,0 +1,49 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Config
* D4F08CCE-FDDD-4416-B5C8-235A765236A2
*
* WenJY
*
* 2025-09-05 10:51:36
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Imm.Daemon.Config;
public class SqlConfig
{
/// <summary>
/// Sql 配置ID实体通过该ID关联数据源
/// </summary>
public string configId { get; set; }
/// <summary>
/// 数据库类型MySql-0;SqlServer-1;Sqlite-2;Oracle-3
/// </summary>
public int dbType { get; set; }
/// <summary>
/// 是否启用true-是false-否
/// </summary>
public bool isFlag{get;set;}
/// <summary>
/// 连接字符串
/// </summary>
public string connStr { get; set; }
}

@ -0,0 +1,203 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Model.dao
* B0FF7F3C-05DE-44D0-9909-3301EA07E749
*
* WenJY
*
* 2025-09-05 11:14:23
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using SqlSugar;
namespace Sln.Imm.Daemon.Model.dao;
/// <summary>
/// 设备信息
/// </summary>
[SugarTable("ems_base_monitor_info"), TenantAttribute("mes")]
public class BaseDeviceInfo
{
/// <summary>
/// Desc:自增标识
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "obj_id")]
public int objid { get; set; }
/// <summary>
/// Desc:父级编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "parent_id")]
public int? parentId { get; set; }
/// <summary>
/// Desc:计量设备编号
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, ColumnName = "monitor_code")]
public string monitorId { get; set; }
/// <summary>
/// Desc:计量设备名称
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "monitor_name")]
public string monitorName { get; set; }
/// <summary>
/// Desc:计量设备位置
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "monitor_addr")]
public string monitorAddr { get; set; }
/// <summary>
/// Desc:计量设备类型
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "monitor_type")]
public int? monitorType { get; set; }
/// <summary>
/// Desc:计量设备状态
/// Default:0
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "monitor_status")]
public int? monitorStatus { get; set; }
/// <summary>
/// Desc:采集设备编号
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "collect_device_id")]
public string collectDeviceId { get; set; }
/// <summary>
/// Desc:祖级列表
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "ancestors")]
public string ancestors { get; set; }
/// <summary>
/// Desc:等级
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "grade")]
public int? grade { get; set; }
/// <summary>
/// Desc:传感器仪表
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "meter_type_id")]
public string meterTypeId { get; set; }
/// <summary>
/// Desc:修正值
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "correct_value")]
public decimal? correctValue { get; set; }
/// <summary>
/// Desc:PT值
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "pt")]
public int? pt { get; set; }
/// <summary>
/// Desc:CT值
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "ct")]
public int? ct { get; set; }
/// <summary>
/// Desc:是否虚拟
/// Default:false
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_ammeter")]
public string isAmmeter { get; set; }
/// <summary>
/// Desc:通断复位
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_key_monitor")]
public int? isKeyMonitor { get; set; }
/// <summary>
/// Desc:是否断路
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "is_circuit")]
public int? isCircuit { get; set; }
/// <summary>
/// Desc:创建人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "create_by")]
public string createBy { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:CURRENT_TIMESTAMP
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "create_time")]
public DateTime? createTime { get; set; }
/// <summary>
/// Desc:更新人
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "update_by")]
public string updateBy { get; set; }
/// <summary>
/// Desc:更新时间
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "update_time")]
public DateTime? updateTime { get; set; }
}

@ -0,0 +1,37 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Model.dao
* 471106BA-23AA-4923-99A0-EBF103DAD909
*
* WenJY
*
* 2025-09-05 11:15:14
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using SqlSugar;
namespace Sln.Imm.Daemon.Model.dao;
/// <summary>
/// 设备采集参数
/// </summary>
[SugarTable("ems_base_monitor_info"), TenantAttribute("mes")]
public class BaseDeviceParam
{
}

@ -0,0 +1,42 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository
* 8E7E6A6F-CF05-49EA-A400-30147E92C840
*
* WenJY
*
* 2025-09-05 11:21:51
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using SqlSugar;
namespace Sln.Imm.Daemon.Repository;
public class Repository<T> : SimpleClient<T> where T : class, new()
{
public ITenant itenant = null; //多租户事务、GetConnection、IsAnyConnection等功能
public Repository(ISqlSugarClient db)
{
itenant = db.AsTenant(); //用来处理事务
base.Context = db.AsTenant().GetConnectionScopeWithAttr<T>(); //获取子Db
//如果不想通过注入多个仓储
//用到ChangeRepository或者Db.GetMyRepository需要看标题4写法
}
}

@ -0,0 +1,70 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository
* E2ACD454-D380-4130-8B28-FB2A2BF58530
*
* WenJY
*
* 2025-09-05 11:22:32
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Microsoft.Extensions.DependencyInjection;
using Sln.Imm.Daemon.Config;
using SqlSugar;
namespace Sln.Imm.Daemon.Repository;
public static class SqlsugarSetup
{
/// <summary>
/// 注册SqlSugar
/// </summary>
/// <param name="services"></param>
public static void AddSqlSugarSetup(this IServiceCollection services)
{
services.AddSingleton<ISqlSugarClient>(x =>
{
var appConfig = x.GetService<AppConfig>();
var connectConfigList = new List<ConnectionConfig>();
if (appConfig.sqlConfig != null)
{
foreach (var item in appConfig.sqlConfig)
{
if (item.isFlag)
{
var config = new ConnectionConfig()
{
ConfigId = item.configId,
DbType = (DbType)item.dbType,
ConnectionString = item.connStr,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true,
};
connectConfigList.Add(config);
}
}
}
SqlSugarScope Db =
new SqlSugarScope(connectConfigList, db => { db.Aop.OnLogExecuting = (sql, pars) => { }; });
return Db;
});
}
}

@ -0,0 +1,33 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository.service
* 77A94DE4-5143-4392-9125-9E505AFC5D2D
*
* WenJY
*
* 2025-09-05 11:25:32
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Sln.Imm.Daemon.Model.dao;
using Sln.Imm.Daemon.Repository.service.@base;
namespace Sln.Imm.Daemon.Repository.service;
public interface IBaseDeviceInfoService : IBaseService<BaseDeviceInfo>
{
}

@ -0,0 +1,33 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository.service
* 99E3BC15-AFBC-4B79-B2FF-38374E3BB6BD
*
* WenJY
*
* 2025-09-05 11:26:53
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Sln.Imm.Daemon.Model.dao;
using Sln.Imm.Daemon.Repository.service.@base;
namespace Sln.Imm.Daemon.Repository.service;
public interface IBaseDeviceParamService : IBaseService<BaseDeviceParam>
{
}

@ -0,0 +1,36 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository.service.Impl
* 4B5A8864-4B34-489E-986B-B4C698CED289
*
* WenJY
*
* 2025-09-05 11:26:11
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Sln.Imm.Daemon.Model.dao;
using Sln.Imm.Daemon.Repository.service.@base;
namespace Sln.Imm.Daemon.Repository.service.Impl;
public class BaseDeviceInfoServiceImpl : BaseServiceImpl<BaseDeviceInfo>, IBaseDeviceInfoService
{
public BaseDeviceInfoServiceImpl(Repository<BaseDeviceInfo> rep) : base(rep)
{
}
}

@ -0,0 +1,36 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository.service.Impl
* 4D067141-7FEC-4ED6-A69C-F285D68FFDEF
*
* WenJY
*
* 2025-09-05 11:27:26
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Sln.Imm.Daemon.Model.dao;
using Sln.Imm.Daemon.Repository.service.@base;
namespace Sln.Imm.Daemon.Repository.service.Impl;
public class BaseDeviceParamServiceImpl : BaseServiceImpl<BaseDeviceParam>, IBaseDeviceParamService
{
public BaseDeviceParamServiceImpl(Repository<BaseDeviceParam> rep) : base(rep)
{
}
}

@ -0,0 +1,368 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository.service.base
* B602D392-6450-4597-A0A9-F0696683B8AB
*
* WenJY
*
* 2025-09-05 11:24:10
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using System.Linq.Expressions;
using SqlSugar;
namespace Sln.Imm.Daemon.Repository.service.@base;
public class BaseServiceImpl<T> : IBaseService<T> where T : class, new()
{
public readonly Repository<T> _rep;
public BaseServiceImpl(Repository<T> rep)
{
_rep = rep;
}
/// <summary>
/// 添加实体信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public bool Insert(T model)
{
if (model == null)
{
throw new ArgumentNullException($"添加实体信息异常:实体参数为空");
}
try
{
return _rep.CopyNew().Insert(model);
}
catch (Exception ex)
{
throw new InvalidOperationException($"添加实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 批量添加实体集合
/// </summary>
/// <param name="lisT"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public bool Insert(List<T> lisT)
{
if (lisT == null)
{
throw new ArgumentNullException($"批量添加实体集合异常:实体集合参数为空");
}
try
{
// _rep.AsTenant().BeginTran();
var info = _rep.CopyNew().InsertRange(lisT);
// _rep.AsTenant().CommitTran();
return true;
}
catch (Exception ex)
{
// _rep.AsTenant().RollbackTran();
throw new InvalidOperationException($"批量添加实体集合异常:{ex.Message}");
}
}
/// <summary>
/// 根据id 删除信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool DeleteById(object id)
{
if (id == null)
{
throw new ArgumentNullException($"根据id删除信息异常:Id参数为空");
}
try
{
return _rep.DeleteById(id);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据id删除信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体删除信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="InvalidOperationException"></exception>
public bool Delete(T model)
{
if (model == null)
{
throw new ArgumentNullException($"根据实体删除信息异常:实体参数为空");
}
try
{
return _rep.DeleteById(model);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体删除信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体集合批量删除信息
/// </summary>
/// <param name="entitys"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool Deletes(List<T> entitys)
{
if (entitys == null)
{
throw new ArgumentNullException($"根据实体集合批量删除信息异常:实体集合参数为空");
}
try
{
return _rep.Delete(entitys);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体集合批量删除信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体更新信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool Update(T model)
{
if (model == null)
{
throw new ArgumentNullException($"根据实体更新信息异常:实体参数为空");
}
try
{
return _rep.Update(model);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体更新信息异常:{ex.Message}");
}
}
/// <summary>
/// 批量更新实体集合信息
/// </summary>
/// <param name="entitys"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public bool Update(List<T> entitys)
{
if (entitys == null)
{
throw new ArgumentNullException($"批量更新实体集合信息异常:实体集合参数为空");
}
try
{
return _rep.UpdateRange(entitys);
}
catch (Exception ex)
{
throw new InvalidOperationException($"批量更新实体集合信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据Where条件更新实体信息
/// </summary>
/// <param name="entity"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
public bool Update(T entity, string strWhere)
{
if (entity == null)
{
throw new ArgumentNullException($"根据Where条件更新实体信息异常:实体参数为空");
}
if (string.IsNullOrEmpty(strWhere))
{
throw new ArgumentNullException($"根据Where条件更新实体信息异常:Where参数为空");
}
try
{
return _rep.AsUpdateable(entity).Where(strWhere).ExecuteCommandHasChange();
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据Where条件更新实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据实体更新指定列
/// </summary>
/// <param name="entity"></param>
/// <param name="lstColumns"></param>
/// <param name="lstIgnoreColumns"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
public bool Update(T entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null,
string strWhere = "")
{
try
{
IUpdateable<T> up = _rep.AsUpdateable(entity);
if (lstIgnoreColumns != null && lstIgnoreColumns.Count > 0)
{
up = up.IgnoreColumns(lstIgnoreColumns.ToArray());
}
if (lstColumns != null && lstColumns.Count > 0)
{
up = up.UpdateColumns(lstColumns.ToArray());
}
if (!string.IsNullOrEmpty(strWhere))
{
up = up.Where(strWhere);
}
return up.ExecuteCommandHasChange();
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据实体更新指定列异常:{ex.Message}");
}
}
/// <summary>
/// 查询所有信息
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<T> Query()
{
try
{
return _rep.GetList();
}
catch (Exception ex)
{
throw new InvalidOperationException($"查询所有信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据Id查询实体
/// </summary>
/// <param name="objId"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public T Query(object objId)
{
if (objId == null)
{
throw new ArgumentNullException($"根据Id查询实体信息异常:Id参数为空");
}
try
{
return _rep.GetById(objId);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据Id查询实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据表达式查询
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<T> Query(Expression<Func<T, bool>> whereExpression)
{
if (whereExpression == null)
{
throw new ArgumentNullException($"根据表达式查询实体信息异常:表达式参数为空");
}
try
{
return _rep.GetList(whereExpression);
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据表达式查询实体信息异常:{ex.Message}");
}
}
/// <summary>
/// 根据表达式排序查询
/// </summary>
/// <param name="whereExpression"></param>
/// <param name="orderByExpression"></param>
/// <param name="isAsc"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<T> Query(Expression<Func<T, bool>> whereExpression, Expression<Func<T, object>> orderByExpression,
bool isAsc = true)
{
if (whereExpression == null)
{
throw new ArgumentNullException($"根据表达式排序查询信息异常:条件表达式参数为空");
}
if (orderByExpression == null)
{
throw new ArgumentNullException($"根据表达式排序查询信息异常:排序表达式参数为空");
}
try
{
return _rep.AsQueryable()
.OrderByIF(orderByExpression != null, orderByExpression, isAsc ? OrderByType.Asc : OrderByType.Desc)
.WhereIF(whereExpression != null, whereExpression).ToList();
}
catch (Exception ex)
{
throw new InvalidOperationException($"根据表达式排序查询信息异常:{ex.Message}");
}
}
}

@ -0,0 +1,128 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Repository.service.base
* 0AE676A9-45F0-4A21-B1E2-BFCBF3BBAF2B
*
* WenJY
*
* 2025-09-05 11:23:41
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using System.Linq.Expressions;
namespace Sln.Imm.Daemon.Repository.service.@base;
public interface IBaseService<T> where T : class
{
/// <summary>
/// 添加实体信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
bool Insert(T model);
/// <summary>
/// 批量添加实体集合
/// </summary>
/// <param name="lisT"></param>
/// <returns></returns>
bool Insert(List<T> lisT);
/// <summary>
/// 根据id 删除信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
bool DeleteById(object id);
/// <summary>
/// 根据实体删除信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
bool Delete(T model);
/// <summary>
/// 根据实体集合批量删除信息
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
bool Deletes(List<T> entitys);
/// <summary>
/// 根据实体更新信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
bool Update(T model);
/// <summary>
/// 批量更新实体集合信息
/// </summary>
/// <param name="entitys"></param>
/// <returns></returns>
bool Update(List<T> entitys);
/// <summary>
/// 根据Where条件更新实体信息
/// </summary>
/// <param name="entity"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
bool Update(T entity, string strWhere);
/// <summary>
/// 根据实体更新指定列
/// </summary>
/// <param name="entity"></param>
/// <param name="lstColumns"></param>
/// <param name="lstIgnoreColumns"></param>
/// <param name="strWhere"></param>
/// <returns></returns>
bool Update(T entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string strWhere = "");
/// <summary>
/// 查询所有信息
/// </summary>
/// <returns></returns>
List<T> Query();
/// <summary>
/// 根据Id查询实体
/// </summary>
/// <param name="objId"></param>
/// <returns></returns>
T Query(object objId);
/// <summary>
/// 根据表达式查询
/// </summary>
/// <param name="whereExpression"></param>
/// <returns></returns>
List<T> Query(Expression<Func<T, bool>> whereExpression);
/// <summary>
/// 根据表达式排序查询
/// </summary>
/// <param name="whereExpression">查询条件</param>
/// <param name="orderByExpression">排序条件</param>
/// <param name="isAsc">是否正序</param>
/// <returns></returns>
List<T> Query(Expression<Func<T, bool>> whereExpression, Expression<Func<T, object>> orderByExpression,
bool isAsc = true);
}

@ -0,0 +1,62 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Serilog
* 21109DAB-7351-4989-B90E-BCCBE927EE8A
*
* WenJY
*
* 2025-09-05 11:00:23
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Microsoft.Extensions.DependencyInjection;
using Serilog;
using Sln.Imm.Daemon.Config;
namespace Sln.Imm.Daemon.Serilog;
public static class SerilogExtensions
{
public static void UseSerilogExtensions(this IServiceProvider service)
{
//启用Serilog中间件
#region 通过配置文件读取日志存放位置
var appConfig = service.GetService<AppConfig>();
var logPath = Path.Combine(appConfig.logPath, "Logs");
#endregion
Log.Logger = new LoggerConfiguration().MinimumLevel.Information().WriteTo.Console()
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(logEvent => logEvent.Properties.ContainsKey("Module") && logEvent.Properties["Module"].ToString().Contains("Info"))
.WriteTo.File(Path.Combine($"{logPath}/Info/", "Info.log"), rollingInterval: RollingInterval.Day))
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(logEvent => logEvent.Properties.ContainsKey("Module") && logEvent.Properties["Module"].ToString().Contains("Iot"))
.WriteTo.File(Path.Combine($"{logPath}/Iot/", "Iot.log"), rollingInterval: RollingInterval.Day))
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(logEvent => logEvent.Properties.ContainsKey("Module") && logEvent.Properties["Module"].ToString().Contains("Alarm"))
.WriteTo.File(Path.Combine($"{logPath}/Alarm/", "Alarm.log"), rollingInterval: RollingInterval.Day))
.WriteTo.Logger(lc => lc
.Filter.ByIncludingOnly(logEvent => logEvent.Properties.ContainsKey("Module") && logEvent.Properties["Module"].ToString().Contains("Error"))
.WriteTo.File(Path.Combine($"{logPath}/Error/", "Error.log"), rollingInterval: RollingInterval.Day))
.CreateLogger();
}
}

@ -0,0 +1,103 @@
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2025 WenJY
* CLR4.0.30319.42000
* Mr.Wen's MacBook Pro
* Sln.Imm.Daemon.Serilog
* 08A4FDC7-3133-4325-BF81-CCAD5E6B7336
*
* WenJY
*
* 2025-09-05 11:02:13
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
using Serilog;
namespace Sln.Imm.Daemon.Serilog;
public class SerilogHelper
{
private readonly ILogger? Info_logger = Log.ForContext("Module", "Info");
private readonly ILogger? Iot_logger = Log.ForContext("Module", "Iot");
private readonly ILogger? Error_logger = Log.ForContext("Module", "Error");
private readonly ILogger? Alarm_logger = Log.ForContext("Module", "Alarm");
/// <summary>
/// Info日志
/// </summary>
/// <param name="msg"></param>
public void Info(string msg)
{
if (Info_logger != null)
{
this.Info_logger.Information(msg);
}
}
/// <summary>
/// Iot日志
/// </summary>
/// <param name="msg"></param>
public void Iot(string msg)
{
if (Iot_logger != null)
{
this.Iot_logger.Information(msg);
}
}
/// <summary>
/// 设备告警日志
/// </summary>
/// <param name="msg"></param>
public void Alarm(string msg)
{
if (Alarm_logger != null)
{
this.Alarm_logger.Information(msg);
}
}
/// <summary>
/// Error日志
/// </summary>
/// <param name="msg"></param>
/// <param name="ex"></param>
public void Error(string msg, Exception ex = null)
{
if (!string.IsNullOrEmpty(msg) && ex == null)
{
this.Error_logger.Information("【附加信息】 : {0}<br>", new object[] { msg });
}
else if (!string.IsNullOrEmpty(msg) && ex != null)
{
string errorMsg = BeautyErrorMsg(ex);
this.Error_logger.Information("【附加信息】 : {0}<br>{1}", new object[] { msg, errorMsg });
}
else if (string.IsNullOrEmpty(msg) && ex != null)
{
string errorMsg = BeautyErrorMsg(ex);
this.Error_logger.Information(errorMsg);
}
}
private string BeautyErrorMsg(Exception ex)
{
string errorMsg = string.Format("【异常类型】:{0} <br>【异常信息】:{1} <br>【堆栈调用】:{2}", new object[] { ex.GetType().Name, ex.Message, ex.StackTrace });
errorMsg = errorMsg.Replace("\r\n", "<br>");
errorMsg = errorMsg.Replace("位置", "<strong style=\"color:red\">位置</strong>");
return errorMsg;
}
}

@ -5,6 +5,18 @@ VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon", "Sln.Imm.Daemon\Sln.Imm.Daemon.csproj", "{682DDE67-2CBF-4B54-831F-987EC6667FD1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon.Config", "Sln.Imm.Daemon.Config\Sln.Imm.Daemon.Config.csproj", "{A08A7879-F8B6-4A34-8ABE-2DEE3309F225}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon.Serilog", "Sln.Imm.Daemon.Serilog\Sln.Imm.Daemon.Serilog.csproj", "{3D173F48-72EC-46F5-AB2E-2B0A1A1729B9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon.Common", "Sln.Imm.Daemon.Common\Sln.Imm.Daemon.Common.csproj", "{728A030C-33EC-494C-AF86-ABC24B84AFD0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon.Model", "Sln.Imm.Daemon.Model\Sln.Imm.Daemon.Model.csproj", "{D0A7BFAC-A920-48E1-9F54-CA70DE7D01CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon.Repository", "Sln.Imm.Daemon.Repository\Sln.Imm.Daemon.Repository.csproj", "{BE51B37D-92B4-4561-92B6-D236300E33FA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sln.Imm.Daemon.Cache", "Sln.Imm.Daemon.Cache\Sln.Imm.Daemon.Cache.csproj", "{143CC5C4-661C-42A9-BEA0-3C6653347DE5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +27,30 @@ Global
{682DDE67-2CBF-4B54-831F-987EC6667FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{682DDE67-2CBF-4B54-831F-987EC6667FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{682DDE67-2CBF-4B54-831F-987EC6667FD1}.Release|Any CPU.Build.0 = Release|Any CPU
{A08A7879-F8B6-4A34-8ABE-2DEE3309F225}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A08A7879-F8B6-4A34-8ABE-2DEE3309F225}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A08A7879-F8B6-4A34-8ABE-2DEE3309F225}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A08A7879-F8B6-4A34-8ABE-2DEE3309F225}.Release|Any CPU.Build.0 = Release|Any CPU
{3D173F48-72EC-46F5-AB2E-2B0A1A1729B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D173F48-72EC-46F5-AB2E-2B0A1A1729B9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D173F48-72EC-46F5-AB2E-2B0A1A1729B9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D173F48-72EC-46F5-AB2E-2B0A1A1729B9}.Release|Any CPU.Build.0 = Release|Any CPU
{728A030C-33EC-494C-AF86-ABC24B84AFD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{728A030C-33EC-494C-AF86-ABC24B84AFD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{728A030C-33EC-494C-AF86-ABC24B84AFD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{728A030C-33EC-494C-AF86-ABC24B84AFD0}.Release|Any CPU.Build.0 = Release|Any CPU
{D0A7BFAC-A920-48E1-9F54-CA70DE7D01CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0A7BFAC-A920-48E1-9F54-CA70DE7D01CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0A7BFAC-A920-48E1-9F54-CA70DE7D01CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0A7BFAC-A920-48E1-9F54-CA70DE7D01CF}.Release|Any CPU.Build.0 = Release|Any CPU
{BE51B37D-92B4-4561-92B6-D236300E33FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE51B37D-92B4-4561-92B6-D236300E33FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE51B37D-92B4-4561-92B6-D236300E33FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE51B37D-92B4-4561-92B6-D236300E33FA}.Release|Any CPU.Build.0 = Release|Any CPU
{143CC5C4-661C-42A9-BEA0-3C6653347DE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{143CC5C4-661C-42A9-BEA0-3C6653347DE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{143CC5C4-661C-42A9-BEA0-3C6653347DE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{143CC5C4-661C-42A9-BEA0-3C6653347DE5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -1,10 +1,71 @@
namespace Sln.Imm.Daemon
using System.Reflection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NeoSmart.Caching.Sqlite;
using Sln.Imm.Daemon.Config;
using Sln.Imm.Daemon.Repository;
using Sln.Imm.Daemon.Serilog;
using ZiggyCreatures.Caching.Fusion;
using ZiggyCreatures.Caching.Fusion.Serialization.NewtonsoftJson;
namespace Sln.Imm.Daemon
{
internal class Program
{
public static IServiceProvider? ServiceProvider = null;
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
var services = new ServiceCollection();
ConfigureServices(services);
ServiceProvider = services.BuildServiceProvider();
ServiceProvider.UseSerilogExtensions();
var appConfig = ServiceProvider.GetService<AppConfig>();
var log = ServiceProvider.GetService<SerilogHelper>();
log.Info($"系统启动成功,日志存放位置:{appConfig.logPath}");
}
private static void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<AppConfig>(provider =>
{
var configurationBuilder = new ConfigurationBuilder()
.SetBasePath(AppDomain.CurrentDomain.BaseDirectory)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
IConfiguration configuration = configurationBuilder.Build();
var ap = configuration.GetSection("AppConfig").Get<AppConfig>();
return ap;
});
Assembly[] assemblies =
{
Assembly.LoadFrom("Sln.Iot.Common.dll"),
Assembly.LoadFrom("Sln.Iot.Repository.dll"),
// Assembly.LoadFrom("Sln.Iot.Socket.dll"),
// Assembly.LoadFrom("Sln.Iot.Business.dll"),
// Assembly.LoadFrom("Sln.Iot.Cache.dll"),
};
services.Scan(scan => scan.FromAssemblies(assemblies)
.AddClasses()
.AsImplementedInterfaces()
.AsSelf()
.WithSingletonLifetime());
services.AddSingleton(typeof(SerilogHelper));
services.AddSqlSugarSetup();
services.AddFusionCache()
.WithSerializer(
new FusionCacheNewtonsoftJsonSerializer()
)
.WithDistributedCache(
new SqliteCache(new SqliteCacheOptions
{
CachePath = "/Users/wenxiansheng/Public/WorkSpace/Mesnac/项目资料/澳柯玛注塑车间MES项目/数据缓存/FusionCache.db"
}));
}
}
}
}

@ -1,10 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.8"/>
<PackageReference Include="Scrutor" Version="6.1.0"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sln.Imm.Daemon.Cache\Sln.Imm.Daemon.Cache.csproj"/>
<ProjectReference Include="..\Sln.Imm.Daemon.Config\Sln.Imm.Daemon.Config.csproj"/>
<ProjectReference Include="..\Sln.Imm.Daemon.Repository\Sln.Imm.Daemon.Repository.csproj"/>
<ProjectReference Include="..\Sln.Imm.Daemon.Serilog\Sln.Imm.Daemon.Serilog.csproj"/>
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

@ -0,0 +1,14 @@
{
"AppConfig": {
"logPath": "/Users/wenxiansheng/Public/WorkSpace/Mesnac/项目资料/澳柯玛注塑车间MES项目/日志信息",
"SqlConfig": [
{
"configId": "mes", //imm:
"dbType": 0, //tidb mysql
"isFlag": false,
"connStr": "server=127.0.0.1;Port=4000;Database=tao_iot;Uid=root;" //Pwd=haiwei@123;
//"connStr": "server=1.13.177.47;Port=3306;Database=tao_iot;Uid=root;Pwd=Haiwei123456;"
}
]
}
}
Loading…
Cancel
Save