增加了初始弹窗,但是没有成功

更改了CAN和LIN协调
更改了配置程序的名称顺序
This commit is contained in:
2025-01-11 12:04:34 +08:00
parent 620c5e8178
commit e49a48fb25
53 changed files with 5118 additions and 131 deletions

View File

@@ -42,7 +42,7 @@ namespace CapMachine.Wpf.ViewModels
CategoryComboBoxList = new List<ComboBoxModel>()
{
new ComboBoxModel(){Key="0",Text="系统日志" },
new ComboBoxModel(){Key="1",Text="程序步骤" },
//new ComboBoxModel(){Key="1",Text="程序步骤" },
new ComboBoxModel(){Key="2",Text="历史报警" },
};
}
@@ -210,12 +210,14 @@ namespace CapMachine.Wpf.ViewModels
//多条件查询
if (!string.IsNullOrEmpty(SearchStartDate))
{
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
var Start = DateTime.Parse(SearchStartDate);
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(Start));
}
//多条件查询
if (!string.IsNullOrEmpty(SearchEndDate))
{
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
var End = DateTime.Parse(SearchEndDate);
MulConHistoryAlarmQueryable = MulConHistoryAlarmQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(End).AddDays(1));
}
var ListHistoryAlarmDpI = MulConHistoryAlarmQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
@@ -228,12 +230,14 @@ namespace CapMachine.Wpf.ViewModels
//多条件查询
if (!string.IsNullOrEmpty(SearchStartDate))
{
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(SearchStartDate));
var Start = DateTime.Parse(SearchStartDate);
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date >= Convert.ToDateTime(Start));
}
//多条件查询
if (!string.IsNullOrEmpty(SearchEndDate))
{
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(SearchEndDate).AddDays(1));
var End = DateTime.Parse(SearchEndDate);
MulConActionLogQueryable = MulConActionLogQueryable.Where(t => t.CreateTime.Date < Convert.ToDateTime(End).AddDays(1));
}
var ListActionLogDpI = MulConActionLogQueryable.OrderByDescending(a => a.CreateTime).ToList();//.Where(a => a.CreateTime >= DateTime.Now);
ListModelDto = new ObservableCollection<object>(Mapper.Map<List<ActionLogDto>>(ListActionLogDpI));

View File

