增加了CAN调度表发送,但是没有测试成功
This commit is contained in:
@@ -182,6 +182,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
canLinConfigPros = FreeSql.Select<CanLinConfigPro>().Where(a => a.CANLINInfo == CANLIN.CAN)
|
||||
.Include(a => a.CANConfigExd)
|
||||
.IncludeMany(a => a.CanLinConfigContents, then => then.Include(b => b.LogicRule))//,then=> then.Include(b=>b.LogicRule) //.IncludeMany(a => a.CanLinConfigContents)
|
||||
.IncludeMany(a => a.CanScheduleConfigs)//
|
||||
.ToList();
|
||||
|
||||
ListCanLinConfigPro = new ObservableCollection<CanLinConfigPro>(canLinConfigPros);
|
||||
@@ -225,6 +226,12 @@ namespace CapMachine.Wpf.ViewModels
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
|
||||
}
|
||||
//调度表配置信息
|
||||
if (SelectCanLinConfigPro.CanScheduleConfigs != null && SelectCanLinConfigPro.CanScheduleConfigs.Count() > 0)
|
||||
{
|
||||
ListCANScheduleConfigDto = new ObservableCollection<CANScheduleConfigDto>(Mapper.Map<List<CANScheduleConfigDto>>(SelectCanLinConfigPro.CanScheduleConfigs));
|
||||
}
|
||||
|
||||
|
||||
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListCanDbcModel
|
||||
MatchSeletedAndCanDbcModel();
|
||||
@@ -584,6 +591,17 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
SelectCanLinConfigProConfigName = SelectCanLinConfigPro.ConfigName;
|
||||
|
||||
//调度表配置信息
|
||||
if (SelectCanLinConfigPro.CanScheduleConfigs != null && SelectCanLinConfigPro.CanScheduleConfigs.Count() > 0)
|
||||
{
|
||||
ListCANScheduleConfigDto = new ObservableCollection<CANScheduleConfigDto>(Mapper.Map<List<CANScheduleConfigDto>>(SelectCanLinConfigPro.CanScheduleConfigs));
|
||||
}
|
||||
else
|
||||
{
|
||||
ListCANScheduleConfigDto = new ObservableCollection<CANScheduleConfigDto>();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
//先判断是否是正确的集合数据,防止DataGrid的数据源刷新导致的触发事件
|
||||
@@ -868,7 +886,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
private ObservableCollection<CbxItems> _DataBaudRateCbxItems;
|
||||
/// <summary>
|
||||
/// CAN FD 数据波特率
|
||||
/// CAN 数据波特率
|
||||
/// </summary>
|
||||
public ObservableCollection<CbxItems> DataBaudRateCbxItems
|
||||
{
|
||||
@@ -876,6 +894,47 @@ namespace CapMachine.Wpf.ViewModels
|
||||
set { _DataBaudRateCbxItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DelegateCommand<object> _SchEnableCmd;
|
||||
/// <summary>
|
||||
/// 调度表的使能 操作的指令
|
||||
/// </summary>
|
||||
public DelegateCommand<object> SchEnableCmd
|
||||
{
|
||||
set
|
||||
{
|
||||
_SchEnableCmd = value;
|
||||
}
|
||||
get
|
||||
{
|
||||
if (_SchEnableCmd == null)
|
||||
{
|
||||
_SchEnableCmd = new DelegateCommand<object>((Par) => SchEnableCmdCall(Par));
|
||||
}
|
||||
return _SchEnableCmd;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 调度表的使能信息
|
||||
/// </summary>
|
||||
/// <param name="par"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void SchEnableCmdCall(object par)
|
||||
{
|
||||
var dd = SelectedCANConfigExdDto.SchEnable;
|
||||
var Result = (bool)par;
|
||||
if (Result)
|
||||
{
|
||||
CanDriveService.ToomossCanDrive.SchEnable = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
CanDriveService.ToomossCanDrive.SchEnable = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private DelegateCommand<string> _CanOpCmd;
|
||||
/// <summary>
|
||||
/// CAN操作的指令
|
||||
@@ -963,6 +1022,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
.Set(a => a.DbcPath, SelectedCANConfigExdDto.DbcPath)
|
||||
.Set(a => a.Cycle, SelectedCANConfigExdDto.Cycle)
|
||||
.Set(a => a.BaudRate, SelectedCANConfigExdDto.BaudRate)
|
||||
.Set(a => a.SchEnable, SelectedCANConfigExdDto.SchEnable)
|
||||
.Where(a => a.Id == SelectedCANConfigExdDto.Id)
|
||||
.ExecuteUpdated();
|
||||
}
|
||||
@@ -1024,7 +1084,12 @@ namespace CapMachine.Wpf.ViewModels
|
||||
|
||||
break;
|
||||
case "CycleSend"://循环发送你
|
||||
//循环发送数据
|
||||
|
||||
//有可能加载完毕后不手动改变状态,导致值没有传输,所以这里赋值
|
||||
CanDriveService.ToomossCanDrive.SchEnable = SelectedCANConfigExdDto.SchEnable;
|
||||
//无论有没有调度表,都要把这个配置给CanDriveService
|
||||
CanDriveService.ListCANScheduleConfig = ListCANScheduleConfigDto.ToList();
|
||||
|
||||
CanDriveService.CycleSendMsg();
|
||||
|
||||
//Listen
|
||||
@@ -1099,6 +1164,17 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<CANScheduleConfigDto> _ListCANScheduleConfigDto;
|
||||
/// <summary>
|
||||
///调度表集合
|
||||
/// </summary>
|
||||
public ObservableCollection<CANScheduleConfigDto> ListCANScheduleConfigDto
|
||||
{
|
||||
get { return _ListCANScheduleConfigDto; }
|
||||
set { _ListCANScheduleConfigDto = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
//private string _SelectedWriteName;
|
||||
///// <summary>
|
||||
///// 选中的写入的Name
|
||||
@@ -1244,6 +1320,44 @@ namespace CapMachine.Wpf.ViewModels
|
||||
System.Windows.MessageBox.Show("请选中后再进行【删除】操作?", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
case "WriteSch"://调度表
|
||||
|
||||
var data = CanDriveService.CmdData.GroupBy(a => a.MsgName).Select(a => a.Key).ToList();
|
||||
|
||||
if (data != null && data.Count > 0)
|
||||
{
|
||||
//弹窗
|
||||
DialogService.ShowDialog("DialogCANSchConfigView", new DialogParameters() {
|
||||
{"ListMsg", CanDriveService.CmdData.GroupBy(a=>a.MsgName).Select(a=>a.Key).ToList() },
|
||||
{ "ListCANScheduleConfigDto",ListCANScheduleConfigDto},
|
||||
{ "SelectCanLinConfigProId",SelectCanLinConfigPro.Id},
|
||||
|
||||
}, (par) =>
|
||||
{
|
||||
if (par.Result == ButtonResult.OK)
|
||||
{
|
||||
////程序名称
|
||||
ListCANScheduleConfigDto = par.Parameters.GetValue<ObservableCollection<CANScheduleConfigDto>>("ReturnValue");
|
||||
//把更新后的最新值给当前的主集合中
|
||||
SelectCanLinConfigPro.CanScheduleConfigs = Mapper.Map<List<CANScheduleConfig>>(ListCANScheduleConfigDto.ToList());
|
||||
|
||||
}
|
||||
else if (par.Result == ButtonResult.Cancel)
|
||||
{
|
||||
//取消
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("未发现写入的执行的命令数据,无法配置?", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user