增加CAN 调度表配置
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using CapMachine.Model.CANLIN;
|
||||
using CapMachine.Wpf.CanDrive;
|
||||
using CapMachine.Wpf.Dtos;
|
||||
using ImTools;
|
||||
using Prism.Ioc;
|
||||
using Prism.Mvvm;
|
||||
@@ -189,6 +190,12 @@ namespace CapMachine.Wpf.Services
|
||||
/// </summary>
|
||||
public List<CanCmdData> CmdData { get; set; } = new List<CanCmdData>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// CNA 调度表的配置信息
|
||||
/// </summary>
|
||||
public List<CANScheduleConfigDto> ListCANScheduleConfig { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 增加发送的指令数据
|
||||
/// </summary>
|
||||
@@ -388,14 +395,43 @@ namespace CapMachine.Wpf.Services
|
||||
{
|
||||
if (ToomossCanDrive.OpenState)
|
||||
{
|
||||
if (ToomossCanDrive.IsCycleSend == false)//要防止多次启动导致的问题,来回转换
|
||||
if (ToomossCanDrive.IsCycleSend == false)
|
||||
{
|
||||
if (CmdData.Count > 0)
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = true;
|
||||
|
||||
ToomossCanDrive.CmdData = CmdData;
|
||||
//ToomossCanDrive.StartCycleSendMsg();
|
||||
ToomossCanDrive.StartPrecisionCycleSendMsg();
|
||||
|
||||
if (ToomossCanDrive.SchEnable)
|
||||
{
|
||||
|
||||
//使用调度表的话,需要在调度表中配置信息后才可以进行操作
|
||||
var GroupMsg = ToomossCanDrive.CmdData.GroupBy(a => a.MsgName).ToList();
|
||||
foreach (var itemMsg in GroupMsg)
|
||||
{
|
||||
if (!ListCANScheduleConfig.ToList().Any(a => a.MsgName == itemMsg.Key))
|
||||
{
|
||||
System.Windows.MessageBox.Show($"你使能了调度表,但是调度表中没有设置【{itemMsg.Key}】信息,请设置后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ListCANScheduleConfig == null && ListCANScheduleConfig!.Count() == 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show("调度表配置为空数据,请检查!将无法发送数据", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
return;
|
||||
}
|
||||
ToomossCanDrive.ListCANScheduleConfig = ListCANScheduleConfig!;
|
||||
ToomossCanDrive.StartSchedule();
|
||||
ToomossCanDrive.StartCycleUpdateCmd();
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossCanDrive.StartPrecisionCycleSendMsg();
|
||||
//ToomossCanDrive.StartCycleSendMsg();
|
||||
}
|
||||
|
||||
ToomossCanDrive.IsCycleSend = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -404,7 +440,15 @@ namespace CapMachine.Wpf.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = false;
|
||||
if (ToomossCanDrive.SchEnable)
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = false;
|
||||
ToomossCanDrive.StopSchedule();
|
||||
}
|
||||
else
|
||||
{
|
||||
ToomossCanDrive.IsCycleSend = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user