调整SN的获取来源
This commit is contained in:
parent
57ea062060
commit
c7ccffdfaf
|
@ -1,6 +0,0 @@
|
||||||
namespace MasstransferCommon.Model.Constant;
|
|
||||||
|
|
||||||
public class Constants
|
|
||||||
{
|
|
||||||
public const string SN = "G5506771257";
|
|
||||||
}
|
|
|
@ -1,128 +1,128 @@
|
||||||
namespace MasstransferCommon.Model.Constant;
|
using MasstransferSecurity.Utils;
|
||||||
|
|
||||||
|
namespace MasstransferCommon.Model.Constant;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 这里保存所有的 Mqtt Topic
|
/// 这里保存所有的 Mqtt Topic
|
||||||
/// topic 的基本结构构成
|
/// topic 的基本结构构成
|
||||||
/// up/{sn}/{cmd}/{version}
|
/// up/{DeviceInfoUtil.GetDeviceSN()}/{cmd}/{version}
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Topics
|
public static class Topics
|
||||||
{
|
{
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
private const string SN = "G5506771257";
|
private static string Version = "1.0.0";
|
||||||
|
|
||||||
private const string Version = "1.0.0";
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上报生产数据
|
/// 上报生产数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportProductRecord = $"up/{SN}/100/{Version}";
|
public static string ReportProductRecord = $"up/{DeviceInfoUtil.GetDeviceSN()}/100/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图片上传
|
/// 图片上传
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ImageUpload = $"up/{SN}/102/{Version}";
|
public static string ImageUpload = $"up/{DeviceInfoUtil.GetDeviceSN()}/102/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询图片
|
/// 查询图片
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string QueryImage = $"down/{SN}/103/{Version}";
|
public static string QueryImage = $"down/{DeviceInfoUtil.GetDeviceSN()}/103/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 坐标文件上传
|
/// 坐标文件上传
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string CoordinateUpload = $"up/{SN}/104/{Version}";
|
public static string CoordinateUpload = $"up/{DeviceInfoUtil.GetDeviceSN()}/104/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询坐标文件
|
/// 查询坐标文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string QueryCoordinate = $"down/{SN}/105/{Version}";
|
public static string QueryCoordinate = $"down/{DeviceInfoUtil.GetDeviceSN()}/105/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上报用户操作数据
|
/// 上报用户操作数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportOperationLog = $"up/{SN}/200/{Version}";
|
public static string ReportOperationLog = $"up/{DeviceInfoUtil.GetDeviceSN()}/200/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上传系统日志文件
|
/// 上传系统日志文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string UploadLogFile = $"up/{SN}/201/{Version}";
|
public static string UploadLogFile = $"up/{DeviceInfoUtil.GetDeviceSN()}/201/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询系统日志文件
|
/// 查询系统日志文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string QueryLogFile = $"down/{SN}/202/{Version}";
|
public static string QueryLogFile = $"down/{DeviceInfoUtil.GetDeviceSN()}/202/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上报故障信息
|
/// 上报故障信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportFaultRecord = $"up/{SN}/203/{Version}";
|
public static string ReportFaultRecord = $"up/{DeviceInfoUtil.GetDeviceSN()}/203/{Version}";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上报配置数据
|
/// 上报配置数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportConfigData = $"up/{SN}/400/{Version}";
|
public static string ReportConfigData = $"up/{DeviceInfoUtil.GetDeviceSN()}/400/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下发配置数据
|
/// 下发配置数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string DownloadConfigData = $"down/{SN}/401/{Version}";
|
public static string DownloadConfigData = $"down/{DeviceInfoUtil.GetDeviceSN()}/401/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下发远程控制指令
|
/// 下发远程控制指令
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string RemoteControl = $"down/{SN}/402/{Version}";
|
public static string RemoteControl = $"down/{DeviceInfoUtil.GetDeviceSN()}/402/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上报配置字典数据
|
/// 上报配置字典数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportConfigDictionary = $"up/{SN}/403/{Version}";
|
public static string ReportConfigDictionary = $"up/{DeviceInfoUtil.GetDeviceSN()}/403/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 下发OTA包
|
/// 下发OTA包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public const string IssuedOTAPackage = $"down/{SN}/500/{Version}";
|
public static string IssuedOTAPackage = $"down/{DeviceInfoUtil.GetDeviceSN()}/500/{Version}";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询OTA信息
|
/// 查询OTA信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public const string QueryOTA = $"up/{SN}/501/{Version}";
|
public static string QueryOTA = $"up/{DeviceInfoUtil.GetDeviceSN()}/501/{Version}";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OTA 更新反馈
|
/// OTA 更新反馈
|
||||||
/// </summary>
|
/// </summary>
|
||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public const string OTAUpgradeFeedback = $"up/{SN}/502/{Version}";
|
public static string OTAUpgradeFeedback = $"up/{DeviceInfoUtil.GetDeviceSN()}/502/{Version}";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新证书事件
|
/// 更新证书事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string UpdateLicenseEvent = $"up/{SN}/503/{Version}";
|
public static string UpdateLicenseEvent = $"up/{DeviceInfoUtil.GetDeviceSN()}/503/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新证书事件反馈
|
/// 更新证书事件反馈
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string UpdateLicenseEventFeedback = $"up/{SN}/505/{Version}";
|
public static string UpdateLicenseEventFeedback = $"up/{DeviceInfoUtil.GetDeviceSN()}/505/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上行心跳信息
|
/// 上行心跳信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string HeartBeat = $"up/{SN}/600/{Version}";
|
public static string HeartBeat = $"up/{DeviceInfoUtil.GetDeviceSN()}/600/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上行系统状态信息
|
/// 上行系统状态信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportSystemStat = $"up/{SN}/601/{Version}";
|
public static string ReportSystemStat = $"up/{DeviceInfoUtil.GetDeviceSN()}/601/{Version}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上行系统版本信息
|
/// 上行系统版本信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReportSystemVersion = $"up/{SN}/602/{Version}";
|
public static string ReportSystemVersion = $"up/{DeviceInfoUtil.GetDeviceSN()}/602/{Version}";
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Management;
|
using System.Management;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using MasstransferCommon.Utils;
|
||||||
|
|
||||||
namespace MasstransferSecurity.Utils;
|
namespace MasstransferSecurity.Utils;
|
||||||
|
|
||||||
|
@ -9,6 +10,8 @@ namespace MasstransferSecurity.Utils;
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class DeviceInfoUtil
|
public sealed class DeviceInfoUtil
|
||||||
{
|
{
|
||||||
|
private const string KeyPath = @"Software\Masstransfer\Device";
|
||||||
|
|
||||||
public static string GenerateUniqueID()
|
public static string GenerateUniqueID()
|
||||||
{
|
{
|
||||||
var cpuId = GetCpuId();
|
var cpuId = GetCpuId();
|
||||||
|
@ -87,4 +90,13 @@ public sealed class DeviceInfoUtil
|
||||||
|
|
||||||
return builder.ToString();
|
return builder.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取设备的序列号
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string GetDeviceSN()
|
||||||
|
{
|
||||||
|
return (string)RegistryHelper.ReadValue(KeyPath, "SerialNumber");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,7 @@ using MasstransferCommunicate.Minio;
|
||||||
using MasstransferCommunicate.Mqtt.Client;
|
using MasstransferCommunicate.Mqtt.Client;
|
||||||
using MasstransferExporter.DataExporter.Model;
|
using MasstransferExporter.DataExporter.Model;
|
||||||
using MasstransferInfrastructure.Database.Sqlite;
|
using MasstransferInfrastructure.Database.Sqlite;
|
||||||
|
using MasstransferSecurity.Utils;
|
||||||
using Masuit.Tools;
|
using Masuit.Tools;
|
||||||
|
|
||||||
namespace MasstransferExporter.DataExporter;
|
namespace MasstransferExporter.DataExporter;
|
||||||
|
@ -59,7 +60,7 @@ public class CoordinateService : Instant
|
||||||
|
|
||||||
await File.WriteAllTextAsync(path, substrate.SubstrateMarkPointJson);
|
await File.WriteAllTextAsync(path, substrate.SubstrateMarkPointJson);
|
||||||
|
|
||||||
var fileName = $"{Constants.SN}/{batchCode}/{substrateCode}/MARK/mark.json";
|
var fileName = $"{DeviceInfoUtil.GetDeviceSN()}/{batchCode}/{substrateCode}/MARK/mark.json";
|
||||||
|
|
||||||
await Minio.UploadFileAsync("coordinate", fileName, path);
|
await Minio.UploadFileAsync("coordinate", fileName, path);
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ public class CoordinateService : Instant
|
||||||
{
|
{
|
||||||
await File.WriteAllTextAsync(path, wafer.CoordinateJson);
|
await File.WriteAllTextAsync(path, wafer.CoordinateJson);
|
||||||
|
|
||||||
var fileName = $"{Constants.SN}/{wafer.BatchCode}/{wafer.WaferCode}/WAFER/wafer.json";
|
var fileName = $"{DeviceInfoUtil.GetDeviceSN()}/{wafer.BatchCode}/{wafer.WaferCode}/WAFER/wafer.json";
|
||||||
|
|
||||||
await Minio.UploadFileAsync("coordinate", fileName, path);
|
await Minio.UploadFileAsync("coordinate", fileName, path);
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ public class CoordinateService : Instant
|
||||||
{
|
{
|
||||||
await File.WriteAllTextAsync(path, substrate.CoordinateJson);
|
await File.WriteAllTextAsync(path, substrate.CoordinateJson);
|
||||||
|
|
||||||
var fileName = $"{Constants.SN}/{substrate.BatchNo}/{substrate.SubstrateCode}/PCB/pcb.json";
|
var fileName = $"{DeviceInfoUtil.GetDeviceSN()}/{substrate.BatchNo}/{substrate.SubstrateCode}/PCB/pcb.json";
|
||||||
|
|
||||||
await Minio.UploadFileAsync("coordinate", fileName, path);
|
await Minio.UploadFileAsync("coordinate", fileName, path);
|
||||||
|
|
||||||
|
@ -196,7 +197,8 @@ public class CoordinateService : Instant
|
||||||
{
|
{
|
||||||
await File.WriteAllTextAsync(path, record.ToJsonString());
|
await File.WriteAllTextAsync(path, record.ToJsonString());
|
||||||
|
|
||||||
var fileName = $"{Constants.SN}/{record.BatchNo}/{record.SubstrateCode}/ROUTE/{record.Id}.json";
|
var fileName =
|
||||||
|
$"{DeviceInfoUtil.GetDeviceSN()}/{record.BatchNo}/{record.SubstrateCode}/ROUTE/{record.Id}.json";
|
||||||
|
|
||||||
await Minio.UploadFileAsync("coordinate", fileName, path);
|
await Minio.UploadFileAsync("coordinate", fileName, path);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
using System.ComponentModel;
|
||||||
|
using MasstransferCommon.Model.Entity;
|
||||||
|
using SQLite;
|
||||||
|
|
||||||
|
namespace MasstransferExporter.DataExporter.Model;
|
||||||
|
|
||||||
|
[Table("device"), Description("设备信息")]
|
||||||
|
public class DeviceParams : Entity
|
||||||
|
{
|
||||||
|
[Column("device_name"), Description("设备名称")]
|
||||||
|
public string? DeviceName { get; set; }
|
||||||
|
|
||||||
|
[Column("device_type"), Description("设备型号")]
|
||||||
|
public string? DeviceType { get; set; }
|
||||||
|
|
||||||
|
[Column("weight"), Description("设备重量(kg)")]
|
||||||
|
public int Weight { get; set; }
|
||||||
|
|
||||||
|
[Column("input_pressure"), Description("输入压力(MPa)")]
|
||||||
|
public string? InputPressure { get; set; }
|
||||||
|
|
||||||
|
[Column("length"), Description("设备长度(mm)")]
|
||||||
|
public int Length { get; set; }
|
||||||
|
|
||||||
|
[Column("width"), Description("设备宽度(mm)")]
|
||||||
|
public int Width { get; set; }
|
||||||
|
|
||||||
|
[Column("height"), Description("设备高度(mm)")]
|
||||||
|
public int Height { get; set; }
|
||||||
|
|
||||||
|
[Column("power"), Description("设备功率(W)")]
|
||||||
|
public int Power { get; set; }
|
||||||
|
|
||||||
|
[Column("voltage"), Description("设备电压(V)")]
|
||||||
|
public int Voltage { get; set; }
|
||||||
|
|
||||||
|
[Column("current"), Description("设备电流(A)")]
|
||||||
|
public int Current { get; set; }
|
||||||
|
|
||||||
|
[Column("date_of_manufacture"), Description("设备生产日期")]
|
||||||
|
public string? DateOfManufacture { get; set; }
|
||||||
|
|
||||||
|
[Column("serial_number"), Description("设备序列号")]
|
||||||
|
public string? SerialNumber { get; set; }
|
||||||
|
}
|
|
@ -24,4 +24,6 @@ public class SystemParamsDTO
|
||||||
public AxisVariables? AxisVariables { get; set; }
|
public AxisVariables? AxisVariables { get; set; }
|
||||||
|
|
||||||
public AxisPositionParams? AxisPositionParams { get; set; }
|
public AxisPositionParams? AxisPositionParams { get; set; }
|
||||||
|
|
||||||
|
public DeviceParams? DeviceParams { get; set; }
|
||||||
}
|
}
|
|
@ -148,7 +148,8 @@ public class SystemParamsService
|
||||||
ScannerParams = GetScannerParams(),
|
ScannerParams = GetScannerParams(),
|
||||||
SystemParams = GetSystemParams(),
|
SystemParams = GetSystemParams(),
|
||||||
AxisVariables = GetAxisVariables(),
|
AxisVariables = GetAxisVariables(),
|
||||||
AxisPositionParams = GetAxisPositionParams()
|
AxisPositionParams = GetAxisPositionParams(),
|
||||||
|
DeviceParams = GetDeviceParams()
|
||||||
};
|
};
|
||||||
|
|
||||||
var systemParams = new ConfigData<SystemParamsDTO>()
|
var systemParams = new ConfigData<SystemParamsDTO>()
|
||||||
|
@ -235,4 +236,10 @@ public class SystemParamsService
|
||||||
return Db.Query<AxisPositionParams>("select * from axis_position_params limit 1")
|
return Db.Query<AxisPositionParams>("select * from axis_position_params limit 1")
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static DeviceParams? GetDeviceParams()
|
||||||
|
{
|
||||||
|
return Db.Query<DeviceParams>("select * from device limit 1")
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ using MasstransferCommunicate.Mqtt.Client;
|
||||||
using MasstransferExporter.DataExporter.Model;
|
using MasstransferExporter.DataExporter.Model;
|
||||||
using MasstransferExporter.ImageExporter.Model;
|
using MasstransferExporter.ImageExporter.Model;
|
||||||
using MasstransferInfrastructure.Database.Sqlite;
|
using MasstransferInfrastructure.Database.Sqlite;
|
||||||
|
using MasstransferSecurity.Utils;
|
||||||
|
|
||||||
namespace MasstransferExporter.ImageExporter;
|
namespace MasstransferExporter.ImageExporter;
|
||||||
|
|
||||||
|
@ -89,7 +90,8 @@ public class ImageService : Instant
|
||||||
}
|
}
|
||||||
|
|
||||||
// 上传文件
|
// 上传文件
|
||||||
var fileName = $"{Constants.SN}/{codeDir.Name}/{batchDir.Name}/{picType.ToUpper()}/{name}";
|
var fileName =
|
||||||
|
$"{DeviceInfoUtil.GetDeviceSN()}/{codeDir.Name}/{batchDir.Name}/{picType.ToUpper()}/{name}";
|
||||||
|
|
||||||
await Minio.UploadFileAsync(bucket, fileName, path);
|
await Minio.UploadFileAsync(bucket, fileName, path);
|
||||||
|
|
||||||
|
@ -233,7 +235,7 @@ public class ImageService : Instant
|
||||||
foreach (var image in images)
|
foreach (var image in images)
|
||||||
{
|
{
|
||||||
var fileName =
|
var fileName =
|
||||||
$"{Constants.SN}/{codeDir.Name}/{batchCode.Name}/{type.Name.ToUpper()}/{image.Name}";
|
$"{DeviceInfoUtil.GetDeviceSN()}/{codeDir.Name}/{batchCode.Name}/{type.Name.ToUpper()}/{image.Name}";
|
||||||
|
|
||||||
var path = image.FullName;
|
var path = image.FullName;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ using MasstransferCommunicate.Minio;
|
||||||
using MasstransferCommunicate.Mqtt.Client;
|
using MasstransferCommunicate.Mqtt.Client;
|
||||||
using MasstransferExporter.LogExporter.Model;
|
using MasstransferExporter.LogExporter.Model;
|
||||||
using MasstransferInfrastructure.Database.Sqlite;
|
using MasstransferInfrastructure.Database.Sqlite;
|
||||||
|
using MasstransferSecurity.Utils;
|
||||||
|
|
||||||
namespace MasstransferExporter.LogExporter;
|
namespace MasstransferExporter.LogExporter;
|
||||||
|
|
||||||
|
@ -34,8 +35,7 @@ public class LogFileExporter : Instant
|
||||||
{
|
{
|
||||||
if (dto == null) return;
|
if (dto == null) return;
|
||||||
|
|
||||||
var path =
|
var path = GetBaseDirectory();
|
||||||
"C:\\workspace\\code_repos\\haiju\\MasstransferHost\\MasstransferDesktop\\bin\\Debug\\net7.0";
|
|
||||||
|
|
||||||
var directory = new DirectoryInfo(path + "\\logs");
|
var directory = new DirectoryInfo(path + "\\logs");
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class LogFileExporter : Instant
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
var fileName =
|
var fileName =
|
||||||
$"{Constants.SN}/{TimeUtil.FormatTime(file.CreationTime, "yyyyMMdd")}/{dto.Module}/{file.Name}";
|
$"{DeviceInfoUtil.GetDeviceSN()}/{TimeUtil.FormatTime(file.CreationTime, "yyyyMMdd")}/{dto.Module}/{file.Name}";
|
||||||
|
|
||||||
await Minio.UploadFileAsync("log", fileName, file.FullName);
|
await Minio.UploadFileAsync("log", fileName, file.FullName);
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,7 @@ public class LogFileExporter : Instant
|
||||||
|
|
||||||
var yesterday = DateTime.Today.AddDays(-1);
|
var yesterday = DateTime.Today.AddDays(-1);
|
||||||
|
|
||||||
var path =
|
var path = GetBaseDirectory();
|
||||||
"C:\\workspace\\code_repos\\haiju\\MasstransferHost\\MasstransferDesktop\\bin\\Debug\\net7.0";
|
|
||||||
|
|
||||||
foreach (var level in Levels)
|
foreach (var level in Levels)
|
||||||
{
|
{
|
||||||
|
@ -72,7 +71,8 @@ public class LogFileExporter : Instant
|
||||||
|
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
var fileName = $"{Constants.SN}/{TimeUtil.FormatTime(yesterday, "yyyyMMdd")}/{level}/{file.Name}";
|
var fileName =
|
||||||
|
$"{DeviceInfoUtil.GetDeviceSN()}/{TimeUtil.FormatTime(yesterday, "yyyyMMdd")}/{level}/{file.Name}";
|
||||||
|
|
||||||
await Minio.UploadFileAsync("log", fileName, file.FullName);
|
await Minio.UploadFileAsync("log", fileName, file.FullName);
|
||||||
}
|
}
|
||||||
|
@ -128,4 +128,20 @@ public class LogFileExporter : Instant
|
||||||
{
|
{
|
||||||
EventBus<bool>.AddEventHandler(EventType.StartUp, ListenQueryLogEvent);
|
EventBus<bool>.AddEventHandler(EventType.StartUp, ListenQueryLogEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取根目录路径
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
private static string GetBaseDirectory()
|
||||||
|
{
|
||||||
|
var logParams = GetLogParams();
|
||||||
|
return logParams?.Path ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static LogParams? GetLogParams()
|
||||||
|
{
|
||||||
|
return Helper.Query<LogParams>("select * from log_params limit 1")
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
using MasstransferCommon.Model.Constant;
|
using MasstransferCommon.Utils;
|
||||||
using MasstransferCommon.Utils;
|
|
||||||
using MasstransferCommunicate.Mqtt.Model;
|
using MasstransferCommunicate.Mqtt.Model;
|
||||||
using MasstransferInfrastructure.Mqtt.Model;
|
using MasstransferInfrastructure.Mqtt.Model;
|
||||||
|
using MasstransferSecurity.Utils;
|
||||||
using Masuit.Tools;
|
using Masuit.Tools;
|
||||||
using MQTTnet;
|
using MQTTnet;
|
||||||
using MQTTnet.Client;
|
using MQTTnet.Client;
|
||||||
|
@ -28,7 +28,7 @@ internal class MqttClient
|
||||||
{
|
{
|
||||||
return new MqttClientOptionsBuilder()
|
return new MqttClientOptionsBuilder()
|
||||||
.WithTcpServer(options.ServerAddress, options.Port)
|
.WithTcpServer(options.ServerAddress, options.Port)
|
||||||
.WithClientId(Constants.SN)
|
.WithClientId(DeviceInfoUtil.GetDeviceSN())
|
||||||
.WithKeepAlivePeriod(TimeSpan.FromSeconds(60))
|
.WithKeepAlivePeriod(TimeSpan.FromSeconds(60))
|
||||||
.WithCleanStart(true)
|
.WithCleanStart(true)
|
||||||
.WithWillRetain(false)
|
.WithWillRetain(false)
|
||||||
|
|
Loading…
Reference in New Issue