|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Quartz.Util;
|
|
|
|
|
using SlnMesnac.Business;
|
|
|
|
|
using SlnMesnac.Model.domain;
|
|
|
|
|
using SlnMesnac.WPF.Model;
|
|
|
|
|
using SlnMesnac.WPF.ViewModel;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
|
|
|
|
|
namespace SlnMesnac.WPF.Page
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class RecipeModeSetWindow : Window
|
|
|
|
|
{
|
|
|
|
|
private RecipeManageCache recipeManageCache = RecipeManageCache.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手动修改配方
|
|
|
|
|
/// </summary>
|
|
|
|
|
public delegate Task<bool> ManualChangeRecipe(RecipeManage targetRecipe);
|
|
|
|
|
public static event ManualChangeRecipe? ManualChangeRecipeEvent;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public RecipeModeSetWindow()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async void ChangeRecipeButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var button = sender as Button;
|
|
|
|
|
if (button != null)
|
|
|
|
|
{
|
|
|
|
|
var tag = button.Tag as string;
|
|
|
|
|
var result = MessageBox.Show($"是否确认切换为手动模式---{tag},系统当前{recipeManageCache.RecipeMode}---{recipeManageCache.RecipeName}", "确认", MessageBoxButton.YesNo, MessageBoxImage.Information);
|
|
|
|
|
if(result == MessageBoxResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
// 调用委托在设备监控界面发送PLC频率
|
|
|
|
|
this.Close();
|
|
|
|
|
bool? changeResult = await ManualChangeRecipeEvent?.Invoke(recipeManageCache.recipeManageList.FirstOrDefault(x=>x.RecipeName==tag));
|
|
|
|
|
//if(changeResult.HasValue && changeResult.Value)
|
|
|
|
|
//{
|
|
|
|
|
// // MessageBox.Show("配方切换成功");
|
|
|
|
|
// recipeManageCache.RecipeMode = "手动模式";
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// MessageBox.Show("配方切换失败");
|
|
|
|
|
//}
|
|
|
|
|
//MessageBox.Show("配方切换成功");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|