|
|
using GalaSoft.MvvmLight;
|
|
|
using GalaSoft.MvvmLight.Command;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
using SlnMesnac.Business;
|
|
|
using SlnMesnac.Business.@base;
|
|
|
using SlnMesnac.Model.domain;
|
|
|
using SlnMesnac.Model.dto;
|
|
|
using SlnMesnac.Plc;
|
|
|
using SlnMesnac.Repository.service;
|
|
|
using SlnMesnac.WPF.Model;
|
|
|
using SlnMesnac.WPF.Page;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
|
|
|
#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
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 设备参数监控
|
|
|
/// </summary>
|
|
|
internal class RecipeManageViewModel : ViewModelBase
|
|
|
{
|
|
|
private BaseBusiness baseBusiness = null;
|
|
|
|
|
|
private PlcAbsractFactory plc = null;
|
|
|
|
|
|
private RecipeManageCache recipeManageCache = RecipeManageCache.Instance;
|
|
|
|
|
|
/// <summary>
|
|
|
/// 修改配方
|
|
|
/// </summary>
|
|
|
public RelayCommand<int> UpdateRecipeCommand { get; set; }
|
|
|
|
|
|
public RecipeManageViewModel()
|
|
|
{
|
|
|
baseBusiness = App.ServiceProvider.GetService<BaseBusiness>();
|
|
|
UpdateRecipeCommand = new RelayCommand<int>(obj => UpdateRecipe(obj));
|
|
|
RrfreshDataGrid();
|
|
|
}
|
|
|
|
|
|
public void RrfreshDataGrid()
|
|
|
{
|
|
|
List<RecipeManage> list = recipeManageCache.recipeManageList;
|
|
|
if (list != null && list.Count > 0)
|
|
|
{
|
|
|
RecipeDataGrid.Clear();
|
|
|
foreach (var item in list)
|
|
|
{
|
|
|
RecipeDataGrid.Add(item);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 参数定义
|
|
|
/// <summary>
|
|
|
/// 配方DataGrid
|
|
|
/// </summary>
|
|
|
private ObservableCollection<RecipeManage> recipeDataGrid = new ObservableCollection<RecipeManage>();
|
|
|
|
|
|
public ObservableCollection<RecipeManage> RecipeDataGrid
|
|
|
{
|
|
|
get { return recipeDataGrid; }
|
|
|
set { recipeDataGrid = value; RaisePropertyChanged(() => RecipeDataGrid); }
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateRecipe(int RecipeKey)
|
|
|
{
|
|
|
|
|
|
RecipeManageSetWindow window = new RecipeManageSetWindow(RecipeKey);
|
|
|
window.ShowDialog();
|
|
|
RrfreshDataGrid();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|