添加项目文件。

This commit is contained in:
2025-09-15 17:59:48 +08:00
parent 872f090cc2
commit e7adae128e
91 changed files with 14260 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 报警模型
/// </summary>
public class AlarmModel
{
private readonly IFreeSql _fsql;
private bool _isActive;
private DateTime _startTime;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="fsql">FreeSql实例</param>
public AlarmModel(IFreeSql fsql)
{
_fsql = fsql;
_isActive = false;
DeviceCode = string.Empty;
DeviceName = string.Empty;
AlarmMessage = string.Empty;
DeviceState = 0;
}
/// <summary>
/// 设备编号
/// </summary>
public string DeviceCode { get; set; }
/// <summary>
/// 设备名称
/// </summary>
public string DeviceName { get; set; }
/// <summary>
/// 报警信息
/// </summary>
public string AlarmMessage { get; set; }
/// <summary>
/// 设备状态码
/// </summary>
public int DeviceState { get; set; }
/// <summary>
/// Index
/// </summary>
public int Index { get; set; }
/// <summary>
/// 报警是否激活
/// </summary>
public bool IsActive
{
get => _isActive;
set
{
// 如果报警状态从激活变为不激活,保存报警记录
if (_isActive && !value)
{
SaveAlarmRecord();
}
// 如果报警状态从不激活变为激活,记录开始时间
else if (!_isActive && value)
{
_startTime = DateTime.Now;
}
_isActive = value;
}
}
/// <summary>
/// 更新设备码数据
/// </summary>
public void UpdateDeviceInfo(string deviceName, string DeviceCode)
{
this.DeviceName = deviceName;
this.DeviceCode= DeviceCode;
}
/// <summary>
/// 保存报警记录到数据库
/// </summary>
private void SaveAlarmRecord()
{
try
{
var endTime = DateTime.Now;
// 创建设备报警记录
var deviceAlarm = new DeviceAlarm
{
DeviceCode = this.DeviceCode,
DeviceName = this.DeviceName,
DeviceState = this.DeviceState,
AlarmMessage = this.AlarmMessage,
StartTime = _startTime,
EndTime = endTime
};
// 保存到数据库
_fsql.Insert(deviceAlarm).ExecuteAffrows();
Console.WriteLine($"报警记录已保存: {DeviceCode}, 开始时间: {_startTime}, 结束时间: {endTime}");
}
catch (Exception ex)
{
Console.WriteLine($"保存报警记录失败: {ex.Message}");
}
}
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 清洗动作
/// </summary>
public class ClearAction
{
/// <summary>
/// 清洗事件
/// </summary>
public event EventHandler<string> ClearActionEvent;
private bool _ClearEnd;
/// <summary>
/// 清洗完成信号
/// </summary>
public bool ClearEnd
{
get { return _ClearEnd; }
set
{
if (_ClearEnd != value)
{
_ClearEnd = value;
//清洗完成
if (_ClearEnd)
{
ClearActionEvent.BeginInvoke(this, "清洗完成", null, null);
}
}
}
}
private bool _DeviceClose;
/// <summary>
/// 设备关机信号
/// </summary>
public bool DeviceClose
{
get { return _DeviceClose; }
set
{
if (_DeviceClose != value)
{
_DeviceClose = value;
//清洗完成
if (_DeviceClose)
{
ClearActionEvent.BeginInvoke(this, "设备关机", null, null);
}
}
}
}
}
}

View File

