using Admin.Core.IService; using Admin.Core.Service; using Aucma.Core.Palletiz.Views; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace Aucma.Core.Palletiz.ViewModels { /** * 发泡计划 * * */ public partial class PlanPageViewModel : ObservableObject { protected readonly IBoxFoamPlanServices? _boxFoamPlanServices; public PlanPageViewModel() { _boxFoamPlanServices = App.ServiceProvider.GetService(); InitData(); } public async void InitData() { var task =await _boxFoamPlanServices.QueryAsync(); task.OrderBy(d=>d.ObjId); foreach (var item in task) { Id.Add(item.ObjId); MaterialCode.Add(item.MaterialCode); MaterialName.Add(item.MaterialName); PlanAmount.Add(item.PlanAmount); } } #region MyRegion private ObservableCollection _id = new ObservableCollection(); public ObservableCollection Id { get => _id; set => SetProperty(ref _id, value); } private ObservableCollection _materialCode = new ObservableCollection(); public ObservableCollection MaterialCode { get => _materialCode; set => SetProperty(ref _materialCode, value); } private ObservableCollection _materialName = new ObservableCollection(); public ObservableCollection MaterialName { get => _materialName; set => SetProperty(ref _materialName, value); } private ObservableCollection _planAmount = new ObservableCollection(); public ObservableCollection PlanAmount { get => _planAmount; set => SetProperty(ref _planAmount, value); } #endregion } }