@@ -25,6 +25,7 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using static CapMachine.Wpf.Models.ComEnum;
namespace CapMachine.Wpf.ViewModels
{
@@ -35,6 +36,7 @@ namespace CapMachine.Wpf.ViewModels
{
public CANConfigViewModel(IDialogService dialogService, IFreeSql freeSql,
IEventAggregator eventAggregator, IRegionManager regionManager, SysRunService sysRunService,
ComActionService actionService,
ConfigService configService, CanDriveService canDriveService,
IMapper mapper, MachineRtDataService machineRtDataService)
{
@@ -43,6 +45,7 @@ namespace CapMachine.Wpf.ViewModels
EventAggregator = eventAggregator;
RegionManager = regionManager;
SysRunService = sysRunService;
ComActionService = actionService;
ConfigService = configService;
CanDriveService = canDriveService;
Mapper = mapper;
@@ -80,6 +83,7 @@ namespace CapMachine.Wpf.ViewModels
public IEventAggregator EventAggregator { get; }
public IRegionManager RegionManager { get; }
public SysRunService SysRunService { get; }
public ComActionService ComActionService { get; }
public ConfigService ConfigService { get; }
public CanDriveService CanDriveService { get; }
public IMapper Mapper { get; }
@@ -329,23 +333,42 @@ namespace CapMachine.Wpf.ViewModels
}
break;
case "Active":
if (SelectCanLinConfigPro != null)
//激活到取消的状态的判断
if (IsCanConfigProActive==true)
{
//控件的激活
IsCanConfigProActive = !IsCanConfigProActive;
//控件的激活配置信息
IsCANConfigDatagridActive = !IsCanConfigProActive;
//当前使用的CAN 配置信息
CanDriveService.InitCanConfig(SelectCanLinConfigPro);
return;
}
if ((CanDriveService.ToomossCanDrive.OpenState == true && CanDriveService.ToomossCanDrive.DbcParserState == true))
{
if (SelectCanLinConfigPro != null)
{
//控件的激活
IsCanConfigProActive = !IsCanConfigProActive;
//控件的激活配置信息
IsCANConfigDatagridActive = !IsCanConfigProActive;
//当前使用的CAN 配置信息
CanDriveService.InitCanConfig(SelectCanLinConfigPro);
InitLoadCanConfigPro();
}
else
{
System.Windows.MessageBox.Show("选中后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
InitLoadCanConfigPro();
}
else
{
System.Windows.MessageBox.Show("选中后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("请确保CAN连接打开和Dbc解析成功后再激活", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
break;
default:
break;
@@ -579,7 +602,7 @@ namespace CapMachine.Wpf.ViewModels
}
else
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
@@ -754,10 +777,17 @@ namespace CapMachine.Wpf.ViewModels
switch (Par)
{
case "Open":
if (ComActionService.IsCanToDoWork()==false)
{
System.Windows.MessageBox.Show("请关闭LIN连接后才能开启CAN同一个时刻只能有一个通信驱动压缩机", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
return;
}
if (SelectCanLinConfigPro != null && SelectedCANConfigExdDto != null)
{
//打开连接
CanDriveService.ToomossCanDrive.StartCanDrive();
//系统使用了CAN
ConfigService.CanLinRunStateModel.CurSysSelectedCanLin = CanLinEnum.Can;
//CAN DBC配置 有DBC配置的话则直接加载DBC信息
if (!string.IsNullOrEmpty(SelectCanLinConfigPro.CANConfigExd.DbcPath))
{
@@ -767,7 +797,7 @@ namespace CapMachine.Wpf.ViewModels
}
else
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
break;
@@ -776,11 +806,12 @@ namespace CapMachine.Wpf.ViewModels
{
CanDriveService.ToomossCanDrive.CloseDevice();
//系统取消使用了CAN
ConfigService.CanLinRunStateModel.CurSysSelectedCanLin = CanLinEnum.No;
}
else
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
break;
@@ -802,7 +833,7 @@ namespace CapMachine.Wpf.ViewModels
}
else
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
break;
@@ -837,7 +868,7 @@ namespace CapMachine.Wpf.ViewModels
}
else
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
}
break;
@@ -1004,7 +1035,7 @@ namespace CapMachine.Wpf.ViewModels
{
if (SelectCanLinConfigPro == null)
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
return;
}
@@ -1139,7 +1170,7 @@ namespace CapMachine.Wpf.ViewModels
{
if (SelectCanLinConfigPro == null)
{
System.Windows.MessageBox.Show("新建CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
System.Windows.MessageBox.Show("选中CAN配置名称后再操作", "提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Hand);
return;
}

View File

@@ -16,7 +16,7 @@ namespace CapMachine.Wpf.ViewModels
{
public DialogCanLinConfigCreateViewModel()
{
this.Title = "Can/LIN程序名称配置";
}
private string name;

View File

@@ -0,0 +1,60 @@
using CapMachine.Wpf.Services;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using Prism.Ioc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Wpf.ViewModels
{
public abstract class HostDialogViewModel : BindableBase, IHostDialogAware
{
public string Title { get; set; }
public string IdentifierName { get; set; }
public DelegateCommand SaveCommand { get; private set; }
public DelegateCommand CancelCommand { get; private set; }
private IHostDialogService dialogService;
public HostDialogViewModel()
{
SaveCommand = new DelegateCommand(async () => await Save());
CancelCommand = new DelegateCommand(Cancel);
dialogService = ContainerLocator.Container.Resolve<IHostDialogService>();
}
public virtual void Cancel()
{
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.No));
}
public virtual async Task Save()
{
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK));
await Task.CompletedTask;
}
protected virtual void Save(object value)
{
DialogParameters param = new DialogParameters();
param.Add("Value", value);
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK, param));
}
protected virtual void Save(DialogParameters param)
{
dialogService.Close(IdentifierName, new DialogResult(ButtonResult.OK, param));
}
public abstract void OnDialogOpened(IDialogParameters parameters);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
using CapMachine.Core;
using CapMachine.Wpf.Services;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CapMachine.Wpf.ViewModels
{
public class SplashScreenViewModel : DialogViewModel
{
private readonly IApplicationContext applicationContext;
private string displayText;
public string DisplayText
{
get { return displayText; }
set { displayText = value; RaisePropertyChanged(); }
}
public SplashScreenViewModel(
IApplicationContext applicationContext
)
{
this.applicationContext = applicationContext;
}
public override async void OnDialogOpened(IDialogParameters parameters)
{
await SetBusyAsync(async () =>
{
await Task.Delay(2000);
//加载本地的缓存信息
DisplayText = "Initializing";
OnDialogClosed();
//OnDialogClosed(ButtonResult.OK);
////如果本地授权存在,直接进入系统首页
//if (accessTokenManager.IsUserLoggedIn && applicationContext.Configuration != null)
// OnDialogClosed();
//else if (applicationContext.Configuration != null)
// OnDialogClosed(ButtonResult.Ignore);
//else
// OnDialogClosed(ButtonResult.No);
});
}
}
}

View File

@@ -0,0 +1,41 @@
using CapMachine.Wpf.Services;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Ioc;
namespace CapMachine.Wpf.ViewModels
{
public class TaskBarViewModel : BindableBase
{
private readonly IHostDialogService dialog;
private readonly IAppStartService appStartService;
public DelegateCommand ExitCommand { get; set; }
public DelegateCommand ShowViewCommand { get; private set; }
public TaskBarViewModel()
{
dialog = ContainerLocator.Container.Resolve<IHostDialogService>();
appStartService = ContainerLocator.Container.Resolve<IAppStartService>();
ExitCommand = new DelegateCommand(Exit);
ShowViewCommand = new DelegateCommand(ShowView);
}
private async void Exit()
{
ShowView();
if (await dialog.Question("确定","1"))
appStartService.Exit();
}
private void ShowView()
{
if (!App.Current.MainWindow.IsVisible)
{
App.Current.MainWindow.Show();
App.Current.MainWindow.WindowState = System.Windows.WindowState.Normal;
}
}
}
}