CAN FD 增加逻辑功能

This commit is contained in:
2025-07-11 14:58:47 +08:00
parent 3ef3c534f3
commit f6d9437143
19 changed files with 1524 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
using CapMachine.Model.CANLIN;
using CapMachine.Wpf.CanDrive;
using CapMachine.Wpf.Models;
using CapMachine.Wpf.Models.ProModelPars;
using ImTools;
using Prism.Ioc;
using Prism.Mvvm;
@@ -18,15 +20,17 @@ namespace CapMachine.Wpf.Services
public class CanFdDriveService : BindableBase
{
public HighSpeedDataService HighSpeedDataService { get; }
public LogicRuleService LogicRuleService { get; }
/// <summary>
/// 实例化函数
/// </summary>
public CanFdDriveService(HighSpeedDataService highSpeedDataService, IContainerProvider containerProvider)
public CanFdDriveService(HighSpeedDataService highSpeedDataService, IContainerProvider containerProvider, LogicRuleService logicRuleService)
{
ToomossCanFDDrive = new ToomossCanFD(containerProvider);
//高速数据服务
HighSpeedDataService = highSpeedDataService;
LogicRuleService = logicRuleService;
//ToomossCanFDDrive.StartCanDrive();
}
@@ -172,7 +176,14 @@ namespace CapMachine.Wpf.Services
{
if (SpeedCanCmdData != null)
{
SpeedCanCmdData.SignalCmdValue = SpeedData;
if (SpeedCanCmdData.LogicRuleDto == null)
{
//没有启动逻辑规则处理
SpeedCanCmdData.SignalCmdValue = SpeedData;
return;
}
SpeedCanCmdData.SignalCmdValue = LogicRuleService.ApplyExpressionFast(SpeedData, SpeedCanCmdData.LogicRuleDto);
}
//if (EnableCanCmdData != null)
//{
@@ -201,7 +212,12 @@ namespace CapMachine.Wpf.Services
{
if (PwLimitCanCmdData != null)
{
PwLimitCanCmdData.SignalCmdValue = PwLimit;
if (PwLimitCanCmdData.LogicRuleDto==null)
{
PwLimitCanCmdData.SignalCmdValue = PwLimit;
return;
}
PwLimitCanCmdData.SignalCmdValue = LogicRuleService.ApplyExpressionFast(PwLimit, PwLimitCanCmdData.LogicRuleDto!);
}
}
@@ -226,7 +242,12 @@ namespace CapMachine.Wpf.Services
{
if (PTCPwCanCmdData != null)
{
PTCPwCanCmdData.SignalCmdValue = PTCPw;
if (PTCPwCanCmdData.LogicRuleDto == null)
{
PTCPwCanCmdData.SignalCmdValue = PTCPw;
return;
}
PTCPwCanCmdData.SignalCmdValue = LogicRuleService.ApplyExpressionFast(PTCPw, PTCPwCanCmdData.LogicRuleDto!);
}
}
@@ -238,7 +259,12 @@ namespace CapMachine.Wpf.Services
{
if (PTCFlowCanCmdData != null)
{
PTCFlowCanCmdData.SignalCmdValue = Flow;
if (PTCFlowCanCmdData.LogicRuleDto == null)
{
PTCFlowCanCmdData.SignalCmdValue = Flow;
return;
}
PTCFlowCanCmdData.SignalCmdValue = LogicRuleService.ApplyExpressionFast(Flow, PTCFlowCanCmdData.LogicRuleDto!);
}
}
@@ -250,7 +276,12 @@ namespace CapMachine.Wpf.Services
{
if (PTCWaterTempCanCmdData != null)
{
PTCWaterTempCanCmdData.SignalCmdValue = WaterTemp;
if (PTCWaterTempCanCmdData.LogicRuleDto == null)
{
PTCWaterTempCanCmdData.SignalCmdValue = WaterTemp;
return;
}
PTCWaterTempCanCmdData.SignalCmdValue = LogicRuleService.ApplyExpressionFast(WaterTemp, PTCWaterTempCanCmdData.LogicRuleDto!);
}
}