Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1057_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 8fd26869
由
张东亮
编写于
2023-02-20 17:14:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
添加称重
1 个父辈
233b9f3d
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
372 行增加
和
69 行删除
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/BSQController.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
DeviceLibrary/theMachine/RobotManage.cs
TheMachine/Form1.Designer.cs
TheMachine/Form1.cs
TheMachine/SettingControl.Designer.cs
TheMachine/SettingControl.cs
TheMachine/UC/ConfigControl.designer.cs
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
8fd2686
...
@@ -83,6 +83,7 @@
...
@@ -83,6 +83,7 @@
<Compile Include="DeviceLibrary\LiftMonitor.cs" />
<Compile Include="DeviceLibrary\LiftMonitor.cs" />
<Compile Include="DeviceLibrary\LineRunMonitor.cs" />
<Compile Include="DeviceLibrary\LineRunMonitor.cs" />
<Compile Include="DeviceLibrary\C8WeightSensor.cs" />
<Compile Include="DeviceLibrary\C8WeightSensor.cs" />
<Compile Include="DeviceLibrary\BSQController.cs" />
<Compile Include="DeviceLibrary\OKLEController.cs" />
<Compile Include="DeviceLibrary\OKLEController.cs" />
<Compile Include="DeviceLibrary\ServerCommunication.cs" />
<Compile Include="DeviceLibrary\ServerCommunication.cs" />
<Compile Include="theMachine\AxisBean.cs" />
<Compile Include="theMachine\AxisBean.cs" />
...
...
DeviceLibrary/DeviceLibrary/BSQController.cs
0 → 100644
查看文件 @
8fd2686
using
DeviceLibrary
;
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.IO.Ports
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
static
OnlineStore
.
NetTCPServer
;
public
class
BSQController
{
private
static
int
bautRate
=
9600
;
//波特率
private
static
Parity
parity
=
Parity
.
None
;
//校验位
private
static
int
dataBits
=
8
;
//数据位
private
static
StopBits
stopBits
=
StopBits
.
One
;
//停止位
private
static
Dictionary
<
string
,
AcSerialBean
>
SerialMap
=
new
Dictionary
<
string
,
AcSerialBean
>();
private
static
Dictionary
<
string
,
double
>
ValueBuffer
=
new
Dictionary
<
string
,
double
>();
private
static
string
LogName
=
""
;
private
static
AcSerialBean
GetSerialBean
(
string
port
)
{
if
(
SerialMap
.
ContainsKey
(
port
))
{
return
SerialMap
[
port
];
}
return
null
;
}
public
static
void
OpenAll
(
string
[]
ports
)
{
foreach
(
string
port
in
ports
)
{
Init
(
port
);
}
}
public
static
bool
Init
(
string
port
)
{
if
(
SerialMap
.
ContainsKey
(
port
))
{
return
true
;
}
LogName
=
"[BSQ_"
+
port
+
"]"
;
if
(!
ValueBuffer
.
ContainsKey
(
port
))
ValueBuffer
.
Add
(
port
,
0
);
AcSerialBean
sb
=
new
AcSerialBean
(
port
,
bautRate
,
parity
,
dataBits
,
stopBits
);
try
{
if
(
sb
.
openPort
())
{
if
(
SerialMap
.
ContainsKey
(
port
))
{
SerialMap
.
Remove
(
port
);
}
SerialMap
.
Add
(
port
,
sb
);
return
true
;
}
else
{
LogUtil
.
error
(
LogName
+
"串口打开失败!"
);
return
false
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
LogName
+
"打开出错:"
+
ex
.
ToString
());
}
return
true
;
}
public
static
bool
IsRun
(
string
port
)
{
if
(
GetSerialBean
(
port
)
!=
null
)
{
return
true
;
}
return
false
;
}
/// <summary>
/// 释放资源
/// </summary>
public
static
void
Release
(
params
string
[]
ports
)
{
if
(
ports
.
Length
<=
0
)
{
ports
=
(
new
List
<
string
>(
SerialMap
.
Keys
)).
ToArray
();
}
foreach
(
string
port
in
ports
)
{
try
{
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
!=
null
)
{
sb
.
closePort
();
}
//IsRun = false;
SerialMap
.
Remove
(
port
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"Release BSQ port ["
+
port
+
"] error :"
+
ex
.
ToString
());
}
}
}
/// <summary>
/// 零点校准
/// 01 06 00 60 00 01 48 14
/// </summary>
/// <returns></returns>
public
static
bool
ZeroCalibration
(
string
port
)
{
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
{
return
false
;
}
if
(!
Monitor
.
TryEnter
(
sb
))
return
false
;
try
{
List
<
byte
>
bytes
=
new
List
<
byte
>();
bytes
.
Add
(
0x01
);
bytes
.
Add
(
0x06
);
bytes
.
Add
(
0
);
bytes
.
Add
(
0x60
);
bytes
.
Add
(
0
);
bytes
.
Add
(
0x01
);
bytes
.
Add
(
0x48
);
bytes
.
Add
(
0x14
);
byte
[]
recvData
=
new
byte
[
8
];
string
str
=
AcSerialBean
.
byteToHexStr
(
bytes
.
ToArray
(),
" "
);
sb
.
SendCommand
(
bytes
.
ToArray
(),
ref
recvData
,
100
,
out
bool
isOk
);
//01 06 00 60 00 01 48 14
if
(
recvData
[
0
]
==
0x01
&&
recvData
[
1
]
==
0x06
&&
recvData
[
3
]
==
0x60
&&
recvData
[
5
]
==
0x01
&&
recvData
[
6
]
==
0x48
&&
recvData
[
7
]
==
0x14
)
{
LogUtil
.
info
(
LogName
+
" 零校准 发送数据:"
+
str
+
",收到数据 :"
+
AcSerialBean
.
byteToHexStr
(
recvData
,
" "
));
return
true
;
}
}
catch
{
}
return
false
;
}
public
static
double
LastWeight
=
0.0
;
public
static
bool
queryData
(
string
port
,
out
double
weight
)
{
weight
=
0
;
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
{
return
false
;
}
if
(!
Monitor
.
TryEnter
(
sb
))
return
false
;
try
{
LogName
=
"[BSQ_"
+
port
+
"]"
;
//12..1.2读取力值(毛重)指令,指令格式:01 03 00 50 00 02 C4 1A
//01 03 00 00 00 02 C4 0B
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x03
;
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
0x00
;
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x01
;
sendData
[
6
]
=
0x84
;
sendData
[
7
]
=
0x0A
;
//sendData = buildCheckData(sendData, sendData.Length - 2);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
,
" "
);
byte
[]
reviceData
=
new
byte
[
7
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
//LogUtil.debug(LogName + "发送数据:" + str + ",收到数据 :" + AcSerialBean.byteToHexStr(reviceData, " "));
bool
recvState
=
getReviceData
(
reviceData
,
out
int
tWeight
);
weight
=
calNetWet
(
tWeight
);
weight
=
weight
>
0
?
weight
:
0
;
LastWeight
=
weight
;
return
recvState
;
}
catch
(
Exception
e
)
{
LogUtil
.
debug
(
LogName
+
e
.
ToString
());
return
false
;
}
finally
{
Monitor
.
Exit
(
sb
);
}
}
static
double
calNetWet
(
int
weight
)
{
return
(
weight
/
10.0
-
RobotManage
.
Config
.
WeightSensorBase
)
*
1.0
;
}
private
static
bool
getReviceData
(
byte
[]
dataArray
,
out
int
value
)
{
value
=
0
;
try
{
//01 03 02 00 00 B8 44
if
(
dataArray
[
0
]
==
0x01
&&
dataArray
[
1
]
==
0x03
&&
dataArray
[
2
]
==
0x02
)
{
byte
[]
bytes
=
new
byte
[]
{
dataArray
[
3
],
dataArray
[
4
]
};
Array
.
Reverse
(
bytes
);
value
=
BitConverter
.
ToInt16
(
bytes
,
0
);
return
true
;
}
}
catch
(
Exception
ex
)
{
LogUtil
.
info
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
false
;
}
private
static
byte
[]
buildCheckData
(
byte
[]
sendData
,
int
length
)
{
ushort
pChecksum
=
0
;
AcSerialBean
.
CalculateCRC
(
sendData
,
length
,
out
pChecksum
);
string
checkStr
=
Convert
.
ToString
(
pChecksum
,
16
);
byte
[]
checkByte
=
AcSerialBean
.
StringToByte
(
checkStr
);
if
(
checkByte
.
Length
==
1
)
{
sendData
[
length
]
=
checkByte
[
0
];
sendData
[
length
+
1
]
=
0x00
;
}
else
{
sendData
[
length
+
1
]
=
checkByte
[
0
];
sendData
[
length
]
=
checkByte
[
1
];
}
return
sendData
;
}
}
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
8fd2686
...
@@ -78,7 +78,7 @@ namespace DeviceLibrary
...
@@ -78,7 +78,7 @@ namespace DeviceLibrary
}
}
).
Where
(
x
=>!
string
.
IsNullOrEmpty
(
x
)));
).
Where
(
x
=>!
string
.
IsNullOrEmpty
(
x
)));
}
}
public
void
SendInStoreRequest
(
string
[]
codelist
,
InOutDevice
inOutDevice
,
bool
printlog
=
false
)
{
public
void
SendInStoreRequest
(
string
[]
codelist
,
InOutDevice
inOutDevice
,
bool
printlog
=
false
,
double
weight
=
0.0
)
{
if
(
RobotManage
.
InoutDebugMode
)
if
(
RobotManage
.
InoutDebugMode
)
return
;
return
;
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
8fd2686
...
@@ -77,16 +77,16 @@ namespace DeviceLibrary
...
@@ -77,16 +77,16 @@ namespace DeviceLibrary
humitureControllers
.
Add
(
hc
);
humitureControllers
.
Add
(
hc
);
}
}
}
}
//if (StoreType == StoreType.TypeA)
//{
if
(
StoreType
==
StoreType
.
TypeA
)
// if (!OKLEController.Init(Config.WeightSensorPort))
{
// {
if
(!
BSQController
.
Init
(
Config
.
WeightSensorPort
))
// IsLoadOk = false;
{
// msg += $"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n";
IsLoadOk
=
false
;
// }
msg
+=
$
"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n"
;
//}
}
}
if
(!
CameraA
.
LoadCameraConfig
(
"CameraA"
,
out
string
errmsg
))
if
(!
CameraA
.
LoadCameraConfig
(
"CameraA"
,
out
string
errmsg
))
{
{
//IsLoadOk = false;
//IsLoadOk = false;
...
@@ -97,17 +97,15 @@ namespace DeviceLibrary
...
@@ -97,17 +97,15 @@ namespace DeviceLibrary
//IsLoadOk = false;
//IsLoadOk = false;
msg
+=
errmsg
+
"\r\n"
;
msg
+=
errmsg
+
"\r\n"
;
}
}
IOManager
.
IOMove
(
IO_Type
.
Device_Led
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Device_Led
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
HIGH
);
LoadFinishEvent
?.
Invoke
(
IsConfigMode
?
IsConfigMode
:
IsLoadOk
,
msg
);
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
LogUtil
.
error
(
ex
.
Message
);
LogUtil
.
error
(
ex
.
Message
+
ex
.
StackTrace
);
return
;
return
;
}
}
LoadFinishEvent
?.
Invoke
(
IsConfigMode
?
IsConfigMode
:
IsLoadOk
,
msg
);
}
}
public
static
void
LoadDebug
()
{
public
static
void
LoadDebug
()
{
LoadFinishEvent
?.
Invoke
(
true
,
"打开调试模式"
);
LoadFinishEvent
?.
Invoke
(
true
,
"打开调试模式"
);
...
@@ -151,6 +149,7 @@ namespace DeviceLibrary
...
@@ -151,6 +149,7 @@ namespace DeviceLibrary
IOManager
.
CloseAllConnection
();
IOManager
.
CloseAllConnection
();
CameraA
.
stopCamera
();
CameraA
.
stopCamera
();
CameraB
.
stopCamera
();
CameraB
.
stopCamera
();
BSQController
.
Release
(
RobotManage
.
Config
.
WeightSensorPort
);
}
}
public
static
void
UserPause
(
bool
userpause
)
public
static
void
UserPause
(
bool
userpause
)
{
{
...
...
TheMachine/Form1.Designer.cs
查看文件 @
8fd2686
...
@@ -63,13 +63,14 @@ namespace TheMachine
...
@@ -63,13 +63,14 @@ namespace TheMachine
// menuStrip1
// menuStrip1
//
//
this
.
menuStrip1
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
menuStrip1
.
BackColor
=
System
.
Drawing
.
Color
.
Transparent
;
this
.
menuStrip1
.
ImageScalingSize
=
new
System
.
Drawing
.
Size
(
20
,
20
);
this
.
menuStrip1
.
Items
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
this
.
menuStrip1
.
Items
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
this
.
设备操作
ToolStripMenuItem
,
this
.
设备操作
ToolStripMenuItem
,
this
.
关于
ToolStripMenuItem
});
this
.
关于
ToolStripMenuItem
});
this
.
menuStrip1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
menuStrip1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
menuStrip1
.
Name
=
"menuStrip1"
;
this
.
menuStrip1
.
Name
=
"menuStrip1"
;
this
.
menuStrip1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
7
,
2
,
0
,
2
);
this
.
menuStrip1
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
7
,
2
,
0
,
2
);
this
.
menuStrip1
.
Size
=
new
System
.
Drawing
.
Size
(
1008
,
29
);
this
.
menuStrip1
.
Size
=
new
System
.
Drawing
.
Size
(
1008
,
35
);
this
.
menuStrip1
.
TabIndex
=
0
;
this
.
menuStrip1
.
TabIndex
=
0
;
this
.
menuStrip1
.
Text
=
"menuStrip1"
;
this
.
menuStrip1
.
Text
=
"menuStrip1"
;
//
//
...
@@ -83,38 +84,38 @@ namespace TheMachine
...
@@ -83,38 +84,38 @@ namespace TheMachine
this
.
退出
ToolStripMenuItem
});
this
.
退出
ToolStripMenuItem
});
this
.
设备操作
ToolStripMenuItem
.
Font
=
new
System
.
Drawing
.
Font
(
"Microsoft YaHei UI"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
设备操作
ToolStripMenuItem
.
Font
=
new
System
.
Drawing
.
Font
(
"Microsoft YaHei UI"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
设备操作
ToolStripMenuItem
.
Name
=
"设备操作ToolStripMenuItem"
;
this
.
设备操作
ToolStripMenuItem
.
Name
=
"设备操作ToolStripMenuItem"
;
this
.
设备操作
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
86
,
25
);
this
.
设备操作
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
106
,
31
);
this
.
设备操作
ToolStripMenuItem
.
Text
=
"设备操作"
;
this
.
设备操作
ToolStripMenuItem
.
Text
=
"设备操作"
;
//
//
// 启用调试模式ToolStripMenuItem
// 启用调试模式ToolStripMenuItem
//
//
this
.
启用调试模式
ToolStripMenuItem
.
Enabled
=
false
;
this
.
启用调试模式
ToolStripMenuItem
.
Enabled
=
false
;
this
.
启用调试模式
ToolStripMenuItem
.
Name
=
"启用调试模式ToolStripMenuItem"
;
this
.
启用调试模式
ToolStripMenuItem
.
Name
=
"启用调试模式ToolStripMenuItem"
;
this
.
启用调试模式
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
192
,
26
);
this
.
启用调试模式
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
238
,
32
);
this
.
启用调试模式
ToolStripMenuItem
.
Text
=
"启用配置模式"
;
this
.
启用调试模式
ToolStripMenuItem
.
Text
=
"启用配置模式"
;
this
.
启用调试模式
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
启用调试模式
ToolStripMenuItem_Click
);
this
.
启用调试模式
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
启用调试模式
ToolStripMenuItem_Click
);
//
//
// toolStripSeparator4
// toolStripSeparator4
//
//
this
.
toolStripSeparator4
.
Name
=
"toolStripSeparator4"
;
this
.
toolStripSeparator4
.
Name
=
"toolStripSeparator4"
;
this
.
toolStripSeparator4
.
Size
=
new
System
.
Drawing
.
Size
(
189
,
6
);
this
.
toolStripSeparator4
.
Size
=
new
System
.
Drawing
.
Size
(
235
,
6
);
//
//
// 二维码识别调试ToolStripMenuItem
// 二维码识别调试ToolStripMenuItem
//
//
this
.
二维码识别调试
ToolStripMenuItem
.
Name
=
"二维码识别调试ToolStripMenuItem"
;
this
.
二维码识别调试
ToolStripMenuItem
.
Name
=
"二维码识别调试ToolStripMenuItem"
;
this
.
二维码识别调试
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
192
,
26
);
this
.
二维码识别调试
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
238
,
32
);
this
.
二维码识别调试
ToolStripMenuItem
.
Text
=
"二维码识别调试"
;
this
.
二维码识别调试
ToolStripMenuItem
.
Text
=
"二维码识别调试"
;
this
.
二维码识别调试
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
二维码识别调试
ToolStripMenuItem_Click
);
this
.
二维码识别调试
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
二维码识别调试
ToolStripMenuItem_Click
);
//
//
// toolStripSeparator1
// toolStripSeparator1
//
//
this
.
toolStripSeparator1
.
Name
=
"toolStripSeparator1"
;
this
.
toolStripSeparator1
.
Name
=
"toolStripSeparator1"
;
this
.
toolStripSeparator1
.
Size
=
new
System
.
Drawing
.
Size
(
189
,
6
);
this
.
toolStripSeparator1
.
Size
=
new
System
.
Drawing
.
Size
(
235
,
6
);
//
//
// 退出ToolStripMenuItem
// 退出ToolStripMenuItem
//
//
this
.
退出
ToolStripMenuItem
.
Name
=
"退出ToolStripMenuItem"
;
this
.
退出
ToolStripMenuItem
.
Name
=
"退出ToolStripMenuItem"
;
this
.
退出
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
192
,
26
);
this
.
退出
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
238
,
32
);
this
.
退出
ToolStripMenuItem
.
Text
=
"退出"
;
this
.
退出
ToolStripMenuItem
.
Text
=
"退出"
;
this
.
退出
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
退出
ToolStripMenuItem_Click
);
this
.
退出
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
退出
ToolStripMenuItem_Click
);
//
//
...
@@ -122,7 +123,7 @@ namespace TheMachine
...
@@ -122,7 +123,7 @@ namespace TheMachine
//
//
this
.
关于
ToolStripMenuItem
.
Font
=
new
System
.
Drawing
.
Font
(
"Microsoft YaHei UI"
,
12F
);
this
.
关于
ToolStripMenuItem
.
Font
=
new
System
.
Drawing
.
Font
(
"Microsoft YaHei UI"
,
12F
);
this
.
关于
ToolStripMenuItem
.
Name
=
"关于ToolStripMenuItem"
;
this
.
关于
ToolStripMenuItem
.
Name
=
"关于ToolStripMenuItem"
;
this
.
关于
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
54
,
25
);
this
.
关于
ToolStripMenuItem
.
Size
=
new
System
.
Drawing
.
Size
(
66
,
31
);
this
.
关于
ToolStripMenuItem
.
Text
=
"关于"
;
this
.
关于
ToolStripMenuItem
.
Text
=
"关于"
;
this
.
关于
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
关于
ToolStripMenuItem_Click
);
this
.
关于
ToolStripMenuItem
.
Click
+=
new
System
.
EventHandler
(
this
.
关于
ToolStripMenuItem_Click
);
//
//
...
@@ -150,9 +151,9 @@ namespace TheMachine
...
@@ -150,9 +151,9 @@ namespace TheMachine
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_IgnoreGratingSignal
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_IgnoreGratingSignal
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_IgnoreSafecheck
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_IgnoreSafecheck
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
tabPage1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
3
0
);
this
.
tabPage1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
3
6
);
this
.
tabPage1
.
Name
=
"tabPage1"
;
this
.
tabPage1
.
Name
=
"tabPage1"
;
this
.
tabPage1
.
Size
=
new
System
.
Drawing
.
Size
(
1000
,
605
);
this
.
tabPage1
.
Size
=
new
System
.
Drawing
.
Size
(
1000
,
599
);
this
.
tabPage1
.
TabIndex
=
0
;
this
.
tabPage1
.
TabIndex
=
0
;
this
.
tabPage1
.
Text
=
"信息"
;
this
.
tabPage1
.
Text
=
"信息"
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
...
@@ -223,7 +224,7 @@ namespace TheMachine
...
@@ -223,7 +224,7 @@ namespace TheMachine
this
.
cb_EnableBuzzer
.
AutoSize
=
true
;
this
.
cb_EnableBuzzer
.
AutoSize
=
true
;
this
.
cb_EnableBuzzer
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
16
);
this
.
cb_EnableBuzzer
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
16
);
this
.
cb_EnableBuzzer
.
Name
=
"cb_EnableBuzzer"
;
this
.
cb_EnableBuzzer
.
Name
=
"cb_EnableBuzzer"
;
this
.
cb_EnableBuzzer
.
Size
=
new
System
.
Drawing
.
Size
(
1
09
,
25
);
this
.
cb_EnableBuzzer
.
Size
=
new
System
.
Drawing
.
Size
(
1
34
,
31
);
this
.
cb_EnableBuzzer
.
TabIndex
=
5
;
this
.
cb_EnableBuzzer
.
TabIndex
=
5
;
this
.
cb_EnableBuzzer
.
Text
=
"使用蜂鸣器"
;
this
.
cb_EnableBuzzer
.
Text
=
"使用蜂鸣器"
;
this
.
cb_EnableBuzzer
.
UseVisualStyleBackColor
=
true
;
this
.
cb_EnableBuzzer
.
UseVisualStyleBackColor
=
true
;
...
@@ -234,7 +235,7 @@ namespace TheMachine
...
@@ -234,7 +235,7 @@ namespace TheMachine
this
.
cb_IgnoreGratingSignal
.
AutoSize
=
true
;
this
.
cb_IgnoreGratingSignal
.
AutoSize
=
true
;
this
.
cb_IgnoreGratingSignal
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
78
);
this
.
cb_IgnoreGratingSignal
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
78
);
this
.
cb_IgnoreGratingSignal
.
Name
=
"cb_IgnoreGratingSignal"
;
this
.
cb_IgnoreGratingSignal
.
Name
=
"cb_IgnoreGratingSignal"
;
this
.
cb_IgnoreGratingSignal
.
Size
=
new
System
.
Drawing
.
Size
(
1
25
,
25
);
this
.
cb_IgnoreGratingSignal
.
Size
=
new
System
.
Drawing
.
Size
(
1
54
,
31
);
this
.
cb_IgnoreGratingSignal
.
TabIndex
=
2
;
this
.
cb_IgnoreGratingSignal
.
TabIndex
=
2
;
this
.
cb_IgnoreGratingSignal
.
Text
=
"忽略安全光栅"
;
this
.
cb_IgnoreGratingSignal
.
Text
=
"忽略安全光栅"
;
this
.
cb_IgnoreGratingSignal
.
UseVisualStyleBackColor
=
true
;
this
.
cb_IgnoreGratingSignal
.
UseVisualStyleBackColor
=
true
;
...
@@ -245,7 +246,7 @@ namespace TheMachine
...
@@ -245,7 +246,7 @@ namespace TheMachine
this
.
cb_IgnoreSafecheck
.
AutoSize
=
true
;
this
.
cb_IgnoreSafecheck
.
AutoSize
=
true
;
this
.
cb_IgnoreSafecheck
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
47
);
this
.
cb_IgnoreSafecheck
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
47
);
this
.
cb_IgnoreSafecheck
.
Name
=
"cb_IgnoreSafecheck"
;
this
.
cb_IgnoreSafecheck
.
Name
=
"cb_IgnoreSafecheck"
;
this
.
cb_IgnoreSafecheck
.
Size
=
new
System
.
Drawing
.
Size
(
2
15
,
25
);
this
.
cb_IgnoreSafecheck
.
Size
=
new
System
.
Drawing
.
Size
(
2
68
,
31
);
this
.
cb_IgnoreSafecheck
.
TabIndex
=
2
;
this
.
cb_IgnoreSafecheck
.
TabIndex
=
2
;
this
.
cb_IgnoreSafecheck
.
Text
=
"忽略安全检查(含安全光栅)"
;
this
.
cb_IgnoreSafecheck
.
Text
=
"忽略安全检查(含安全光栅)"
;
this
.
cb_IgnoreSafecheck
.
UseVisualStyleBackColor
=
true
;
this
.
cb_IgnoreSafecheck
.
UseVisualStyleBackColor
=
true
;
...
@@ -267,10 +268,10 @@ namespace TheMachine
...
@@ -267,10 +268,10 @@ namespace TheMachine
this
.
stateView
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
stateView
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
stateView
.
HeaderStyle
=
System
.
Windows
.
Forms
.
ColumnHeaderStyle
.
Nonclickable
;
this
.
stateView
.
HeaderStyle
=
System
.
Windows
.
Forms
.
ColumnHeaderStyle
.
Nonclickable
;
this
.
stateView
.
HideSelection
=
false
;
this
.
stateView
.
HideSelection
=
false
;
this
.
stateView
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
25
);
this
.
stateView
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
30
);
this
.
stateView
.
MultiSelect
=
false
;
this
.
stateView
.
MultiSelect
=
false
;
this
.
stateView
.
Name
=
"stateView"
;
this
.
stateView
.
Name
=
"stateView"
;
this
.
stateView
.
Size
=
new
System
.
Drawing
.
Size
(
605
,
2
64
);
this
.
stateView
.
Size
=
new
System
.
Drawing
.
Size
(
605
,
2
59
);
this
.
stateView
.
TabIndex
=
0
;
this
.
stateView
.
TabIndex
=
0
;
this
.
stateView
.
UseCompatibleStateImageBehavior
=
false
;
this
.
stateView
.
UseCompatibleStateImageBehavior
=
false
;
//
//
...
@@ -314,7 +315,7 @@ namespace TheMachine
...
@@ -314,7 +315,7 @@ namespace TheMachine
//
//
// Form1
// Form1
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
14
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
9F
,
17
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1008
,
729
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1008
,
729
);
...
...
TheMachine/Form1.cs
查看文件 @
8fd2686
...
@@ -22,7 +22,7 @@ namespace TheMachine
...
@@ -22,7 +22,7 @@ namespace TheMachine
{
{
InitializeComponent
();
InitializeComponent
();
this
.
FormClosing
+=
Form1_FormClosing
;
this
.
FormClosing
+=
Form1_FormClosing
;
this
.
Text
=
Setting_Init
.
App_Title
+
" "
+
Setting_Init
.
Server_CID
;
this
.
Text
=
Setting_Init
.
App_Title
+
" "
+
Setting_Init
.
Server_CID
;
t1
.
Interval
=
1000
;
t1
.
Interval
=
1000
;
t1
.
Tick
+=
T1_Tick
;
t1
.
Tick
+=
T1_Tick
;
...
@@ -106,7 +106,7 @@ namespace TheMachine
...
@@ -106,7 +106,7 @@ namespace TheMachine
RobotManage
.
UserPauseSet
+=
RobotManage_UserPauseSet
;
RobotManage
.
UserPauseSet
+=
RobotManage_UserPauseSet
;
RobotManage
.
CameraA
.
camera_event
+=
CameraA_camera_event
;
RobotManage
.
CameraA
.
camera_event
+=
CameraA_camera_event
;
RobotManage
.
CameraB
.
camera_event
+=
CameraA_camera_event
;
RobotManage
.
CameraB
.
camera_event
+=
CameraA_camera_event
;
}
}
private
void
CameraA_camera_event
(
object
sender
,
Bitmap
e
)
private
void
CameraA_camera_event
(
object
sender
,
Bitmap
e
)
...
@@ -119,7 +119,8 @@ namespace TheMachine
...
@@ -119,7 +119,8 @@ namespace TheMachine
pictureBox1
.
Image
=
e
;
pictureBox1
.
Image
=
e
;
},
sender
,
e
);
},
sender
,
e
);
}
}
else
{
else
{
this
.
Invoke
((
EventHandler
<
Bitmap
>)
delegate
this
.
Invoke
((
EventHandler
<
Bitmap
>)
delegate
{
{
pictureBox2
.
Visible
=
true
;
pictureBox2
.
Visible
=
true
;
...
@@ -130,7 +131,8 @@ namespace TheMachine
...
@@ -130,7 +131,8 @@ namespace TheMachine
private
void
AlarmBuzzer_BuzzerStateChange
(
object
sender
,
bool
e
)
private
void
AlarmBuzzer_BuzzerStateChange
(
object
sender
,
bool
e
)
{
{
this
.
Invoke
((
EventHandler
<
bool
>)
delegate
{
this
.
Invoke
((
EventHandler
<
bool
>)
delegate
{
btn_PauseBuzzer
.
Visible
=
e
;
btn_PauseBuzzer
.
Visible
=
e
;
},
sender
,
e
);
},
sender
,
e
);
}
}
...
@@ -140,12 +142,13 @@ namespace TheMachine
...
@@ -140,12 +142,13 @@ namespace TheMachine
e
.
NewWidth
=
(
sender
as
ListView
).
Columns
[
e
.
ColumnIndex
].
Width
;
e
.
NewWidth
=
(
sender
as
ListView
).
Columns
[
e
.
ColumnIndex
].
Width
;
e
.
Cancel
=
true
;
e
.
Cancel
=
true
;
}
}
void
addTablePage
()
{
void
addTablePage
()
{
AddForm
(
"IO调试"
,
ioc
);
AddForm
(
"IO调试"
,
ioc
);
AddForm
(
"伺服调试"
,
ac
);
AddForm
(
"伺服调试"
,
ac
);
AddForm
(
"库位调试"
,
bd
);
AddForm
(
"库位调试"
,
bd
);
AddForm
(
"相关设置"
,
sc
);
AddForm
(
"相关设置"
,
sc
);
}
}
private
void
T1_Tick
(
object
sender
,
EventArgs
e
)
private
void
T1_Tick
(
object
sender
,
EventArgs
e
)
...
@@ -168,11 +171,11 @@ namespace TheMachine
...
@@ -168,11 +171,11 @@ namespace TheMachine
{
{
continue
;
continue
;
}
}
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
moveInfo
.
Name
,
moveInfo
.
MoveStep
.
ToString
(),
moveInfo
.
GetStateStr
()
});
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
moveInfo
.
Name
,
moveInfo
.
MoveStep
.
ToString
(),
moveInfo
.
GetStateStr
()
});
stateView
.
Items
.
Add
(
lvi
);
stateView
.
Items
.
Add
(
lvi
);
}
}
this
.
ResumeLayout
(
true
);
this
.
ResumeLayout
(
true
);
}
}
private
void
AddForm
(
string
text
,
UserControl
form
)
private
void
AddForm
(
string
text
,
UserControl
form
)
{
{
...
@@ -209,8 +212,9 @@ namespace TheMachine
...
@@ -209,8 +212,9 @@ namespace TheMachine
addTablePage
();
addTablePage
();
RobotManage
.
LoadDebug
();
RobotManage
.
LoadDebug
();
}
}
else
{
else
for
(
int
i
=
tabControl1
.
TabPages
.
Count
-
1
;
i
>
1
;
i
--)
{
for
(
int
i
=
tabControl1
.
TabPages
.
Count
-
1
;
i
>
1
;
i
--)
{
{
tabControl1
.
TabPages
[
i
].
Parent
=
null
;
tabControl1
.
TabPages
[
i
].
Parent
=
null
;
}
}
...
@@ -226,11 +230,11 @@ namespace TheMachine
...
@@ -226,11 +230,11 @@ namespace TheMachine
private
void
RobotManage_LoadFinishEvent
(
bool
state
,
string
msg
)
private
void
RobotManage_LoadFinishEvent
(
bool
state
,
string
msg
)
{
{
if
(
InvokeRequired
)
if
(
InvokeRequired
)
{
{
Invoke
((
EventHandler
)
delegate
{
Invoke
((
EventHandler
)
delegate
RobotManage_LoadFinishEvent
(
state
,
msg
);
{
RobotManage_LoadFinishEvent
(
state
,
msg
);
});
});
return
;
return
;
}
}
...
@@ -245,7 +249,7 @@ namespace TheMachine
...
@@ -245,7 +249,7 @@ namespace TheMachine
ioc
.
Config
=
RobotManage
.
Config
;
ioc
.
Config
=
RobotManage
.
Config
;
bd
.
Config
=
RobotManage
.
Config
;
bd
.
Config
=
RobotManage
.
Config
;
var
lm
=
new
List
<
Msg
>();
var
lm
=
new
List
<
Msg
>();
foreach
(
string
ms
in
msg
.
Split
(
new
char
[]
{
'\n'
},
StringSplitOptions
.
RemoveEmptyEntries
))
foreach
(
string
ms
in
msg
.
Split
(
new
char
[]
{
'\n'
},
StringSplitOptions
.
RemoveEmptyEntries
))
{
{
var
m
=
new
Msg
();
var
m
=
new
Msg
();
m
.
datetime
=
DateTime
.
Now
;
m
.
datetime
=
DateTime
.
Now
;
...
@@ -257,8 +261,10 @@ namespace TheMachine
...
@@ -257,8 +261,10 @@ namespace TheMachine
}
}
void
SetMsg
(
List
<
Msg
>
msgs
)
void
SetMsg
(
List
<
Msg
>
msgs
)
{
{
if
(
InvokeRequired
)
{
if
(
InvokeRequired
)
Invoke
((
EventHandler
)
delegate
{
{
Invoke
((
EventHandler
)
delegate
{
SetMsg
(
msgs
);
SetMsg
(
msgs
);
});
});
return
;
return
;
...
@@ -281,14 +287,16 @@ namespace TheMachine
...
@@ -281,14 +287,16 @@ namespace TheMachine
}
}
else
if
(
msg
.
errInfo
==
ErrInfo
.
ResetBtn
)
else
if
(
msg
.
errInfo
==
ErrInfo
.
ResetBtn
)
{
{
Task
.
Run
(()=>
{
Task
.
Run
(()
=>
{
if
(!
RobotManage
.
isRunning
||
userpause
)
if
(!
RobotManage
.
isRunning
||
userpause
)
btn_run_Click
(
this
,
EventArgs
.
Empty
);
btn_run_Click
(
this
,
EventArgs
.
Empty
);
});
});
}
}
else
if
(
msg
.
errInfo
==
ErrInfo
.
SuddenStop
)
else
if
(
msg
.
errInfo
==
ErrInfo
.
SuddenStop
)
{
{
Task
.
Run
(()
=>
{
Task
.
Run
(()
=>
{
if
(
RobotManage
.
isRunning
)
if
(
RobotManage
.
isRunning
)
btn_stop_Click
(
this
,
EventArgs
.
Empty
);
btn_stop_Click
(
this
,
EventArgs
.
Empty
);
});
});
...
@@ -335,7 +343,7 @@ namespace TheMachine
...
@@ -335,7 +343,7 @@ namespace TheMachine
},
sender
,
e
);
},
sender
,
e
);
return
;
return
;
}
}
if
(
e
)
if
(
e
)
{
{
userpause
=
true
;
userpause
=
true
;
...
@@ -351,11 +359,11 @@ namespace TheMachine
...
@@ -351,11 +359,11 @@ namespace TheMachine
//cb_IgnoreSafecheck.Checked = false;
//cb_IgnoreSafecheck.Checked = false;
cb_IgnoreSafecheck
.
Enabled
=
false
;
cb_IgnoreSafecheck
.
Enabled
=
false
;
}
}
}
}
private
void
btn_stop_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_stop_Click
(
object
sender
,
EventArgs
e
)
{
{
RobotManage
.
UserPause
(
false
);
RobotManage
.
UserPause
(
false
);
userpause
=
false
;
userpause
=
false
;
Task
.
Run
(()
=>
{
RobotManage
.
Stop
();
});
Task
.
Run
(()
=>
{
RobotManage
.
Stop
();
});
...
@@ -367,9 +375,12 @@ namespace TheMachine
...
@@ -367,9 +375,12 @@ namespace TheMachine
private
void
退出
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
private
void
退出
ToolStripMenuItem_Click
(
object
sender
,
EventArgs
e
)
{
{
if
(
RobotManage
.
isRunning
)
{
if
(
RobotManage
.
isRunning
)
{
MessageBox
.
Show
(
"机器尚在运行,不能退出,请先停止运行."
);
MessageBox
.
Show
(
"机器尚在运行,不能退出,请先停止运行."
);
}
else
{
}
else
{
RobotManage
.
Stop
();
RobotManage
.
Stop
();
RobotManage
.
ShutDown
();
RobotManage
.
ShutDown
();
Thread
.
Sleep
(
2000
);
Thread
.
Sleep
(
2000
);
...
@@ -417,7 +428,7 @@ namespace TheMachine
...
@@ -417,7 +428,7 @@ namespace TheMachine
private
void
cb_EnableBuzzer_CheckedChanged
(
object
sender
,
EventArgs
e
)
private
void
cb_EnableBuzzer_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
{
Setting_Init
.
Device_EnableBuzzer
=
cb_EnableBuzzer
.
Checked
;
Setting_Init
.
Device_EnableBuzzer
=
cb_EnableBuzzer
.
Checked
;
AlarmBuzzer
.
Enable
=
cb_EnableBuzzer
.
Checked
;
AlarmBuzzer
.
Enable
=
cb_EnableBuzzer
.
Checked
;
}
}
private
void
btn_PauseBuzzer_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_PauseBuzzer_Click
(
object
sender
,
EventArgs
e
)
...
...
TheMachine/SettingControl.Designer.cs
查看文件 @
8fd2686
...
@@ -41,6 +41,8 @@ namespace TheMachine
...
@@ -41,6 +41,8 @@ namespace TheMachine
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
lbl_hmdstate
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lbl_hmdstate
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblWeight
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
button2
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
tp
.
SuspendLayout
();
this
.
tp
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
...
@@ -51,7 +53,7 @@ namespace TheMachine
...
@@ -51,7 +53,7 @@ namespace TheMachine
this
.
cb_leftmode
.
FormattingEnabled
=
true
;
this
.
cb_leftmode
.
FormattingEnabled
=
true
;
this
.
cb_leftmode
.
Location
=
new
System
.
Drawing
.
Point
(
198
,
37
);
this
.
cb_leftmode
.
Location
=
new
System
.
Drawing
.
Point
(
198
,
37
);
this
.
cb_leftmode
.
Name
=
"cb_leftmode"
;
this
.
cb_leftmode
.
Name
=
"cb_leftmode"
;
this
.
cb_leftmode
.
Size
=
new
System
.
Drawing
.
Size
(
121
,
2
4
);
this
.
cb_leftmode
.
Size
=
new
System
.
Drawing
.
Size
(
121
,
2
8
);
this
.
cb_leftmode
.
TabIndex
=
2
;
this
.
cb_leftmode
.
TabIndex
=
2
;
//
//
// cb_rightmode
// cb_rightmode
...
@@ -60,7 +62,7 @@ namespace TheMachine
...
@@ -60,7 +62,7 @@ namespace TheMachine
this
.
cb_rightmode
.
FormattingEnabled
=
true
;
this
.
cb_rightmode
.
FormattingEnabled
=
true
;
this
.
cb_rightmode
.
Location
=
new
System
.
Drawing
.
Point
(
198
,
80
);
this
.
cb_rightmode
.
Location
=
new
System
.
Drawing
.
Point
(
198
,
80
);
this
.
cb_rightmode
.
Name
=
"cb_rightmode"
;
this
.
cb_rightmode
.
Name
=
"cb_rightmode"
;
this
.
cb_rightmode
.
Size
=
new
System
.
Drawing
.
Size
(
121
,
2
4
);
this
.
cb_rightmode
.
Size
=
new
System
.
Drawing
.
Size
(
121
,
2
8
);
this
.
cb_rightmode
.
TabIndex
=
2
;
this
.
cb_rightmode
.
TabIndex
=
2
;
//
//
// label1
// label1
...
@@ -101,7 +103,7 @@ namespace TheMachine
...
@@ -101,7 +103,7 @@ namespace TheMachine
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
AutoSize
=
true
;
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
23
,
154
);
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
23
,
154
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
176
,
16
);
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
219
,
20
);
this
.
label3
.
TabIndex
=
5
;
this
.
label3
.
TabIndex
=
5
;
this
.
label3
.
Text
=
"*保存后需重启料仓生效"
;
this
.
label3
.
Text
=
"*保存后需重启料仓生效"
;
//
//
...
@@ -135,7 +137,7 @@ namespace TheMachine
...
@@ -135,7 +137,7 @@ namespace TheMachine
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
());
this
.
tp
.
Size
=
new
System
.
Drawing
.
Size
(
1
28
,
40
);
this
.
tp
.
Size
=
new
System
.
Drawing
.
Size
(
1
52
,
44
);
this
.
tp
.
TabIndex
=
7
;
this
.
tp
.
TabIndex
=
7
;
//
//
// chbAutoRun
// chbAutoRun
...
@@ -145,7 +147,7 @@ namespace TheMachine
...
@@ -145,7 +147,7 @@ namespace TheMachine
this
.
chbAutoRun
.
Location
=
new
System
.
Drawing
.
Point
(
10
,
10
);
this
.
chbAutoRun
.
Location
=
new
System
.
Drawing
.
Point
(
10
,
10
);
this
.
chbAutoRun
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
10
);
this
.
chbAutoRun
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
10
);
this
.
chbAutoRun
.
Name
=
"chbAutoRun"
;
this
.
chbAutoRun
.
Name
=
"chbAutoRun"
;
this
.
chbAutoRun
.
Size
=
new
System
.
Drawing
.
Size
(
1
07
,
20
);
this
.
chbAutoRun
.
Size
=
new
System
.
Drawing
.
Size
(
1
31
,
24
);
this
.
chbAutoRun
.
TabIndex
=
7
;
this
.
chbAutoRun
.
TabIndex
=
7
;
this
.
chbAutoRun
.
Text
=
"开机自启动"
;
this
.
chbAutoRun
.
Text
=
"开机自启动"
;
this
.
chbAutoRun
.
UseVisualStyleBackColor
=
true
;
this
.
chbAutoRun
.
UseVisualStyleBackColor
=
true
;
...
@@ -164,9 +166,29 @@ namespace TheMachine
...
@@ -164,9 +166,29 @@ namespace TheMachine
this
.
lbl_hmdstate
.
TabIndex
=
8
;
this
.
lbl_hmdstate
.
TabIndex
=
8
;
this
.
lbl_hmdstate
.
Text
=
"label4"
;
this
.
lbl_hmdstate
.
Text
=
"label4"
;
//
//
// lblWeight
//
this
.
lblWeight
.
Location
=
new
System
.
Drawing
.
Point
(
428
,
72
);
this
.
lblWeight
.
Name
=
"lblWeight"
;
this
.
lblWeight
.
Size
=
new
System
.
Drawing
.
Size
(
405
,
145
);
this
.
lblWeight
.
TabIndex
=
9
;
this
.
lblWeight
.
Text
=
"weight"
;
//
// button2
//
this
.
button2
.
Location
=
new
System
.
Drawing
.
Point
(
499
,
231
);
this
.
button2
.
Name
=
"button2"
;
this
.
button2
.
Size
=
new
System
.
Drawing
.
Size
(
204
,
45
);
this
.
button2
.
TabIndex
=
10
;
this
.
button2
.
Text
=
"称重零校准"
;
this
.
button2
.
UseVisualStyleBackColor
=
true
;
this
.
button2
.
Click
+=
new
System
.
EventHandler
(
this
.
button2_Click
);
//
// SettingControl
// SettingControl
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Controls
.
Add
(
this
.
button2
);
this
.
Controls
.
Add
(
this
.
lblWeight
);
this
.
Controls
.
Add
(
this
.
lbl_hmdstate
);
this
.
Controls
.
Add
(
this
.
lbl_hmdstate
);
this
.
Controls
.
Add
(
this
.
tp
);
this
.
Controls
.
Add
(
this
.
tp
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
...
@@ -195,5 +217,7 @@ namespace TheMachine
...
@@ -195,5 +217,7 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRun
;
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRun
;
private
System
.
Windows
.
Forms
.
Timer
timer1
;
private
System
.
Windows
.
Forms
.
Timer
timer1
;
private
System
.
Windows
.
Forms
.
Label
lbl_hmdstate
;
private
System
.
Windows
.
Forms
.
Label
lbl_hmdstate
;
private
System
.
Windows
.
Forms
.
Label
lblWeight
;
private
System
.
Windows
.
Forms
.
Button
button2
;
}
}
}
}
TheMachine/SettingControl.cs
查看文件 @
8fd2686
...
@@ -34,14 +34,14 @@ namespace TheMachine
...
@@ -34,14 +34,14 @@ namespace TheMachine
private
void
RobotManage_LoadFinishEvent
(
bool
state
,
string
msg
)
private
void
RobotManage_LoadFinishEvent
(
bool
state
,
string
msg
)
{
{
if
(!
state
)
if
(!
state
)
return
;
return
;
}
}
private
void
SettingControl_Load
(
object
sender
,
EventArgs
e
)
private
void
SettingControl_Load
(
object
sender
,
EventArgs
e
)
{
{
cb_leftmode
.
Items
.
AddRange
(
InOutModeItem
.
Items
);
cb_leftmode
.
Items
.
AddRange
(
InOutModeItem
.
Items
);
cb_leftmode
.
SelectedIndex
=(
int
)((
InOutModeE
)
Setting_Init
.
Device_LeftInoutMode
);
cb_leftmode
.
SelectedIndex
=
(
int
)((
InOutModeE
)
Setting_Init
.
Device_LeftInoutMode
);
cb_rightmode
.
Items
.
AddRange
(
InOutModeItem
.
Items
);
cb_rightmode
.
Items
.
AddRange
(
InOutModeItem
.
Items
);
cb_rightmode
.
SelectedIndex
=
(
int
)((
InOutModeE
)
Setting_Init
.
Device_RightInoutMode
);
cb_rightmode
.
SelectedIndex
=
(
int
)((
InOutModeE
)
Setting_Init
.
Device_RightInoutMode
);
...
@@ -75,7 +75,7 @@ namespace TheMachine
...
@@ -75,7 +75,7 @@ namespace TheMachine
{
{
if
(
chbAutoRun
.
Checked
)
if
(
chbAutoRun
.
Checked
)
{
{
Setting_Init
.
App_AutoRun
=
true
;
Setting_Init
.
App_AutoRun
=
true
;
AutoRun
(
Application
.
ExecutablePath
,
true
);
AutoRun
(
Application
.
ExecutablePath
,
true
);
}
}
else
else
...
@@ -85,7 +85,8 @@ namespace TheMachine
...
@@ -85,7 +85,8 @@ namespace TheMachine
}
}
}
}
public
class
InOutModeItem
{
public
class
InOutModeItem
{
public
InOutModeE
inOutModeItem
=
InOutModeE
.
Both
;
public
InOutModeE
inOutModeItem
=
InOutModeE
.
Both
;
public
string
Name
=
""
;
public
string
Name
=
""
;
static
List
<
InOutModeItem
>
items
=
new
List
<
InOutModeItem
>();
static
List
<
InOutModeItem
>
items
=
new
List
<
InOutModeItem
>();
...
@@ -97,10 +98,10 @@ namespace TheMachine
...
@@ -97,10 +98,10 @@ namespace TheMachine
}
}
static
InOutModeItem
()
static
InOutModeItem
()
{
{
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
Both
,
Name
=
"双向"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
Both
,
Name
=
"双向"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
OnlyIN
,
Name
=
"仅入库"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
OnlyIN
,
Name
=
"仅入库"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
OnlyOUT
,
Name
=
"仅出库"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
OnlyOUT
,
Name
=
"仅出库"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
Disable
,
Name
=
"禁用"
});
items
.
Add
(
new
InOutModeItem
{
inOutModeItem
=
InOutModeE
.
Disable
,
Name
=
"禁用"
});
}
}
}
}
...
@@ -127,6 +128,18 @@ namespace TheMachine
...
@@ -127,6 +128,18 @@ namespace TheMachine
var
t
=
RobotManage
.
humitureControllers
[
i
].
LastData
;
var
t
=
RobotManage
.
humitureControllers
[
i
].
LastData
;
lbl_hmdstate
.
Text
+=
", 温度"
+
$
":{t.Temperate}℃, "
+
"湿度"
+
$
":{t.Humidity}%, "
+
"氮气"
+
$
":{100 - t.OxygenV - 1}%"
;
lbl_hmdstate
.
Text
+=
", 温度"
+
$
":{t.Temperate}℃, "
+
"湿度"
+
$
":{t.Humidity}%, "
+
"氮气"
+
$
":{100 - t.OxygenV - 1}%"
;
}
}
lblWeight
.
Text
=
"称重实时值:"
;
lblWeight
.
Text
+=
"\r\n\t端口:"
+
RobotManage
.
Config
.
WeightSensorPort
;
if
(
BSQController
.
queryData
(
RobotManage
.
Config
.
WeightSensorPort
,
out
double
weight
))
lblWeight
.
Text
+=
", 重量:"
+
weight
.
ToString
(
"f1"
)
+
"KG"
;
}
private
void
button2_Click
(
object
sender
,
EventArgs
e
)
{
if
(
BSQController
.
ZeroCalibration
(
RobotManage
.
Config
.
WeightSensorPort
))
{
MessageBox
.
Show
(
"称重传感器零校准完成!"
);
}
}
}
}
}
}
}
TheMachine/UC/ConfigControl.designer.cs
查看文件 @
8fd2686
...
@@ -52,6 +52,7 @@ namespace TheMachine
...
@@ -52,6 +52,7 @@ namespace TheMachine
this
.
tableLayoutPanel1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
this
.
tableLayoutPanel1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
tableLayoutPanel1
.
AutoScroll
=
true
;
this
.
tableLayoutPanel1
.
ColumnCount
=
6
;
this
.
tableLayoutPanel1
.
ColumnCount
=
6
;
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
30F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
30F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
10F
));
this
.
tableLayoutPanel1
.
ColumnStyles
.
Add
(
new
System
.
Windows
.
Forms
.
ColumnStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
10F
));
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论