using GalaSoft.MvvmLight; using Microsoft.Extensions.DependencyInjection; using SlnMesnac.Business; using SlnMesnac.Model.domain; using SlnMesnac.Model.dto; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; #region << 版 本 注 释 >> /*-------------------------------------------------------------------- * 版权所有 (c) 2024 WenJY 保留所有权利。 * CLR版本:4.0.30319.42000 * 机器名称:LAPTOP-E0N2L34V * 命名空间:SlnMesnac.WPF.ViewModel * 唯一标识:14008fcc-0a31-4f1e-bc80-9f9ea84d3de5 * * 创建者:WenJY * 电子邮箱:wenjy@mesnac.com * 创建时间:2024-04-10 16:18:57 * 版本:V1.0.0 * 描述: * *-------------------------------------------------------------------- * 修改人: * 时间: * 修改说明: * * 版本:V1.0.0 *--------------------------------------------------------------------*/ #endregion << 版 本 注 释 >> namespace SlnMesnac.WPF.ViewModel { /// /// 生产统计ViewModel /// internal class ProdStatisticsViewModel : ViewModelBase { private readonly PalletStowBusiness _palletStowBusiness; private readonly ProdCompletionBusiness _prodCompletionBusiness; public ProdStatisticsViewModel() { _palletStowBusiness = App.ServiceProvider.GetService(); _prodCompletionBusiness = App.ServiceProvider.GetService(); var palletTask = App.ServiceProvider.GetService>(); RefreshPalletTaskDataGrid(palletTask); _palletStowBusiness.RefreshPalletTaskListEvent += RefreshPalletTaskDataGrid; var barCodeTasks = App.ServiceProvider.GetService>(); RefreshBarCodeTaskDataGrid(barCodeTasks); _prodCompletionBusiness.RefreshBarCodeTaskListEvent += RefreshBarCodeTaskDataGrid; } #region 参数定义 /// /// 托盘队列DataGrid /// private ObservableCollection palletTaskDataGrid; public ObservableCollection PalletTaskDataGrid { get { return palletTaskDataGrid; } set { palletTaskDataGrid = value; RaisePropertyChanged(() => PalletTaskDataGrid); } } /// /// 条码队列DataGrid /// private ObservableCollection barCodeTaskDataGrid; public ObservableCollection BarCodeTaskDataGrid { get { return barCodeTaskDataGrid; } set { barCodeTaskDataGrid = value; RaisePropertyChanged(() => BarCodeTaskDataGrid); } } #endregion /// /// 刷新托盘队列信息 /// /// private void RefreshPalletTaskDataGrid(List palletTasks) { PalletTaskDataGrid = new ObservableCollection(); foreach (var task in palletTasks) { PalletTaskDataGrid.Add(task); } } /// /// 刷新条码队列信息 /// /// private void RefreshBarCodeTaskDataGrid(List barCodeTasks) { BarCodeTaskDataGrid = new ObservableCollection(); foreach (var task in barCodeTasks) { BarCodeTaskDataGrid.Add(task); } } } }