From 3db26d6a0c9a1035855cc6876fdc08cc94c526ee Mon Sep 17 00:00:00 2001 From: liuwf Date: Sat, 30 Dec 2023 15:53:28 +0800 Subject: [PATCH] CHANGE --- .../ViewModels/BeforeFoamingPageModelView.cs | 2 +- .../ViewModels/RealRoadPageViewModel.cs | 2 +- .../ViewModels/RoadKindPageViewModel.cs | 20 ++++++++++++++++++- .../ViewModels/SelectTypeViewModel.cs | 10 +++++----- .../Views/RoadKindPageView.xaml.cs | 1 + 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs b/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs index 4f17b97c..ae6056b7 100644 --- a/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs +++ b/Aucma.Core.BoxFoam/ViewModels/BeforeFoamingPageModelView.cs @@ -26,7 +26,7 @@ namespace Aucma.Core.BoxFoam.ViewModels private readonly IBaseSpaceDetailServices? _baseSpaceDetailServices; private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices; - + public BeforeFoamingPageModelView() { // 设置型号 diff --git a/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs index f0f492b4..10751c4b 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/RealRoadPageViewModel.cs @@ -31,7 +31,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels _oldBoxFoamTypeServices = App.ServiceProvider.GetService(); InitData(); } - + public async void InitData() { List list = await _oldBoxFoamTypeServices.QueryAsync(); diff --git a/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs index e3d32a1a..f65842c3 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/RoadKindPageViewModel.cs @@ -3,6 +3,7 @@ using Admin.Core.Model.Model_New; using Admin.Core.Service; using Aucma.Core.OldBoxFoam; using Aucma.Core.OldBoxFoam.Models; +using Aucma.Core.OldBoxFoam.Views; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; @@ -15,7 +16,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows; -namespace Aucma.Core.BoxFoam.ViewModels +namespace Aucma.Core.OldBoxFoam.ViewModels { @@ -25,13 +26,30 @@ namespace Aucma.Core.BoxFoam.ViewModels protected IOldBoxFoamTypeServices? _boxFoamTypeServices; public RoadKindPageViewModel() { + // 设置型号 + SubmitCommand = new RelayCommand(obj => SubmitCommandExecute(obj)); _boxFoamPlanServices = App.ServiceProvider.GetService(); _boxFoamTypeServices = App.ServiceProvider.GetService(); + SelectTypeViewModel.RefreshPageEvent += InitData; InitData(); } + /// + /// 设置型号 + /// + public RelayCommand SubmitCommand { get; set; } + + private void SubmitCommandExecute(string spaceCode) + { + + SelectType type = new SelectType(spaceCode); + type.ShowDialog(); + + } + public async void InitData() { + Shapes.Clear(); List list = await _boxFoamTypeServices.QueryAsync(); if (list == null) return; foreach(OldBoxFoamType item in list) diff --git a/Aucma.Core.OldBoxFoam/ViewModels/SelectTypeViewModel.cs b/Aucma.Core.OldBoxFoam/ViewModels/SelectTypeViewModel.cs index 35202894..df17508e 100644 --- a/Aucma.Core.OldBoxFoam/ViewModels/SelectTypeViewModel.cs +++ b/Aucma.Core.OldBoxFoam/ViewModels/SelectTypeViewModel.cs @@ -72,11 +72,11 @@ namespace Aucma.Core.OldBoxFoam.ViewModels materialDataGrid = new ObservableCollection(); Console.WriteLine(spaceCode); Load(); - + } public async void Load() { - var infos = await _baseMaterialInfoServices.QueryAsync(x=>x.MaterialSubclass=="200"); + var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200"); MaterialDataGrid.Clear(); Application.Current.Dispatcher.Invoke(() => { @@ -100,7 +100,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels { get { return selectedDataItem; } set => SetProperty(ref selectedDataItem, value); - + } public void MouseClick(object obj) @@ -235,7 +235,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels if (result) { MessageBox.Show("型号设置成功"); - } + } //关闭窗口 closeEvent?.Invoke(); //刷新界面 @@ -249,7 +249,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels { if (!string.IsNullOrEmpty(searchText)) { - var infos =await _baseMaterialInfoServices.QueryAsync(x=>x.MaterialSubclass=="200" && (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText))); + var infos = await _baseMaterialInfoServices.QueryAsync(x => x.MaterialSubclass == "200" && (x.MaterialName.Contains(searchText) || x.MaterialCode.Contains(searchText))); MaterialDataGrid.Clear(); Application.Current.Dispatcher.Invoke(() => { diff --git a/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml.cs b/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml.cs index 877a99ba..3890e1c6 100644 --- a/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml.cs +++ b/Aucma.Core.OldBoxFoam/Views/RoadKindPageView.xaml.cs @@ -27,5 +27,6 @@ namespace Aucma.Core.OldBoxFoam.Views InitializeComponent(); this.DataContext = new RoadKindPageViewModel(); } + } }