Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
SmartShelf
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 11b90637
由
LN
编写于
2020-04-22 14:27:12 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
rest/api/v1/shelf/allPosOff?color=green 指定灭灯的颜色,如果为空,所有灯全部熄灭
1 个父辈
9a53769b
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
145 行增加
和
83 行删除
DeviceLibrary/DeviceLibrary/led/BaseLEDManager.cs
DeviceLibrary/manager/BOXManager.cs
SmartShelf/FrmStore.Designer.cs
SmartShelf/FrmStore.cs
DeviceLibrary/DeviceLibrary/led/BaseLEDManager.cs
查看文件 @
11b9063
...
@@ -154,6 +154,7 @@ namespace SmartShelf.DeviceLibrary
...
@@ -154,6 +154,7 @@ namespace SmartShelf.DeviceLibrary
public
class
Light
public
class
Light
{
{
public
static
string
defaultColor
=
"green"
;
public
static
byte
defaultR
=
0
;
public
static
byte
defaultR
=
0
;
public
static
byte
defaultG
=
50
;
public
static
byte
defaultG
=
50
;
public
static
byte
defaultB
=
0
;
public
static
byte
defaultB
=
0
;
...
...
DeviceLibrary/manager/BOXManager.cs
查看文件 @
11b9063
...
@@ -14,19 +14,37 @@ namespace SmartShelf.DeviceLibrary
...
@@ -14,19 +14,37 @@ namespace SmartShelf.DeviceLibrary
public
class
BOXManager
public
class
BOXManager
{
{
private
static
int
ServerPort
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ServerPort
);
private
static
int
ServerPort
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ServerPort
);
private
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
System
.
Reflection
.
MethodBase
.
GetCurrentMethod
().
DeclaringType
);
//
private static readonly ILog LOGGER = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public
static
string
BoxName
=
"单色灯料架"
;
public
static
string
BoxName
=
"单色灯料架"
;
public
static
string
CID
=
""
;
public
static
string
CID
=
""
;
private
static
System
.
Timers
.
Timer
timersTimer
;
private
static
System
.
Timers
.
Timer
timersTimer
;
private
static
bool
isInit
=
false
;
private
static
bool
isInit
=
false
;
public
static
string
WarnMsg
=
""
;
public
static
string
WarnMsg
=
""
;
public
static
Dictionary
<
string
,
BoxPosition
>
PositionMap
=
null
;
public
static
Dictionary
<
string
,
BoxPosition
>
PositionMap
=
null
;
public
static
int
BoxCount
=
1
;
public
static
int
BoxCount
=
1
;
p
ublic
static
Dictionary
<
string
,
int
>
StatusMap
=
new
Dictionary
<
string
,
int
>();
p
rivate
static
Dictionary
<
string
,
string
>
StatusColorMap
=
new
Dictionary
<
string
,
string
>();
public
static
bool
IsRun
=
false
;
public
static
bool
IsRun
=
false
;
public
static
string
GetPosIdColor
(
string
posId
)
{
if
(
StatusColorMap
.
ContainsKey
(
posId
))
{
return
StatusColorMap
[
posId
];
}
return
""
;
}
public
static
void
UpdatePosIdColor
(
string
posId
,
string
color
=
""
)
{
if
(
StatusColorMap
.
ContainsKey
(
posId
))
{
StatusColorMap
[
posId
]
=
color
;
}
else
{
StatusColorMap
.
Add
(
posId
,
color
);
}
}
public
static
bool
StartInit
()
public
static
bool
StartInit
()
{
{
try
try
...
@@ -54,14 +72,14 @@ namespace SmartShelf.DeviceLibrary
...
@@ -54,14 +72,14 @@ namespace SmartShelf.DeviceLibrary
return
false
;
return
false
;
}
}
LEDManager
.
deviceMap
=
new
Dictionary
<
string
,
LEDBaseModule
>();
LEDManager
.
deviceMap
=
new
Dictionary
<
string
,
LEDBaseModule
>();
Status
Map
=
new
Dictionary
<
string
,
int
>();
Status
ColorMap
=
new
Dictionary
<
string
,
string
>();
foreach
(
BoxPosition
box
in
PositionMap
.
Values
)
foreach
(
BoxPosition
box
in
PositionMap
.
Values
)
{
{
if
(!
LEDManager
.
deviceMap
.
ContainsKey
(
box
.
DeviceIp
))
if
(!
LEDManager
.
deviceMap
.
ContainsKey
(
box
.
DeviceIp
))
{
{
LEDManager
.
deviceMap
.
Add
(
box
.
DeviceIp
,
LEDBaseModule
.
GetModule
(
box
.
DeviceIp
));
LEDManager
.
deviceMap
.
Add
(
box
.
DeviceIp
,
LEDBaseModule
.
GetModule
(
box
.
DeviceIp
));
}
}
Status
Map
.
Add
(
box
.
PositionNum
,
-
1
);
Status
ColorMap
.
Add
(
box
.
PositionNum
,
""
);
}
}
CID
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_CID
);
CID
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Store_CID
);
...
@@ -87,7 +105,7 @@ namespace SmartShelf.DeviceLibrary
...
@@ -87,7 +105,7 @@ namespace SmartShelf.DeviceLibrary
{
{
timersTimer
=
new
System
.
Timers
.
Timer
();
timersTimer
=
new
System
.
Timers
.
Timer
();
timersTimer
.
Enabled
=
false
;
timersTimer
.
Enabled
=
false
;
timersTimer
.
Interval
=
2
00
;
timersTimer
.
Interval
=
10
00
;
timersTimer
.
Elapsed
+=
timersTimer_Elapsed
;
timersTimer
.
Elapsed
+=
timersTimer_Elapsed
;
timersTimer
.
AutoReset
=
true
;
timersTimer
.
AutoReset
=
true
;
isInit
=
true
;
isInit
=
true
;
...
@@ -97,10 +115,10 @@ namespace SmartShelf.DeviceLibrary
...
@@ -97,10 +115,10 @@ namespace SmartShelf.DeviceLibrary
public
static
bool
StartRun
()
public
static
bool
StartRun
()
{
{
ServerPort
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ServerPort
);
ServerPort
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
ServerPort
);
LogUtil
.
info
(
LOGGER
,
BoxName
+
"开始启动:"
+
DateTime
.
Now
.
ToString
()
+
"!"
);
LogUtil
.
info
(
BoxName
+
"开始启动:"
+
DateTime
.
Now
.
ToString
()
+
"!"
);
timersTimer
.
Enabled
=
true
;
timersTimer
.
Enabled
=
true
;
IsRun
=
true
;
IsRun
=
true
;
LEDManager
.
OpenStatusLights
(
"green"
);
LEDManager
.
OpenStatusLights
(
"green"
);
HttpServer
.
Start
(
ServerOnReceived
,
ServerPort
);
HttpServer
.
Start
(
ServerOnReceived
,
ServerPort
);
LogUtil
.
info
(
"启动服务完成,ServerPort【"
+
ServerPort
+
"】"
);
LogUtil
.
info
(
"启动服务完成,ServerPort【"
+
ServerPort
+
"】"
);
return
true
;
return
true
;
...
@@ -110,14 +128,14 @@ namespace SmartShelf.DeviceLibrary
...
@@ -110,14 +128,14 @@ namespace SmartShelf.DeviceLibrary
{
{
//关闭串口
//关闭串口
timersTimer
.
Enabled
=
false
;
timersTimer
.
Enabled
=
false
;
foreach
(
LEDBaseModule
led
in
LEDManager
.
deviceMap
.
Values
)
foreach
(
LEDBaseModule
led
in
LEDManager
.
deviceMap
.
Values
)
{
{
led
.
AllLightOff
();
led
.
AllLightOff
();
}
}
LEDManager
.
CloseStatusLights
();
LEDManager
.
CloseStatusLights
();
HttpServer
.
Stop
();
HttpServer
.
Stop
();
IsRun
=
false
;
IsRun
=
false
;
LogUtil
.
info
(
LOGGER
,
BoxName
+
"停止运行,时间"
+
DateTime
.
Now
.
ToShortTimeString
()
+
"!"
);
LogUtil
.
info
(
BoxName
+
"停止运行,时间"
+
DateTime
.
Now
.
ToShortTimeString
()
+
"!"
);
}
}
protected
static
void
timersTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
protected
static
void
timersTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
...
@@ -126,11 +144,13 @@ namespace SmartShelf.DeviceLibrary
...
@@ -126,11 +144,13 @@ namespace SmartShelf.DeviceLibrary
{
{
//判断是否需要亮黄灯
//判断是否需要亮黄灯
List
<
string
>
openLeds
=
new
List
<
string
>();
List
<
string
>
openLeds
=
new
List
<
string
>();
foreach
(
string
key
in
StatusMap
.
Keys
)
foreach
(
string
key
in
Status
Color
Map
.
Keys
)
{
{
if
(
StatusMap
[
key
].
Equals
(
1
))
string
color
=
GetPosIdColor
(
key
);
if
(!
String
.
IsNullOrEmpty
(
color
))
{
{
openLeds
.
Add
(
key
);
openLeds
.
Add
(
key
);
break
;
}
}
}
}
if
(
openLeds
.
Count
>
0
)
if
(
openLeds
.
Count
>
0
)
...
@@ -160,6 +180,7 @@ namespace SmartShelf.DeviceLibrary
...
@@ -160,6 +180,7 @@ namespace SmartShelf.DeviceLibrary
public
static
string
Path_ledOffAll
=
"/rest/api/v1/shelf/allPosOff"
;
public
static
string
Path_ledOffAll
=
"/rest/api/v1/shelf/allPosOff"
;
public
static
string
Param_posId
=
"posId"
;
public
static
string
Param_posId
=
"posId"
;
public
static
string
Param_color
=
"color"
;
public
static
char
PosId_SpiltChar
=
';'
;
public
static
char
PosId_SpiltChar
=
';'
;
public
static
char
PosId_Color_SpiltChar
=
'@'
;
public
static
char
PosId_Color_SpiltChar
=
'@'
;
...
@@ -167,12 +188,13 @@ namespace SmartShelf.DeviceLibrary
...
@@ -167,12 +188,13 @@ namespace SmartShelf.DeviceLibrary
// 关灯:http:/localhost:80/rest/api/v1/shelf/posOff?posId=1_3_1;1_3_2;1_3_4
// 关灯:http:/localhost:80/rest/api/v1/shelf/posOff?posId=1_3_1;1_3_2;1_3_4
//关闭所有:http:/localhost:80/rest/api/v1/shelf/allPosOn
//关闭所有:http:/localhost:80/rest/api/v1/shelf/allPosOn
//打开所有:http:/localhost:80/rest/api/v1/shelf/allPosOff
//打开所有:http:/localhost:80/rest/api/v1/shelf/allPosOff
//rest/api/v1/shelf/allPosOff? color = green 指定灭灯的颜色,如果为空,所有灯全部熄灭
private
static
string
ServerOnReceived
(
string
reqPath
,
string
paramStr
)
private
static
string
ServerOnReceived
(
string
reqPath
,
string
paramStr
)
{
{
try
try
{
{
Dictionary
<
string
,
string
>
paramMap
=
GetParam
(
paramStr
);
Dictionary
<
string
,
string
>
paramMap
=
GetParam
(
paramStr
);
string
msg
=
": conot find param "
+
Param_posId
;
string
msg
=
": conot find param "
+
Param_posId
;
if
(
reqPath
.
Equals
(
Path_LedOn
))
if
(
reqPath
.
Equals
(
Path_LedOn
))
{
{
if
(
paramMap
.
ContainsKey
(
Param_posId
))
if
(
paramMap
.
ContainsKey
(
Param_posId
))
...
@@ -183,7 +205,7 @@ namespace SmartShelf.DeviceLibrary
...
@@ -183,7 +205,7 @@ namespace SmartShelf.DeviceLibrary
}
}
else
else
{
{
return
GetResult
(
false
,
"posOn"
)+
msg
;
return
GetResult
(
false
,
"posOn"
)
+
msg
;
}
}
}
}
else
if
(
reqPath
.
Equals
(
Path_LedOff
))
else
if
(
reqPath
.
Equals
(
Path_LedOff
))
...
@@ -206,7 +228,17 @@ namespace SmartShelf.DeviceLibrary
...
@@ -206,7 +228,17 @@ namespace SmartShelf.DeviceLibrary
}
}
else
if
(
reqPath
.
Equals
(
Path_ledOffAll
))
else
if
(
reqPath
.
Equals
(
Path_ledOffAll
))
{
{
bool
result
=
ProcessCloseAll
();
bool
result
=
true
;
string
color
=
""
;
if
(
paramMap
.
ContainsKey
(
Param_color
)
&&
(
paramMap
[
Param_color
]
!=
""
))
{
color
=
paramMap
[
Param_color
];
result
=
ProcessCloseByColor
(
color
);
}
else
{
result
=
ProcessCloseAll
();
}
return
GetResult
(
result
,
"allPosOff"
);
return
GetResult
(
result
,
"allPosOff"
);
}
}
else
else
...
@@ -284,16 +316,16 @@ namespace SmartShelf.DeviceLibrary
...
@@ -284,16 +316,16 @@ namespace SmartShelf.DeviceLibrary
}
}
if
(
String
.
IsNullOrEmpty
(
ip
)
||
pIP
.
Equals
(
ip
))
if
(
String
.
IsNullOrEmpty
(
ip
)
||
pIP
.
Equals
(
ip
))
{
{
StatusMap
[
key
]
=
1
;
UpdatePosIdColor
(
key
,
Light
.
defaultColor
)
;
}
}
}
}
return
true
;
return
true
;
}
}
public
static
bool
ProcessCloseAll
(
string
proMsg
=
"Revice "
,
string
ip
=
""
)
public
static
bool
ProcessCloseAll
(
string
proMsg
=
"Revice "
,
string
ip
=
""
)
{
{
LogUtil
.
info
(
BoxName
+
proMsg
+
" closeAll命令:"
);
LogUtil
.
info
(
BoxName
+
proMsg
+
" closeAll命令:"
);
List
<
string
>
posIdList
=
new
List
<
string
>(
PositionMap
.
Keys
);
List
<
string
>
posIdList
=
new
List
<
string
>(
PositionMap
.
Keys
);
foreach
(
LEDBaseModule
led
in
LEDManager
.
deviceMap
.
Values
)
foreach
(
LEDBaseModule
led
in
LEDManager
.
deviceMap
.
Values
)
{
{
if
(
String
.
IsNullOrEmpty
(
ip
)
||
led
.
ModuleIP
.
Equals
(
ip
))
if
(
String
.
IsNullOrEmpty
(
ip
)
||
led
.
ModuleIP
.
Equals
(
ip
))
{
{
...
@@ -309,7 +341,31 @@ namespace SmartShelf.DeviceLibrary
...
@@ -309,7 +341,31 @@ namespace SmartShelf.DeviceLibrary
}
}
if
(
String
.
IsNullOrEmpty
(
ip
)
||
pIP
.
Equals
(
ip
))
if
(
String
.
IsNullOrEmpty
(
ip
)
||
pIP
.
Equals
(
ip
))
{
{
StatusMap
[
key
]
=
0
;
UpdatePosIdColor
(
key
);
}
}
return
true
;
}
public
static
bool
ProcessCloseByColor
(
string
color
,
string
proMsg
=
"Revice "
,
string
ip
=
""
)
{
LogUtil
.
info
(
BoxName
+
proMsg
+
" ProcessCloseByColor 命令:"
+
color
);
List
<
string
>
posIdList
=
new
List
<
string
>(
PositionMap
.
Keys
);
foreach
(
LEDBaseModule
led
in
LEDManager
.
deviceMap
.
Values
)
{
if
(
String
.
IsNullOrEmpty
(
ip
)
||
led
.
ModuleIP
.
Equals
(
ip
))
{
led
.
AllLightOff
();
}
}
foreach
(
string
key
in
posIdList
)
{
string
status
=
GetPosIdColor
(
key
);
if
(
status
.
ToLower
().
Equals
(
color
.
ToLower
()))
{
BoxPosition
position
=
PositionMap
[
key
];
LEDManager
.
GetLedModule
(
position
.
DeviceIp
).
LightOff
(
Light
.
GetLights
(
position
.
DmxId
,
position
.
GetLedList
(),
0
));
UpdatePosIdColor
(
key
);
}
}
}
}
return
true
;
return
true
;
...
@@ -323,7 +379,7 @@ namespace SmartShelf.DeviceLibrary
...
@@ -323,7 +379,7 @@ namespace SmartShelf.DeviceLibrary
foreach
(
string
posStr
in
posArray
)
foreach
(
string
posStr
in
posArray
)
{
{
string
posid
=
posStr
;
string
posid
=
posStr
;
string
color
=
"Green"
;
string
color
=
Light
.
defaultColor
;
if
(
posStr
.
Contains
(
PosId_Color_SpiltChar
))
if
(
posStr
.
Contains
(
PosId_Color_SpiltChar
))
{
{
string
[]
posInfos
=
posStr
.
Split
(
PosId_Color_SpiltChar
);
string
[]
posInfos
=
posStr
.
Split
(
PosId_Color_SpiltChar
);
...
@@ -336,7 +392,8 @@ namespace SmartShelf.DeviceLibrary
...
@@ -336,7 +392,8 @@ namespace SmartShelf.DeviceLibrary
BoxPosition
position
=
PositionMap
[
posid
];
BoxPosition
position
=
PositionMap
[
posid
];
Light
[]
lights
=
Light
.
GetLights
(
position
.
DmxId
,
color
,
position
.
GetLedList
().
ToArray
());
Light
[]
lights
=
Light
.
GetLights
(
position
.
DmxId
,
color
,
position
.
GetLedList
().
ToArray
());
LEDManager
.
GetLedModule
(
position
.
DeviceIp
).
LightOn
(
lights
);
LEDManager
.
GetLedModule
(
position
.
DeviceIp
).
LightOn
(
lights
);
StatusMap
[
posid
]
=
1
;
UpdatePosIdColor
(
posid
,
color
);
}
}
else
else
{
{
...
@@ -370,8 +427,9 @@ namespace SmartShelf.DeviceLibrary
...
@@ -370,8 +427,9 @@ namespace SmartShelf.DeviceLibrary
if
(
PositionMap
.
ContainsKey
(
posName
))
if
(
PositionMap
.
ContainsKey
(
posName
))
{
{
BoxPosition
position
=
PositionMap
[
posName
];
BoxPosition
position
=
PositionMap
[
posName
];
LEDManager
.
GetLedModule
(
position
.
DeviceIp
).
LightOff
(
Light
.
GetLights
(
position
.
DmxId
,
position
.
GetLedList
(),
0
)
);
LEDManager
.
GetLedModule
(
position
.
DeviceIp
).
LightOff
(
Light
.
GetLights
(
position
.
DmxId
,
position
.
GetLedList
(),
0
));
StatusMap
[
posName
]
=
0
;
// StatusColorMap[posName] = "";
UpdatePosIdColor
(
posName
);
}
}
else
else
{
{
...
...
SmartShelf/FrmStore.Designer.cs
查看文件 @
11b9063
...
@@ -32,9 +32,7 @@
...
@@ -32,9 +32,7 @@
System
.
ComponentModel
.
ComponentResourceManager
resources
=
new
System
.
ComponentModel
.
ComponentResourceManager
(
typeof
(
FrmSMStore
));
System
.
ComponentModel
.
ComponentResourceManager
resources
=
new
System
.
ComponentModel
.
ComponentResourceManager
(
typeof
(
FrmSMStore
));
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
button5
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
lblAddr
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btnCloseSLed
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOpenSLed
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
cmbNum
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
cmbNum
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
txtDmxId
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtDmxId
=
new
System
.
Windows
.
Forms
.
TextBox
();
...
@@ -48,6 +46,9 @@
...
@@ -48,6 +46,9 @@
this
.
label5
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label5
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
cmbPositionList
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
cmbPositionList
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
label10
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label10
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
button5
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnCloseSLed
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOpenSLed
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label4
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label4
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
numYu
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
this
.
numYu
=
new
System
.
Windows
.
Forms
.
NumericUpDown
();
...
@@ -73,7 +74,6 @@
...
@@ -73,7 +74,6 @@
this
.
btOAll
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btOAll
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
txtIp2
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtIp2
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
label6
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label6
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblAddr
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numYu
)).
BeginInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numYu
)).
BeginInit
();
...
@@ -116,38 +116,14 @@
...
@@ -116,38 +116,14 @@
this
.
groupBox2
.
TabStop
=
false
;
this
.
groupBox2
.
TabStop
=
false
;
this
.
groupBox2
.
Text
=
"库位操作测试"
;
this
.
groupBox2
.
Text
=
"库位操作测试"
;
//
//
// button5
// lblAddr
//
this
.
button5
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
button5
.
Location
=
new
System
.
Drawing
.
Point
(
127
,
21
);
this
.
button5
.
Name
=
"button5"
;
this
.
button5
.
Size
=
new
System
.
Drawing
.
Size
(
95
,
35
);
this
.
button5
.
TabIndex
=
112
;
this
.
button5
.
Text
=
"亮黄灯"
;
this
.
button5
.
UseVisualStyleBackColor
=
true
;
this
.
button5
.
Click
+=
new
System
.
EventHandler
(
this
.
button5_Click
);
//
// btnCloseSLed
//
this
.
btnCloseSLed
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnCloseSLed
.
Location
=
new
System
.
Drawing
.
Point
(
228
,
21
);
this
.
btnCloseSLed
.
Name
=
"btnCloseSLed"
;
this
.
btnCloseSLed
.
Size
=
new
System
.
Drawing
.
Size
(
95
,
35
);
this
.
btnCloseSLed
.
TabIndex
=
111
;
this
.
btnCloseSLed
.
Text
=
"关闭灯"
;
this
.
btnCloseSLed
.
UseVisualStyleBackColor
=
true
;
this
.
btnCloseSLed
.
Click
+=
new
System
.
EventHandler
(
this
.
btnCloseSLed_Click
);
//
// btnOpenSLed
//
//
this
.
btnOpenSLed
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lblAddr
.
AutoSize
=
true
;
this
.
btnOpenSLed
.
Location
=
new
System
.
Drawing
.
Point
(
26
,
21
);
this
.
lblAddr
.
Location
=
new
System
.
Drawing
.
Point
(
232
,
112
);
this
.
btnOpenSLed
.
Name
=
"btnOpenSLed"
;
this
.
lblAddr
.
Name
=
"lblAddr"
;
this
.
btnOpenSLed
.
Size
=
new
System
.
Drawing
.
Size
(
95
,
35
);
this
.
lblAddr
.
Size
=
new
System
.
Drawing
.
Size
(
0
,
17
);
this
.
btnOpenSLed
.
TabIndex
=
110
;
this
.
lblAddr
.
TabIndex
=
113
;
this
.
btnOpenSLed
.
Text
=
"亮绿灯"
;
this
.
lblAddr
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
btnOpenSLed
.
UseVisualStyleBackColor
=
true
;
this
.
btnOpenSLed
.
Click
+=
new
System
.
EventHandler
(
this
.
btnOpenSLed_Click
);
//
//
// cmbNum
// cmbNum
//
//
...
@@ -283,6 +259,39 @@
...
@@ -283,6 +259,39 @@
this
.
label10
.
Text
=
"库位列表:"
;
this
.
label10
.
Text
=
"库位列表:"
;
this
.
label10
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label10
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
//
//
// button5
//
this
.
button5
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
button5
.
Location
=
new
System
.
Drawing
.
Point
(
127
,
21
);
this
.
button5
.
Name
=
"button5"
;
this
.
button5
.
Size
=
new
System
.
Drawing
.
Size
(
95
,
35
);
this
.
button5
.
TabIndex
=
112
;
this
.
button5
.
Text
=
"亮黄灯"
;
this
.
button5
.
UseVisualStyleBackColor
=
true
;
this
.
button5
.
Click
+=
new
System
.
EventHandler
(
this
.
button5_Click
);
//
// btnCloseSLed
//
this
.
btnCloseSLed
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnCloseSLed
.
Location
=
new
System
.
Drawing
.
Point
(
228
,
21
);
this
.
btnCloseSLed
.
Name
=
"btnCloseSLed"
;
this
.
btnCloseSLed
.
Size
=
new
System
.
Drawing
.
Size
(
95
,
35
);
this
.
btnCloseSLed
.
TabIndex
=
111
;
this
.
btnCloseSLed
.
Text
=
"关闭灯"
;
this
.
btnCloseSLed
.
UseVisualStyleBackColor
=
true
;
this
.
btnCloseSLed
.
Click
+=
new
System
.
EventHandler
(
this
.
btnCloseSLed_Click
);
//
// btnOpenSLed
//
this
.
btnOpenSLed
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnOpenSLed
.
Location
=
new
System
.
Drawing
.
Point
(
26
,
21
);
this
.
btnOpenSLed
.
Name
=
"btnOpenSLed"
;
this
.
btnOpenSLed
.
Size
=
new
System
.
Drawing
.
Size
(
95
,
35
);
this
.
btnOpenSLed
.
TabIndex
=
110
;
this
.
btnOpenSLed
.
Text
=
"亮绿灯"
;
this
.
btnOpenSLed
.
UseVisualStyleBackColor
=
true
;
this
.
btnOpenSLed
.
Click
+=
new
System
.
EventHandler
(
this
.
btnOpenSLed_Click
);
//
// label3
// label3
//
//
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
AutoSize
=
true
;
...
@@ -389,6 +398,7 @@
...
@@ -389,6 +398,7 @@
this
.
panel1
.
AutoScroll
=
true
;
this
.
panel1
.
AutoScroll
=
true
;
this
.
panel1
.
Controls
.
Add
(
this
.
lblLedInfo
);
this
.
panel1
.
Controls
.
Add
(
this
.
lblLedInfo
);
this
.
panel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
panel1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
panel1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
22
);
this
.
panel1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
22
);
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Name
=
"panel1"
;
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
734
,
772
);
this
.
panel1
.
Size
=
new
System
.
Drawing
.
Size
(
734
,
772
);
...
@@ -396,14 +406,16 @@
...
@@ -396,14 +406,16 @@
//
//
// lblLedInfo
// lblLedInfo
//
//
this
.
lblLedInfo
.
AutoSize
=
true
;
this
.
lblLedInfo
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
this
.
lblLedInfo
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Bold
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
this
.
lblLedInfo
.
ForeColor
=
System
.
Drawing
.
Color
.
Green
;
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
lblLedInfo
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
16
);
this
.
lblLedInfo
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lblLedInfo
.
ForeColor
=
System
.
Drawing
.
Color
.
Blue
;
this
.
lblLedInfo
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
6
);
this
.
lblLedInfo
.
Name
=
"lblLedInfo"
;
this
.
lblLedInfo
.
Name
=
"lblLedInfo"
;
this
.
lblLedInfo
.
Size
=
new
System
.
Drawing
.
Size
(
51
,
19
);
this
.
lblLedInfo
.
Size
=
new
System
.
Drawing
.
Size
(
728
,
765
);
this
.
lblLedInfo
.
TabIndex
=
0
;
this
.
lblLedInfo
.
TabIndex
=
0
;
this
.
lblLedInfo
.
Text
=
"
label3
"
;
this
.
lblLedInfo
.
Text
=
"
?
"
;
//
//
// groupTest
// groupTest
//
//
...
@@ -574,15 +586,6 @@
...
@@ -574,15 +586,6 @@
this
.
label6
.
Text
=
"模块IP:"
;
this
.
label6
.
Text
=
"模块IP:"
;
this
.
label6
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
this
.
label6
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
//
//
// lblAddr
//
this
.
lblAddr
.
AutoSize
=
true
;
this
.
lblAddr
.
Location
=
new
System
.
Drawing
.
Point
(
232
,
112
);
this
.
lblAddr
.
Name
=
"lblAddr"
;
this
.
lblAddr
.
Size
=
new
System
.
Drawing
.
Size
(
0
,
17
);
this
.
lblAddr
.
TabIndex
=
113
;
this
.
lblAddr
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleRight
;
//
// groupBox3
// groupBox3
//
//
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnOpenSLed
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
btnOpenSLed
);
...
@@ -619,7 +622,6 @@
...
@@ -619,7 +622,6 @@
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numYu
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
numYu
)).
EndInit
();
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
groupBox1
.
ResumeLayout
(
false
);
this
.
panel1
.
ResumeLayout
(
false
);
this
.
panel1
.
ResumeLayout
(
false
);
this
.
panel1
.
PerformLayout
();
this
.
groupTest
.
ResumeLayout
(
false
);
this
.
groupTest
.
ResumeLayout
(
false
);
this
.
groupTest
.
PerformLayout
();
this
.
groupTest
.
PerformLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
trackBar3
)).
EndInit
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
trackBar3
)).
EndInit
();
...
...
SmartShelf/FrmStore.cs
查看文件 @
11b9063
...
@@ -98,19 +98,20 @@ namespace SmartShelf
...
@@ -98,19 +98,20 @@ namespace SmartShelf
foreach
(
BoxPosition
p
in
positions
)
foreach
(
BoxPosition
p
in
positions
)
{
{
int
status
=
BOXManager
.
StatusMap
[
p
.
PositionNum
]
;
string
status
=
BOXManager
.
GetPosIdColor
(
p
.
PositionNum
)
;
str
+=
status
.
ToString
();
str
+=
status
.
ToString
();
if
(
status
.
Equals
(
1
))
if
(
!
String
.
IsNullOrEmpty
(
status
))
{
{
num
++;
num
++;
int
length
=
p
.
PositionNum
.
Length
;
int
length
=
p
.
PositionNum
.
Length
;
if
((
num
%
10
).
Equals
(
0
))
//if ((num % 10).Equals(0))
//{
// msg += p.PositionNum.PadLeft(24 - length, ' ') +"["+status+"]"+ "\r\n ";
//}
//else
{
{
msg
+=
p
.
PositionNum
.
PadLeft
(
24
-
length
,
' '
)
+
"\r\n "
;
msg
+=
p
.
PositionNum
.
PadLeft
(
20
-
length
,
' '
)+
"["
+
status
+
"]"
;
}
else
{
msg
+=
p
.
PositionNum
.
PadLeft
(
24
-
length
,
' '
);
}
}
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论