HandSrmTaskRevert.xaml.cs
3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace HH_WCS_Standard
{
/// <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)
{
//if (Comm_Device.SelectedValue == null)
//{
// MessageBox.Show($"请选择设备");
// return;
//}
var deviceCode = "Srm01";
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() == "FullIn")
{
bllResult = excute.FullInExcute();
}
else if (button.CommandParameter.ToString() == "Del")
{
bllResult = excute.DeleteTask();
}
//else if (button.CommandParameter.ToString() == "TakeErr")
//{
// bllResult = excute.TakeErrorExcute();
//}
else
{
bllResult = BllResult.Error($"恢复设备{deviceCode}任务失败,未找到对应的操作类型");
}
if (bllResult.Success)
{
MessageBox.Show("设备任务恢复成功");
}
else
{
MessageBox.Show($"设备任务恢复失败,错误原因是:{bllResult.Msg}");
}
}
}
}