其他程序的CAN CANFD LIN的移植
This commit is contained in:
@@ -55,22 +55,44 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//MachineDataService = machineDataService;
|
||||
DialogService = dialogService;
|
||||
|
||||
//数据波特率
|
||||
DataBaudRateCbxItems = new ObservableCollection<CbxItems>()
|
||||
{
|
||||
new CbxItems(){ Key="38400",Text="38400"},
|
||||
new CbxItems(){ Key="19200",Text="19200"},
|
||||
new CbxItems(){ Key="14400",Text="14400"},
|
||||
new CbxItems(){ Key="9600",Text="9600"},
|
||||
new CbxItems(){ Key="4800",Text="4800"},
|
||||
new CbxItems(){ Key="2400",Text="2400"},
|
||||
};
|
||||
|
||||
WriteNameCbxItems = new ObservableCollection<CbxItems>()
|
||||
{
|
||||
new CbxItems(){ Key="转速",Text="转速"},
|
||||
new CbxItems(){ Key="功率限制",Text="功率限制"},
|
||||
new CbxItems(){ Key="使能",Text="使能"},
|
||||
new CbxItems(){ Key="Anti_Sleep",Text="Anti_Sleep"},
|
||||
new CbxItems(){ Key="PTC使能",Text="PTC使能"},
|
||||
new CbxItems(){ Key="PTC功率",Text="PTC功率"},
|
||||
new CbxItems(){ Key="PTC水流量",Text="PTC水流量"},
|
||||
new CbxItems(){ Key="PTC水温",Text="PTC水温"},
|
||||
};
|
||||
|
||||
ReadNameCbxItems = new ObservableCollection<CbxItems>()
|
||||
{
|
||||
new CbxItems(){ Key="通讯转速",Text="通讯转速"},
|
||||
new CbxItems(){ Key="通讯母线电压",Text="通讯母线电压"},
|
||||
new CbxItems(){ Key="通讯母线电流",Text="通讯母线电流"},
|
||||
new CbxItems(){ Key="通讯相电流",Text="通讯相电流"},
|
||||
new CbxItems(){ Key="通讯功率",Text="通讯功率"},
|
||||
new CbxItems(){ Key="通讯芯片温度",Text="通讯芯片温度"},
|
||||
new CbxItems(){ Key="通讯Cmp转速",Text="通讯Cmp转速"},
|
||||
new CbxItems(){ Key="通讯Cmp母线电压",Text="通讯Cmp母线电压"},
|
||||
new CbxItems(){ Key="通讯Cmp母线电流",Text="通讯Cmp母线电流"},
|
||||
new CbxItems(){ Key="通讯Cmp相电流",Text="通讯Cmp相电流"},
|
||||
new CbxItems(){ Key="通讯Cmp功率",Text="通讯Cmp功率"},
|
||||
new CbxItems(){ Key="通讯Cmp芯片温度",Text="通讯Cmp芯片温度"},
|
||||
|
||||
new CbxItems(){ Key="通讯PTC入水温度",Text="通讯PTC入水温度"},
|
||||
new CbxItems(){ Key="通讯PTC出水温度",Text="通讯PTC出水温度"},
|
||||
new CbxItems(){ Key="通讯PTC峰值电流",Text="通讯PTC峰值电流"},
|
||||
new CbxItems(){ Key="通讯PTC母线电流",Text="通讯PTC母线电流"},
|
||||
new CbxItems(){ Key="通讯PTC膜温",Text="通讯PTC膜温"},
|
||||
new CbxItems(){ Key="通讯PTC模块温度",Text="通讯PTC模块温度"},
|
||||
};
|
||||
InitLoadLinConfigPro();
|
||||
|
||||
@@ -108,6 +130,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
canLinConfigPros = FreeSql.Select<CanLinConfigPro>().Where(a => a.CANLINInfo == CANLIN.LIN)
|
||||
.Include(a => a.LINConfigExd)
|
||||
.IncludeMany(a => a.CanLinConfigContents)
|
||||
.IncludeMany(a => a.LinScheduleConfigs)
|
||||
.ToList();
|
||||
|
||||
ListCanLinConfigPro = new ObservableCollection<CanLinConfigPro>(canLinConfigPros);
|
||||
@@ -145,11 +168,26 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ListWriteCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
|
||||
}
|
||||
|
||||
var ReadData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Read).ToList();
|
||||
if (ReadData != null && ReadData.Count > 0)
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
|
||||
}
|
||||
else
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
|
||||
}
|
||||
|
||||
//调度表配置信息
|
||||
if (SelectCanLinConfigPro.CanScheduleConfigs != null && SelectCanLinConfigPro.CanScheduleConfigs.Count() > 0)
|
||||
{
|
||||
ListLINScheduleConfigDto = new ObservableCollection<LINScheduleConfigDto>(Mapper.Map<List<LINScheduleConfigDto>>(SelectCanLinConfigPro.LinScheduleConfigs));
|
||||
}
|
||||
|
||||
//匹配选中的SelectCanLinConfigPro.CanLinConfigContents和ListLinLdfModel
|
||||
MatchSeletedAndLinLdfModel();
|
||||
@@ -497,13 +535,33 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ListWriteCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
|
||||
}
|
||||
var ReadData = SelectCanLinConfigPro.CanLinConfigContents!.Where(a => a.RWInfo == RW.Read).ToList();
|
||||
if (ReadData != null && ReadData.Count > 0)
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>(Mapper.Map<List<CanLinRWConfigDto>>(ReadData));
|
||||
}
|
||||
else
|
||||
{
|
||||
ListReadCanLinRWConfigDto = new ObservableCollection<CanLinRWConfigDto>();
|
||||
}
|
||||
|
||||
SelectCanLinConfigProConfigName = SelectCanLinConfigPro.ConfigName;
|
||||
|
||||
//调度表配置信息
|
||||
if (SelectCanLinConfigPro.CanScheduleConfigs != null && SelectCanLinConfigPro.CanScheduleConfigs.Count() > 0)
|
||||
{
|
||||
ListLINScheduleConfigDto = new ObservableCollection<LINScheduleConfigDto>(Mapper.Map<List<LINScheduleConfigDto>>(SelectCanLinConfigPro.LinScheduleConfigs));
|
||||
}
|
||||
else
|
||||
{
|
||||
ListLINScheduleConfigDto = new ObservableCollection<LINScheduleConfigDto>();
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
//先判断是否是正确的集合数据,防止DataGrid的数据源刷新导致的触发事件
|
||||
@@ -781,6 +839,16 @@ namespace CapMachine.Wpf.ViewModels
|
||||
set { _SelectedLINConfigExdDto = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private ObservableCollection<CbxItems> _DataBaudRateCbxItems;
|
||||
/// <summary>
|
||||
/// CAN 数据波特率
|
||||
/// </summary>
|
||||
public ObservableCollection<CbxItems> DataBaudRateCbxItems
|
||||
{
|
||||
get { return _DataBaudRateCbxItems; }
|
||||
set { _DataBaudRateCbxItems = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
private DelegateCommand<string> _LinOpCmd;
|
||||
/// <summary>
|
||||
/// LIN操作的指令
|
||||
@@ -824,7 +892,7 @@ namespace CapMachine.Wpf.ViewModels
|
||||
//系统使用了LIN
|
||||
ConfigService.CanLinRunStateModel.CurSysSelectedCanLin = CanLinEnum.Lin;
|
||||
}
|
||||
|
||||
|
||||
//LIN LDF配置 有LDF配置的话,则直接加载LDF信息
|
||||
if (!string.IsNullOrEmpty(SelectCanLinConfigPro.LINConfigExd.LdfPath))
|
||||
{
|
||||
@@ -981,6 +1049,17 @@ namespace CapMachine.Wpf.ViewModels
|
||||
}
|
||||
|
||||
|
||||
private ObservableCollection<LINScheduleConfigDto> _ListLINScheduleConfigDto;
|
||||
/// <summary>
|
||||
///调度表集合
|
||||
/// </summary>
|
||||
public ObservableCollection<LINScheduleConfigDto> ListLINScheduleConfigDto
|
||||
{
|
||||
get { return _ListLINScheduleConfigDto; }
|
||||
set { _ListLINScheduleConfigDto = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
//private string _SelectedWriteName;
|
||||
///// <summary>
|
||||
///// 选中的写入的Name
|
||||
@@ -1125,6 +1204,47 @@ namespace CapMachine.Wpf.ViewModels
|
||||
System.Windows.MessageBox.Show("请选中后再进行【删除】操作?", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
|
||||
}
|
||||
|
||||
break;
|
||||
case "WriteSch"://调度表
|
||||
|
||||
LinDriveService.ToomossLinDrive.LinTest();
|
||||
|
||||
|
||||
//var data = LinDriveService.CmdData.GroupBy(a => a.MsgName).Select(a => a.Key).ToList();
|
||||
|
||||
//if (data != null && data.Count > 0)
|
||||
//{
|
||||
// //弹窗
|
||||
// DialogService.ShowDialog("DialogLINSchConfigView", new DialogParameters() {
|
||||
// {"ListMsg", LinDriveService.CmdData.GroupBy(a=>a.MsgName).Select(a=>a.Key).ToList() },
|
||||
// { "ListLINScheduleConfigDto",ListLINScheduleConfigDto},
|
||||
// { "SelectCanLinConfigProId",SelectCanLinConfigPro.Id},
|
||||
|
||||
// }, (par) =>
|
||||
// {
|
||||
// if (par.Result == ButtonResult.OK)
|
||||
// {
|
||||
// ////程序名称
|
||||
// ListLINScheduleConfigDto = par.Parameters.GetValue<ObservableCollection<LINScheduleConfigDto>>("ReturnValue");
|
||||
// //把更新后的最新值给当前的主集合中
|
||||
// SelectCanLinConfigPro.LinScheduleConfigs = Mapper.Map<List<LINScheduleConfig>>(ListLINScheduleConfigDto.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