LoadingLocationInfo.xaml.cs
4.27 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
118
119
120
121
122
using HHECS.BLL.EquipmentExcute;
using HHECS.Executor.EquipmentHandler;
using HHECS.Model.Entities;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
namespace HHECS.WinCommon.Controls
{
/// <summary>
/// MarkingMonitor.xaml 的交互逻辑
/// </summary>
public partial class LoadingLocationInfo : 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(LoadingLocationInfo), new PropertyMetadata(""));
public LoadingLocationInfo(string LineCode)
{
InitializeComponent();
this.txt_LoadingLocationName.SetBinding(TextBlock.TextProperty, new Binding("ControlName") { Source = this });
}
/// <summary>
/// key :线体code ,value:ip 地址
/// </summary>
/// <param name="dicMarking"></param>
public void SetLocationStatus(Equipment Weld)
{
Self = Weld;
var LocationStatus1 = Self[StationProps.LocationStatus1.ToString()];
if (LocationStatus1 != null)
{
if (int.TryParse(LocationStatus1.Value, out int locationStatus1))
{
if (locationStatus1 == 1)
{
this.bor_location01.Background = Brushes.Red;
}
else if (locationStatus1 == 2)
{
this.bor_location01.Background = Brushes.Green;
}
else if (locationStatus1 == 0)
{
this.bor_location01.Background = Brushes.Gray;
}
}
}
var LocationStatus2 = Self[StationProps.LocationStatus2.ToString()];
if (LocationStatus2 != null)
{
if (int.TryParse(LocationStatus2.Value, out int locationStatus2))
{
if (locationStatus2 == 1)
{
this.bor_location02.Background = Brushes.Red;
}
else if (locationStatus2 == 2)
{
this.bor_location02.Background = Brushes.Green;
}
else if (locationStatus2 == 0)
{
this.bor_location02.Background = Brushes.Gray;
}
}
}
var LocationStatus3 = Self[StationProps.LocationStatus3.ToString()];
if (LocationStatus3 != null)
{
if (int.TryParse(LocationStatus3.Value, out int locationStatus3))
{
if (locationStatus3 == 1)
{
this.bor_location03.Background = Brushes.Red;
}
else if (locationStatus3 == 2)
{
this.bor_location03.Background = Brushes.Green;
}
else if (locationStatus3 == 0)
{
this.bor_location03.Background = Brushes.Gray;
}
}
}
var LocationStatus4 = Self[StationProps.LocationStatus4.ToString()];
if (LocationStatus1 != null)
{
if (int.TryParse(LocationStatus4.Value, out int locationStatus4))
{
if (locationStatus4 == 1)
{
bor_location04.Background = Brushes.Red;
}
else if (locationStatus4 == 2)
{
this.bor_location04.Background = Brushes.Green;
}
else if (locationStatus4 == 0)
{
this.bor_location04.Background = Brushes.Gray;
}
}
}
}
}
}