You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AUCMA_SCADA/Aucma.Core.Palletiz/ViewModels/PalletizPageViewModel.cs

76 lines
2.1 KiB
C#

using Admin.Core.IService;
using Admin.Core.Model;
using Aucma.Core.Palletiz.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.ObjectModel;
using System.Linq;
namespace Aucma.Core.Palletiz.ViewModels
{
public partial class PalletizPageViewModel : ObservableObject
{
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(PalletizPageViewModel));
private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices;
public PalletizPageViewModel() {
_baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
LoadDataGrid();
// SelectTypeViewModel.RefreshPageEvent += LoadDataGrid;
}
public void LoadDataGrid()
{
Spaces.Clear();
var spaceList = _baseSpaceInfoServices.Query(X => X.StoreCode.Contains("FDK")).OrderBy(x=>x.ObjId);
foreach(BaseSpaceInfo space in spaceList)
{
Spaces.Add(space);
}
}
#region 初始化
private ObservableCollection<BaseSpaceInfo> _spaces = new ObservableCollection<BaseSpaceInfo>();
public ObservableCollection<BaseSpaceInfo> Spaces
{
get => _spaces;
set => SetProperty(ref _spaces, value);
}
#endregion
public void MouseClick(object obj)
{
var info = SelectedDataItem as BaseSpaceInfo;
if (info != null)
{
SelectType direct = new SelectType(info);
direct.ShowDialog();
}
}
private BaseSpaceInfo selectedDataItem;
public BaseSpaceInfo SelectedDataItem
{
get { return selectedDataItem; }
set
{
selectedDataItem = value;
OnPropertyChanged();
}
}
[RelayCommand]
public void AddStore()
{
SplitPlanView plan = new SplitPlanView();
plan.Show();
}
}
}