Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
SO664-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 0aff9dd7
由
张东亮
编写于
2023-11-24 14:17:59 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
timer改为线程
1 个父辈
7290c4f8
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
340 行增加
和
184 行删除
source/DeviceLibrary/DeviceLibrary.csproj
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
source/DeviceLibrary/assemblyLine/HY/HY_C1Line.cs
source/DeviceLibrary/assemblyLine/HY/HY_C1_SLStation.cs
source/DeviceLibrary/assemblyLine/HY/HY_Coveryor.cs
source/DeviceLibrary/assemblyLine/HY/HY_Coveryor_Partial.cs
source/DeviceLibrary/assemblyLine/HY/HY_OutLine.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/MoveEquip.cs
source/DeviceLibrary/model/KTK_Store.cs
source/HuichuanLibrary/HCLogUtil.cs
source/DeviceLibrary/DeviceLibrary.csproj
查看文件 @
0aff9dd
...
@@ -49,6 +49,9 @@
...
@@ -49,6 +49,9 @@
<Reference Include="CodeLibrary">
<Reference Include="CodeLibrary">
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
<HintPath>..\..\dll\CodeLibrary.dll</HintPath>
</Reference>
</Reference>
<Reference Include="ConfigHelper">
<HintPath>..\..\..\..\..\..\SharedRefDll\Neotel\ConfigHelper\Debug\net461\ConfigHelper.dll</HintPath>
</Reference>
<Reference Include="halcondotnet">
<Reference Include="halcondotnet">
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
<HintPath>..\..\dll\halcondotnet.dll</HintPath>
</Reference>
</Reference>
...
...
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
0aff9dd
...
@@ -21,22 +21,22 @@ namespace OnlineStore.DeviceLibrary
...
@@ -21,22 +21,22 @@ namespace OnlineStore.DeviceLibrary
public
string
RFIDIP
=
""
;
public
string
RFIDIP
=
""
;
public
LineMoveInfo
SecondMoveInfo
=
null
;
public
LineMoveInfo
SecondMoveInfo
=
null
;
public
bool
IsDebug
=
false
;
public
bool
IsDebug
=
false
;
public
bool
UseAxis
=
false
;
public
bool
UseAxis
=
false
;
public
ConcurrentQueue
<
InOutParam
>
waitOutStoreList
=
new
ConcurrentQueue
<
InOutParam
>();
public
ConcurrentQueue
<
InOutParam
>
waitOutStoreList
=
new
ConcurrentQueue
<
InOutParam
>();
public
List
<
InOutParam
>
waitInStoreList
=
new
List
<
InOutParam
>();
public
List
<
InOutParam
>
waitInStoreList
=
new
List
<
InOutParam
>();
internal
object
waitInListLock
=
""
;
internal
object
waitInListLock
=
""
;
protected
int
trayCount
=
0
;
protected
int
trayCount
=
0
;
internal
int
preTrayNum
=
0
;
internal
int
preTrayNum
=
0
;
public
int
currTrayNum
=
0
;
public
int
currTrayNum
=
0
;
public
AxisBean
UpdownAxis
=
null
;
public
AxisBean
UpdownAxis
=
null
;
public
delegate
void
TrayProcessEnd
(
int
swNum
,
int
trayNum
);
public
delegate
void
TrayProcessEnd
(
int
swNum
,
int
trayNum
);
protected
abstract
void
BaseTimerProcess
();
protected
abstract
void
BaseTimerProcess
();
protected
abstract
void
FixtureProcess
();
protected
abstract
void
FixtureProcess
();
protected
override
void
mainT
imer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
protected
override
void
mainT
hread_Process
(
)
{
{
TimerProcess
();
TimerProcess
();
}
}
...
@@ -61,20 +61,20 @@ namespace OnlineStore.DeviceLibrary
...
@@ -61,20 +61,20 @@ namespace OnlineStore.DeviceLibrary
}
}
this
.
alarmType
=
alarmType
;
this
.
alarmType
=
alarmType
;
if
(
alarmType
.
Equals
(
LineAlarmType
.
SuddenStop
)
||
alarmType
.
Equals
(
LineAlarmType
.
NoAirCheck
)
if
(
alarmType
.
Equals
(
LineAlarmType
.
SuddenStop
)
||
alarmType
.
Equals
(
LineAlarmType
.
NoAirCheck
)
||
alarmType
.
Equals
(
LineAlarmType
.
AxisAlarm
)||
alarmType
.
Equals
(
LineAlarm
.
AxisErrorStop
))
||
alarmType
.
Equals
(
LineAlarmType
.
AxisAlarm
)
||
alarmType
.
Equals
(
LineAlarm
.
AxisErrorStop
))
{
{
StopMove
(
alarmType
+
"报警"
);
StopMove
(
alarmType
+
"报警"
);
}
}
}
}
public
virtual
void
CheckAlarmProcess
(
LineMoveInfo
moveInfo
,
LineAlarmType
alarmType
)
public
virtual
void
CheckAlarmProcess
(
LineMoveInfo
moveInfo
,
LineAlarmType
alarmType
)
{
{
}
}
protected
virtual
void
CloseAllDO
()
protected
virtual
void
CloseAllDO
()
{
{
List
<
string
>
doList
=
new
List
<
string
>(
baseConfig
.
DOList
.
Keys
);
List
<
string
>
doList
=
new
List
<
string
>(
baseConfig
.
DOList
.
Keys
);
foreach
(
string
doType
in
doList
)
foreach
(
string
doType
in
doList
)
{
{
if
(
doType
.
Equals
(
IO_Type
.
SL_AlarmLed
)
||
doType
.
Equals
(
IO_Type
.
SL_HddLed
))
if
(
doType
.
Equals
(
IO_Type
.
SL_AlarmLed
)
||
doType
.
Equals
(
IO_Type
.
SL_HddLed
))
{
{
...
@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
private
DateTime
lastProTimer
=
DateTime
.
Now
;
private
DateTime
lastProTimer
=
DateTime
.
Now
;
protected
int
TimerMaxSeconds
=
3
;
protected
int
TimerMaxSeconds
=
3
;
public
void
TimerProcess
()
public
void
TimerProcess
()
{
{
TimeSpan
span
=
DateTime
.
Now
-
lastProTimer
;
TimeSpan
span
=
DateTime
.
Now
-
lastProTimer
;
...
@@ -116,13 +116,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -116,13 +116,13 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
Name
+
"TimerProcess出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"TimerProcess出错:"
,
ex
);
}
}
isInPro
=
false
;
isInPro
=
false
;
}
}
protected
DateTime
preIoTimerOutTime
=
DateTime
.
Now
;
protected
DateTime
preIoTimerOutTime
=
DateTime
.
Now
;
protected
virtual
void
IOTimeOutProcess
()
protected
virtual
void
IOTimeOutProcess
()
{
{
try
try
{
{
...
@@ -136,7 +136,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -136,7 +136,7 @@ namespace OnlineStore.DeviceLibrary
return
;
return
;
}
}
//若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过
//若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
SecondMoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
MoveInfo
.
IsInWait
.
Equals
(
false
)
&&
SecondMoveInfo
.
IsInWait
.
Equals
(
false
))
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
SecondMoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
MoveInfo
.
IsInWait
.
Equals
(
false
)
&&
SecondMoveInfo
.
IsInWait
.
Equals
(
false
))
{
{
LogUtil
.
info
(
Name
+
"清理信号超时报警【"
+
WarnMsg
+
"】 "
);
LogUtil
.
info
(
Name
+
"清理信号超时报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
LineAlarmType
.
None
;
alarmType
=
LineAlarmType
.
None
;
...
@@ -146,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -146,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"IOTimeOutProcess出错:"
,
ex
);
LogUtil
.
error
(
"IOTimeOutProcess出错:"
,
ex
);
}
}
}
}
protected
override
void
BusyMoveProcess
()
protected
override
void
BusyMoveProcess
()
...
@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -178,7 +178,8 @@ namespace OnlineStore.DeviceLibrary
{
{
ResetProcess
();
ResetProcess
();
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
Name
+
" BusyMoveProcess 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
Name
+
" BusyMoveProcess 出错:"
+
ex
.
ToString
());
}
}
...
@@ -208,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -208,7 +209,7 @@ namespace OnlineStore.DeviceLibrary
string
canResult
=
LineManager
.
Line
.
CanStart
();
string
canResult
=
LineManager
.
Line
.
CanStart
();
if
(
String
.
IsNullOrEmpty
(
canResult
).
Equals
(
false
))
if
(
String
.
IsNullOrEmpty
(
canResult
).
Equals
(
false
))
{
{
SetWarnMsg
(
Name
+
canResult
);
SetWarnMsg
(
Name
+
canResult
);
return
false
;
return
false
;
}
}
return
true
;
return
true
;
...
@@ -273,14 +274,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -273,14 +274,14 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
"从调试状态切换到正常状态!"
);
LogInfo
(
"从调试状态切换到正常状态!"
);
}
}
}
}
}
}
internal
virtual
void
OpenStopBlock
()
internal
virtual
void
OpenStopBlock
()
{
{
preRWTime
=
DateTime
.
Now
;
preRWTime
=
DateTime
.
Now
;
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
)
)
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
))
{
{
LogInfo
(
"OpenStopCylinder: 下降阻挡气缸,上下气缸上升,顶升气缸下降"
);
LogInfo
(
"OpenStopCylinder: 下降阻挡气缸,上下气缸上升,顶升气缸下降"
);
IOMove
(
IO_Type
.
StopDown1
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
StopDown1
,
IO_VALUE
.
HIGH
);
...
@@ -293,15 +294,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -293,15 +294,16 @@ namespace OnlineStore.DeviceLibrary
//顶升气缸下降
//顶升气缸下降
CylinderMove
(
null
,
IO_Type
.
TopCylinder_Up
,
IO_Type
.
TopCylinder_Down
);
CylinderMove
(
null
,
IO_Type
.
TopCylinder_Up
,
IO_Type
.
TopCylinder_Down
);
Thread
.
Sleep
(
30
);
Thread
.
Sleep
(
30
);
}
else
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
FeedingEquip
))
}
else
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
FeedingEquip
))
{
{
}
}
}
}
internal
virtual
bool
OpenStopBlockOk
(
TimeSpan
span
)
internal
virtual
bool
OpenStopBlockOk
(
TimeSpan
span
)
{
{
TimeSpan
rwSpan
=
DateTime
.
Now
-
preRWTime
;
TimeSpan
rwSpan
=
DateTime
.
Now
-
preRWTime
;
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
)
)
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
))
{
{
if
(
IOValue
(
IO_Type
.
StopDown1
).
Equals
(
IO_VALUE
.
HIGH
)
&&
if
(
IOValue
(
IO_Type
.
StopDown1
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
StopDown2
).
Equals
(
IO_VALUE
.
HIGH
))
IOValue
(
IO_Type
.
StopDown2
).
Equals
(
IO_VALUE
.
HIGH
))
...
@@ -323,10 +325,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -323,10 +325,10 @@ namespace OnlineStore.DeviceLibrary
}
}
internal
virtual
void
CloseStopBlock
()
internal
virtual
void
CloseStopBlock
()
{
{
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
)
)
if
(
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
))
{
{
LogInfo
(
"CloseCylinderStop: 上升阻挡气缸,关闭上下气缸,顶升气缸IO"
);
LogInfo
(
"CloseCylinderStop: 上升阻挡气缸,关闭上下气缸,顶升气缸IO"
);
IOMove
(
IO_Type
.
StopDown1
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopDown1
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopDown2
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopDown2
,
IO_VALUE
.
LOW
);
//上下气缸上升
//上下气缸上升
...
@@ -391,27 +393,27 @@ namespace OnlineStore.DeviceLibrary
...
@@ -391,27 +393,27 @@ namespace OnlineStore.DeviceLibrary
if
(!
UseAxis
)
if
(!
UseAxis
)
{
{
return
true
;
return
true
;
}
}
string
msg
=
""
;
string
msg
=
""
;
bool
result
=
axis
.
Open
(
isCheck
,
out
msg
);
bool
result
=
axis
.
Open
(
isCheck
,
out
msg
);
if
(
result
&&
String
.
IsNullOrEmpty
(
msg
))
if
(
result
&&
String
.
IsNullOrEmpty
(
msg
))
{
{
return
true
;
return
true
;
}
}
SetWarnMsg
(
Name
+
msg
,
axis
.
Config
.
DisplayStr
+
"_轴报警"
);
SetWarnMsg
(
Name
+
msg
,
axis
.
Config
.
DisplayStr
+
"_轴报警"
);
Alarm
(
LineAlarmType
.
AxisAlarm
);
Alarm
(
LineAlarmType
.
AxisAlarm
);
return
false
;
return
false
;
}
}
public
void
CloseAxis
(
AxisBean
axis
)
public
void
CloseAxis
(
AxisBean
axis
)
{
{
LogUtil
.
info
(
Name
+
"关闭伺服 "
+
axis
.
AxisName
);
LogUtil
.
info
(
Name
+
"关闭伺服 "
+
axis
.
AxisName
);
axis
.
ServoOff
();
axis
.
ServoOff
();
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
}
}
private
DateTime
checkAlarmTime
=
DateTime
.
Now
;
private
DateTime
checkAlarmTime
=
DateTime
.
Now
;
public
bool
CheckAxisAlarm
(
params
AxisBean
[]
axisList
)
public
bool
CheckAxisAlarm
(
params
AxisBean
[]
axisList
)
{
{
if
(!
NoErrorAlarm
())
if
(!
NoErrorAlarm
())
{
{
...
@@ -534,16 +536,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -534,16 +536,16 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
>
LineManager
.
Config
.
IOSingle_TimerOut
&&
alarmType
<=
LineAlarmType
.
IoSingleTimeOut
)
if
(
span
.
TotalSeconds
>
LineManager
.
Config
.
IOSingle_TimerOut
&&
alarmType
<=
LineAlarmType
.
IoSingleTimeOut
)
{
{
ConfigIO
io
=
baseConfig
.
getWaitIO
(
wait
.
IoType
);
ConfigIO
io
=
baseConfig
.
getWaitIO
(
wait
.
IoType
);
string
warnmsg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"] 等待"
+
NotOkMsg
+
" 超时 "
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"秒"
;
string
warnmsg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"] 等待"
+
NotOkMsg
+
" 超时 "
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"秒"
;
SetWarnMsg
(
warnmsg
,
moveInfo
.
GetStepDes
()
+
"_超时报警"
,
moveInfo
);
SetWarnMsg
(
warnmsg
,
moveInfo
.
GetStepDes
()
+
"_超时报警"
,
moveInfo
);
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
13
);
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
13
);
if
(
NoAlarm
())
if
(
NoAlarm
())
{
{
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
CheckAlarmProcess
(
moveInfo
,
LineAlarmType
.
IoSingleTimeOut
);
CheckAlarmProcess
(
moveInfo
,
LineAlarmType
.
IoSingleTimeOut
);
}
}
}
}
if
(
rwSpan
.
TotalSeconds
>
5
&&
span
.
TotalSeconds
>
6
&&
span
.
TotalSeconds
<
LineManager
.
Config
.
IOSingle_TimerOut
*
2
)
if
(
rwSpan
.
TotalSeconds
>
5
&&
span
.
TotalSeconds
>
6
&&
span
.
TotalSeconds
<
LineManager
.
Config
.
IOSingle_TimerOut
*
2
)
{
{
preRWTime
=
DateTime
.
Now
;
preRWTime
=
DateTime
.
Now
;
string
msg
=
moveInfo
.
Name
+
" ["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"] "
+
NotOkMsg
+
"已等待 "
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"秒,重写DO:"
;
string
msg
=
moveInfo
.
Name
+
" ["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"] "
+
NotOkMsg
+
"已等待 "
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"秒,重写DO:"
;
...
@@ -586,7 +588,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -586,7 +588,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_BoxCanInstore
))
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W009_BoxCanInstore
))
{
{
int
storeId
=
moveInfo
.
MoveParam
.
GetStoreId
();
int
storeId
=
moveInfo
.
MoveParam
.
GetStoreId
();
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
,
out
NotOkMsg
);
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
,
out
NotOkMsg
);
}
}
else
else
{
{
...
@@ -643,9 +645,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -643,9 +645,9 @@ namespace OnlineStore.DeviceLibrary
if
(
noTrayAlarm
.
Count
>
0
)
if
(
noTrayAlarm
.
Count
>
0
)
{
{
msg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"]未抓起料盘,请取走料盘后复位["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]"
;
msg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"]未抓起料盘,请取走料盘后复位["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]"
;
type
=
MoveInfo
.
GetStepDes
()
+
"_"
+
"未抓起料"
;
type
=
MoveInfo
.
GetStepDes
()
+
"_"
+
"未抓起料"
;
}
}
//LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
//LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
SetWarnMsg
(
msg
,
type
,
moveInfo
,
second
);
SetWarnMsg
(
msg
,
type
,
moveInfo
,
second
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
...
@@ -681,7 +683,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -681,7 +683,7 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
debug
(
Name
+
""
+
msg
);
LogUtil
.
debug
(
Name
+
""
+
msg
);
}
}
protected
void
InLog
(
string
msg
)
protected
void
InLog
(
string
msg
)
{
{
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
"["
+
currTrayNum
+
"]["
+
MoveInfo
.
MoveParam
.
PosId
+
"]["
+
MoveInfo
.
MoveParam
.
WareCode
+
"]"
:
""
;
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
"["
+
currTrayNum
+
"]["
+
MoveInfo
.
MoveParam
.
PosId
+
"]["
+
MoveInfo
.
MoveParam
.
WareCode
+
"]"
:
""
;
//baseConfig.DType.Equals(DeviceType.HYEquip)
//baseConfig.DType.Equals(DeviceType.HYEquip)
...
@@ -702,7 +704,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -702,7 +704,7 @@ namespace OnlineStore.DeviceLibrary
protected
void
OutLog
(
string
msg
,
int
levle
=
-
1
)
protected
void
OutLog
(
string
msg
,
int
levle
=
-
1
)
{
{
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
"["
+
currTrayNum
+
"]["
+
MoveInfo
.
MoveParam
.
PosId
+
"]["
+
MoveInfo
.
MoveParam
.
WareCode
+
"]"
:
""
;
string
posId
=
MoveInfo
.
MoveParam
!=
null
?
"["
+
currTrayNum
+
"]["
+
MoveInfo
.
MoveParam
.
PosId
+
"]["
+
MoveInfo
.
MoveParam
.
WareCode
+
"]"
:
""
;
if
(
levle
.
Equals
(-
1
)
&&
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
))
if
(
levle
.
Equals
(-
1
)
&&
baseConfig
.
DType
.
Equals
(
DeviceType
.
MoveEquip
))
{
{
levle
=
0
;
levle
=
0
;
...
@@ -712,7 +714,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -712,7 +714,7 @@ namespace OnlineStore.DeviceLibrary
levle
=
1
;
levle
=
1
;
}
}
List
<
int
>
jHy
=
new
List
<
int
>()
{
210
,
212
};
List
<
int
>
jHy
=
new
List
<
int
>()
{
210
,
212
};
if
(
jHy
.
Contains
(
DeviceID
))
if
(
jHy
.
Contains
(
DeviceID
))
{
{
//三个接驳台打印日志
//三个接驳台打印日志
levle
=
1
;
levle
=
1
;
...
@@ -725,7 +727,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -725,7 +727,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
levle
.
Equals
(
0
))
else
if
(
levle
.
Equals
(
0
))
{
{
LogUtil
.
debug
(
Name
+
" "
+
posId
+
msg
);
LogUtil
.
debug
(
Name
+
" "
+
posId
+
msg
);
}
}
}
}
public
virtual
string
GetMoveStr
()
public
virtual
string
GetMoveStr
()
...
@@ -743,7 +745,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -743,7 +745,7 @@ namespace OnlineStore.DeviceLibrary
return
msg
;
return
msg
;
}
}
internal
void
MoveEndS
()
internal
void
MoveEndS
()
{
{
runStatus
=
LineRunStatus
.
Runing
;
runStatus
=
LineRunStatus
.
Runing
;
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
}
}
...
@@ -757,11 +759,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -757,11 +759,11 @@ namespace OnlineStore.DeviceLibrary
"红色:严重报警\r\n"
;
"红色:严重报警\r\n"
;
}
}
public
Color
GetShowColor
()
public
Color
GetShowColor
()
{
{
if
(
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
if
(
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
{
{
if
(
IsDebug
)
if
(
IsDebug
)
{
{
return
Color
.
LightGray
;
return
Color
.
LightGray
;
}
}
else
else
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
查看文件 @
0aff9dd
...
@@ -45,7 +45,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -45,7 +45,8 @@ namespace OnlineStore.DeviceLibrary
RFIDIP
=
RFIDManager
.
GetRFIP
(
DeviceID
);
RFIDIP
=
RFIDManager
.
GetRFIP
(
DeviceID
);
HasOutLine
=
config
.
DOList
.
ContainsKey
(
IO_Type
.
SL_OutLine_Run
);
HasOutLine
=
config
.
DOList
.
ContainsKey
(
IO_Type
.
SL_OutLine_Run
);
addLastDI
(
IO_Type
.
SL_Reset_BTN
,
IO_VALUE
.
LOW
);
addLastDI
(
IO_Type
.
SL_Reset_BTN
,
IO_VALUE
.
LOW
);
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
}
}
public
override
bool
StartRun
(
bool
isDebug
=
false
)
public
override
bool
StartRun
(
bool
isDebug
=
false
)
...
@@ -68,7 +69,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -68,7 +69,8 @@ namespace OnlineStore.DeviceLibrary
}
}
if
(
RunAxis
(
true
,
BatchAxis
)
&&
RunAxis
(
true
,
UpdownAxis
))
if
(
RunAxis
(
true
,
BatchAxis
)
&&
RunAxis
(
true
,
UpdownAxis
))
{
{
mainTimer
.
Enabled
=
false
;
//mainTimer.Enabled = false;
mainStop
();
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
...
@@ -81,7 +83,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -81,7 +83,8 @@ namespace OnlineStore.DeviceLibrary
if
(
isDebug
)
if
(
isDebug
)
{
{
LogInfo
(
"开始调试,启动定时器 "
);
LogInfo
(
"开始调试,启动定时器 "
);
mainTimer
.
Start
();
//mainTimer.Start();
mainStart
();
}
}
return
true
;
return
true
;
}
}
...
@@ -335,10 +338,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -335,10 +338,11 @@ namespace OnlineStore.DeviceLibrary
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
runStatus
=
LineRunStatus
.
Wait
;
runStatus
=
LineRunStatus
.
Wait
;
if
(
mainTimer
!=
null
)
//if (mainTimer != null)
{
//{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
}
//}
mainStop
();
StopMove
();
StopMove
();
CloseLed
();
CloseLed
();
AgvClient
.
SetStatus
(
Config
.
AgvInName
,
""
,
ClientAction
.
None
,
ClientLevel
.
Low
,
true
);
AgvClient
.
SetStatus
(
Config
.
AgvInName
,
""
,
ClientAction
.
None
,
ClientLevel
.
Low
,
true
);
...
@@ -364,7 +368,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -364,7 +368,8 @@ namespace OnlineStore.DeviceLibrary
if
(!
isOk
)
if
(!
isOk
)
{
{
LogUtil
.
error
(
"启动失败,等待下次启动"
);
LogUtil
.
error
(
"启动失败,等待下次启动"
);
mainTimer
.
Enabled
=
true
;
// mainTimer.Enabled = true;
mainStart
();
}
}
}
}
return
;
return
;
...
...
source/DeviceLibrary/assemblyLine/HY/HY_C1Line.cs
查看文件 @
0aff9dd
...
@@ -28,14 +28,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -28,14 +28,16 @@ namespace OnlineStore.DeviceLibrary
{
{
return
false
;
return
false
;
}
}
mainTimer
.
Enabled
=
false
;
//mainTimer.Enabled = false;
mainStop
();
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
StartReset
();
StartReset
();
if
(
isDebug
)
if
(
isDebug
)
{
{
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
}
}
return
true
;
return
true
;
}
}
...
@@ -132,10 +134,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -132,10 +134,11 @@ namespace OnlineStore.DeviceLibrary
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
if
(
mainTimer
!=
null
)
//if (mainTimer != null)
{
//{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
}
//}
mainStop
();
StopMove
();
StopMove
();
runStatus
=
LineRunStatus
.
Wait
;
runStatus
=
LineRunStatus
.
Wait
;
...
...
source/DeviceLibrary/assemblyLine/HY/HY_C1_SLStation.cs
查看文件 @
0aff9dd
...
@@ -27,16 +27,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -27,16 +27,18 @@ namespace OnlineStore.DeviceLibrary
if
(
CanStartRun
().
Equals
(
false
))
if
(
CanStartRun
().
Equals
(
false
))
{
{
return
false
;
return
false
;
}
}
mainTimer
.
Enabled
=
false
;
//mainTimer.Enabled = false;
mainStop
();
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
StartReset
();
StartReset
();
if
(
isDebug
)
if
(
isDebug
)
{
{
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
}
}
return
true
;
return
true
;
}
}
...
@@ -126,10 +128,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -126,10 +128,11 @@ namespace OnlineStore.DeviceLibrary
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
if
(
mainTimer
!=
null
)
//if (mainTimer != null)
{
//{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
}
//}
mainStop
();
StopMove
();
StopMove
();
runStatus
=
LineRunStatus
.
Wait
;
runStatus
=
LineRunStatus
.
Wait
;
...
...
source/DeviceLibrary/assemblyLine/HY/HY_Coveryor.cs
查看文件 @
0aff9dd
...
@@ -43,16 +43,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -43,16 +43,18 @@ namespace OnlineStore.DeviceLibrary
{
{
return
false
;
return
false
;
}
}
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
mainStop
();
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
StartReset
();
StartReset
();
if
(
isDebug
)
if
(
isDebug
)
{
{
mainTimer
.
Interval
=
300
;
//mainTimer.Interval = 300;
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
LogInfo
(
"StartRun 设置 Interval=180 ,启动定时器"
);
mainStart
();
LogInfo
(
"StartRun 设置 Interval=300,启动定时器"
);
}
}
return
true
;
return
true
;
}
}
...
@@ -120,12 +122,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -120,12 +122,15 @@ namespace OnlineStore.DeviceLibrary
}
}
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
JHY_R05_ClampCheck
))
else
if
(
MoveInfo
.
IsStep
(
LineMoveStep
.
JHY_R05_ClampCheck
))
{
{
if
(!
mainTimer
.
Enabl
ed
)
if
(!
IsMainStart
ed
)
{
{
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
SetInterval
(
180
);
LogInfo
(
"复位完成 设置 mainTimer.Enabled = true "
);
LogInfo
(
"复位完成 设置 mainTimer.Enabled = true "
);
}
}
mainTimer
.
Interval
=
180
;
//mainTimer.Interval = 180;
SetInterval
(
180
);
LogInfo
(
"复位完成 设置 Interval=180 "
);
LogInfo
(
"复位完成 设置 Interval=180 "
);
LogInfo
(
MoveInfo
.
MoveType
+
" 完成!"
);
LogInfo
(
MoveInfo
.
MoveType
+
" 完成!"
);
MoveEndS
();
MoveEndS
();
...
@@ -154,10 +159,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -154,10 +159,11 @@ namespace OnlineStore.DeviceLibrary
}
}
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
if
(
mainTimer
!=
null
)
//if (mainTimer != null)
{
//{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
}
//}
mainStop
();
StopMove
();
StopMove
();
//CheckAndMove(IO_Type.HY_ClampCylinder_Work, IO_VALUE.LOW);
//CheckAndMove(IO_Type.HY_ClampCylinder_Work, IO_VALUE.LOW);
//CheckAndMove(IO_Type.HY_ClampCylinder_Relax, IO_VALUE.LOW);
//CheckAndMove(IO_Type.HY_ClampCylinder_Relax, IO_VALUE.LOW);
...
...
source/DeviceLibrary/assemblyLine/HY/HY_Coveryor_Partial.cs
查看文件 @
0aff9dd
...
@@ -93,8 +93,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -93,8 +93,8 @@ namespace OnlineStore.DeviceLibrary
//CheckStopWatch(trayCheckWait, TrayWaitTime, false) &&
//CheckStopWatch(trayCheckWait, TrayWaitTime, false) &&
if
(
check2IsOk
&&
canpro
)
if
(
check2IsOk
&&
canpro
)
{
{
StartTrayCheck
();
//
StartTrayCheck();
Start_JHY_05_TrayCheck
();
}
}
}
}
// else
// else
...
@@ -191,9 +191,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -191,9 +191,8 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo
.
NewMove
(
LineMoveType
.
Fixture
);
SecondMoveInfo
.
NewMove
(
LineMoveType
.
Fixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
JHY_05_TrayCheck
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
JHY_05_TrayCheck
);
CheckLog
(
"接驳台托盘"
+
SecondMoveInfo
.
SLog
+
"前阻挡下降1.2s,等待托盘到位 "
);
CheckLog
(
"接驳台托盘"
+
SecondMoveInfo
.
SLog
+
"前阻挡上升,等待托盘到位 "
);
//IOMove(IO_Type.HY_FrontStopDown, IO_VALUE.LOW);
IOMove
(
IO_Type
.
HY_FrontStopDown
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
HY_FrontStopDown
,
IO_VALUE
.
HIGH
,
1200
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
HY_FrontStopDown
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
HY_FrontStopDown
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
HY_TrayCheck
,
IO_VALUE
.
HIGH
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
HY_TrayCheck
,
IO_VALUE
.
HIGH
));
...
...
source/DeviceLibrary/assemblyLine/HY/HY_OutLine.cs
查看文件 @
0aff9dd
...
@@ -24,14 +24,16 @@ namespace OnlineStore.DeviceLibrary
...
@@ -24,14 +24,16 @@ namespace OnlineStore.DeviceLibrary
{
{
return
false
;
return
false
;
}
}
mainTimer
.
Enabled
=
false
;
//mainTimer.Enabled = false;
mainStop
();
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
MoveInfo
.
NewMove
(
LineMoveType
.
RHome
);
StartReset
();
StartReset
();
if
(
isDebug
)
if
(
isDebug
)
{
{
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
}
}
return
true
;
return
true
;
}
}
...
@@ -95,10 +97,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -95,10 +97,11 @@ namespace OnlineStore.DeviceLibrary
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
if
(
mainTimer
!=
null
)
//if (mainTimer != null)
{
//{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
}
//}
mainStop
();
StopMove
();
StopMove
();
runStatus
=
LineRunStatus
.
Wait
;
runStatus
=
LineRunStatus
.
Wait
;
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
0aff9dd
...
@@ -14,10 +14,10 @@ using System.Timers;
...
@@ -14,10 +14,10 @@ using System.Timers;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
namespace
OnlineStore.DeviceLibrary
namespace
OnlineStore.DeviceLibrary
{
{
public
partial
class
LineBean
:
KTK_Store
public
partial
class
LineBean
:
KTK_Store
{
{
public
bool
IsDebug
=
false
;
public
bool
IsDebug
=
false
;
private
System
.
Timers
.
Timer
ledProcessTimer
=
null
;
private
System
.
Timers
.
Timer
ledProcessTimer
=
null
;
/// <summary>
/// <summary>
/// 分出一个线程,专门处理急停,报警,气压检测,工单信号检测等处理
/// 分出一个线程,专门处理急停,报警,气压检测,工单信号检测等处理
...
@@ -25,17 +25,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -25,17 +25,17 @@ namespace OnlineStore.DeviceLibrary
private
System
.
Timers
.
Timer
IoCheckTimer
=
null
;
private
System
.
Timers
.
Timer
IoCheckTimer
=
null
;
private
System
.
Timers
.
Timer
serverConTimer
=
null
;
private
System
.
Timers
.
Timer
serverConTimer
=
null
;
public
Dictionary
<
int
,
MoveEquip
>
MoveEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
MoveEquip
>
MoveEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
FeedingEquip
>
FeedingEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
FeedingEquip
>
FeedingEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
HYEquipBase
>
HYEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
HYEquipBase
>
HYEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
EquipBase
>
AllEquipMap
{
get
;
set
;
}
public
Dictionary
<
int
,
EquipBase
>
AllEquipMap
{
get
;
set
;
}
public
Line_Config
Config
{
get
;
set
;
}
public
Line_Config
Config
{
get
;
set
;
}
#
region
初始化
#
region
初始化
public
List
<
string
>
cioList
=
new
List
<
string
>();
public
List
<
string
>
cioList
=
new
List
<
string
>();
private
bool
canStart
=
false
;
private
bool
canStart
=
false
;
public
LineBean
(
Line_Config
lineConfig
,
Dictionary
<
int
,
MoveEquip_Config
>
configList
,
Dictionary
<
int
,
FeedingEquip_Config
>
feedMap
,
public
LineBean
(
Line_Config
lineConfig
,
Dictionary
<
int
,
MoveEquip_Config
>
configList
,
Dictionary
<
int
,
FeedingEquip_Config
>
feedMap
,
...
@@ -50,15 +50,15 @@ namespace OnlineStore.DeviceLibrary
...
@@ -50,15 +50,15 @@ namespace OnlineStore.DeviceLibrary
baseConfig
=
lineConfig
;
baseConfig
=
lineConfig
;
this
.
Config
=
lineConfig
;
this
.
Config
=
lineConfig
;
this
.
DeviceID
=
lineConfig
.
Id
;
this
.
DeviceID
=
lineConfig
.
Id
;
T3C1_MoveInfo
=
new
LineMoveInfo
(
DeviceID
,
" T3-C1 "
);
T3C1_MoveInfo
=
new
LineMoveInfo
(
DeviceID
,
" T3-C1 "
);
MoveInfo
=
new
LineMoveInfo
(
DeviceID
,
"[流水线-Move] "
);
MoveInfo
=
new
LineMoveInfo
(
DeviceID
,
"[流水线-Move] "
);
Name
=
(
" 流水线_"
+
Config
.
CID
+
" "
).
ToUpper
();
Name
=
(
" 流水线_"
+
Config
.
CID
+
" "
).
ToUpper
();
AllEquipMap
=
new
Dictionary
<
int
,
EquipBase
>();
AllEquipMap
=
new
Dictionary
<
int
,
EquipBase
>();
MoveEquipMap
=
new
Dictionary
<
int
,
MoveEquip
>();
MoveEquipMap
=
new
Dictionary
<
int
,
MoveEquip
>();
FeedingEquipMap
=
new
Dictionary
<
int
,
FeedingEquip
>();
FeedingEquipMap
=
new
Dictionary
<
int
,
FeedingEquip
>();
HYEquipMap
=
new
Dictionary
<
int
,
HYEquipBase
>();
HYEquipMap
=
new
Dictionary
<
int
,
HYEquipBase
>();
List
<
string
>
ioList
=
new
List
<
string
>();
List
<
string
>
ioList
=
new
List
<
string
>();
ioList
=
new
List
<
string
>(
DeviceConfig
.
ProIOIpMap
.
Values
);
ioList
=
new
List
<
string
>(
DeviceConfig
.
ProIOIpMap
.
Values
);
AddDeviceName
(
ioList
,
Config
.
IOIPList
);
AddDeviceName
(
ioList
,
Config
.
IOIPList
);
...
@@ -73,7 +73,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -73,7 +73,7 @@ namespace OnlineStore.DeviceLibrary
AddDeviceName
(
ioList
,
config
.
IOIPList
);
AddDeviceName
(
ioList
,
config
.
IOIPList
);
FeedingEquipMap
.
Add
(
config
.
Id
,
equip
);
FeedingEquipMap
.
Add
(
config
.
Id
,
equip
);
AllEquipMap
.
Add
(
config
.
Id
,
equip
);
AllEquipMap
.
Add
(
config
.
Id
,
equip
);
}
}
foreach
(
MoveEquip_Config
config
in
configList
.
Values
)
foreach
(
MoveEquip_Config
config
in
configList
.
Values
)
{
{
...
@@ -85,11 +85,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -85,11 +85,11 @@ namespace OnlineStore.DeviceLibrary
}
}
foreach
(
HYEquip_Config
config
in
hyConfigMap
.
Values
)
foreach
(
HYEquip_Config
config
in
hyConfigMap
.
Values
)
{
{
HYEquipBase
equip
=
HYEquipBase
.
GetHY
(
lineConfig
.
CID
,
config
);
HYEquipBase
equip
=
HYEquipBase
.
GetHY
(
lineConfig
.
CID
,
config
);
LogUtil
.
info
(
Name
+
$
" {equip.Name} DeviceID: {equip.DeviceID} "
);
LogUtil
.
info
(
Name
+
$
" {equip.Name} DeviceID: {equip.DeviceID} "
);
AddDeviceName
(
ioList
,
config
.
IOIPList
);
AddDeviceName
(
ioList
,
config
.
IOIPList
);
HYEquipMap
.
Add
(
config
.
Id
,
equip
);
HYEquipMap
.
Add
(
config
.
Id
,
equip
);
AllEquipMap
.
Add
(
config
.
Id
,
equip
);
AllEquipMap
.
Add
(
config
.
Id
,
equip
);
}
}
//先初始化设备
//先初始化设备
...
@@ -101,17 +101,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -101,17 +101,18 @@ namespace OnlineStore.DeviceLibrary
//初始化摄像机配置
//初始化摄像机配置
CodeManager
.
LoadConfig
();
CodeManager
.
LoadConfig
();
cioList
=
new
List
<
string
>(
ioList
);
cioList
=
new
List
<
string
>(
ioList
);
Task
.
Factory
.
StartNew
(
delegate
Task
.
Factory
.
StartNew
(
delegate
{
{
LogUtil
.
info
(
Name
+
"开始连接IO模块 "
);
LogUtil
.
info
(
Name
+
"开始连接IO模块 "
);
IOManager
.
instance
.
ConnectionIOList
(
cioList
);
IOManager
.
instance
.
ConnectionIOList
(
cioList
);
addLastDI
(
IO_Type
.
Airpressure_Check
,
IOValue
(
IO_Type
.
Airpressure_Check
));
addLastDI
(
IO_Type
.
Airpressure_Check
,
IOValue
(
IO_Type
.
Airpressure_Check
));
addLastDI
(
IO_Type
.
SuddenStop_BTN
,
IOValue
(
IO_Type
.
SuddenStop_BTN
));
addLastDI
(
IO_Type
.
SuddenStop_BTN
,
IOValue
(
IO_Type
.
SuddenStop_BTN
));
addLastDI
(
IO_Type
.
Reset_BTN
,
IOValue
(
IO_Type
.
Reset_BTN
));
addLastDI
(
IO_Type
.
Reset_BTN
,
IOValue
(
IO_Type
.
Reset_BTN
));
mainTimer
.
Enabled
=
true
;
// mainTimer.Enabled = true;
mainStart
();
IoCheckTimer
.
Enabled
=
true
;
IoCheckTimer
.
Enabled
=
true
;
AgvClient
.
Init
();
AgvClient
.
Init
();
canStart
=
true
;
canStart
=
true
;
...
@@ -143,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -143,7 +144,7 @@ namespace OnlineStore.DeviceLibrary
IoCheckTimer
.
Elapsed
+=
IoCheckTimerProcess
;
IoCheckTimer
.
Elapsed
+=
IoCheckTimerProcess
;
IoCheckTimer
.
AutoReset
=
true
;
IoCheckTimer
.
AutoReset
=
true
;
IoCheckTimer
.
Enabled
=
false
;
IoCheckTimer
.
Enabled
=
false
;
serverConTimer
=
new
System
.
Timers
.
Timer
();
serverConTimer
=
new
System
.
Timers
.
Timer
();
serverConTimer
.
Interval
=
3000
;
serverConTimer
.
Interval
=
3000
;
serverConTimer
.
AutoReset
=
true
;
serverConTimer
.
AutoReset
=
true
;
...
@@ -201,9 +202,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -201,9 +202,10 @@ namespace OnlineStore.DeviceLibrary
{
{
// ledProcessTimer.Enabled = false;
// ledProcessTimer.Enabled = false;
IoCheckTimer
.
Enabled
=
false
;
IoCheckTimer
.
Enabled
=
false
;
mainTimer
.
Enabled
=
false
;
//mainTimer.Enabled = false;
mainStop
();
ledProcessTimer
.
Enabled
=
true
;
ledProcessTimer
.
Enabled
=
true
;
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
StartTime
=
DateTime
.
Now
;
StartTime
=
DateTime
.
Now
;
LogUtil
.
info
(
Name
+
"开始启动,启动时间:"
+
StartTime
.
ToString
()
+
"先转动链条"
);
LogUtil
.
info
(
Name
+
"开始启动,启动时间:"
+
StartTime
.
ToString
()
+
"先转动链条"
);
...
@@ -236,7 +238,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -236,7 +238,8 @@ namespace OnlineStore.DeviceLibrary
RFIDManager
.
Open
();
RFIDManager
.
Open
();
// WriteDrivetMotorRun(IO_VALUE.LOW);
// WriteDrivetMotorRun(IO_VALUE.LOW);
IoCheckTimer
.
Enabled
=
true
;
IoCheckTimer
.
Enabled
=
true
;
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
serverConTimer
.
Enabled
=
true
;
serverConTimer
.
Enabled
=
true
;
return
true
;
return
true
;
}
}
...
@@ -247,24 +250,26 @@ namespace OnlineStore.DeviceLibrary
...
@@ -247,24 +250,26 @@ namespace OnlineStore.DeviceLibrary
{
{
moveEquip
.
OpenStopBlock
();
moveEquip
.
OpenStopBlock
();
}
}
else
if
(
moveEquip
.
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
else
if
(
moveEquip
.
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
{
{
bool
result
=
moveEquip
.
StartRun
();
bool
result
=
moveEquip
.
StartRun
();
Thread
.
Sleep
(
60
);
Thread
.
Sleep
(
60
);
}
}
else
else
{
{
LogUtil
.
info
(
Name
+
" EquipStartRun:"
+
moveEquip
.
Name
+
" 已启动,不需要重复启动"
);
LogUtil
.
info
(
Name
+
" EquipStartRun:"
+
moveEquip
.
Name
+
" 已启动,不需要重复启动"
);
}
}
}
}
private
void
RHomeOp
()
private
void
RHomeOp
()
{
{
mainTimer
.
Interval
=
1000
;
//mainTimer.Interval = 1000;
SetInterval
(
1000
);
maxSeconds
=
10
;
maxSeconds
=
10
;
// TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ;
// TrayManager.SidesWayStateMap = new System.Collections.Concurrent.ConcurrentDictionary<int, int>() ;
alarmType
=
LineAlarmType
.
None
;
alarmType
=
LineAlarmType
.
None
;
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
IoCheckTimer
.
Enabled
=
false
;
mainStop
();
IoCheckTimer
.
Enabled
=
false
;
isInSuddenDown
=
false
;
isInSuddenDown
=
false
;
isNoAirCheck
=
false
;
isNoAirCheck
=
false
;
TrayManager
.
TrayErrorMsg
=
""
;
TrayManager
.
TrayErrorMsg
=
""
;
...
@@ -282,16 +287,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -282,16 +287,17 @@ namespace OnlineStore.DeviceLibrary
T3C1_Stop
(
MoveInfo
);
T3C1_Stop
(
MoveInfo
);
T3C1_TrayNum
=
-
1
;
T3C1_TrayNum
=
-
1
;
}
}
public
override
bool
Reset
()
public
override
bool
Reset
()
{
{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
IoCheckTimer
.
Enabled
=
false
;
mainStop
();
IoCheckTimer
.
Enabled
=
false
;
bool
isNeedAllReset
=
false
;
bool
isNeedAllReset
=
false
;
if
(
isInSuddenDown
||
isNoAirCheck
||
alarmType
.
Equals
(
LineAlarmType
.
SuddenStop
)||
alarmType
.
Equals
(
LineAlarmType
.
NoAirCheck
))
if
(
isInSuddenDown
||
isNoAirCheck
||
alarmType
.
Equals
(
LineAlarmType
.
SuddenStop
)
||
alarmType
.
Equals
(
LineAlarmType
.
NoAirCheck
))
{
{
//TrayManager.LineNeedEmptyTrayNum = 0;
//TrayManager.LineNeedEmptyTrayNum = 0;
isNeedAllReset
=
true
;
isNeedAllReset
=
true
;
...
@@ -305,7 +311,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -305,7 +311,7 @@ namespace OnlineStore.DeviceLibrary
//停止运动
//停止运动
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
Reset
;
runStatus
=
LineRunStatus
.
Reset
;
LogUtil
.
info
(
Name
+
"开始复位,先转动链条5秒 "
);
LogUtil
.
info
(
Name
+
"开始复位,先转动链条5秒 "
);
DateTime
rstartTime
=
DateTime
.
Now
;
DateTime
rstartTime
=
DateTime
.
Now
;
...
@@ -314,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -314,7 +320,7 @@ namespace OnlineStore.DeviceLibrary
RHomeOp
();
RHomeOp
();
foreach
(
EquipBase
equip
in
AllEquipMap
.
Values
)
foreach
(
EquipBase
equip
in
AllEquipMap
.
Values
)
{
{
//如果已经转动5秒,先停止链条
//如果已经转动5秒,先停止链条
TimeSpan
span
=
DateTime
.
Now
-
rstartTime
;
TimeSpan
span
=
DateTime
.
Now
-
rstartTime
;
if
(
span
.
TotalSeconds
>
5
)
if
(
span
.
TotalSeconds
>
5
)
...
@@ -330,13 +336,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -330,13 +336,14 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
Name
+
"复位过程中发现 runStatus=Wait,中断启动"
);
LogUtil
.
error
(
Name
+
"复位过程中发现 runStatus=Wait,中断启动"
);
return
false
;
return
false
;
}
}
EquipReset
(
equip
,
isNeedAllReset
);
EquipReset
(
equip
,
isNeedAllReset
);
}
}
if
(
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
if
(
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
{
return
false
;
}
{
return
false
;
}
IoCheckTimer
.
Enabled
=
true
;
IoCheckTimer
.
Enabled
=
true
;
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
serverConTimer
.
Enabled
=
true
;
serverConTimer
.
Enabled
=
true
;
return
true
;
return
true
;
}
}
...
@@ -345,7 +352,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -345,7 +352,7 @@ namespace OnlineStore.DeviceLibrary
//调试状态不再重置
//调试状态不再重置
if
(!
equip
.
IsDebug
)
if
(!
equip
.
IsDebug
)
{
{
if
(
isNeedAllReset
||
TrayManager
.
ErrorDeviceId
.
Equals
(
equip
.
DeviceID
)
||
(!
NoAlarm
())
||(!
equip
.
NoAlarm
())
)
if
(
isNeedAllReset
||
TrayManager
.
ErrorDeviceId
.
Equals
(
equip
.
DeviceID
)
||
(!
NoAlarm
())
||
(!
equip
.
NoAlarm
())
)
{
{
LogUtil
.
info
(
Name
+
"收到复位信号,"
+
equip
.
Name
+
" 需要复位"
);
LogUtil
.
info
(
Name
+
"收到复位信号,"
+
equip
.
Name
+
" 需要复位"
);
equip
.
Reset
();
equip
.
Reset
();
...
@@ -367,8 +374,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -367,8 +374,9 @@ namespace OnlineStore.DeviceLibrary
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
IoCheckTimer
.
Enabled
=
false
;
IoCheckTimer
.
Enabled
=
false
;
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
serverConTimer
.
Enabled
=
false
;
mainStop
();
serverConTimer
.
Enabled
=
false
;
AgvClient
.
SetCancelState
(
true
);
AgvClient
.
SetCancelState
(
true
);
RFIDManager
.
Close
();
RFIDManager
.
Close
();
//停止运行时,把阻挡气缸上升
//停止运行时,把阻挡气缸上升
...
@@ -428,7 +436,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -428,7 +436,7 @@ namespace OnlineStore.DeviceLibrary
if
(
alarmType
.
Equals
(
LineAlarmType
.
SuddenStop
)
||
alarmType
.
Equals
(
LineAlarmType
.
NoAirCheck
))
if
(
alarmType
.
Equals
(
LineAlarmType
.
SuddenStop
)
||
alarmType
.
Equals
(
LineAlarmType
.
NoAirCheck
))
{
{
LogUtil
.
error
(
WarnMsg
+
":所有模块停止运行并报警:"
+
alarmType
);
LogUtil
.
error
(
WarnMsg
+
":所有模块停止运行并报警:"
+
alarmType
);
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
WriteDrivetMotorRun
(
IO_VALUE
.
LOW
);
WriteDrivetMotorRun
(
IO_VALUE
.
LOW
);
T3C1_Stop
();
T3C1_Stop
();
...
@@ -488,7 +496,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -488,7 +496,7 @@ namespace OnlineStore.DeviceLibrary
private
void
CloseLed
()
private
void
CloseLed
()
{
{
CheckAndMove
(
IO_Type
.
AutoRun_HddLed
,
IO_VALUE
.
LOW
);
CheckAndMove
(
IO_Type
.
AutoRun_HddLed
,
IO_VALUE
.
LOW
);
CheckAndMove
(
IO_Type
.
Alarm_HddLed
,
IO_VALUE
.
LOW
);
CheckAndMove
(
IO_Type
.
Alarm_HddLed
,
IO_VALUE
.
LOW
);
CheckAndMove
(
IO_Type
.
RunSign_HddLed
,
IO_VALUE
.
LOW
);
CheckAndMove
(
IO_Type
.
RunSign_HddLed
,
IO_VALUE
.
LOW
);
...
@@ -511,17 +519,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -511,17 +519,17 @@ namespace OnlineStore.DeviceLibrary
{
{
yellowShanShuo
=
true
;
yellowShanShuo
=
true
;
}
}
if
(
isInSuddenDown
||
isNoAirCheck
||
alarmType
>
LineAlarmType
.
AxisAlarm
)
if
(
isInSuddenDown
||
isNoAirCheck
||
alarmType
>
LineAlarmType
.
AxisAlarm
)
{
{
isNeedAlarmLed
=
true
;
isNeedAlarmLed
=
true
;
}
}
else
if
(
alarmType
.
Equals
(
LineAlarmType
.
None
).
Equals
(
false
)||
TrayManager
.
TrayErrorMsg
!=
""
)
else
if
(
alarmType
.
Equals
(
LineAlarmType
.
None
).
Equals
(
false
)
||
TrayManager
.
TrayErrorMsg
!=
""
)
{
{
yellowShanShuo
=
true
;
yellowShanShuo
=
true
;
}
}
foreach
(
EquipBase
moveEquip
in
AllEquipMap
.
Values
)
foreach
(
EquipBase
moveEquip
in
AllEquipMap
.
Values
)
{
{
if
(
moveEquip
.
isNoAirCheck
||
moveEquip
.
isInSuddenDown
||
moveEquip
.
alarmType
>
LineAlarmType
.
AxisAlarm
)
if
(
moveEquip
.
isNoAirCheck
||
moveEquip
.
isInSuddenDown
||
moveEquip
.
alarmType
>
LineAlarmType
.
AxisAlarm
)
{
{
isNeedAlarmLed
=
true
;
isNeedAlarmLed
=
true
;
...
@@ -667,8 +675,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -667,8 +675,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"定时检测报警出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"定时检测报警出错:"
,
ex
);
}
}
Thread
.
Sleep
(
1
);
Thread
.
Sleep
(
1
);
}
}
protected
override
void
mainT
imer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
protected
override
void
mainT
hread_Process
(
)
{
{
try
try
{
{
...
@@ -676,7 +684,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -676,7 +684,7 @@ namespace OnlineStore.DeviceLibrary
if
(
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
if
(
runStatus
.
Equals
(
LineRunStatus
.
Wait
))
{
{
//取新的Io状态
//取新的Io状态
IO_VALUE
fuweiValue
=
IOValue
(
IO_Type
.
Reset_BTN
);
IO_VALUE
fuweiValue
=
IOValue
(
IO_Type
.
Reset_BTN
);
IO_VALUE
lastFuwei
=
DILastValueMap
[
IO_Type
.
Reset_BTN
];
IO_VALUE
lastFuwei
=
DILastValueMap
[
IO_Type
.
Reset_BTN
];
addLastDI
(
IO_Type
.
Reset_BTN
,
fuweiValue
);
addLastDI
(
IO_Type
.
Reset_BTN
,
fuweiValue
);
bool
isAutoStart
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
)
==
1
;
bool
isAutoStart
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
App_AutoRun
)
==
1
;
...
@@ -685,12 +693,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -685,12 +693,13 @@ namespace OnlineStore.DeviceLibrary
if
(
isAutoStart
&&
fuweiValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastFuwei
.
Equals
(
IO_VALUE
.
LOW
))
if
(
isAutoStart
&&
fuweiValue
.
Equals
(
IO_VALUE
.
HIGH
)
&&
lastFuwei
.
Equals
(
IO_VALUE
.
LOW
))
{
{
//没有启动时收到启动按钮
//没有启动时收到启动按钮
LogUtil
.
info
(
Name
+
"没有启动时收到启动按钮,开始调用启动方法!"
);
LogUtil
.
info
(
Name
+
"没有启动时收到启动按钮,开始调用启动方法!"
);
bool
isOk
=
StartRun
();
bool
isOk
=
StartRun
();
if
(!
isOk
)
if
(!
isOk
)
{
{
LogUtil
.
error
(
"启动失败,等待下次启动"
);
LogUtil
.
error
(
"启动失败,等待下次启动"
);
mainTimer
.
Enabled
=
true
;
//mainTimer.Enabled = true;
mainStart
();
}
}
}
}
return
;
return
;
...
@@ -702,7 +711,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -702,7 +711,7 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(!
moveEquip
.
IsDebug
)
if
(!
moveEquip
.
IsDebug
)
{
{
if
(!
moveEquip
.
mainTimerStart
)
if
(!
moveEquip
.
IsMainStarted
)
{
{
moveEquip
.
TimerProcess
();
moveEquip
.
TimerProcess
();
}
}
...
@@ -720,11 +729,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -720,11 +729,11 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
Name
+
"主定时器出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"主定时器出错:"
,
ex
);
}
}
Thread
.
Sleep
(
1
);
Thread
.
Sleep
(
1
);
}
}
private
bool
busyPro
=
false
;
private
bool
busyPro
=
false
;
private
DateTime
busyProTime
=
DateTime
.
Now
;
private
DateTime
busyProTime
=
DateTime
.
Now
;
private
int
maxSeconds
=
3
;
private
int
maxSeconds
=
3
;
private
void
LineTimerPro
()
private
void
LineTimerPro
()
...
@@ -777,7 +786,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -777,7 +786,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
Name
+
"LineTimerPro 出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"LineTimerPro 出错:"
,
ex
);
}
}
busyPro
=
false
;
busyPro
=
false
;
}
}
private
IO_VALUE
CheckAir
(
IO_VALUE
airCheck
,
IO_VALUE
lastAir
)
private
IO_VALUE
CheckAir
(
IO_VALUE
airCheck
,
IO_VALUE
lastAir
)
{
{
IO_VALUE
airValue
=
IO_VALUE
.
HIGH
;
IO_VALUE
airValue
=
IO_VALUE
.
HIGH
;
...
@@ -788,10 +797,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -788,10 +797,10 @@ namespace OnlineStore.DeviceLibrary
{
{
if
((
DateTime
.
Now
-
lastAirCloseTime
).
TotalSeconds
>
Config
.
AirCheckSeconds
)
if
((
DateTime
.
Now
-
lastAirCloseTime
).
TotalSeconds
>
Config
.
AirCheckSeconds
)
{
{
SetWarnMsg
(
"持续"
+
Config
.
AirCheckSeconds
+
"秒未检测到气压信号"
);
SetWarnMsg
(
"持续"
+
Config
.
AirCheckSeconds
+
"秒未检测到气压信号"
);
//SendAlarmCode(0, LineAlarm.NoAirCheck);
//SendAlarmCode(0, LineAlarm.NoAirCheck);
airValue
=
IO_VALUE
.
LOW
;
airValue
=
IO_VALUE
.
LOW
;
Alarm
(
LineAlarmType
.
NoAirCheck
);
Alarm
(
LineAlarmType
.
NoAirCheck
);
}
}
}
}
else
else
...
@@ -808,7 +817,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -808,7 +817,7 @@ namespace OnlineStore.DeviceLibrary
}
}
#
region
是否已经接收到过出库信息
#
region
是否已经接收到过出库信息
public
bool
IsReviceInPosId
(
MoveEquip
moveEquip
,
string
posId
)
public
bool
IsReviceInPosId
(
MoveEquip
moveEquip
,
string
posId
)
{
{
bool
isReviceInfo
=
false
;
bool
isReviceInfo
=
false
;
...
@@ -834,9 +843,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -834,9 +843,10 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"IsReviceInPosId【"
+
posId
+
"】出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"IsReviceInPosId【"
+
posId
+
"】出错:"
+
ex
.
ToString
());
}
}
return
isReviceInfo
;
return
isReviceInfo
;
}
}
...
@@ -856,9 +866,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -856,9 +866,9 @@ namespace OnlineStore.DeviceLibrary
equip
.
CloseStopBlock
();
equip
.
CloseStopBlock
();
}
}
}
}
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
WriteDrivetMotorRun
(
IO_VALUE
.
LOW
);
WriteDrivetMotorRun
(
IO_VALUE
.
LOW
);
T3C1_Stop
();
T3C1_Stop
();
}
}
protected
override
void
ResetProcess
()
protected
override
void
ResetProcess
()
...
@@ -935,16 +945,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -935,16 +945,17 @@ namespace OnlineStore.DeviceLibrary
//打开流水线
//打开流水线
WriteDrivetMotorRun
(
IO_VALUE
.
HIGH
);
WriteDrivetMotorRun
(
IO_VALUE
.
HIGH
);
//所有原点重置完成
//所有原点重置完成
runStatus
=
LineRunStatus
.
Runing
;
runStatus
=
LineRunStatus
.
Runing
;
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
mainTimer
.
Interval
=
300
;
//mainTimer.Interval = 300;
SetInterval
(
300
);
maxSeconds
=
3
;
maxSeconds
=
3
;
AgvClient
.
SetCancelState
(
AgvClient
.
CurrCancelState
);
AgvClient
.
SetCancelState
(
AgvClient
.
CurrCancelState
);
LogUtil
.
info
(
Name
+
"所有移栽模块复位完成,打开流水线,开始运转,定时器改为300,耗时 ["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]"
);
LogUtil
.
info
(
Name
+
"所有移栽模块复位完成,打开流水线,开始运转,定时器改为300,耗时 ["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]"
);
}
}
else
if
(
span
.
TotalSeconds
>
120
)
else
if
(
span
.
TotalSeconds
>
120
)
{
{
string
warnmsg
=
Name
+
"["
+
MoveInfo
.
MoveStep
+
"]["
+
msg
+
"]已等待["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]秒"
;
string
warnmsg
=
Name
+
"["
+
MoveInfo
.
MoveStep
+
"]["
+
msg
+
"]已等待["
+
FormUtil
.
GetSpanStr
(
span
)
+
"]秒"
;
//LogUtil.error(WarnMsg, 903);
//LogUtil.error(WarnMsg, 903);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
msg
);
MoveTimeoutAlarm
(
MoveInfo
,
msg
);
...
@@ -958,11 +969,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -958,11 +969,11 @@ namespace OnlineStore.DeviceLibrary
// int tLength = 20;
// int tLength = 20;
//msg += "横移41托盘:" + Sw41TrayNum + "\n";
//msg += "横移41托盘:" + Sw41TrayNum + "\n";
msg
+=
"T3C1托盘:"
+
T3C1_TrayNum
+
"\n"
;
msg
+=
"T3C1托盘:"
+
T3C1_TrayNum
+
"\n"
;
msg
+=
"状态: "
+
runStatus
+
"\t "
;
msg
+=
"状态: "
+
runStatus
+
"\t "
;
msg
+=
"alarm: "
+
alarmType
+
"\n"
;
msg
+=
"alarm: "
+
alarmType
+
"\n"
;
msg
+=
"Move:"
+
MoveInfo
.
MoveType
+
" "
+
MoveInfo
.
SLog
+
"\n"
;
msg
+=
"Move:"
+
MoveInfo
.
MoveType
+
" "
+
MoveInfo
.
SLog
+
"\n"
;
msg
+=
"T3C1:"
+
T3C1_MoveInfo
.
MoveType
+
" "
+
T3C1_MoveInfo
.
MoveStep
+
"\n"
;
msg
+=
"T3C1:"
+
T3C1_MoveInfo
.
MoveType
+
" "
+
T3C1_MoveInfo
.
MoveStep
+
"\n"
;
return
msg
;
return
msg
;
}
}
...
@@ -1061,14 +1072,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1061,14 +1072,14 @@ namespace OnlineStore.DeviceLibrary
else
else
{
{
if
(
noReel
)
if
(
noReel
)
{
{
}
}
else
else
{
{
noReel
=
true
;
noReel
=
true
;
trayNoReelTime
=
DateTime
.
Now
;
trayNoReelTime
=
DateTime
.
Now
;
LogUtil
.
info
(
"收到服务端停机要求 :更新 noReel = true"
);
LogUtil
.
info
(
"收到服务端停机要求 :更新 noReel = true"
);
}
}
}
}
if
(
noReel
)
if
(
noReel
)
...
@@ -1082,9 +1093,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1082,9 +1093,9 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
return
false
;
return
false
;
}
}
public
bool
noReel
=
false
;
public
bool
noReel
=
false
;
private
DateTime
trayNoReelTime
=
DateTime
.
Now
;
private
DateTime
trayNoReelTime
=
DateTime
.
Now
;
}
}
}
}
\ No newline at end of file
\ No newline at end of file
source/DeviceLibrary/assemblyLine/MoveEquip.cs
查看文件 @
0aff9dd
...
@@ -70,7 +70,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -70,7 +70,8 @@ namespace OnlineStore.DeviceLibrary
return
false
;
return
false
;
}
}
mainTimer
.
Enabled
=
false
;
//mainTimer.Enabled = false;
mainStop
();
MoveInfo
.
EndMove
();
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
runStatus
=
LineRunStatus
.
HomeMoving
;
runStatus
=
LineRunStatus
.
HomeMoving
;
...
@@ -79,7 +80,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -79,7 +80,8 @@ namespace OnlineStore.DeviceLibrary
StartReset
();
StartReset
();
if
(
isDebug
)
if
(
isDebug
)
{
{
mainTimer
.
Enabled
=
true
;
// mainTimer.Enabled = true;
mainStart
();
}
}
return
true
;
return
true
;
}
}
...
@@ -205,10 +207,11 @@ namespace OnlineStore.DeviceLibrary
...
@@ -205,10 +207,11 @@ namespace OnlineStore.DeviceLibrary
public
override
void
StopRun
()
public
override
void
StopRun
()
{
{
if
(
mainTimer
!=
null
)
//if (mainTimer != null)
{
//{
mainTimer
.
Enabled
=
false
;
// mainTimer.Enabled = false;
}
//}
mainStop
();
StopMove
();
StopMove
();
//停止运行时,把所有IO 置零
//停止运行时,把所有IO 置零
//CheckAndMove(IO_Type.StopDown1, IO_VALUE.LOW);
//CheckAndMove(IO_Type.StopDown1, IO_VALUE.LOW);
...
...
source/DeviceLibrary/model/KTK_Store.cs
查看文件 @
0aff9dd
using
log4net
;
using
log4net
;
using
OnlineStore.Common
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
...
@@ -24,11 +24,30 @@ namespace OnlineStore.DeviceLibrary
...
@@ -24,11 +24,30 @@ namespace OnlineStore.DeviceLibrary
public
int
DeviceID
{
get
;
set
;
}
public
int
DeviceID
{
get
;
set
;
}
protected
System
.
Timers
.
Timer
mainTimer
;
protected
System
.
Timers
.
Timer
mainTimer
;
protected
Thread
mainThread
;
protected
bool
loop
;
protected
bool
pause
=
false
;
protected
int
threadInterval
=
300
;
private
bool
isInit
=
false
;
private
bool
isInit
=
false
;
/// <summary>
public
bool
mainTimerStart
{
get
=>
mainTimer
.
Enabled
;
}
/// 使用timer定时器
/// </summary>
protected
bool
useTimer
=
ConfigHelper
.
Config
.
Get
(
"Device_MainThreadUseTimer"
,
true
);
public
bool
IsMainStarted
{
get
{
if
(
useTimer
)
{
return
mainTimer
.
Enabled
;
}
else
{
return
!
pause
;
}
}
}
//public bool mainTimerStart { get => mainTimer.Enabled; }
/// <summary>
/// <summary>
/// 托盘检测信号需要持续时间
/// 托盘检测信号需要持续时间
...
@@ -37,6 +56,62 @@ namespace OnlineStore.DeviceLibrary
...
@@ -37,6 +56,62 @@ namespace OnlineStore.DeviceLibrary
public
KTK_Store
()
public
KTK_Store
()
{
{
}
}
~
KTK_Store
()
{
if
(
useTimer
)
{
}
else
{
loop
=
false
;
}
}
/// <summary>
/// 主进程启动
/// </summary>
public
void
mainStart
()
{
if
(
useTimer
)
{
if
(
mainTimer
!=
null
)
{
mainTimer
.
Start
();
}
}
else
{
// pause = false;
}
}
public
void
SetInterval
(
int
interval
=
300
)
{
if
(
useTimer
)
{
if
(
mainTimer
!=
null
)
{
mainTimer
.
Interval
=
interval
;
}
}
else
{
threadInterval
=
interval
;
}
}
/// <summary>
/// 主进程停止
/// </summary>
public
void
mainStop
()
{
if
(
useTimer
)
{
mainTimer
?.
Stop
();
}
else
{
//pause = true;
}
}
/// <summary>
/// <summary>
/// 开始运行的时间
/// 开始运行的时间
/// </summary>
/// </summary>
...
@@ -203,18 +278,60 @@ namespace OnlineStore.DeviceLibrary
...
@@ -203,18 +278,60 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(!
isInit
)
if
(!
isInit
)
{
{
mainTimer
=
new
System
.
Timers
.
Timer
();
if
(
useTimer
)
mainTimer
.
Enabled
=
false
;
{
mainTimer
.
Interval
=
300
;
mainTimer
=
new
System
.
Timers
.
Timer
();
mainTimer
.
Elapsed
+=
mainTimer_Elapsed
;
mainTimer
.
Enabled
=
false
;
mainTimer
.
AutoReset
=
true
;
mainTimer
.
Interval
=
300
;
mainTimer
.
Elapsed
+=
mainTimer_Elapsed
;
mainTimer
.
AutoReset
=
true
;
}
else
{
mainThread
=
new
Thread
(
mainThread_Handle
);
mainThread
.
IsBackground
=
true
;
threadInterval
=
300
;
loop
=
true
;
GC
.
KeepAlive
(
mainThread
);
mainThread
.
Start
();
}
isInit
=
true
;
isInit
=
true
;
}
}
}
}
public
LineMoveInfo
MoveInfo
=
null
;
public
LineMoveInfo
MoveInfo
=
null
;
string
threadInfo
=
""
;
void
mainThread_Handle
()
{
while
(
loop
)
{
if
(
pause
)
{
Thread
.
Sleep
(
1000
);
}
else
{
mainThread_Process
();
Thread
.
Sleep
(
threadInterval
);
try
{
string
curStr
=
$
"{Name}-{DeviceID}:Thread ID: {Thread.CurrentThread.ManagedThreadId}"
;
if
(!
curStr
.
Equals
(
threadInfo
))
{
threadInfo
=
curStr
;
LogUtil
.
LOGGER
.
Info
(
curStr
);
}
}
finally
{
}
protected
abstract
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
);
}
}
}
protected
abstract
void
mainThread_Process
();
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
mainThread_Process
();
}
#
region
出库
#
region
出库
/// <summary>
/// <summary>
...
@@ -642,7 +759,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -642,7 +759,8 @@ namespace OnlineStore.DeviceLibrary
warnParam
.
OperteType
=
""
;
warnParam
.
OperteType
=
""
;
}
}
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
"SetWarnMsg Error: "
+
ex
.
ToString
());
LogUtil
.
error
(
"SetWarnMsg Error: "
+
ex
.
ToString
());
}
}
...
@@ -654,9 +772,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -654,9 +772,9 @@ namespace OnlineStore.DeviceLibrary
try
try
{
{
SetWarnMsg
(
move
.
Name
+
"["
+
move
.
GetMoveType
()
+
"]["
+
move
.
SLog
+
"] "
+
alarmType
+
" ["
+
FormUtil
.
GetSpanStr
(
move
.
StepSpan
())
+
"]"
,
alarmType
,
move
);
SetWarnMsg
(
move
.
Name
+
"["
+
move
.
GetMoveType
()
+
"]["
+
move
.
SLog
+
"] "
+
alarmType
+
" ["
+
FormUtil
.
GetSpanStr
(
move
.
StepSpan
())
+
"]"
,
alarmType
,
move
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
}
}
...
@@ -689,7 +807,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -689,7 +807,7 @@ namespace OnlineStore.DeviceLibrary
string
alarmTypeStr
=
stepDes
+
"_超时报警"
;
string
alarmTypeStr
=
stepDes
+
"_超时报警"
;
if
(
warnParam
.
AlarmType
.
Equals
(
alarmTypeStr
))
if
(
warnParam
.
AlarmType
.
Equals
(
alarmTypeStr
))
{
{
LogUtil
.
info
(
Name
+
$
"步骤{stepDes}结束,清理【{
WarnMsg
}】 "
);
LogUtil
.
info
(
Name
+
$
"步骤{stepDes}结束,清理【{
WarnMsg
}】 "
);
alarmType
=
LineAlarmType
.
None
;
alarmType
=
LineAlarmType
.
None
;
SetWarnMsg
(
""
);
SetWarnMsg
(
""
);
}
}
...
@@ -699,7 +817,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -699,7 +817,7 @@ namespace OnlineStore.DeviceLibrary
string
alarmTypeStr
=
stepDes
+
"_轴运动报警"
;
string
alarmTypeStr
=
stepDes
+
"_轴运动报警"
;
if
(
warnParam
.
AlarmType
.
Equals
(
alarmTypeStr
))
if
(
warnParam
.
AlarmType
.
Equals
(
alarmTypeStr
))
{
{
LogUtil
.
info
(
Name
+
$
"步骤{stepDes}结束,清理【{
WarnMsg
}】 "
);
LogUtil
.
info
(
Name
+
$
"步骤{stepDes}结束,清理【{
WarnMsg
}】 "
);
alarmType
=
LineAlarmType
.
None
;
alarmType
=
LineAlarmType
.
None
;
SetWarnMsg
(
""
);
SetWarnMsg
(
""
);
}
}
...
@@ -732,4 +850,4 @@ namespace OnlineStore.DeviceLibrary
...
@@ -732,4 +850,4 @@ namespace OnlineStore.DeviceLibrary
public
string
Barcode
=
""
;
public
string
Barcode
=
""
;
}
}
}
}
source/HuichuanLibrary/HCLogUtil.cs
查看文件 @
0aff9dd
...
@@ -116,7 +116,7 @@ namespace HuichuanLibrary
...
@@ -116,7 +116,7 @@ namespace HuichuanLibrary
}
}
else
else
{
{
LOGGER
.
Debug
(
"ShowLogPro【"
+
msg
+
"】失败,未得到锁"
);
//
LOGGER.Debug("ShowLogPro【" + msg + "】失败,未得到锁");
}
}
}
}
private
static
List
<
string
>
logList
=
new
List
<
string
>();
private
static
List
<
string
>
logList
=
new
List
<
string
>();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论