Form1.cs
3.77 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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LedHelper
{
public partial class Form1 : Form
{
LEDhelp.LEDHelper leftLED;
LEDhelp.LEDHelper rightLED;
public Form1()
{
InitializeComponent();
}
private void initLED()
{
string leftLedIP = ConfigurationManager.AppSettings["LeftLedIP"];
string rightLedIP = ConfigurationManager.AppSettings["RightLedIP"];
int ledPort = Convert.ToInt32(ConfigurationManager.AppSettings["ledPort"]);
leftLED = new LEDhelp.LEDHelper(leftLedIP, (uint)ledPort, 1);
rightLED = new LEDhelp.LEDHelper(rightLedIP, (uint)ledPort, 1);
}
private void sendLedInfo(int direction, int color, String sendText)
{
if (color == LEDhelp.LEDHelper.GREEN)
{
sendText = "\\C2" + sendText;
}
else if (color == LEDhelp.LEDHelper.YELLOW)
{
sendText = "\\C3" + sendText;
}
else
{
sendText = "\\C1" + sendText;
}
if (direction == LEDhelp.LEDHelper.RIGHT)
{
rightLED.SendLedInfo(sendText);
}
else
{
leftLED.SendLedInfo(sendText);
}
}
private void SCREEN_ForceOnOff(int direction, byte status)
{
if (direction == LEDhelp.LEDHelper.RIGHT)
{
rightLED.SCREEN_ForceOnOff(status);
}
else
{
leftLED.SCREEN_ForceOnOff(status);
}
}
// value 0-15 值越大亮度越大
public void setBrightness(int direction, byte value)
{
if (direction == LEDhelp.LEDHelper.RIGHT)
{
rightLED.setBrightness(1, value, null);
}
else
{
leftLED.setBrightness(1, value, null);
}
}
public void SCREEN_DelDynamicArea(int direction, byte DeleteAreaId)
{
if (direction == LEDhelp.LEDHelper.RIGHT)
{
rightLED.SCREEN_DelDynamicArea(DeleteAreaId);
}
else
{
leftLED.SCREEN_DelDynamicArea(DeleteAreaId);
}
}
private void button1_Click(object sender, EventArgs e)
{
string sendText = string.Format("任务类型:整盘入库\\n托盘条码:P00010\\n仓位:L-001-002-002-000\\n物料:2001020401,10\\n物料:2001020402,10\\n物料:2001020403,100\\n物料:2001020404,100");
SCREEN_ForceOnOff(LEDhelp.LEDHelper.LEFT, LEDhelp.LEDHelper.OPEN);
SCREEN_DelDynamicArea(LEDhelp.LEDHelper.LEFT, 0);
sendLedInfo(LEDhelp.LEDHelper.LEFT, LEDhelp.LEDHelper.GREEN, sendText);
setBrightness(LEDhelp.LEDHelper.LEFT, 10);
}
private void button2_Click(object sender, EventArgs e)
{
string sendText = string.Format("任务类型:整盘入库\\n托盘条码:P00010\\n仓位:L-001-002-002-000\\n物料:2001020401,10\\n物料:2001020402,10\\n物料:2001020403,100\\n物料:2001020404,100");
SCREEN_ForceOnOff(LEDhelp.LEDHelper.RIGHT, LEDhelp.LEDHelper.OPEN);
SCREEN_DelDynamicArea(LEDhelp.LEDHelper.RIGHT, 0);
sendLedInfo(LEDhelp.LEDHelper.RIGHT, LEDhelp.LEDHelper.RED, sendText);
setBrightness(LEDhelp.LEDHelper.RIGHT, 5);
}
private void label1_Click(object sender, EventArgs e)
{
}
}
}