Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1057_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 30ce5a84
由
刘韬
编写于
2022-11-01 09:22:32 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
a6c3be72
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
407 行增加
和
217 行删除
Common/Setting_Init.cs
Common/util/HumitureController.cs
Common/util/HumitureServer.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/theMachine/AxisBean.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/RobotManage.cs
LoadCVSLibrary/Config/Config.csv
LoadCVSLibrary/storeConfig/config/IO_Type.cs
TheMachine/Form1.Designer.cs
TheMachine/Form1.cs
TheMachine/FrmReleaseDoor.Designer.cs
TheMachine/FrmReleaseDoor.cs
TheMachine/FrmReleaseDoor.resx
TheMachine/SettingControl.cs
TheMachine/TheMachine.csproj
Common/Setting_Init.cs
查看文件 @
30ce5a8
...
@@ -54,6 +54,8 @@ namespace OnlineStore.Common
...
@@ -54,6 +54,8 @@ namespace OnlineStore.Common
[
MyConfigComment
(
"扫码读码匹配参数"
)]
[
MyConfigComment
(
"扫码读码匹配参数"
)]
public
static
MyConfig
<
string
>
CodeScan_ParamPath
=
"Conifg\\"
;
public
static
MyConfig
<
string
>
CodeScan_ParamPath
=
"Conifg\\"
;
[
MyConfigComment
(
"允许解锁安全门的氮气阈值"
)]
public
static
MyConfig
<
double
>
Nitrogen_Safe_Maximum
=
80
;
}
}
public
enum
StoreType
public
enum
StoreType
...
...
Common/util/HumitureController.cs
查看文件 @
30ce5a8
...
@@ -90,14 +90,14 @@ namespace OnlineStore.Common
...
@@ -90,14 +90,14 @@ namespace OnlineStore.Common
}
}
IsRun
=
false
;
IsRun
=
false
;
}
}
public
static
ASTemperateParam
LastData
=
new
ASTemperateParam
(
0
,
0
);
public
static
ASTemperateParam
LastData
=
new
ASTemperateParam
(
0
,
0
,
0
);
public
static
ASTemperateParam
QueryData
()
public
static
ASTemperateParam
QueryData
()
{
{
ASTemperateParam
param
=
new
ASTemperateParam
(
0
,
0
);
ASTemperateParam
param
=
new
ASTemperateParam
(
0
,
0
,
0
);
List
<
double
>
data
=
queryData
();
List
<
double
>
data
=
queryData
();
if
(
data
.
Count
.
Equals
(
2
))
if
(
data
.
Count
.
Equals
(
3
))
{
{
param
=
new
ASTemperateParam
(
data
[
1
],
data
[
0
]);
param
=
new
ASTemperateParam
(
data
[
1
],
data
[
0
]
,
data
[
2
]
);
}
}
LastData
=
param
;
LastData
=
param
;
return
param
;
return
param
;
...
@@ -130,7 +130,7 @@ namespace OnlineStore.Common
...
@@ -130,7 +130,7 @@ namespace OnlineStore.Common
sendData
[
2
]
=
0x00
;
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
0x00
;
sendData
[
3
]
=
0x00
;
sendData
[
4
]
=
0x00
;
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x0
2
;
sendData
[
5
]
=
0x0
3
;
sendData
[
6
]
=
0x00
;
sendData
[
6
]
=
0x00
;
sendData
[
7
]
=
0x00
;
sendData
[
7
]
=
0x00
;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
...
@@ -143,115 +143,7 @@ namespace OnlineStore.Common
...
@@ -143,115 +143,7 @@ namespace OnlineStore.Common
}
}
public
static
int
QueryHistoryCount
()
{
if
(
IsRun
.
Equals
(
false
)
||
HumitureControllerType
.
Equals
(
2
).
Equals
(
false
))
{
return
-
1
;
}
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x04
;
sendData
[
2
]
=
0x20
;
sendData
[
3
]
=
0x00
;
byte
[]
addrByte
=
AcSerialBean
.
StringToByte
(
"2000"
);
if
(
addrByte
.
Length
==
1
)
{
sendData
[
2
]
=
0x00
;
sendData
[
3
]
=
addrByte
[
0
];
}
else
if
(
addrByte
.
Length
==
2
)
{
sendData
[
3
]
=
addrByte
[
1
];
sendData
[
2
]
=
addrByte
[
0
];
}
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x02
;
sendData
[
6
]
=
0x00
;
sendData
[
7
]
=
0x00
;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
);
LogUtil
.
debug
(
"温湿度控制器发送数据:"
+
str
);
byte
[]
reviceData
=
new
byte
[
9
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
return
getReviceIntData
(
reviceData
);
}
public
static
int
QueryCurrCount
()
{
if
(
IsRun
.
Equals
(
false
)
||
HumitureControllerType
.
Equals
(
2
).
Equals
(
false
))
{
return
-
1
;
}
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x04
;
sendData
[
2
]
=
0x20
;
sendData
[
3
]
=
0x02
;
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x02
;
sendData
[
6
]
=
0x00
;
sendData
[
7
]
=
0x00
;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
);
LogUtil
.
debug
(
"温湿度控制器发送数据:"
+
str
);
byte
[]
reviceData
=
new
byte
[
9
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
return
getReviceIntData
(
reviceData
);
}
public
static
List
<
object
>
QueryHistory
()
{
List
<
object
>
list
=
new
List
<
object
>();
if
(
IsRun
.
Equals
(
false
)||
HumitureControllerType
.
Equals
(
2
).
Equals
(
false
))
{
return
list
;
}
byte
[]
sendData
=
new
byte
[
8
];
sendData
[
0
]
=
0x01
;
sendData
[
1
]
=
0x04
;
sendData
[
2
]
=
0x20
;
sendData
[
3
]
=
0x04
;
sendData
[
4
]
=
0x00
;
sendData
[
5
]
=
0x05
;
sendData
[
6
]
=
0x00
;
sendData
[
7
]
=
0x00
;
sendData
=
buildCheckData
(
sendData
,
sendData
.
Length
-
2
);
string
str
=
AcSerialBean
.
byteToHexStr
(
sendData
);
LogUtil
.
debug
(
"温湿度控制器发送数据:"
+
str
);
byte
[]
reviceData
=
new
byte
[
15
];
bool
isOk
=
false
;
sb
.
SendCommand
(
sendData
,
ref
reviceData
,
100
,
out
isOk
);
try
{
if
(
reviceData
!=
null
&&
reviceData
.
Length
>=
9
)
{
string
temp
=
String
.
Format
(
"{0:X2}"
,
reviceData
[
3
])
+
String
.
Format
(
"{0:X2}"
,
reviceData
[
4
]);
string
hum
=
String
.
Format
(
"{0:X2}"
,
reviceData
[
5
])
+
String
.
Format
(
"{0:X2}"
,
reviceData
[
6
]);
double
tempV
=
(
double
)
Convert
.
ToInt32
(
temp
,
16
)
/
10
;
double
humV
=
(
double
)
Convert
.
ToInt32
(
hum
,
16
)
/
10
;
int
year
=
Convert
.
ToInt32
(
String
.
Format
(
"{0:X2}"
,
reviceData
[
7
]),
16
);
int
mouth
=
Convert
.
ToInt32
(
String
.
Format
(
"{0:X2}"
,
reviceData
[
8
]),
16
);
int
day
=
Convert
.
ToInt32
(
String
.
Format
(
"{0:X2}"
,
reviceData
[
9
]),
16
);
int
hour
=
Convert
.
ToInt32
(
String
.
Format
(
"{0:X2}"
,
reviceData
[
10
]),
16
);
int
minute
=
Convert
.
ToInt32
(
String
.
Format
(
"{0:X2}"
,
reviceData
[
11
]),
16
);
int
second
=
Convert
.
ToInt32
(
String
.
Format
(
"{0:X2}"
,
reviceData
[
12
]),
16
);
DateTime
time
=
new
DateTime
(
year
,
mouth
,
day
,
hour
,
minute
,
second
);
list
.
Add
(
tempV
);
list
.
Add
(
humV
);
list
.
Add
(
time
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
Info
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
list
;
}
private
static
byte
[]
buildCheckData
(
byte
[]
sendData
,
int
length
)
private
static
byte
[]
buildCheckData
(
byte
[]
sendData
,
int
length
)
...
@@ -274,29 +166,6 @@ namespace OnlineStore.Common
...
@@ -274,29 +166,6 @@ namespace OnlineStore.Common
return
sendData
;
return
sendData
;
}
}
private
static
int
getReviceIntData
(
byte
[]
dataArray
)
{
List
<
double
>
list
=
new
List
<
double
>();
try
{
if
(
dataArray
==
null
)
{
return
-
1
;
}
if
(
dataArray
.
Length
>=
9
)
{
string
data
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
5
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
6
]+
String
.
Format
(
"{0:X2}"
,
dataArray
[
3
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
4
])
);
int
tempV
=
Convert
.
ToInt32
(
data
,
16
);
return
tempV
;
}
}
catch
(
Exception
ex
)
{
LOGGER
.
Info
(
LogName
+
"转换出错:"
+
ex
.
ToString
());
}
return
-
1
;
}
private
static
List
<
double
>
getReviceData
(
byte
[]
dataArray
)
private
static
List
<
double
>
getReviceData
(
byte
[]
dataArray
)
{
{
List
<
double
>
list
=
new
List
<
double
>();
List
<
double
>
list
=
new
List
<
double
>();
...
@@ -311,10 +180,13 @@ namespace OnlineStore.Common
...
@@ -311,10 +180,13 @@ namespace OnlineStore.Common
string
temp
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
3
])+
String
.
Format
(
"{0:X2}"
,
dataArray
[
4
]);
string
temp
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
3
])+
String
.
Format
(
"{0:X2}"
,
dataArray
[
4
]);
string
hum
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
5
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
6
]);
string
hum
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
5
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
6
]);
string
Oxygen
=
String
.
Format
(
"{0:X2}"
,
dataArray
[
7
])
+
String
.
Format
(
"{0:X2}"
,
dataArray
[
8
]);
double
tempV
=
(
double
)
Convert
.
ToInt32
(
temp
,
16
)/
10
;
double
tempV
=
(
double
)
Convert
.
ToInt32
(
temp
,
16
)/
10
;
double
humV
=(
double
)
Convert
.
ToInt32
(
hum
,
16
)/
10
;
double
humV
=(
double
)
Convert
.
ToInt32
(
hum
,
16
)/
10
;
double
OxygenV
=
(
double
)
Convert
.
ToInt32
(
Oxygen
,
16
)/
10
;
list
.
Add
(
tempV
);
list
.
Add
(
tempV
);
list
.
Add
(
humV
);
list
.
Add
(
humV
);
list
.
Add
(
OxygenV
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
Common/util/HumitureServer.cs
查看文件 @
30ce5a8
...
@@ -31,49 +31,6 @@ namespace OnlineStore.Common
...
@@ -31,49 +31,6 @@ namespace OnlineStore.Common
return
temperate
;
return
temperate
;
}
}
/// <summary>
/// <summary>
/// 显示用的温湿度信息(改为计算平均温湿度)
/// </summary>
public
static
ASTemperateParam
GetTemperateParam
(
List
<
string
>
ipAddrList
)
{
ASTemperateParam
temperate
=
null
;
int
allCount
=
0
;
double
wenDu
=
0
;
double
shiDu
=
0
;
foreach
(
string
addr
in
ipAddrList
)
{
ASTemperateParam
param
=
GetTemperateParam
(
addr
);
if
(
param
!=
null
&&
param
.
IsValid
())
{
allCount
++;
wenDu
=
wenDu
+
param
.
Temperate
;
shiDu
=
shiDu
+
param
.
Humidity
;
}
}
if
(
allCount
>
0
)
{
double
avgWendu
=
Math
.
Round
(
wenDu
/
allCount
,
1
);
double
avgShidu
=
Math
.
Round
(
shiDu
/
allCount
,
1
);
temperate
=
new
ASTemperateParam
(
avgWendu
,
avgShidu
);
}
return
temperate
;
}
public
static
double
GetMaxHumidity
(
List
<
string
>
ipAddrList
)
{
double
maxValue
=
0
;
foreach
(
string
addr
in
ipAddrList
)
{
ASTemperateParam
param
=
GetTemperateParam
(
addr
);
if
(
param
!=
null
&&
param
.
IsValid
())
{
if
(
param
.
Humidity
>
maxValue
)
{
maxValue
=
param
.
Humidity
;
}
}
}
return
maxValue
;
}
/// <summary>
/// 温湿度传感器服务器
/// 温湿度传感器服务器
/// </summary>
/// </summary>
private
static
UdpServer
temperateTcpServer
=
null
;
private
static
UdpServer
temperateTcpServer
=
null
;
...
@@ -225,13 +182,14 @@ namespace OnlineStore.Common
...
@@ -225,13 +182,14 @@ namespace OnlineStore.Common
this
.
UpdateTime
=
updateTime
;
this
.
UpdateTime
=
updateTime
;
}
}
//获取平均值时使用此 参数,只做显示用
//获取平均值时使用此 参数,只做显示用
public
ASTemperateParam
(
double
wendu
,
double
shidu
)
public
ASTemperateParam
(
double
wendu
,
double
shidu
,
double
oxygenV
)
{
{
this
.
IpAddress
=
""
;
this
.
IpAddress
=
""
;
this
.
DeviceAddress
=
""
;
this
.
DeviceAddress
=
""
;
this
.
Password
=
""
;
this
.
Password
=
""
;
this
.
Temperate
=
wendu
;
this
.
Temperate
=
wendu
;
this
.
Humidity
=
shidu
;
this
.
Humidity
=
shidu
;
this
.
OxygenV
=
oxygenV
;
this
.
UpdateTime
=
DateTime
.
Now
;
this
.
UpdateTime
=
DateTime
.
Now
;
}
}
/// <summary>
/// <summary>
...
@@ -272,5 +230,9 @@ namespace OnlineStore.Common
...
@@ -272,5 +230,9 @@ namespace OnlineStore.Common
/// 湿度
/// 湿度
/// </summary>
/// </summary>
public
double
Humidity
{
get
;
set
;
}
public
double
Humidity
{
get
;
set
;
}
/// <summary>
/// 氧含量
/// </summary>
public
double
OxygenV
{
get
;
set
;
}
}
}
}
}
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
30ce5a8
...
@@ -70,7 +70,7 @@ namespace DeviceLibrary
...
@@ -70,7 +70,7 @@ namespace DeviceLibrary
}
}
p
rivate
static
void
LoadCamera
(
bool
isReLoad
)
p
ublic
static
void
LoadCamera
(
bool
isReLoad
)
{
{
if
(
isReLoad
||
Camera
.
_cam
==
null
)
if
(
isReLoad
||
Camera
.
_cam
==
null
)
{
{
...
@@ -155,7 +155,7 @@ namespace DeviceLibrary
...
@@ -155,7 +155,7 @@ namespace DeviceLibrary
continue
;
continue
;
retrytime
++;
retrytime
++;
LogUtil
.
info
(
$
"bitmap为空重试第{retrytime}次"
);
LogUtil
.
info
(
$
"bitmap为空重试第{retrytime}次"
);
CloseCamera
(
cameraNam
e
);
LoadCamera
(
tru
e
);
Task
.
Delay
(
1500
).
Wait
();
Task
.
Delay
(
1500
).
Wait
();
goto
retry
;
goto
retry
;
}
}
...
...
DeviceLibrary/theMachine/AxisBean.cs
查看文件 @
30ce5a8
...
@@ -21,7 +21,7 @@ namespace DeviceLibrary
...
@@ -21,7 +21,7 @@ namespace DeviceLibrary
/// <summary>
/// <summary>
/// 干涉检测回调 from, to
/// 干涉检测回调 from, to
/// </summary>
/// </summary>
public
event
Func
<
int
,
int
,(
bool
,
string
)>
interference
;
public
event
Func
<
int
,
int
,
(
bool
,
string
)>
interference
;
public
string
AxisName
;
public
string
AxisName
;
public
bool
ForceSafeCheck
=
false
;
public
bool
ForceSafeCheck
=
false
;
public
AxisBean
(
ConfigMoveAxis
axisConfig
,
string
deviceName
)
public
AxisBean
(
ConfigMoveAxis
axisConfig
,
string
deviceName
)
...
@@ -92,7 +92,7 @@ namespace DeviceLibrary
...
@@ -92,7 +92,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
"ServoOff【"
+
AxisName
+
"】"
);
LogUtil
.
info
(
"ServoOff【"
+
AxisName
+
"】"
);
AxisManager
.
ServoOff
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
AxisManager
.
ServoOff
(
Config
.
DeviceName
,
Config
.
GetAxisValue
());
}
}
public
void
HomeMove
(
MoveInfo
MoveInfo
,
bool
force
=
true
)
public
void
HomeMove
(
MoveInfo
MoveInfo
,
bool
force
=
true
)
{
{
if
(!
force
&&
AxisManager
.
GetHomeEndStatus
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
())
==
3
)
if
(!
force
&&
AxisManager
.
GetHomeEndStatus
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
())
==
3
)
{
{
...
@@ -101,8 +101,12 @@ namespace DeviceLibrary
...
@@ -101,8 +101,12 @@ namespace DeviceLibrary
}
}
Config
.
TargetPosition
=
0
;
Config
.
TargetPosition
=
0
;
LogUtil
.
info
(
AxisName
+
"speed["
+
Config
.
HomeHighSpeed
+
"]开始原点返回"
);
LogUtil
.
info
(
AxisName
+
"speed["
+
Config
.
HomeHighSpeed
+
"]开始原点返回"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
true
));
if
(
MoveInfo
!=
null
)
AxisManager
.
HomeMove
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
(),
Config
.
HomeHighSpeed
,
Config
.
HomeLowSpeed
,
Config
.
HomeAddSpeed
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
true
));
var
HomeLowSpeed
=
Config
.
HomeLowSpeed
>
0
?
Config
.
HomeLowSpeed
:
Config
.
HomeHighSpeed
/
10
;
var
HomeAddSpeed
=
Config
.
HomeAddSpeed
>
0
?
Config
.
HomeAddSpeed
:
Config
.
HomeHighSpeed
*
5
;
AxisManager
.
HomeMove
(
Config
.
DeviceName
,
(
short
)
Config
.
GetAxisValue
(),
Config
.
HomeHighSpeed
,
HomeLowSpeed
,
HomeAddSpeed
);
}
}
/// <summary>
/// <summary>
...
@@ -111,9 +115,12 @@ namespace DeviceLibrary
...
@@ -111,9 +115,12 @@ namespace DeviceLibrary
public
void
AbsMove
(
MoveInfo
MoveInfo
,
int
targetPosition
,
int
targetSpeed
)
public
void
AbsMove
(
MoveInfo
MoveInfo
,
int
targetPosition
,
int
targetSpeed
)
{
{
if
(
IsInPosition
(
targetPosition
))
if
(
IsInPosition
(
targetPosition
))
{
LogUtil
.
info
(
AxisName
+
$
" 已在目标点:{targetPosition}"
);
return
;
return
;
}
if
(
ForceSafeCheck
&&
!
IsSafe
(
targetPosition
,
out
string
msg
))
if
(
ForceSafeCheck
&&
!
IsSafe
(
targetPosition
,
out
string
msg
))
{
{
Msg
.
add
(
msg
,
MsgLevel
.
alarm
);
Msg
.
add
(
msg
,
MsgLevel
.
alarm
);
RobotManage
.
UserPause
(
msg
);
RobotManage
.
UserPause
(
msg
);
...
@@ -129,7 +136,9 @@ namespace DeviceLibrary
...
@@ -129,7 +136,9 @@ namespace DeviceLibrary
{
{
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
targetPosition
,
targetSpeed
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
Config
,
targetPosition
,
targetSpeed
));
Config
.
TargetPosition
=
targetPosition
;
Config
.
TargetPosition
=
targetPosition
;
AxisManager
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
targetSpeed
*
4
,
targetSpeed
*
4
);
// Config.AddSpeed, Config.DelSpeed);
var
AddSpeed
=
Config
.
AddSpeed
>
0
?
Config
.
AddSpeed
:
targetSpeed
*
4
;
var
DelSpeed
=
Config
.
DelSpeed
>
0
?
Config
.
DelSpeed
:
targetSpeed
*
4
;
AxisManager
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
AddSpeed
,
DelSpeed
);
// Config.AddSpeed, Config.DelSpeed);
}
}
}
}
...
@@ -179,7 +188,9 @@ namespace DeviceLibrary
...
@@ -179,7 +188,9 @@ namespace DeviceLibrary
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
}
}
LogUtil
.
error
(
$
"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"
);
LogUtil
.
error
(
$
"{ MoveInfo.Name} {MoveInfo.MoveStep} {axis.DisplayStr}目标位置{targetPosition}当前位置{outCount},误差过大,{clearMsg}重新开始运动,剩余{MoveInfo.CanWhileCount}次"
);
AxisManager
.
AbsMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
targetSpeed
*
4
,
targetSpeed
*
4
);
// , axis.AddSpeed, axis.DelSpeed);
var
AddSpeed
=
axis
.
AddSpeed
>
0
?
axis
.
AddSpeed
:
targetSpeed
*
4
;
var
DelSpeed
=
axis
.
DelSpeed
>
0
?
axis
.
DelSpeed
:
targetSpeed
*
4
;
AxisManager
.
AbsMove
(
axis
.
DeviceName
,
axis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
,
AddSpeed
,
DelSpeed
);
// , axis.AddSpeed, axis.DelSpeed);
MoveInfo
.
CanWhileCount
--;
MoveInfo
.
CanWhileCount
--;
Thread
.
Sleep
(
200
);
Thread
.
Sleep
(
200
);
}
}
...
@@ -239,7 +250,7 @@ namespace DeviceLibrary
...
@@ -239,7 +250,7 @@ namespace DeviceLibrary
/// <summary>
/// <summary>
/// 绝对运动至点,不等待结果
/// 绝对运动至点,不等待结果
/// </summary>
/// </summary>
private
void
AbsMove
(
int
targetPos
,
double
targetSpeed
)
private
void
AbsMove
(
int
targetPos
,
int
targetSpeed
)
{
{
if
(
targetPos
.
Equals
(-
1
))
if
(
targetPos
.
Equals
(-
1
))
{
{
...
@@ -255,7 +266,9 @@ namespace DeviceLibrary
...
@@ -255,7 +266,9 @@ namespace DeviceLibrary
{
{
targetSpeed
=
Config
.
TargetSpeed
*
targetSpeed
;
targetSpeed
=
Config
.
TargetSpeed
*
targetSpeed
;
}
}
AxisManager
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
(
int
)
targetSpeed
,
(
int
)
targetSpeed
*
4
,
(
int
)
targetSpeed
*
4
);
// , Config.AddSpeed, Config.DelSpeed);
var
AddSpeed
=
Config
.
AddSpeed
>
0
?
Config
.
AddSpeed
:
targetSpeed
*
4
;
var
DelSpeed
=
Config
.
DelSpeed
>
0
?
Config
.
DelSpeed
:
targetSpeed
*
4
;
AxisManager
.
AbsMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
targetSpeed
,
AddSpeed
,
DelSpeed
);
// , Config.AddSpeed, Config.DelSpeed);
}
}
/// <summary>
/// <summary>
...
@@ -280,7 +293,8 @@ namespace DeviceLibrary
...
@@ -280,7 +293,8 @@ namespace DeviceLibrary
AxisManager
.
RelMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
(
int
)
targetSpeed
,
(
int
)
targetSpeed
*
4
,
(
int
)
targetSpeed
*
4
);
// , Config.AddSpeed, Config.DelSpeed);
AxisManager
.
RelMove
(
Config
.
DeviceName
,
Config
.
GetAxisValue
(),
targetPos
,
(
int
)
targetSpeed
,
(
int
)
targetSpeed
*
4
,
(
int
)
targetSpeed
*
4
);
// , Config.AddSpeed, Config.DelSpeed);
}
}
public
bool
IsBusy
{
public
bool
IsBusy
{
get
=>
AxisManager
.
GetBusyStatus
(
Config
.
DeviceName
,
Config
.
GetAxisValue
())
==
1
;
get
=>
AxisManager
.
GetBusyStatus
(
Config
.
DeviceName
,
Config
.
GetAxisValue
())
==
1
;
}
}
public
bool
IsServeoOn
public
bool
IsServeoOn
...
@@ -295,15 +309,17 @@ namespace DeviceLibrary
...
@@ -295,15 +309,17 @@ namespace DeviceLibrary
/// 判断轴运动是否安全
/// 判断轴运动是否安全
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
bool
IsSafe
(
int
Targetpos
,
out
string
msg
)
{
public
bool
IsSafe
(
int
Targetpos
,
out
string
msg
)
{
msg
=
""
;
msg
=
""
;
if
(
interference
==
null
)
if
(
interference
==
null
)
return
true
;
return
true
;
bool
result
;
bool
result
;
var
from
=
GetAclPosition
();
var
from
=
GetAclPosition
();
(
result
,
msg
)
=
interference
.
Invoke
(
from
,
Targetpos
);
(
result
,
msg
)
=
interference
.
Invoke
(
from
,
Targetpos
);
if
(
result
)
{
if
(
result
)
{
LogUtil
.
info
(
AxisName
+
$
" 干涉:{msg},From:{from},To:{Targetpos}"
);
LogUtil
.
info
(
AxisName
+
$
" 干涉:{msg},From:{from},To:{Targetpos}"
);
}
}
...
@@ -313,19 +329,15 @@ namespace DeviceLibrary
...
@@ -313,19 +329,15 @@ namespace DeviceLibrary
#
region
匀速上升处理
#
region
匀速上升处理
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
private
System
.
Timers
.
Timer
axisCheckTimer
=
null
;
internal
string
TargetIoType
=
""
;
internal
string
[]
TargetIoType
=
new
string
[]
{
}
;
internal
IO_VALUE
TargetIoValue
=
IO_VALUE
.
HIGH
;
internal
IO_VALUE
TargetIoValue
=
IO_VALUE
.
HIGH
;
public
bool
BatchAxisStartCheck
(
string
targetIo
,
IO_VALUE
value
=
IO_VALUE
.
HIGH
)
public
bool
BatchAxisStartCheck
(
string
[]
targetIo
,
IO_VALUE
value
=
IO_VALUE
.
HIGH
)
{
{
if
(
String
.
IsNullOrEmpty
(
targetIo
))
{
targetIo
=
""
;
}
if
(
axisCheckTimer
==
null
)
if
(
axisCheckTimer
==
null
)
{
{
axisCheckTimer
=
new
System
.
Timers
.
Timer
();
axisCheckTimer
=
new
System
.
Timers
.
Timer
();
axisCheckTimer
.
AutoReset
=
true
;
axisCheckTimer
.
AutoReset
=
true
;
axisCheckTimer
.
Interval
+=
30
;
axisCheckTimer
.
Interval
+=
15
;
axisCheckTimer
.
Elapsed
+=
CheckTimer_Elapsed
;
axisCheckTimer
.
Elapsed
+=
CheckTimer_Elapsed
;
axisCheckTimer
.
Enabled
=
false
;
axisCheckTimer
.
Enabled
=
false
;
}
}
...
@@ -345,21 +357,21 @@ namespace DeviceLibrary
...
@@ -345,21 +357,21 @@ namespace DeviceLibrary
return
true
;
return
true
;
}
}
private
bool
IsInProcess
=
false
;
private
bool
IsInProcess
=
false
;
private
DateTime
lastOkTime
=
DateTime
.
Now
;
private
void
CheckTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
private
void
CheckTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
TimeSpan
pan
=
DateTime
.
Now
-
lastOkTime
;
if
(
IsInProcess
)
{
return
;
}
if
(
IsInProcess
&&
pan
.
TotalMilliseconds
<
100
)
{
return
;
}
try
try
{
{
IsInProcess
=
true
;
IsInProcess
=
true
;
lastOkTime
=
DateTime
.
Now
;
foreach
(
var
io
in
TargetIoType
)
if
(
IOManager
.
IOValue
(
TargetIoType
).
Equals
(
TargetIoValue
))
{
{
StopAxisCheckMove
();
if
(
IOManager
.
IOValue
(
io
).
Equals
(
TargetIoValue
))
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 "
+
TargetIoType
+
"="
+
TargetIoValue
+
",停止运动"
);
{
SuddenStop
();
SuddenStop
();
StopAxisCheckMove
();
LogUtil
.
info
(
AxisName
+
"上料轴,检测到 "
+
io
+
"="
+
TargetIoValue
+
",停止运动"
);
break
;
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -400,7 +412,7 @@ namespace DeviceLibrary
...
@@ -400,7 +412,7 @@ namespace DeviceLibrary
public
static
void
CloseMultiAxis
(
List
<
AxisBean
>
axisArray
)
public
static
void
CloseMultiAxis
(
List
<
AxisBean
>
axisArray
)
{
{
foreach
(
AxisBean
axis
in
axisArray
)
foreach
(
AxisBean
axis
in
axisArray
)
{
{
axis
.
ServoOff
();
axis
.
ServoOff
();
Thread
.
Sleep
(
10
);
Thread
.
Sleep
(
10
);
}
}
...
...
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
30ce5a8
...
@@ -42,7 +42,7 @@ namespace DeviceLibrary
...
@@ -42,7 +42,7 @@ namespace DeviceLibrary
else
else
{
{
var
timediff
=
DateTime
.
Now
-
lastBtnUpPressTime
;
var
timediff
=
DateTime
.
Now
-
lastBtnUpPressTime
;
if
(
timediff
.
TotalSeconds
<
1
&&
trueCount
==
2
)
{
if
(
timediff
.
TotalSeconds
<
3
&&
trueCount
==
2
)
{
if
(
btnUP_L
&&
btnUP_R
)
if
(
btnUP_L
&&
btnUP_R
)
{
{
BtnAction
=
BtnActionE
.
Mid_Up
;
BtnAction
=
BtnActionE
.
Mid_Up
;
...
@@ -100,7 +100,7 @@ namespace DeviceLibrary
...
@@ -100,7 +100,7 @@ namespace DeviceLibrary
else
{
else
{
Msg
.
add
(
ld
.
Name
+
msg
,
MsgLevel
.
info
);
Msg
.
add
(
ld
.
Name
+
msg
,
MsgLevel
.
info
);
}
}
}
}
}
}
...
@@ -111,10 +111,17 @@ namespace DeviceLibrary
...
@@ -111,10 +111,17 @@ namespace DeviceLibrary
DateTime
lastAirprocesstime
=
DateTime
.
Now
;
DateTime
lastAirprocesstime
=
DateTime
.
Now
;
void
airprocess
()
void
airprocess
()
{
{
if
(
IOManager
.
IOValue
(
IO_Type
.
AirValve_Open
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOManager
.
IOValue
(
IO_Type
.
FrontDoor_Check
).
Equals
(
IO_VALUE
.
LOW
)
||
IOManager
.
IOValue
(
IO_Type
.
BackDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
LOW
);
return
;
}
if
((
DateTime
.
Now
-
lastAirprocesstime
).
TotalSeconds
<
5
)
if
((
DateTime
.
Now
-
lastAirprocesstime
).
TotalSeconds
<
5
)
return
;
return
;
lastAirprocesstime
=
DateTime
.
Now
;
lastAirprocesstime
=
DateTime
.
Now
;
IOManager
.
IOMove
(
IO_Type
.
SafeDoor_Lock
,
IO_VALUE
.
HIGH
);
//var temp = HumitureController.QueryData();
//var temp = HumitureController.QueryData();
var
temp
=
HumitureController
.
LastData
;
var
temp
=
HumitureController
.
LastData
;
Current_Humidity
=
temp
.
Humidity
;
Current_Humidity
=
temp
.
Humidity
;
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
30ce5a8
...
@@ -103,7 +103,7 @@ namespace DeviceLibrary
...
@@ -103,7 +103,7 @@ namespace DeviceLibrary
};
};
//BoxTransport_InOutEndProcessEvent;
//BoxTransport_InOutEndProcessEvent;
//ProcessMsgEvent += MainMachine_ProcessMsgEvent;
//ProcessMsgEvent += MainMachine_ProcessMsgEvent;
CodeManager
.
LoadCamera
(
true
);
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
//IOMonitor.RegisterIO(IO_Type.OutLeave_BTN, Config, IO_VALUE.HIGH, OutLeave_BTN,2500,100);
//IOMonitor.RegisterIO(IO_Type.OutLeave_BTN, Config, IO_VALUE.HIGH, OutLeave_BTN,2500,100);
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
30ce5a8
...
@@ -93,6 +93,7 @@ namespace DeviceLibrary
...
@@ -93,6 +93,7 @@ namespace DeviceLibrary
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
LogUtil
.
error
(
ex
.
Message
);
return
;
return
;
}
}
LoadFinishEvent
?.
Invoke
(
IsConfigMode
?
IsConfigMode
:
IsLoadOk
,
msg
);
LoadFinishEvent
?.
Invoke
(
IsConfigMode
?
IsConfigMode
:
IsLoadOk
,
msg
);
...
...
LoadCVSLibrary/Config/Config.csv
查看文件 @
30ce5a8
...
@@ -123,3 +123,5 @@ DO,0,右线体防护门上升,Right_Door_Up,26,HC,Y26,,,,,,,,,,
...
@@ -123,3 +123,5 @@ DO,0,右线体防护门上升,Right_Door_Up,26,HC,Y26,,,,,,,,,,
DO,0,右线体防护门下降,Right_Door_Down,27,HC,Y27,,,,,,,,,,
DO,0,右线体防护门下降,Right_Door_Down,27,HC,Y27,,,,,,,,,,
DO,0,分拣台上升,Mid_Up,28,HC,Y28,,,,,,,,,,
DO,0,分拣台上升,Mid_Up,28,HC,Y28,,,,,,,,,,
DO,0,分拣台下降,Mid_Down,29,HC,Y29,,,,,,,,,,
DO,0,分拣台下降,Mid_Down,29,HC,Y29,,,,,,,,,,
DO,0,安全门关闭,SafeDoor_Lock,30,HC,Y30,,,,,,,,,,
DO,0,空气阀门打开,AirValve_Open,31,HC,Y31,,,,,,,,,,
LoadCVSLibrary/storeConfig/config/IO_Type.cs
查看文件 @
30ce5a8
...
@@ -338,6 +338,14 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -338,6 +338,14 @@ namespace OnlineStore.LoadCSVLibrary
public
static
string
Mid_Down
=
"Mid_Down"
;
public
static
string
Mid_Down
=
"Mid_Down"
;
/// <summary>
/// DO,0,安全门关闭,SafeDoor_Lock,30,HC,Y30,,,,,,,,,,
/// </summary>
public
static
string
SafeDoor_Lock
=
"SafeDoor_Lock"
;
/// <summary>
/// DO,0,空气阀门打开,AirValve_Open,31,HC,Y31,,,,,,,,,,
/// </summary>
public
static
string
AirValve_Open
=
"AirValve_Open"
;
}
}
public
enum
IO_VALUE
public
enum
IO_VALUE
{
{
...
...
TheMachine/Form1.Designer.cs
查看文件 @
30ce5a8
...
@@ -51,6 +51,7 @@ namespace TheMachine
...
@@ -51,6 +51,7 @@ namespace TheMachine
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_opendoor
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
...
@@ -142,6 +143,7 @@ namespace TheMachine
...
@@ -142,6 +143,7 @@ namespace TheMachine
//
//
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox2
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox2
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox1
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
pictureBox1
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_opendoor
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_IgnoreX09
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_IgnoreX09
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_PauseBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
btn_PauseBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_EnableBuzzer
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
cb_EnableBuzzer
);
...
@@ -299,6 +301,18 @@ namespace TheMachine
...
@@ -299,6 +301,18 @@ namespace TheMachine
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
//
//
// btn_opendoor
//
this
.
btn_opendoor
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
btn_opendoor
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
236
);
this
.
btn_opendoor
.
Name
=
"btn_opendoor"
;
this
.
btn_opendoor
.
Size
=
new
System
.
Drawing
.
Size
(
201
,
40
);
this
.
btn_opendoor
.
TabIndex
=
6
;
this
.
btn_opendoor
.
Text
=
"解锁舱门"
;
this
.
btn_opendoor
.
UseVisualStyleBackColor
=
false
;
this
.
btn_opendoor
.
Visible
=
false
;
this
.
btn_opendoor
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_opendoor_Click
);
//
// Form1
// Form1
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
14F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
14F
);
...
@@ -353,6 +367,7 @@ namespace TheMachine
...
@@ -353,6 +367,7 @@ namespace TheMachine
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox2
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox2
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
private
System
.
Windows
.
Forms
.
PictureBox
pictureBox1
;
private
System
.
Windows
.
Forms
.
Button
btn_IgnoreX09
;
private
System
.
Windows
.
Forms
.
Button
btn_IgnoreX09
;
private
System
.
Windows
.
Forms
.
Button
btn_opendoor
;
}
}
}
}
TheMachine/Form1.cs
查看文件 @
30ce5a8
...
@@ -154,6 +154,8 @@ namespace TheMachine
...
@@ -154,6 +154,8 @@ namespace TheMachine
}
}
void
SetState
(
List
<
MoveInfo
>
moveInfoList
)
void
SetState
(
List
<
MoveInfo
>
moveInfoList
)
{
{
if
(
RobotManage
.
mainMachine
==
null
)
return
;
this
.
SuspendLayout
();
this
.
SuspendLayout
();
stateView
.
Items
.
Clear
();
stateView
.
Items
.
Clear
();
foreach
(
MoveInfo
moveInfo
in
moveInfoList
)
foreach
(
MoveInfo
moveInfo
in
moveInfoList
)
...
@@ -448,5 +450,13 @@ namespace TheMachine
...
@@ -448,5 +450,13 @@ namespace TheMachine
RobotManage
.
mainMachine
.
IgnoreX09
();
RobotManage
.
mainMachine
.
IgnoreX09
();
btn_IgnoreX09
.
Visible
=
false
;
btn_IgnoreX09
.
Visible
=
false
;
}
}
private
void
btn_opendoor_Click
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
info
(
"用户点击打开舱门"
);
RobotManage
.
UserPause
(
true
);
FrmReleaseDoor
frmReleaseDoor
=
new
FrmReleaseDoor
();
frmReleaseDoor
.
ShowDialog
();
}
}
}
}
}
TheMachine/FrmReleaseDoor.Designer.cs
0 → 100644
查看文件 @
30ce5a8
namespace
TheMachine
{
partial
class
FrmReleaseDoor
{
/// <summary>
/// Required designer variable.
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
Windows
Form
Designer
generated
code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private
void
InitializeComponent
()
{
this
.
components
=
new
System
.
ComponentModel
.
Container
();
this
.
btn_cancel
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
lbl_lockstatus
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lbl_airstatus
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
timer1
=
new
System
.
Windows
.
Forms
.
Timer
(
this
.
components
);
this
.
SuspendLayout
();
//
// btn_cancel
//
this
.
btn_cancel
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
14.25F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_cancel
.
Location
=
new
System
.
Drawing
.
Point
(
202
,
318
);
this
.
btn_cancel
.
Name
=
"btn_cancel"
;
this
.
btn_cancel
.
Size
=
new
System
.
Drawing
.
Size
(
234
,
49
);
this
.
btn_cancel
.
TabIndex
=
0
;
this
.
btn_cancel
.
Text
=
"取消开启或关闭门锁"
;
this
.
btn_cancel
.
UseVisualStyleBackColor
=
true
;
this
.
btn_cancel
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_cancel_Click
);
//
// lbl_lockstatus
//
this
.
lbl_lockstatus
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
14.25F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lbl_lockstatus
.
Location
=
new
System
.
Drawing
.
Point
(
99
,
24
);
this
.
lbl_lockstatus
.
Name
=
"lbl_lockstatus"
;
this
.
lbl_lockstatus
.
Size
=
new
System
.
Drawing
.
Size
(
469
,
75
);
this
.
lbl_lockstatus
.
TabIndex
=
1
;
this
.
lbl_lockstatus
.
Text
=
"门锁状态:已锁定"
;
//
// lbl_airstatus
//
this
.
lbl_airstatus
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
14.25F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
lbl_airstatus
.
Location
=
new
System
.
Drawing
.
Point
(
99
,
112
);
this
.
lbl_airstatus
.
Name
=
"lbl_airstatus"
;
this
.
lbl_airstatus
.
Size
=
new
System
.
Drawing
.
Size
(
469
,
149
);
this
.
lbl_airstatus
.
TabIndex
=
1
;
this
.
lbl_airstatus
.
Text
=
"舱内氮气含量:"
;
//
// timer1
//
this
.
timer1
.
Enabled
=
true
;
this
.
timer1
.
Interval
=
1500
;
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
timer1_Tick
);
//
// FrmReleaseDoor
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
662
,
394
);
this
.
Controls
.
Add
(
this
.
lbl_airstatus
);
this
.
Controls
.
Add
(
this
.
lbl_lockstatus
);
this
.
Controls
.
Add
(
this
.
btn_cancel
);
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
FixedSingle
;
this
.
MaximizeBox
=
false
;
this
.
MinimizeBox
=
false
;
this
.
Name
=
"FrmReleaseDoor"
;
this
.
ShowIcon
=
false
;
this
.
StartPosition
=
System
.
Windows
.
Forms
.
FormStartPosition
.
CenterScreen
;
this
.
Text
=
"解锁门锁"
;
this
.
Load
+=
new
System
.
EventHandler
(
this
.
FrmReleaseDoor_Load
);
this
.
ResumeLayout
(
false
);
}
#
endregion
private
System
.
Windows
.
Forms
.
Button
btn_cancel
;
private
System
.
Windows
.
Forms
.
Label
lbl_lockstatus
;
private
System
.
Windows
.
Forms
.
Label
lbl_airstatus
;
private
System
.
Windows
.
Forms
.
Timer
timer1
;
}
}
\ No newline at end of file
\ No newline at end of file
TheMachine/FrmReleaseDoor.cs
0 → 100644
查看文件 @
30ce5a8
using
DeviceLibrary
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
namespace
TheMachine
{
public
partial
class
FrmReleaseDoor
:
Form
{
public
FrmReleaseDoor
()
{
InitializeComponent
();
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
IOManager
.
IOMove
(
IO_Type
.
AirValve_Open
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
LOW
);
var
dd
=
HumitureController
.
QueryData
();
var
nitrogen
=
100
-
dd
.
OxygenV
-
1
;
if
(
nitrogen
<=
Setting_Init
.
Nitrogen_Safe_Maximum
)
{
IOManager
.
IOMove
(
IO_Type
.
SafeDoor_Lock
,
IO_VALUE
.
LOW
);
}
lbl_airstatus
.
Text
=
$
"当前氮气含量:{nitrogen:0.0}%, 等待低于{Setting_Init.Nitrogen_Safe_Maximum}%后解锁舱门"
;
var
islock
=
IOManager
.
IOValue
(
IO_Type
.
SafeDoor_Lock
).
Equals
(
IO_VALUE
.
HIGH
);
var
isair
=
IOManager
.
IOValue
(
IO_Type
.
AirValve_Open
).
Equals
(
IO_VALUE
.
HIGH
);
lbl_lockstatus
.
Text
=
$
"当前门锁状态:{(islock ? "
已锁门
" : "
已解锁
")}\r\n空气阀状态:{(isair ? "
已打开
" : "
已关闭
")}"
;
}
private
void
FrmReleaseDoor_Load
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
info
(
"请求打开舱门开始"
);
IOManager
.
IOMove
(
IO_Type
.
AirValve_Open
,
IO_VALUE
.
HIGH
);
Thread
.
Sleep
(
1000
);
IOManager
.
IOMove
(
IO_Type
.
AirValue
,
IO_VALUE
.
LOW
);
}
private
void
btn_cancel_Click
(
object
sender
,
EventArgs
e
)
{
if
(
IOManager
.
IOValue
(
IO_Type
.
FrontDoor_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOManager
.
IOValue
(
IO_Type
.
BackDoor_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
timer1
.
Stop
();
IOManager
.
IOMove
(
IO_Type
.
SafeDoor_Lock
,
IO_VALUE
.
HIGH
);
Thread
.
Sleep
(
200
);
IOManager
.
IOMove
(
IO_Type
.
SafeDoor_Lock
,
IO_VALUE
.
HIGH
);
IOManager
.
IOMove
(
IO_Type
.
AirValve_Open
,
IO_VALUE
.
LOW
);
this
.
Close
();
}
else
{
MessageBox
.
Show
(
"请先关闭料仓门"
);
}
}
}
}
TheMachine/FrmReleaseDoor.resx
0 → 100644
查看文件 @
30ce5a8
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
\ No newline at end of file
TheMachine/SettingControl.cs
查看文件 @
30ce5a8
...
@@ -130,7 +130,7 @@ namespace TheMachine
...
@@ -130,7 +130,7 @@ namespace TheMachine
return
;
return
;
}
}
var
t
=
HumitureController
.
LastData
;
var
t
=
HumitureController
.
LastData
;
lbl_hmdstate
.
Text
+=
"温度"
+
$
":{t.Temperate}℃, "
+
"湿度"
+
$
":{t.Humidity}%"
;
lbl_hmdstate
.
Text
+=
"温度"
+
$
":{t.Temperate}℃, "
+
"湿度"
+
$
":{t.Humidity}%
, "
+
"氮气"
+
$
":{100-t.OxygenV-1}%
"
;
}
}
}
}
}
}
TheMachine/TheMachine.csproj
查看文件 @
30ce5a8
...
@@ -93,6 +93,12 @@
...
@@ -93,6 +93,12 @@
<Compile Include="Form1.Designer.cs">
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
</Compile>
<Compile Include="FrmReleaseDoor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmReleaseDoor.Designer.cs">
<DependentUpon>FrmReleaseDoor.cs</DependentUpon>
</Compile>
<Compile Include="Frm_AxisMoveByIO.cs">
<Compile Include="Frm_AxisMoveByIO.cs">
<SubType>Form</SubType>
<SubType>Form</SubType>
</Compile>
</Compile>
...
@@ -153,6 +159,9 @@
...
@@ -153,6 +159,9 @@
<EmbeddedResource Include="Form1.resx">
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
<EmbeddedResource Include="FrmReleaseDoor.resx">
<DependentUpon>FrmReleaseDoor.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Frm_AxisMoveByIO.resx">
<EmbeddedResource Include="Frm_AxisMoveByIO.resx">
<DependentUpon>Frm_AxisMoveByIO.cs</DependentUpon>
<DependentUpon>Frm_AxisMoveByIO.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论