增加CAN FD和规则的功能

This commit is contained in:
2025-07-11 23:26:21 +08:00
parent 010497604d
commit a373265201
33 changed files with 5744 additions and 516 deletions

View File

@@ -0,0 +1,53 @@
using FreeSql.DataAnnotations;
namespace CapMachine.Model.CANLIN
{
/// <summary>
/// CAN和LIN的配置信息数据
/// </summary>
[Table(Name = "CANFdConfigExd")]
public class CANFdConfigExd
{
/// <summary>
/// 主键
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 数据波特率
/// </summary>
[Column(Name = "DataBaudRate")]
public int DataBaudRate { get; set; }
/// <summary>
/// 仲裁波特率
/// </summary>
[Column(Name = "ArbBaudRate")]
public int ArbBaudRate { get; set; }
/// <summary>
/// CAN FD标准 ISO是否启用
/// </summary>
[Column(Name = "ISOEnable")]
public bool ISOEnable { get; set; }
/// <summary>
/// 终端电阻 是否启用
/// </summary>
[Column(Name = "ResEnable")]
public bool ResEnable { get; set; }
/// <summary>
/// 周期
/// </summary>
[Column(Name = "Cycle")]
public int Cycle { get; set; }
/// <summary>
/// Dbc文件路径
/// </summary>
[Column(Name = "DbcPath", IsNullable = false, StringLength = 500)]
public string? DbcPath { get; set; }
}
}

View File

@@ -44,6 +44,11 @@ namespace CapMachine.Model.CANLIN
public List<CanLinRWConfig>? CanLinConfigContents { get; set; }
/// <summary>
/// ///////////////////////////////////////////导航属性 LIN 一对一///////////////////////////////////////////////////////
/// </summary>
public long CANFdConfigExdId { get; set; } // 外键字段,必要
public CANFdConfigExd CANFdConfigExd { get; set; }
/// <summary>
/// ///////////////////////////////////////////导航属性 CAN 一对一///////////////////////////////////////////////////////

View File

@@ -19,6 +19,12 @@ namespace CapMachine.Model.CANLIN
/// LIN
/// </summary>
LIN = 2,
/// <summary>
/// CANFD
/// </summary>
CANFD = 3,
}
/// <summary>

View File

@@ -61,5 +61,14 @@ namespace CapMachine.Model.CANLIN
public long CanLinConfigProId { get; set; }
public CanLinConfigPro? CanLinConfigPro { get; set; }
public long LogicRuleId { get; set; }
/// <summary>
/// CanLinConfig的逻辑转换规则
/// 比如速度下发的数据SV是4000但是下发到CAN的值是40可能是其他的逻辑转换规则这里就是保存其中的逻辑规则
/// </summary>
public LogicRule? LogicRule { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
using CapMachine.Model.CANLIN;
using FreeSql.DataAnnotations;
namespace CapMachine.Model
{
/// <summary>
/// 逻辑转换规则模型
/// </summary>
[Table(Name = "LogicRule")]
public class LogicRule
{
/// <summary>
/// 主键ID
/// </summary>
[Column(IsPrimary = true, IsIdentity = true)]
public long Id { get; set; }
/// <summary>
/// 规则名称
/// </summary>
[Column(Name = "Name", StringLength = 50)]
public string? Name { get; set; }
/// <summary>
/// 规则描述
/// </summary>
[Column(Name = "Description", StringLength = 200)]
public string? Description { get; set; }
/// <summary>
/// 规则表达式
/// </summary>
[Column(Name = "Expression", StringLength = 500)]
public string? Expression { get; set; }
/// <summary>
/// 适用的参数类型(如:转速、功率等)
/// </summary>
[Column(Name = "ParameterType", StringLength = 50)]
public string? ParameterType { get; set; }
[Column(ServerTime = DateTimeKind.Local, CanUpdate = false)]
public DateTime CreateTime { get; set; }
/// <summary>
/// ///////////////////////////////////////////导航属性///////////////////////////////////////////////////////
/// </summary>
public List<CanLinRWConfig>? CanLinRWConfigs { get; set; }
}
}