@@ -0,0 +1,190 @@
using FreeSql.DataAnnotations;
using System;
namespace MoviconHub.App.Models
{
/// <summary>
/// 清洗数据
/// </summary>
[Table(Name = "ClearData")]
public class ClearData
{
/// <summary>
/// 主键ID
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 设备码
/// </summary>
[Column(Name = "DeviceCode", StringLength = 100, IsNullable = true)]
public string DeviceCode { get; set; }
/// <summary>
/// 设备名称
/// </summary>
[Column(Name = "DeviceName", StringLength = 100, IsNullable = true)]
public string DeviceName { get; set; }
/// <summary>
/// 程序进程
/// </summary>
[Column(Name = "program_process", StringLength = 100, IsNullable = true)]
public string program_process { get; set; }
/// <summary>
/// 车型
/// </summary>
[Column(Name = "vehicle_model", StringLength = 100, IsNullable = true)]
public string vehicle_model { get; set; }
/// <summary>
/// 下车号
/// </summary>
[Column(Name = "locomotive_number", StringLength = 100, IsNullable = true)]
public string locomotive_number { get; set; }
/// <summary>
/// 修程
/// </summary>
[Column(Name = "repair_process", StringLength = 100, IsNullable = true)]
public string repair_process { get; set; }
/// <summary>
/// 部件名称
/// </summary>
[Column(Name = "component_name", StringLength = 100, IsNullable = true)]
public string component_name { get; set; }
/// <summary>
/// 位别
/// </summary>
[Column(Name = "part_position", StringLength = 100, IsNullable = true)]
public string part_position { get; set; }
/// <summary>
/// 部件编号
/// </summary>
[Column(Name = "part_num", StringLength = 100, IsNullable = true)]
public string part_num { get; set; }
/// <summary>
/// 部件二维码
/// </summary>
[Column(Name = "part_qrid", StringLength = 100, IsNullable = true)]
public string part_qrid { get; set; }
/// <summary>
/// 程序进程百分比​
/// </summary>
[Column(Name = "Test_FrameworkProgramProcessPercentage", StringLength = 100, IsNullable = true)]
public string Test_FrameworkProgramProcessPercentage { get; set; }
/// <summary>
/// 程序进程​
/// </summary>
[Column(Name = "Test_FrameworkProgramProcess", StringLength = 100, IsNullable = true)]
public string Test_FrameworkProgramProcess { get; set; }
/// <summary>
/// 构架单个机型清洗时长
/// </summary>
[Column(Name = "Test_FrameworkPerModelCleaningDuration", StringLength = 100, IsNullable = true)]
public string Test_FrameworkPerModelCleaningDuration { get; set; }
/// <summary>
/// 构架单个机型用清洗剂量
/// </summary>
[Column(Name = "Test_FrameworkPerModelCleaningAgentUsage", StringLength = 100, IsNullable = true)]
public string Test_FrameworkPerModelCleaningAgentUsage { get; set; }
/// <summary>
/// 构架单个机型用水量
/// </summary>
[Column(Name = "Test_FrameworkPerModelWaterUsage", StringLength = 100, IsNullable = true)]
public string Test_FrameworkPerModelWaterUsage { get; set; }
/// <summary>
/// 水罐温度
/// </summary>
[Column(Name = "WaterTank_Temp", StringLength = 100, IsNullable = true)]
public string WaterTank_Temp { get; set; }
/// <summary>
/// 清洗剂罐温度
/// </summary>
[Column(Name = "AgentTank_Temp", StringLength = 100, IsNullable = true)]
public string AgentTank_Temp { get; set; }
/// <summary>
/// 水罐液位
/// </summary>
[Column(Name = "WaterTank_Level", StringLength = 100, IsNullable = true)]
public string WaterTank_Level { get; set; }
/// <summary>
/// 清洗剂罐液位
/// </summary>
[Column(Name = "AgentTank_Level", StringLength = 100, IsNullable = true)]
public string AgentTank_Level { get; set; }
/// <summary>
/// 浸泡池1温度
/// </summary>
[Column(Name = "SoakingTank1_Temp", StringLength = 100, IsNullable = true)]
public string SoakingTank1_Temp { get; set; }
/// <summary>
/// 浸泡池2温度
/// </summary>
[Column(Name = "SoakingTank2_Temp", StringLength = 100, IsNullable = true)]
public string SoakingTank2_Temp { get; set; }
/// <summary>
/// ​热水罐加热模式运行​​
/// </summary>
[Column(Name = "Test_WaterTankHeat", StringLength = 100, IsNullable = true)]
public string Test_WaterTankHeat { get; set; }
/// <summary>
/// ​热水罐补水模式运行​​
/// </summary>
[Column(Name = "Test_WaterTankAdd", StringLength = 100, IsNullable = true)]
public string Test_WaterTankAdd { get; set; }
/// <summary>
/// ​清洗剂罐加热模式运行
/// </summary>
[Column(Name = "Test_CleaningAgentTankHeat", StringLength = 100, IsNullable = true)]
public string Test_CleaningAgentTankHeat { get; set; }
/// <summary>
/// ​清洗剂罐补水模式运行​​
/// </summary>
[Column(Name = "Test_CleaningAgentTankAdd", StringLength = 100, IsNullable = true)]
public string Test_CleaningAgentTankAdd { get; set; }
/// <summary>
/// ​电能监控​​
/// </summary>
[Column(Name = "Test_ElectricSurveillance", StringLength = 100, IsNullable = true)]
public string Test_ElectricSurveillance { get; set; }
/// <summary>
/// ​蒸汽监控​​
/// </summary>
[Column(Name = "Test_SteamSurveillance", StringLength = 100, IsNullable = true)]
public string Test_SteamSurveillance { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 不论多部件还是单部件均采用数组,若为单部件则数组中仅有一个对象
/// </summary>
public class ComponentsInfo
{
/// <summary>
/// 车型
/// </summary>
[JsonProperty("part_Vehicle_model")]
public string part_Vehicle_model { get; set; }
/// <summary>
/// 车号
/// </summary>
[JsonProperty("part_locomotive_number")]
public string part_locomotive_number { get; set; }
/// <summary>
/// 修程
/// </summary>
[JsonProperty("part_repair_process")]
public string part_repair_process { get; set; }
/// <summary>
/// 位别
/// </summary>
[JsonProperty("part_position")]
public string part_position { get; set; }
/// <summary>
/// 部件名称
/// </summary>
[JsonProperty("component_name")]
public string part_name { get; set; }
/// <summary>
/// 部件编号
/// </summary>
[JsonProperty("part_num")]
public string part_num { get; set; }
/// <summary>
/// 二维码id
/// </summary>
[JsonProperty("part_qrid")]
public string part_qrid { get; set; }
}
}

View File

@@ -0,0 +1,199 @@
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 当前运行的清洗状态
/// </summary>
[Table(Name = "CurRunClearState")]
public class CurRunClearState
{
/// <summary>
/// 主键ID
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 设备码
/// </summary>
[Column(Name = "DeviceCode", StringLength = 100, IsNullable = true)]
public string DeviceCode { get; set; }
/// <summary>
/// 设备名称
/// </summary>
[Column(Name = "DeviceName", StringLength = 100, IsNullable = true)]
public string DeviceName { get; set; }
/// <summary>
/// 程序进程
/// </summary>
[Column(Name = "program_process", StringLength = 100, IsNullable = true)]
public string program_process { get; set; }
/// <summary>
/// 车型
/// </summary>
[Column(Name = "vehicle_model", StringLength = 100, IsNullable = true)]
public string vehicle_model { get; set; }
/// <summary>
/// 下车号
/// </summary>
[Column(Name = "locomotive_number", StringLength = 100, IsNullable = true)]
public string locomotive_number { get; set; }
/// <summary>
/// 修程
/// </summary>
[Column(Name = "repair_process", StringLength = 100, IsNullable = true)]
public string repair_process { get; set; }
/// <summary>
/// 部件名称
/// </summary>
[Column(Name = "component_name", StringLength = 100, IsNullable = true)]
public string component_name { get; set; }
/// <summary>
/// 位别
/// </summary>
[Column(Name = "part_position", StringLength = 100, IsNullable = true)]
public string part_position { get; set; }
/// <summary>
/// 部件编号
/// </summary>
[Column(Name = "part_num", StringLength = 100, IsNullable = true)]
public string part_num { get; set; }
/// <summary>
/// 部件二维码
/// </summary>
[Column(Name = "part_qrid", StringLength = 100, IsNullable = true)]
public string part_qrid { get; set; }
/// <summary>
/// 程序进程百分比​
/// </summary>
[Column(Name = "Test_FrameworkProgramProcessPercentage", StringLength = 100, IsNullable = true)]
public string Test_FrameworkProgramProcessPercentage { get; set; }
/// <summary>
/// 程序进程​
/// </summary>
[Column(Name = "Test_FrameworkProgramProcess", StringLength = 100, IsNullable = true)]
public string Test_FrameworkProgramProcess { get; set; }
/// <summary>
/// 零部件设备状态
/// </summary>
[Column(Name = "Test_PartsEquipmentStatus", StringLength = 100, IsNullable = true)]
public string Test_PartsEquipmentStatus { get; set; }
/// <summary>
/// 构架单个机型清洗时长
/// </summary>
[Column(Name = "Test_FrameworkPerModelCleaningDuration", StringLength = 100, IsNullable = true)]
public string Test_FrameworkPerModelCleaningDuration { get; set; }
/// <summary>
/// 构架单个机型用清洗剂量
/// </summary>
[Column(Name = "Test_FrameworkPerModelCleaningAgentUsage", StringLength = 100, IsNullable = true)]
public string Test_FrameworkPerModelCleaningAgentUsage { get; set; }
/// <summary>
/// 构架单个机型用水量
/// </summary>
[Column(Name = "Test_FrameworkPerModelWaterUsage", StringLength = 100, IsNullable = true)]
public string Test_FrameworkPerModelWaterUsage { get; set; }
/// <summary>
/// 水罐温度
/// </summary>
[Column(Name = "WaterTank_Temp", StringLength = 100, IsNullable = true)]
public string WaterTank_Temp { get; set; }
/// <summary>
/// 清洗剂罐温度
/// </summary>
[Column(Name = "AgentTank_Temp", StringLength = 100, IsNullable = true)]
public string AgentTank_Temp { get; set; }
/// <summary>
/// 水罐液位
/// </summary>
[Column(Name = "WaterTank_Level", StringLength = 100, IsNullable = true)]
public string WaterTank_Level { get; set; }
/// <summary>
/// 清洗剂罐液位
/// </summary>
[Column(Name = "AgentTank_Level", StringLength = 100, IsNullable = true)]
public string AgentTank_Level { get; set; }
/// <summary>
/// 浸泡池1温度
/// </summary>
[Column(Name = "SoakingTank1_Temp", StringLength = 100, IsNullable = true)]
public string SoakingTank1_Temp { get; set; }
/// <summary>
/// 浸泡池2温度
/// </summary>
[Column(Name = "SoakingTank2_Temp", StringLength = 100, IsNullable = true)]
public string SoakingTank2_Temp { get; set; }
/// <summary>
/// ​热水罐加热模式运行​​
/// </summary>
[Column(Name = "Test_WaterTankHeat", StringLength = 100, IsNullable = true)]
public string Test_WaterTankHeat { get; set; }
/// <summary>
/// ​热水罐补水模式运行​​
/// </summary>
[Column(Name = "Test_WaterTankAdd", StringLength = 100, IsNullable = true)]
public string Test_WaterTankAdd { get; set; }
/// <summary>
/// ​清洗剂罐加热模式运行
/// </summary>
[Column(Name = "Test_CleaningAgentTankHeat", StringLength = 100, IsNullable = true)]
public string Test_CleaningAgentTankHeat { get; set; }
/// <summary>
/// ​清洗剂罐补水模式运行​​
/// </summary>
[Column(Name = "Test_CleaningAgentTankAdd", StringLength = 100, IsNullable = true)]
public string Test_CleaningAgentTankAdd { get; set; }
/// <summary>
/// ​电能监控​​
/// </summary>
[Column(Name = "Test_ElectricSurveillance", StringLength = 100, IsNullable = true)]
public string Test_ElectricSurveillance { get; set; }
/// <summary>
/// ​蒸汽监控​​
/// </summary>
[Column(Name = "Test_SteamSurveillance", StringLength = 100, IsNullable = true)]
public string Test_SteamSurveillance { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,62 @@
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 设备报警
/// </summary>
[Table(Name = "DeviceAlarm")]
public class DeviceAlarm
{
/// <summary>
/// 主键ID
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 设备码
/// </summary>
[Column(Name = "DeviceCode", StringLength = 100, IsNullable = true)]
public string DeviceCode { get; set; }
/// <summary>
/// 设备名称
/// </summary>
[Column(Name = "DeviceName", StringLength = 100, IsNullable = true)]
public string DeviceName { get; set; }
/// <summary>
/// 设备状态
/// </summary>
[Column(Name = "DeviceState", IsNullable = true)]
public int? DeviceState { get; set; }
/// <summary>
/// 报警信息
/// </summary>
[Column(Name = "AlarmMessage", StringLength = 180, IsNullable = true)]
public string AlarmMessage { get; set; }
/// <summary>
/// 开始时间
/// </summary>
//[Column(CanUpdate = false)]
public DateTime StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
//[Column(CanUpdate = false)]
public DateTime EndTime { get; set; }
}
}

View File

@@ -0,0 +1,97 @@
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 设备状态
/// </summary>
[Table(Name = "DeviceState")]
public class DeviceState
{
/// <summary>
/// 主键ID
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 设备码
/// </summary>
[Column(Name = "DeviceCode", StringLength = 100, IsNullable = true)]
public string DeviceCode { get; set; }
/// <summary>
/// 设备名称
/// </summary>
[Column(Name = "DeviceName", StringLength = 100, IsNullable = true)]
public string DeviceName { get; set; }
/// <summary>
/// 开机时长status为1
/// </summary>
[Column(Name = "PowerOnTime", IsNullable = true)]
public int PowerOnTime { get; set; }
/// <summary>
/// 运行时长status为2
/// </summary>
[Column(Name = "RunTime", IsNullable = true)]
public int RunTime { get; set; }
/// <summary>
/// 待机时长status为3
/// </summary>
[Column(Name = "StandbyTime", IsNullable = true)]
public int StandbyTime { get; set; }
/// <summary>
/// 故障时长status为4
/// </summary>
[Column(Name = "FaultTime", IsNullable = true)]
public int FaultTime { get; set; }
/// <summary>
/// 关机时长status为5
/// </summary>
[Column(Name = "ShutdownTime", IsNullable = true)]
public int ShutdownTime { get; set; }
///// <summary>
///// 使用率(PowerOnTime+ RunTime+ StandbyTime+ FaultTime)/( EndTime- StartTime) 从ts_sh_device_status_change_log中计算
///// </summary>
//[Column(Name = "UseRatio", IsNullable = true)]
//public int UseRatio { get; set; }
/// <summary>
/// 使用率(PowerOnTime+ RunTime+ StandbyTime+ FaultTime)/( EndTime- StartTime) 从ts_sh_device_status_change_log中计算
/// </summary>
[Column(Name = "UseRatio", StringLength = 100, IsNullable = true)]
public string UseRatio { get; set; }
/// <summary>
/// 故障次数
/// </summary>
[Column(Name = "FaultNum", IsNullable = true)]
public int FaultNum { get; set; }
/// <summary>
/// 作业次数,建议从作业数据表中取数据
/// </summary>
[Column(Name = "JobNum", IsNullable = true)]
public int JobNum { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 设备状态统计模型
/// </summary>
public class DeviceStateStaticModel
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 设备名称
/// </summary>
public int Value { get; set; }
/// <summary>
/// Index
/// </summary>
public int Index { get; set; }
}
}

View File

@@ -0,0 +1,64 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 设备状态数据模型
/// Websocket数据格式
/// </summary>
public class DeviceStatusData
{
/// <summary>
/// 设备ID
/// </summary>
[JsonProperty("device_id")]
public string DeviceId { get; set; }
/// <summary>
/// 设备名称
/// </summary>
[JsonProperty("device_name")]
public string DeviceName { get; set; }
/// <summary>
/// 设备状态(开启/关闭/运行中/待机)
/// </summary>
[JsonProperty("status")]
public string Status { get; set; }
/// <summary>
/// 电压值
/// </summary>
[JsonProperty("voltage")]
public double Voltage { get; set; }
/// <summary>
/// 电流值
/// </summary>
[JsonProperty("current")]
public double Current { get; set; }
/// <summary>
/// 温度值
/// </summary>
[JsonProperty("temperature")]
public double Temperature { get; set; }
/// <summary>
/// 其他自定义状态参数
/// </summary>
[JsonProperty("parameters")]
public Dictionary<string, object> Parameters { get; set; } = new Dictionary<string, object>();
/// <summary>
/// 记录时间
/// </summary>
[JsonProperty("record_time")]
public DateTime RecordTime { get; set; } = DateTime.Now;
}
}

View File

@@ -0,0 +1,40 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 环境数据模型
/// </summary>
public class EnvironmentData
{
/// <summary>
/// 环境温度
/// </summary>
[JsonProperty("env_temperature")]
public double Temperature { get; set; }
/// <summary>
/// 环境湿度
/// </summary>
[JsonProperty("env_humidity")]
public double Humidity { get; set; }
/// <summary>
/// VOC浓度
/// </summary>
[JsonProperty("voc_concentration")]
public double VocConcentration { get; set; }
/// <summary>
/// 粉尘指数
/// </summary>
[JsonProperty("dust_index")]
public double DustIndex { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 设备故障数据模型
/// </summary>
public class FaultDetails
{
/// <summary>
///错误代码, 无错误为空
/// </summary>
[JsonProperty("Fault_Code")]
public string Fault_Code { get; set; }
/// <summary>
/// 错误发生时间,无错误为空
/// </summary>
[JsonProperty("Fault_Time")]
public DateTime Fault_Time { get; set; } = DateTime.Now;
/// <summary>
/// 错误描述,无错误为空
/// </summary>
[JsonProperty("Fault_Description")]
public string Fault_Description { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// WebSocket消息类型枚举
/// </summary>
public enum MessageType
{
/// <summary>
/// 心跳消息
/// </summary>
Heartbeat = 0,
/// <summary>
/// 设备状态数据
/// </summary>
DeviceStatus = 1,
/// <summary>
/// 试验测试数据
/// </summary>
TestData = 2,
/// <summary>
/// 设备故障信息
/// </summary>
DeviceFault = 3,
/// <summary>
/// 认证消息
/// </summary>
Authentication = 4,
/// <summary>
/// 系统消息
/// </summary>
SystemMessage = 99
}
}

View File

@@ -0,0 +1,55 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 部件信息数据模型
/// </summary>
public class PartInfo
{
[JsonProperty("part_id")]
public string PartId { get; set; }
[JsonProperty("order_id")]
public string OrderId { get; set; }
[JsonProperty("vehicle_model")]
public string VehicleModel { get; set; }
[JsonProperty("locomotive_number")]
public string LocomotiveNumber { get; set; }
[JsonProperty("repair_process")]
public string RepairProcess { get; set; }
[JsonProperty("component_name")]
public string ComponentName { get; set; }
[JsonProperty("part_position")]
public string PartPosition { get; set; }
[JsonProperty("part_num")]
public string PartNum { get; set; }
[JsonProperty("order_type_id")]
public string OrderTypeId { get; set; }
[JsonProperty("product_type_id")]
public string ProductTypeId { get; set; }
[JsonProperty("part_qrCode")]
public string PartQrCode { get; set; }
[JsonProperty("traceable_code")]
public string TraceableCode { get; set; }
[JsonProperty("part_code")]
public string PartCode { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 部件信息响应模型
/// </summary>
public class PartInfoResponse
{
[JsonProperty("status")]
public int Status { get; set; }
[JsonProperty("msg")]
public string Message { get; set; }
[JsonProperty("data")]
public PartInfo Data { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 试验箱湿度 表设置
/// </summary>
public class RTVar
{
/// <summary>
/// Name
/// </summary>
[Column(Name = "Name",StringLength =255)]
public string Name { get; set; }
/// <summary>
/// Val
/// </summary>
[Column(Name = "Val", StringLength = 255)]
public string Val { get; set; }
/// <summary>
/// LastTime
/// </summary>
[Column(Name = "LastTime")]
public DateTime LastTime { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using System;
namespace MoviconHub.App.Models
{
/// <summary>
/// 信号模型
/// </summary>
public class SglModel
{
public event EventHandler<string> SglModelChanged;
private string _CodeReady;
/// <summary>
/// 条码信息OK
/// </summary>
public string CodeReady
{
get
{
return _CodeReady;
}
set
{
if (value != _CodeReady)
{
if (!string.IsNullOrEmpty(value))
{
SglModelChanged(this, "CodeReady");//开始动作
}
_CodeReady = value;
}
}
}
}
}

View File

@@ -0,0 +1,220 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 测试数据模型 - 可根据实际测试数据结构进行扩展
/// </summary>
public class TestData
{
/// <summary>
/// 程序进程百分比​
/// </summary>
[JsonProperty("Test_FrameworkProgramProcessPercentage")]
public string Test_FrameworkProgramProcessPercentage { get; set; }
/// <summary>
/// 程序进程​
/// </summary>
[JsonProperty("Test_FrameworkProgramProcess")]
public string Test_FrameworkProgramProcess { get; set; }
/// <summary>
/// 构架设备状态​
/// </summary>
[JsonProperty("Test_FrameworkEquipmentStatus")]
public string Test_FrameworkEquipmentStatus { get; set; }
/// <summary>
/// 零部件设备状态​
/// </summary>
[JsonProperty("Test_PartsEquipmentStatus")]
public string Test_PartsEquipmentStatus { get; set; }
/// <summary>
/// ​构架累计用清洗剂量​
/// </summary>
[JsonProperty("Test_FrameworkCumulativeCleaningAgentUsage")]
public string Test_FrameworkCumulativeCleaningAgentUsage { get; set; }
/// <summary>
/// 构架累计用水量​
/// </summary>
[JsonProperty("Test_FrameworkCumulativeWaterUsage")]
public string Test_FrameworkCumulativeWaterUsage { get; set; }
/// <summary>
/// 构架累计清洗时长​
/// </summary>
[JsonProperty("Test_FrameworkCumulativeCleaningDuration")]
public string Test_FrameworkCumulativeCleaningDuration { get; set; }
/// <summary>
/// 零部件累计用水量
/// </summary>
[JsonProperty("Test_PartsCumulativeWaterUsage")]
public string Test_PartsCumulativeWaterUsage { get; set; }
/// <summary>
/// ​零部件累计清洗时长​
/// </summary>
[JsonProperty("Test_PartsCumulativeCleaningDuration")]
public string Test_PartsCumulativeCleaningDuration { get; set; }
/// <summary>
/// 累计检修数量​
/// </summary>
[JsonProperty("Test_CumulativeMaintenanceCount")]
public string Test_CumulativeMaintenanceCount { get; set; }
/// <summary>
/// 机器人1状态
/// </summary>
[JsonProperty("Test_Robot1Status")]
public string Test_Robot1Status { get; set; }
/// <summary>
/// 机器人2状态
/// </summary>
[JsonProperty("Test_Robot2Status")]
public string Test_Robot2Status { get; set; }
/// <summary>
/// 构架清洗数量
/// </summary>
[JsonProperty("Test_FrameworkCleaningCount")]
public string Test_FrameworkCleaningCount { get; set; }
/// <summary>
/// 构架单个机型清洗时长​
/// </summary>
[JsonProperty("Test_FrameworkPerModelCleaningDuration")]
public string Test_FrameworkPerModelCleaningDuration { get; set; }
/// <summary>
/// ​​构架单个机型用清洗剂量​
/// </summary>
[JsonProperty("Test_FrameworkPerModelCleaningAgentUsage")]
public string Test_FrameworkPerModelCleaningAgentUsage { get; set; }
/// <summary>
/// ​构架单个机型用水量​
/// </summary>
[JsonProperty("Test_FrameworkPerModelWaterUsage")]
public string Test_FrameworkPerModelWaterUsage { get; set; }
/// <summary>
/// ​​零部件单次清洗时长​
/// </summary>
[JsonProperty("Test_PartsSingleCleaningDuration")]
public string Test_PartsSingleCleaningDuration { get; set; }
/// <summary>
/// 零部件单次用水量​
/// </summary>
[JsonProperty("Test_PartsSingleWaterUsage")]
public string Test_PartsSingleWaterUsage { get; set; }
/// <summary>
/// ​水罐温度​
/// </summary>
[JsonProperty("Test_WaterTankTemperature")]
public string Test_WaterTankTemperature { get; set; }
/// <summary>
/// ​​清洗剂罐温度​
/// </summary>
[JsonProperty("Test_CleaningAgentTankTemperature")]
public string Test_CleaningAgentTankTemperature { get; set; }
/// <summary>
/// 浸泡池1温度
/// </summary>
[JsonProperty("Test_SoakingTank1Temperature")]
public string Test_SoakingTank1Temperature { get; set; }
/// <summary>
/// 浸泡池2温度
/// </summary>
[JsonProperty("Test_SoakingTank2Temperature")]
public string Test_SoakingTank2Temperature { get; set; }
/// <summary>
/// ​水罐液位​​
/// </summary>
[JsonProperty("Test_WaterTankLevel")]
public string Test_WaterTankLevel { get; set; }
/// <summary>
/// ​清洗剂罐液位​​
/// </summary>
[JsonProperty("Test_CleaningAgentTankLevel")]
public string Test_CleaningAgentTankLevel { get; set; }
/// <summary>
/// ​热水罐加热模式运行​​
/// </summary>
[JsonProperty("Test_WaterTankHeat")]
public string Test_WaterTankHeat { get; set; }
/// <summary>
/// ​热水罐补水模式运行​​
/// </summary>
[JsonProperty("Test_WaterTankAdd")]
public string Test_WaterTankAdd { get; set; }
/// <summary>
/// ​清洗剂罐加热模式运行
/// </summary>
[JsonProperty("Test_CleaningAgentTankHeat")]
public string Test_CleaningAgentTankHeat { get; set; }
/// <summary>
/// ​清洗剂罐补水模式运行​​
/// </summary>
[JsonProperty("Test_CleaningAgentTankAdd")]
public string Test_CleaningAgentTankAdd { get; set; }
/// <summary>
/// ​电能监控​​
/// </summary>
[JsonProperty("Test_ElectricSurveillance")]
public string Test_ElectricSurveillance { get; set; }
/// <summary>
/// ​蒸汽监控​​
/// </summary>
[JsonProperty("Test_SteamSurveillance")]
public string Test_SteamSurveillance { get; set; }
/// <summary>
/// 测试数据值集合
/// </summary>
[JsonProperty("test_values")]
public Dictionary<string, object> TestValues { get; set; } = new Dictionary<string, object>();
}
}

View File

@@ -0,0 +1,24 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// 试验数据响应模型
/// </summary>
public class TestDataResponse
{
[JsonProperty("status")]
public int Status { get; set; }
[JsonProperty("msg")]
public string Message { get; set; }
[JsonProperty("data")]
public Dictionary<string, object> Data { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// WebSocket连接事件参数
/// </summary>
public class WebSocketConnectEventArgs : EventArgs
{
/// <summary>
/// 服务器地址
/// </summary>
public string ServerAddress { get; set; }
/// <summary>
/// 服务器端口
/// </summary>
public int ServerPort { get; set; }
/// <summary>
/// 是否是重新连接
/// </summary>
public bool IsReconnection { get; set; }
/// <summary>
/// 连接时间
/// </summary>
public DateTime ConnectTime { get; set; } = DateTime.Now;
}
}

View File

@@ -0,0 +1,60 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// WebSocket数据模型
/// </summary>
public class WebSocketData
{
/// <summary>
/// 设备编号
/// </summary>
[JsonProperty("DeviceCode")]
public string Device_Code { get; set; } = "";
/// <summary>
/// 设备名称
/// </summary>
[JsonProperty("DeviceName")]
public string Device_Name { get; set; } = "";
/// <summary>
/// 设备厂商
/// </summary>
[JsonProperty("DeviceManufacturer")]
public string Device_Manufacturer { get; set; } = "";
/// <summary>
/// 设备状态, 代码含义自定
/// </summary>
[JsonProperty("Status")]
public string Device_Status { get; set; } = "";
/// <summary>
/// 设备错误
/// </summary>
[JsonProperty("FaultDetails")]
public FaultDetails FaultDetails { get; set; } = new FaultDetails();
/// <summary>
/// 部件信息列表
/// </summary>
[JsonProperty("ComponentsInfo")]
public List<ComponentsInfo> ListComponentsInfo { get; set; }
/// <summary>
/// 测试数据
/// </summary>
[JsonProperty("TestData")]
public TestData TestData { get; set; } = new TestData();
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// WebSocket错误事件参数
/// </summary>
public class WebSocketErrorEventArgs : EventArgs
{
/// <summary>
/// 错误信息
/// </summary>
public string ErrorMessage { get; set; }
/// <summary>
/// 异常对象
/// </summary>
public Exception Exception { get; set; }
/// <summary>
/// 错误时间
/// </summary>
public DateTime ErrorTime { get; set; } = DateTime.Now;
}
}

View File

@@ -0,0 +1,107 @@
using Newtonsoft.Json;
using System;
namespace MoviconHub.App.Models
{
/// <summary>
/// WebSocket消息模型
/// </summary>
public class WebSocketMessage
{
/// <summary>
/// 状态码, 200表示成功
/// </summary>
[JsonProperty("status")]
public string Status { get; set; } = "200";
/// <summary>
/// 状态信息
/// </summary>
[JsonProperty("msg")]
public string Msg { get; set; } = "200";
/// <summary>
/// 消息数据
/// </summary>
[JsonProperty("data")]
public object Data { get; set; }
/// <summary>
/// 快速创建设备状态消息
/// </summary>
public static WebSocketMessage CreateDeviceData(object DeviceData)
{
return new WebSocketMessage
{
Msg = "success",
Status = "200",
Data = DeviceData
};
}
/// <summary>
/// 快速创建设备状态消息
/// </summary>
public static WebSocketMessage CreateDeviceStatusMessage(string deviceCode, object statusData)
{
return new WebSocketMessage
{
Msg = "success",
Status = "200",
Data = statusData
};
}
/// <summary>
/// 快速创建测试数据消息
/// </summary>
public static WebSocketMessage CreateTestDataMessage(string deviceCode, object testData)
{
return new WebSocketMessage
{
Msg = "success",
Status = "200",
Data = testData
};
}
/// <summary>
/// 快速创建故障信息消息
/// </summary>
public static WebSocketMessage CreateFaultMessage(string deviceCode, object faultData)
{
return new WebSocketMessage
{
Msg = "success",
Status = "200",
Data = faultData
};
}
/// <summary>
/// 创建心跳消息
/// </summary>
public static WebSocketMessage CreateHeartbeat(string deviceCode)
{
return new WebSocketMessage
{
Msg = "success",
Status = "200",
Data = new { status = "online" }
};
}
/// <summary>
/// 创建认证消息
/// </summary>
public static WebSocketMessage CreateAuthMessage(string deviceCode, string secretKey)
{
return new WebSocketMessage
{
Msg = "success",
Status = "200",
Data = new { code = deviceCode, key = secretKey }
};
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MoviconHub.App.Models
{
/// <summary>
/// WebSocket消息事件参数
/// </summary>
public class WebSocketMessageEventArgs : EventArgs
{
/// <summary>
/// 解析后的消息对象
/// </summary>
public WebSocketMessage Message { get; set; }
/// <summary>
/// 原始消息内容
/// </summary>
public string RawMessage { get; set; }
}
}