97 lines
3.4 KiB
C#
97 lines
3.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace WCS_YongFeng
|
|
{
|
|
/// <summary>
|
|
/// HandSrmTaskRevert.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class HandSrmTaskRevert
|
|
{
|
|
public HandSrmTaskRevert()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void DMSkinWindow_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
var deviceList = App.f_ServiceModels.Select(a => a.device).ToList().FindAll(a => a.Type == "Srm" || a.Type == "Rgv");
|
|
List<BindComboxType<string>> bindComboxTypes = new List<BindComboxType<string>>();
|
|
foreach (var device in deviceList)
|
|
{
|
|
bindComboxTypes.Add(new BindComboxType<string> { Name = device.Name, Type = device.Code });
|
|
}
|
|
Comm_Device.ItemsSource = bindComboxTypes;
|
|
Comm_Device.DisplayMemberPath = "Name";
|
|
Comm_Device.SelectedValuePath = "Type";
|
|
}
|
|
|
|
/// <summary>
|
|
/// 按钮点击事件入口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btn_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
//var deviceCode = "Srm01";
|
|
if (Comm_Device.SelectedValue == null)
|
|
{
|
|
MessageBox.Show("请选择必选项", "提示");
|
|
return;
|
|
}
|
|
var deviceCode = Comm_Device.SelectedValue.ToString();
|
|
var excute_device = App.i_Excutes.FirstOrDefault(a => a.f_service.device.Code == deviceCode);
|
|
if (excute_device == null)
|
|
{
|
|
MessageBox.Show($"设备{deviceCode}任务恢复失败:找不到对应设备的处理类");
|
|
return;
|
|
}
|
|
var excute = excute_device as I_Excute_S;
|
|
if (excute == null)
|
|
{
|
|
MessageBox.Show($"设备{deviceCode}恢复失败,找不到对应的设备类型");
|
|
return;
|
|
}
|
|
Button button = sender as Button;
|
|
BllResult bllResult;
|
|
if (button.CommandParameter.ToString() == "Req")
|
|
{
|
|
bllResult = excute.HandReqExcute();
|
|
}
|
|
else if (button.CommandParameter.ToString() == "Finish")
|
|
{
|
|
bllResult = excute.HandFinishExcute();
|
|
}
|
|
else if (button.CommandParameter.ToString() == "EmptyOut")
|
|
{
|
|
bllResult = excute.EmptyOutExcute();
|
|
}
|
|
else if (button.CommandParameter.ToString() == "PickError")
|
|
{
|
|
bllResult = excute.PickErrorExcute();
|
|
}
|
|
else if (button.CommandParameter.ToString() == "FullIn")
|
|
{
|
|
bllResult = excute.FullInExcute();
|
|
}
|
|
else if (button.CommandParameter.ToString() == "Del")
|
|
{
|
|
bllResult = excute.DeleteTask();
|
|
}
|
|
else
|
|
{
|
|
bllResult = BllResult.Error($"恢复设备{deviceCode}任务失败,未找到对应的操作类型");
|
|
}
|
|
if (bllResult.Success)
|
|
{
|
|
MessageBox.Show("设备任务恢复成功");
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show($"设备任务恢复失败,错误原因是:{bllResult.Msg}");
|
|
}
|
|
}
|
|
}
|
|
} |