dev
liuwf 1 year ago
parent b013f1747c
commit 3db26d6a0c

@ -26,7 +26,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
private readonly IBaseSpaceDetailServices? _baseSpaceDetailServices; private readonly IBaseSpaceDetailServices? _baseSpaceDetailServices;
private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices; private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices;
public BeforeFoamingPageModelView() { public BeforeFoamingPageModelView() {
// 设置型号 // 设置型号

@ -31,7 +31,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
_oldBoxFoamTypeServices = App.ServiceProvider.GetService<IOldBoxFoamTypeServices>(); _oldBoxFoamTypeServices = App.ServiceProvider.GetService<IOldBoxFoamTypeServices>();
InitData(); InitData();
} }
public async void InitData() public async void InitData()
{ {
List<OldBoxFoamType> list = await _oldBoxFoamTypeServices.QueryAsync(); List<OldBoxFoamType> list = await _oldBoxFoamTypeServices.QueryAsync();

@ -3,6 +3,7 @@ using Admin.Core.Model.Model_New;
using Admin.Core.Service; using Admin.Core.Service;
using Aucma.Core.OldBoxFoam; using Aucma.Core.OldBoxFoam;
using Aucma.Core.OldBoxFoam.Models; using Aucma.Core.OldBoxFoam.Models;
using Aucma.Core.OldBoxFoam.Views;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.Mvvm.Messaging;
@ -15,7 +16,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; 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; protected IOldBoxFoamTypeServices? _boxFoamTypeServices;
public RoadKindPageViewModel() public RoadKindPageViewModel()
{ {
// 设置型号
SubmitCommand = new RelayCommand<string>(obj => SubmitCommandExecute(obj));
_boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>(); _boxFoamPlanServices = App.ServiceProvider.GetService<IBoxFoamPlanServices>();
_boxFoamTypeServices = App.ServiceProvider.GetService<IOldBoxFoamTypeServices>(); _boxFoamTypeServices = App.ServiceProvider.GetService<IOldBoxFoamTypeServices>();
SelectTypeViewModel.RefreshPageEvent += InitData;
InitData(); InitData();
} }
/// <summary>
/// 设置型号
/// </summary>
public RelayCommand<string> SubmitCommand { get; set; }
private void SubmitCommandExecute(string spaceCode)
{
SelectType type = new SelectType(spaceCode);
type.ShowDialog();
}
public async void InitData() public async void InitData()
{ {
Shapes.Clear();
List<OldBoxFoamType> list = await _boxFoamTypeServices.QueryAsync(); List<OldBoxFoamType> list = await _boxFoamTypeServices.QueryAsync();
if (list == null) return; if (list == null) return;
foreach(OldBoxFoamType item in list) foreach(OldBoxFoamType item in list)

@ -72,11 +72,11 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
materialDataGrid = new ObservableCollection<BaseMaterialInfo>(); materialDataGrid = new ObservableCollection<BaseMaterialInfo>();
Console.WriteLine(spaceCode); Console.WriteLine(spaceCode);
Load(); Load();
} }
public async void 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(); MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
@ -100,7 +100,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
{ {
get { return selectedDataItem; } get { return selectedDataItem; }
set => SetProperty(ref selectedDataItem, value); set => SetProperty(ref selectedDataItem, value);
} }
public void MouseClick(object obj) public void MouseClick(object obj)
@ -235,7 +235,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
if (result) if (result)
{ {
MessageBox.Show("型号设置成功"); MessageBox.Show("型号设置成功");
} }
//关闭窗口 //关闭窗口
closeEvent?.Invoke(); closeEvent?.Invoke();
//刷新界面 //刷新界面
@ -249,7 +249,7 @@ namespace Aucma.Core.OldBoxFoam.ViewModels
{ {
if (!string.IsNullOrEmpty(searchText)) 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(); MaterialDataGrid.Clear();
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {

@ -27,5 +27,6 @@ namespace Aucma.Core.OldBoxFoam.Views
InitializeComponent(); InitializeComponent();
this.DataContext = new RoadKindPageViewModel(); this.DataContext = new RoadKindPageViewModel();
} }
} }
} }

Loading…
Cancel
Save