RGVInfo.xaml.cs
3.6 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
using HHECS.Application.Enums;
using HHECS.BLL.EquipmentExcute;
using HHECS.Executor.EquipmentHandler;
using HHECS.Model.Entities;
using HHHECS.Model.Enums;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using HHECS.Infrastructure.CommonHelper;
using System.Linq;
namespace HHECS.WinCommon.Controls
{
/// <summary>
/// MarkingMonitor.xaml 的交互逻辑
/// </summary>
public partial class RGVInfo : UserControl
{
public Equipment Self { get; set; }
public string ControlName
{
get { return (string)GetValue(ControlNameProperty); }
set { SetValue(ControlNameProperty, value); }
}
public static readonly DependencyProperty ControlNameProperty =
DependencyProperty.Register("ControlName", typeof(string), typeof(RGVInfo), new PropertyMetadata(""));
public RGVInfo()
{
InitializeComponent();
this.txt_RGVName.SetBinding(TextBlock.TextProperty, new Binding("ControlName") { Source = this });
}
/// <summary>
/// key :线体code ,value:ip 地址
/// </summary>
/// <param name="dicMarking"></param>
public void SetRGVProps(Equipment RGV,List<Equipment> allEquipments)
{
Self = RGV;
var Status = Self[StationProps.RGVStatus.ToString()];
if (Status != null)
{
if (int.TryParse(Status.Value, out int status))
{
txt_RGVStatus.Text = typeof(EquipmentStatus).GetDescriptionString(status);
}
else
{
txt_RGVStatus.Text = "未识别";
}
}
var RGVNow = Self[StationProps.RGVNow.ToString()];
if (RGVNow != null)
{
if (!string.IsNullOrEmpty(RGVNow.Value))
{
if (RGVNow.Value == "0")
{
txt_RGVNow.Text = "未获取";
}
else
{
txt_RGVNow.Text = allEquipments.Find(t => t.SelfAddress == RGVNow.Value).Name;
}
}
}
var RGVStart = Self[StationProps.RGVStart.ToString()];
if (RGVStart != null)
{
if (!string.IsNullOrEmpty(RGVStart.Value))
{
if (RGVStart.Value=="0")
{
txt_RGVStart.Text = "未获取"; }
else
{
txt_RGVStart.Text = allEquipments.Find(t => t.SelfAddress == RGVStart.Value).Name;
}
}
}
var RGVEnd = Self[StationProps.RGVEnd.ToString()];
if (RGVEnd != null)
{
if (!string.IsNullOrEmpty(RGVEnd.Value))
{
if (RGVEnd.Value == "0")
{
txt_RGVEnd.Text = "未获取";
}
else if (RGVEnd.Value == "2010")
{
txt_RGVEnd.Text = "下线工位";
}
else
{
txt_RGVEnd.Text = allEquipments.Find(t => t.SelfAddress == RGVEnd.Value).Name;
}
}
}
}
}
}