Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 3547a0c6
由
LN
编写于
2019-10-08 10:07:39 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
179c6ed8
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
291 行增加
和
261 行删除
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
source/DeviceLibrary/assemblyLine/MoveEquip.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
source/DeviceLibrary/server/LineServer.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
3547a0c
...
...
@@ -377,6 +377,10 @@ namespace OnlineStore.DeviceLibrary
{
return
true
;
}
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
).
Equals
(
false
))
{
return
true
;
}
if
(
SW12_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
).
Equals
(
false
))
{
return
true
;
...
...
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
查看文件 @
3547a0c
...
...
@@ -44,14 +44,11 @@ namespace OnlineStore.DeviceLibrary
{
isInprocess
=
true
;
lastProTime
=
DateTime
.
Now
;
if
(!
isCanProcessLine
())
{
return
;
}
//出入料口条件: 各料仓无报警( 伺服), 各移栽装置处 于原位待机, 检测夹具IO,驱动电机运转
if
(
IOValue
(
IO_Type
.
DriveMotor_Run
).
Equals
(
IO_VALUE
.
LOW
))
if
(
!
isCanProcessLine
()
||
IOValue
(
IO_Type
.
DriveMotor_Run
).
Equals
(
IO_VALUE
.
LOW
))
{
isWaitOutGo
=
false
;
isInprocess
=
false
;
return
;
}
...
...
@@ -274,6 +271,7 @@ namespace OnlineStore.DeviceLibrary
if
(!
wait
.
IsEnd
)
{
List
<
WriteIOInfo
>
wLists
=
checkWaitInfo
.
WriteIoList
;
TimeSpan
rwSpan
=
DateTime
.
Now
-
preRWTime
;
if
(
span
.
TotalMilliseconds
>
LineManager
.
Config
.
IOSingle_TimerOut
)
{
...
...
@@ -281,20 +279,19 @@ namespace OnlineStore.DeviceLibrary
WarnMsg
=
Name
+
" 等待"
+
NotOkMsg
+
"超时"
;
Alarm
(
LineAlarmType
.
IoSingleTimeOut
,
io
.
ElectricalDefinition
,
WarnMsg
,
checkWaitInfo
.
MoveType
);
LogUtil
.
error
(
checkWaitInfo
.
Name
+
":"
+
wait
.
IoType
+
"等待"
+
NotOkMsg
+
"超时"
,
14
);
LogUtil
.
error
(
checkWaitInfo
.
Name
+
":"
+
checkWaitInfo
.
MoveStep
+
"等待"
+
NotOkMsg
+
"超时"
,
14
);
isOk
=
false
;
break
;
}
else
if
(
rwSpan
.
TotalSeconds
>
3
&&
span
.
TotalSeconds
>
3
&&
(
checkWaitInfo
.
WriteIoList
!=
null
)
&&
checkWaitInfo
.
WriteIoList
.
Count
>
0
)
else
if
(
rwSpan
.
TotalSeconds
>
3
&&
span
.
TotalSeconds
>
3
&&
(
wLists
!=
null
)
&&
wLists
.
Count
>
0
)
{
List
<
WriteIOInfo
>
wLists
=
new
List
<
WriteIOInfo
>(
checkWaitInfo
.
WriteIoList
);
preRWTime
=
DateTime
.
Now
;
string
msg
=
checkWaitInfo
.
Name
+
"
"
+
NotOkMsg
+
" 已等待"
+
Math
.
Abs
(
span
.
TotalSeconds
)
+
"秒,重写DO:"
;
string
msg
=
checkWaitInfo
.
Name
+
"
["
+
checkWaitInfo
.
MoveStep
+
"]"
+
" 已等待 "
+
NotOkMsg
+
Math
.
Abs
(
span
.
TotalSeconds
)
+
"秒,重写DO:"
;
foreach
(
WriteIOInfo
ww
in
wLists
)
{
IOMove
(
ww
.
IoType
,
ww
.
IoValue
);
msg
+=
"["
+
ww
.
IoType
+
"
+
"
+
ww
.
IoValue
+
"],"
;
msg
+=
"["
+
ww
.
IoType
+
"
=
"
+
ww
.
IoValue
+
"],"
;
}
LogUtil
.
error
(
msg
);
}
...
...
@@ -339,7 +336,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
checkWaitInfo
.
Name
+
" ["
+
checkWaitInfo
.
MoveStep
+
"] CheckWait 出错:"
+
ex
.
ToString
()
);
LogUtil
.
error
(
checkWaitInfo
.
Name
+
" ["
+
checkWaitInfo
.
MoveStep
+
"] CheckWait 出错:"
+
ex
.
StackTrace
);
}
}
...
...
@@ -419,7 +416,6 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
LI_00_Wait100
);
MoveInfo
.
MoveParam
=
param
;
preTrayNum
=
param
.
TrayNumber
;
//等待料仓验证成功,最多等待10秒,若验证不成功,直接失败
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
...
...
@@ -460,6 +456,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
preTrayNum
=
MoveInfo
.
MoveParam
.
TrayNumber
;
lock
(
moveEquip
.
waitInListLock
)
{
//如果当前正在出入库中,需要记录下来,等待空闲时执行
...
...
@@ -612,95 +609,113 @@ namespace OnlineStore.DeviceLibrary
private
bool
SideWay12IsWait
=
false
;
private
DateTime
SideWay34Ntime
=
DateTime
.
Now
;
private
bool
SideWay34IsWait
=
false
;
private
bool
sdIsInprocess
=
false
;
private
DateTime
sdlastProTime
=
DateTime
.
Now
;
private
void
SideWayTimerProcess
()
{
//流水线转动中,并且在忙碌或出入库处理中,需要处理移栽
if
(
IOValue
(
IO_Type
.
DriveMotor_Run
).
Equals
(
IO_VALUE
.
HIGH
)
&&
runStatus
>=
LineRunStatus
.
Runing
)
TimeSpan
span
=
DateTime
.
Now
-
sdlastProTime
;
if
(
sdIsInprocess
&&
span
.
TotalSeconds
<
5
)
{
return
;
}
try
{
if
(
SW12_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
IOValue
(
IO_Type
.
SidesWay2_FixtureCheck
).
Equals
(
IO_VALUE
.
LOW
))
sdIsInprocess
=
true
;
sdlastProTime
=
DateTime
.
Now
;
//流水线转动中,并且在忙碌或出入库处理中,需要处理移栽
if
(
IOValue
(
IO_Type
.
DriveMotor_Run
).
Equals
(
IO_VALUE
.
HIGH
)
&&
runStatus
>=
LineRunStatus
.
Runing
)
{
TimeSpan
span12
=
DateTime
.
Now
-
SideWay12Ntime
;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡2下降,盘通过
if
(
IOValue
(
IO_Type
.
SidesWay1_StopFixtureCheck
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
SW12_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
IOValue
(
IO_Type
.
SidesWay2_FixtureCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(
SideWay12IsWait
&&
span12
.
TotalSeconds
>
1
)
TimeSpan
span12
=
DateTime
.
Now
-
SideWay12Ntime
;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡2下降,盘通过
if
(
IOValue
(
IO_Type
.
SidesWay1_StopFixtureCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
SWLog
(
"横移轨道阻挡1检测到托盘,开始移动托盘,下降横移气缸12"
);
SW12_MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
SW12_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW00_Wait
);
SideWay12TopCylinderMove
(
IO_VALUE
.
HIGH
,
IO_VALUE
.
LOW
,
SW12_MoveInfo
);
}
else
if
(!
SideWay12IsWait
)
{
SideWay12IsWait
=
true
;
SideWay12Ntime
=
DateTime
.
Now
;
if
(
SideWay12IsWait
&&
span12
.
TotalSeconds
>
1
)
{
SWLog
(
"横移轨道阻挡1检测到托盘,开始移动托盘,下降横移气缸12"
);
SW12_MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
SW12_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW00_Wait
);
SideWay12TopCylinderMove
(
IO_VALUE
.
HIGH
,
IO_VALUE
.
LOW
,
SW12_MoveInfo
);
}
else
if
(!
SideWay12IsWait
)
{
SideWay12IsWait
=
true
;
SideWay12Ntime
=
DateTime
.
Now
;
}
}
}
else
if
(
IOValue
(
IO_Type
.
SidesWay1_FixtureCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
SideWay12IsWait
&&
span12
.
TotalSeconds
>
1
)
else
if
(
IOValue
(
IO_Type
.
SidesWay1_FixtureCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
SWLog
(
"横移轨道1检测到托盘,阻挡1上升,等待横移1夹具检测信号"
);
SW12_MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
SW12_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW02_WaitFixtureCheck
);
IOMove
(
IO_Type
.
SidesWay1_StopCylinderDown
,
IO_VALUE
.
LOW
);
SW12_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SidesWay1_FixtureCheck
,
IO_VALUE
.
HIGH
));
if
(
SideWay12IsWait
&&
span12
.
TotalSeconds
>
1
)
{
SWLog
(
"横移轨道1检测到托盘,阻挡1上升,等待横移1夹具检测信号"
);
SW12_MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
SW12_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW02_WaitFixtureCheck
);
IOMove
(
IO_Type
.
SidesWay1_StopCylinderDown
,
IO_VALUE
.
LOW
);
SW12_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
SidesWay1_FixtureCheck
,
IO_VALUE
.
HIGH
));
}
else
if
(!
SideWay12IsWait
)
{
SideWay12IsWait
=
true
;
SideWay12Ntime
=
DateTime
.
Now
;
}
}
else
if
(!
SideWay12IsWait
)
else
{
SideWay12IsWait
=
true
;
SideWay12Ntime
=
DateTime
.
Now
;
SideWay12IsWait
=
false
;
}
}
else
{
SideWay12IsWait
=
false
;
SideWay12BusyProcess
();
}
}
else
{
SideWay12IsWait
=
false
;
SideWay12BusyProcess
();
}
if
(
SW34_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
IOValue
(
IO_Type
.
SidesWay4_FixtureCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
TimeSpan
span34
=
DateTime
.
Now
-
SideWay34Ntime
;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡4下降,盘通过
if
(
IOValue
(
IO_Type
.
SidesWay3_FixtureCheck
).
Equals
(
IO_VALUE
.
HIGH
))
if
(
SW34_MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
IOValue
(
IO_Type
.
SidesWay4_FixtureCheck
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(
SideWay34IsWait
&&
span34
.
TotalSeconds
>
1
)
TimeSpan
span34
=
DateTime
.
Now
-
SideWay34Ntime
;
//检测到阻挡夹具信号后,阻挡气缸下降,等待有夹具信号,阻挡气缸上升,
//顶升气缸上升到位,开始流水线转动,检测到出口信号后,停止转动,顶升气缸下降,阻挡4下降,盘通过
if
(
IOValue
(
IO_Type
.
SidesWay3_FixtureCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
SWLog
(
"横移轨道3检测到托盘,开始移动托盘"
);
SW34_MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
SW34_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW01_StopCylinderDown
);
IOMove
(
IO_Type
.
SidesWay3_StopCylinderDown
,
IO_VALUE
.
HIGH
);
SideWay34TopCylinderMove
(
IO_VALUE
.
HIGH
,
IO_VALUE
.
LOW
,
SW34_MoveInfo
);
if
(
SideWay34IsWait
&&
span34
.
TotalSeconds
>
1
)
{
SWLog
(
"横移轨道3检测到托盘,开始移动托盘"
);
SW34_MoveInfo
.
NewMove
(
LineMoveType
.
InStore
);
SW34_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW01_StopCylinderDown
);
IOMove
(
IO_Type
.
SidesWay3_StopCylinderDown
,
IO_VALUE
.
HIGH
);
SideWay34TopCylinderMove
(
IO_VALUE
.
HIGH
,
IO_VALUE
.
LOW
,
SW34_MoveInfo
);
}
else
if
(!
SideWay34IsWait
)
{
SideWay34IsWait
=
true
;
SideWay34Ntime
=
DateTime
.
Now
;
}
}
else
if
(!
SideWay34IsWait
)
else
{
SideWay34IsWait
=
true
;
SideWay34Ntime
=
DateTime
.
Now
;
SideWay34IsWait
=
false
;
}
}
else
{
SideWay34IsWait
=
false
;
SideWay34BusyProcess
();
}
}
else
{
SideWay34IsWait
=
false
;
SideWay
34BusyProcess
()
;
SideWay
12IsWait
=
false
;
}
}
else
catch
(
Exception
ex
)
{
SideWay34IsWait
=
false
;
SideWay12IsWait
=
false
;
LogUtil
.
error
(
"SideWayTimerProcess 出错:"
+
ex
.
StackTrace
);
}
sdIsInprocess
=
false
;
}
private
void
SideWay12BusyProcess
()
...
...
@@ -812,7 +827,8 @@ namespace OnlineStore.DeviceLibrary
else
if
(
SW34_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
SW02_WaitFixtureCheck
))
{
SW34_MoveInfo
.
NextMoveStep
(
LineMoveStep
.
SW03_TopCylinderUp
);
SWLog
(
"横移轨道34:顶升气缸上升 ,横移3阻挡上升 "
);
SWLog
(
"横移轨道34:顶升气缸上升 ,横移3阻挡上升,至少等待1000 "
);
SW34_MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
IOMove
(
IO_Type
.
SidesWay3_StopCylinderDown
,
IO_VALUE
.
LOW
);
SideWay34TopCylinderMove
(
IO_VALUE
.
LOW
,
IO_VALUE
.
HIGH
,
SW34_MoveInfo
);
}
...
...
source/DeviceLibrary/assemblyLine/MoveEquip.cs
查看文件 @
3547a0c
...
...
@@ -20,7 +20,7 @@ namespace OnlineStore.DeviceLibrary
public
bool
UpdownUseAxis
=
false
;
public
AxisAlarmInfo
AxisAlarm
=
new
AxisAlarmInfo
();
public
MoveEquip_Config
Config
;
/// <summary>
///移栽装置后面分为两条移动线
/// </summary>
...
...
@@ -29,13 +29,13 @@ namespace OnlineStore.DeviceLibrary
public
List
<
InOutParam
>
waitOutStoreList
=
new
List
<
InOutParam
>();
public
List
<
InOutParam
>
waitInStoreList
=
new
List
<
InOutParam
>();
public
object
waitInListLock
=
""
;
public
object
waitOutListLock
=
""
;
public
object
waitOutListLock
=
""
;
public
MoveEquip
(
string
cid
,
MoveEquip_Config
config
)
{
this
.
DeviceID
=
config
.
Id
;
this
.
Config
=
config
;
Name
=
(
" "
+
"_移栽_"
+
DeviceID
+
" "
).
ToUpper
();
Name
=
(
" "
+
"_移栽_"
+
DeviceID
+
" "
).
ToUpper
();
//Name = (" " + cid + "_移栽_" + DeviceID + " ").ToUpper();
Init
();
//添加调试
...
...
@@ -44,8 +44,8 @@ namespace OnlineStore.DeviceLibrary
IsDebug
=
true
;
}
//this.Box = box;
MoveInfo
=
new
LineMoveInfo
(
DeviceID
,
"移栽-"
+
DeviceID
+
"-MoveInfo"
);
MoveInfo
=
new
LineMoveInfo
(
DeviceID
,
"移栽-"
+
DeviceID
+
"-MoveInfo"
);
SecondMoveInfo
=
new
LineMoveInfo
(
DeviceID
,
"移栽-"
+
DeviceID
+
"-SecondMoveInfo"
);
IsDebug
=
config
.
IsDebug
.
Equals
(
1
);
UpdownUseAxis
=
config
.
UpDownUseAxis
.
Equals
(
1
);
...
...
@@ -66,20 +66,20 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 开始运行
/// </summary>
public
override
bool
StartRun
(
)
public
override
bool
StartRun
()
{
preTrayNum
=
0
;
currMoveTrayNum
=
0
;
mainTimer
.
Enabled
=
false
;
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
lineStatus
=
LineStatus
.
StoreOnline
;
lineStatus
=
LineStatus
.
StoreOnline
;
//TODO 调试时暂时注释
runStatus
=
LineRunStatus
.
HomeMoving
;
return
MoveEquipMentHome
();
return
MoveEquipMentHome
();
}
public
bool
StartDebugRun
()
public
bool
StartDebugRun
()
{
preTrayNum
=
0
;
currMoveTrayNum
=
0
;
...
...
@@ -89,7 +89,7 @@ namespace OnlineStore.DeviceLibrary
lineStatus
=
LineStatus
.
StoreOnline
;
//TODO 调试时暂时注释
runStatus
=
LineRunStatus
.
HomeMoving
;
bool
result
=
MoveEquipMentHome
();
bool
result
=
MoveEquipMentHome
();
if
(
result
)
{
mainTimer
.
Enabled
=
true
;
...
...
@@ -167,13 +167,13 @@ namespace OnlineStore.DeviceLibrary
StopMoveProcess
();
}
if
(
SecondMoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
CheckFixture
))
if
(
SecondMoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
CheckFixture
))
{
CheckFixtureProcess
();
}
}
protected
override
void
mainTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
TimerProcess
();
...
...
@@ -199,15 +199,15 @@ namespace OnlineStore.DeviceLibrary
if
(
SecondMoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
))
{
LineBean
lineBean
=
LineManager
.
Line
;
if
(
lineBean
.
isCanProcessLine
()
&&
IOManager
.
IOValue
(
IO_Type
.
DriveMotor_Run
,
0
).
Equals
(
IO_VALUE
.
HIGH
)
&&
lineBean
.
runStatus
>=
LineRunStatus
.
Runing
&&
lineBean
.
IsSleep
.
Equals
(
false
))
if
(
lineBean
.
isCanProcessLine
()
&&
IOManager
.
IOValue
(
IO_Type
.
DriveMotor_Run
,
0
).
Equals
(
IO_VALUE
.
HIGH
)
&&
lineBean
.
runStatus
>=
LineRunStatus
.
Runing
&&
lineBean
.
IsSleep
.
Equals
(
false
))
{
// LogUtil.info("StartCheckFixture");
// LogUtil.info("StartCheckFixture");
StartCheckFixture
();
}
}
IOTimeOutProcess
();
OutStoreListPro
();
OutStoreListPro
();
}
catch
(
Exception
ex
)
{
...
...
@@ -221,7 +221,7 @@ namespace OnlineStore.DeviceLibrary
/// 出库队列处理
/// </summary>
private
void
OutStoreListPro
()
{
{
//料仓出库完成,移栽装置开始出库检测
if
(
IsDebug
.
Equals
(
false
)
&&
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
)
&&
runStatus
.
Equals
(
LineRunStatus
.
Runing
))
{
...
...
@@ -238,7 +238,7 @@ namespace OnlineStore.DeviceLibrary
{
LogUtil
.
info
(
Name
+
"开始 执行排队中的出库【"
+
waitOutParma
.
ToStr
()
+
"】"
);
//出库
bool
result
=
StartOutStoreMove
(
waitOutParma
);
bool
result
=
StartOutStoreMove
(
waitOutParma
);
if
(!
result
)
{
LogUtil
.
info
(
Name
+
" 执行排队中的出库【"
+
waitOutParma
.
ToStr
()
+
"】失败,重新加入等待队列"
);
...
...
@@ -247,11 +247,20 @@ namespace OnlineStore.DeviceLibrary
}
}
}
public
void
AddWaitOutInfo
(
InOutParam
param
)
{
public
void
AddWaitOutInfo
(
InOutParam
param
)
{
lock
(
waitOutListLock
)
{
waitOutStoreList
.
Add
(
param
);
//判断是否已经加入,不重复加
List
<
InOutParam
>
paramList
=
(
from
m
in
waitOutStoreList
where
m
.
PosId
.
Equals
(
param
.
PosId
)
select
m
).
ToList
<
InOutParam
>();
if
(
paramList
.
Count
>
0
)
{
LogUtil
.
error
(
Name
+
"出库【"
+
param
.
ToStr
()
+
"】加入等待出库队列失败,此库位已存在列表中"
);
}
else
{
waitOutStoreList
.
Add
(
param
);
}
}
}
...
...
@@ -261,17 +270,17 @@ namespace OnlineStore.DeviceLibrary
try
{
TimeSpan
span
=
DateTime
.
Now
-
preIoTimerOutTime
;
if
(
span
.
TotalSeconds
>
1
&&
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
if
(
span
.
TotalSeconds
>
1
&&
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
{
preIoTimerOutTime
=
DateTime
.
Now
;
if
(
runStatus
<
LineRunStatus
.
Runing
||
isInSuddenDown
||
isNoAirCheck
)
if
(
runStatus
<
LineRunStatus
.
Runing
||
isInSuddenDown
||
isNoAirCheck
)
{
return
;
}
}
//若BOX和移栽都没有在等待Io的过程中则此Io超时异常可能已经处理过
if
(
MoveInfo
.
IsInWait
.
Equals
(
false
)&&
SecondMoveInfo
.
IsInWait
.
Equals
(
false
))
if
(
MoveInfo
.
IsInWait
.
Equals
(
false
)
&&
SecondMoveInfo
.
IsInWait
.
Equals
(
false
))
{
LogUtil
.
info
(
Name
+
"清理信号超时报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
LineAlarmType
.
None
;
...
...
@@ -281,14 +290,14 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"IOTimeOutProcess出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"IOTimeOutProcess出错:"
+
ex
.
ToString
());
}
}
/// <summary>
/// 移栽装置原点返回
/// </summary>
public
bool
MoveEquipMentHome
()
public
bool
MoveEquipMentHome
()
{
mainTimer
.
Stop
();
if
(!
RunAxis
(
true
))
...
...
@@ -298,11 +307,11 @@ namespace OnlineStore.DeviceLibrary
alarmType
=
LineAlarmType
.
None
;
runStatus
=
LineRunStatus
.
HomeMoving
;
LogInfo
(
"开始原点返回: (上下气缸回原点,阻挡气缸输入=0 )开始"
);
LogInfo
(
"开始原点返回: (上下气缸回原点,阻挡气缸输入=0 )开始"
);
MoveInfo
.
NewMove
(
LineMoveType
.
ReturnHome
);
//移载装置原点状态:顶升气缸下降端,前后气缸后退端,上下气缸上升端,夹料气缸放松端,阻挡气缸输入=0
UpdownHomeMove
();
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if
(
IsDebug
)
{
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
);
...
...
@@ -311,17 +320,17 @@ namespace OnlineStore.DeviceLibrary
else
{
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
LOW
);
}
return
true
;
}
/// <summary>
/// 移栽装置重置
/// </summary>
public
override
bool
Reset
()
public
override
bool
Reset
()
{
WarnMsg
=
""
;
//如果正在出库中,需要减去托盘号
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
OutStore
))
{
...
...
@@ -329,7 +338,7 @@ namespace OnlineStore.DeviceLibrary
//减去需要的盘数
TrayManager
.
DelNeedEmptyTrayNum
();
MoveInfo
.
EndMove
();
}
}
if
(!
RunAxis
(
true
))
{
return
false
;
...
...
@@ -338,13 +347,13 @@ namespace OnlineStore.DeviceLibrary
//重置时清理盘号,从头开始判断
preTrayNum
=
0
;
currMoveTrayNum
=
0
;
LogInfo
(
"开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;"
);
LogInfo
(
"开始重置:清零上一个托盘号,(上下气缸回原点,阻挡气缸输入=0 )开始;"
);
runStatus
=
LineRunStatus
.
Reset
;
SecondMoveInfo
.
EndMove
();
MoveInfo
.
NewMove
(
LineMoveType
.
Reset
);
UpdownHomeMove
();
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
// CylinderMove(MoveInfo, IO_Type.UpDownCylinder_Down, IO_Type.UpDownCylinder_Up);
if
(
IsDebug
)
{
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
);
...
...
@@ -389,7 +398,7 @@ namespace OnlineStore.DeviceLibrary
case
LineMoveStep
.
MH_UpDownCylinder_Up
:
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MH_OtherCylinder_Back
);
LogInfo
(
"重置: (上升到位,顶升气缸下降,前后气缸回退 )开始"
);
LogInfo
(
"重置: (上升到位,顶升气缸下降,前后气缸回退 )开始"
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_UP
,
IO_Type
.
TopCylinder_Down
);
CylinderMove
(
MoveInfo
,
IO_Type
.
BeforeAfterCylinder_Before
,
IO_Type
.
BeforeAfterCylinder_After
);
CylinderMove
(
MoveInfo
,
IO_Type
.
ClampCylinder_Slack
,
IO_Type
.
ClampCylinder_Tighten
);
...
...
@@ -397,7 +406,7 @@ namespace OnlineStore.DeviceLibrary
case
LineMoveStep
.
MH_OtherCylinder_Back
:
LogInfo
(
"重置完成!"
);
LogInfo
(
"重置完成!"
);
runStatus
=
LineRunStatus
.
Runing
;
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
...
...
@@ -412,7 +421,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 原点返回处理
/// </summary>
protected
void
ReturnHomeProcess
()
protected
void
ReturnHomeProcess
()
{
if
(
MoveInfo
.
IsInWait
)
{
...
...
@@ -444,7 +453,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
LogInfo
(
"原点返回完成!"
);
LogInfo
(
"原点返回完成!"
);
runStatus
=
LineRunStatus
.
Runing
;
//如果是调试模式,移栽装置两个阻挡气缸落下,并且不再移动
if
(
IsDebug
)
...
...
@@ -475,12 +484,12 @@ namespace OnlineStore.DeviceLibrary
if
(!
MoveInfo
.
IsInWait
&&
!
SecondMoveInfo
.
IsInWait
)
{
switch
(
MoveInfo
.
MoveStep
)
{
{
//流水线各装置复原位,夹料气缸状态不变 //阻挡气缸全部=0 //上下气缸上升,、 //上升到位,顶升气缸下降,前后气缸回退
case
LineMoveStep
.
MH_UpDownCylinder_Up
:
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MH_OtherCylinder_Back
);
LogInfo
(
"停止运动: (上升到位,顶升气缸下降,前后气缸回退 )开始"
);
LogInfo
(
"停止运动: (上升到位,顶升气缸下降,前后气缸回退 )开始"
);
IOMove
(
IO_Type
.
UpDownCylinder_Up
,
IO_VALUE
.
LOW
);
CylinderMove
(
MoveInfo
,
IO_Type
.
TopCylinder_UP
,
IO_Type
.
TopCylinder_Down
);
...
...
@@ -513,22 +522,22 @@ namespace OnlineStore.DeviceLibrary
//如果正在出库中,需要减去托盘号
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
OutStore
))
{
LogInfo
(
"停止运动时出库执行中,减去托盘数;"
);
LogInfo
(
"停止运动时出库执行中,减去托盘数;"
);
//减去需要的盘数
TrayManager
.
DelNeedEmptyTrayNum
();
MoveInfo
.
EndMove
();
}
runStatus
=
LineRunStatus
.
Busy
;
SecondMoveInfo
.
EndMove
();
LogInfo
(
"停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 "
);
SecondMoveInfo
.
EndMove
();
LogInfo
(
"停止运动:(上下气缸上升端,阻挡气缸输入=0 )开始 "
);
MoveInfo
.
NewMove
(
LineMoveType
.
StopMove
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MH_UpDownCylinder_Up
);
UpdownUpMove
();
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
LOW
);
}
public
void
ChangeDebug
()
...
...
@@ -559,7 +568,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
internal
void
OpenStopCylinder
()
{
LogInfo
(
"下降阻挡气缸,上下气缸上升,顶升气缸下降"
);
LogInfo
(
"下降阻挡气缸,上下气缸上升,顶升气缸下降"
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
);
//上下气缸上升
...
...
@@ -574,7 +583,7 @@ namespace OnlineStore.DeviceLibrary
}
internal
void
CloseCylinderStop
()
{
LogInfo
(
"上升阻挡气缸,关闭上下气缸,顶升气缸IO"
);
LogInfo
(
"上升阻挡气缸,关闭上下气缸,顶升气缸IO"
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
LOW
);
//上下气缸上升
...
...
@@ -584,7 +593,7 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
IO_Type
.
TopCylinder_UP
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
TopCylinder_Down
,
IO_VALUE
.
LOW
);
}
#
region
上下气缸伺服运动
private
string
portName
;
private
short
slvAddr
;
...
...
@@ -629,33 +638,33 @@ namespace OnlineStore.DeviceLibrary
private
bool
OpenAxis
()
{
//判断轴是否正常
if
(
ACServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
{
LogUtil
.
info
(
Name
+
"成功打开轴:"
+
Config
.
UpDown_Axis
.
Explain
);
}
else
{
//清理报警,再重新打开一次
LogUtil
.
info
(
Name
+
"第一次打开轴"
+
Config
.
UpDown_Axis
.
Explain
+
"失败,先清理一下报警,再重新打开一次"
);
ACServerManager
.
AlarmClear
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
1200
);
ACServerManager
.
ServoOn
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
100
);
if
(
ACServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
{
LogUtil
.
info
(
Name
+
"成功打开轴
:"
+
Config
.
UpDown_Axis
.
Explain
);
LogUtil
.
info
(
Name
+
"清理报警后重新打卡轴成功
:"
+
Config
.
UpDown_Axis
.
Explain
);
}
else
{
//清理报警,再重新打开一次
LogUtil
.
info
(
Name
+
"第一次打开轴"
+
Config
.
UpDown_Axis
.
Explain
+
"失败,先清理一下报警,再重新打开一次"
);
ACServerManager
.
AlarmClear
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
1200
);
ACServerManager
.
ServoOn
(
portName
,
slvAddr
);
System
.
Threading
.
Thread
.
Sleep
(
100
);
if
(
ACServerManager
.
ServerOnStatus
(
portName
,
slvAddr
))
{
LogUtil
.
info
(
Name
+
"清理报警后重新打卡轴成功:"
+
Config
.
UpDown_Axis
.
Explain
);
}
else
{
ACServerManager
.
ServoOff
(
portName
,
slvAddr
);
WarnMsg
=
Name
+
"打开轴"
+
Config
.
UpDown_Axis
.
Explain
+
"失败 "
;
LogUtil
.
info
(
Name
+
WarnMsg
);
Alarm
(
LineAlarmType
.
AxisAlarm
,
5.
ToString
(),
WarnMsg
,
MoveInfo
.
MoveType
);
return
false
;
}
ACServerManager
.
ServoOff
(
portName
,
slvAddr
);
WarnMsg
=
Name
+
"打开轴"
+
Config
.
UpDown_Axis
.
Explain
+
"失败 "
;
LogUtil
.
info
(
Name
+
WarnMsg
);
Alarm
(
LineAlarmType
.
AxisAlarm
,
5.
ToString
(),
WarnMsg
,
MoveInfo
.
MoveType
);
return
false
;
}
}
return
true
;
}
...
...
@@ -673,12 +682,12 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
IO_Type
.
UpDownAxis_ServoOn
,
IO_VALUE
.
LOW
);
}
private
void
ACAxisHomeMove
(
ConfigMoveAxis
moveAxis
)
{
moveAxis
.
TargetPosition
=
0
;
LogUtil
.
info
(
moveAxis
.
DisplayStr
+
"speed["
+
moveAxis
.
TargetSpeed
+
"]开始原点返回"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
moveAxis
,
true
));
LogUtil
.
info
(
moveAxis
.
DisplayStr
+
"speed["
+
moveAxis
.
TargetSpeed
+
"]开始原点返回"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
moveAxis
,
true
));
ACServerManager
.
HomeMove
(
moveAxis
.
DeviceName
,
(
short
)
moveAxis
.
GetAxisValue
(),
moveAxis
.
HomeHighSpeed
);
}
...
...
@@ -688,7 +697,7 @@ namespace OnlineStore.DeviceLibrary
private
void
ACAxisMove
(
ConfigMoveAxis
moveAxis
,
int
targetPosition
,
int
targetSpeed
)
{
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitAxis
(
moveAxis
,
targetPosition
,
targetSpeed
));
moveAxis
.
TargetPosition
=
targetPosition
;
moveAxis
.
TargetPosition
=
targetPosition
;
ACServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
);
}
...
...
@@ -700,7 +709,7 @@ namespace OnlineStore.DeviceLibrary
msg
=
""
;
string
deviceName
=
moveAxis
.
DeviceName
;
short
axisNo
=
moveAxis
.
GetAxisValue
();
bool
isOk
=
ACServerManager
.
GetBusyStatus
(
deviceName
,
axisNo
).
Equals
(
0
);
int
outCount
=
ACServerManager
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
...
...
@@ -713,7 +722,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动
if
(
MoveInfo
.
CanWhileCount
>
0
)
{
LogUtil
.
error
(
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
LogUtil
.
error
(
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,重新开始运动,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
ACServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
);
MoveInfo
.
CanWhileCount
--;
...
...
@@ -722,7 +731,7 @@ namespace OnlineStore.DeviceLibrary
{
msg
=
Name
+
" storeMoveStep="
+
MoveInfo
.
MoveStep
+
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
msg
);
LogUtil
.
error
(
msg
);
}
}
return
false
;
...
...
@@ -742,7 +751,7 @@ namespace OnlineStore.DeviceLibrary
//判断是否需要重新运动
if
(
MoveInfo
.
CanWhileCount
>
0
)
{
LogUtil
.
error
(
moveAxis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
LogUtil
.
error
(
moveAxis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],重新回原点,剩余["
+
MoveInfo
.
CanWhileCount
+
"]次"
);
//LogUtil.error( StoreName + moveAxis.DisplayStr + "重新回原点");
ACServerManager
.
HomeMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
moveAxis
.
HomeHighSpeed
);
MoveInfo
.
CanWhileCount
--;
...
...
@@ -750,11 +759,11 @@ namespace OnlineStore.DeviceLibrary
else
{
msg
=
Name
+
" storeMoveStep="
+
MoveInfo
.
MoveStep
+
moveAxis
.
DisplayStr
+
"收到原点完成信号,当前位置["
+
outCount
+
"],误差过大,需要报警"
;
LogUtil
.
error
(
msg
);
LogUtil
.
error
(
msg
);
}
}
return
false
;
}
}
/// <summary>
/// 上下气缸移动到上升端
/// </summary>
...
...
@@ -769,7 +778,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove
(
MoveInfo
,
IO_Type
.
UpDownCylinder_Down
,
IO_Type
.
UpDownCylinder_Up
);
}
}
private
void
UpdownDownMove
(
int
trayHeight
)
{
if
(
UpdownUseAxis
)
...
...
@@ -787,7 +796,7 @@ namespace OnlineStore.DeviceLibrary
if
(
UpdownUseAxis
)
{
int
position
=
Config
.
GetUpdownBoxPosition
(
trayHeight
);
ACAxisMove
(
Config
.
UpDown_Axis
,
position
,
Config
.
UpdownAxis_DownSpeed
);
ACAxisMove
(
Config
.
UpDown_Axis
,
position
,
Config
.
UpdownAxis_DownSpeed
);
}
else
{
...
...
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
3547a0c
...
...
@@ -87,12 +87,12 @@ namespace OnlineStore.DeviceLibrary
//一分钟还未检测到
if
(
span
.
TotalMilliseconds
>
LineManager
.
Config
.
IOSingle_TimerOut
)
{
ConfigIO
io
=
Config
.
getWaitIO
(
wait
.
IoType
);
ConfigIO
io
=
Config
.
getWaitIO
(
wait
.
IoType
);
WarnMsg
=
Name
+
"等待"
+
NotOkMsg
+
" 超时"
;
Alarm
(
LineAlarmType
.
IoSingleTimeOut
,
io
.
ElectricalDefinition
,
WarnMsg
,
MoveInfo
.
MoveType
);
LogUtil
.
error
(
MoveInfo
.
Name
+
WarnMsg
,
13
);
LogUtil
.
error
(
MoveInfo
.
Name
+
WarnMsg
,
13
);
}
else
if
(
rwSpan
.
TotalSeconds
>
3
&&
span
.
TotalSeconds
>
3
)
else
if
(
rwSpan
.
TotalSeconds
>
3
&&
span
.
TotalSeconds
>
3
)
{
preRWTime
=
DateTime
.
Now
;
string
msg
=
moveInfo
.
Name
+
" "
+
NotOkMsg
+
"已等待 "
+
Math
.
Abs
(
span
.
TotalSeconds
)
+
"秒,重写DO:"
;
...
...
@@ -120,7 +120,7 @@ namespace OnlineStore.DeviceLibrary
{
wait
.
IsEnd
=
(
span
.
TotalMilliseconds
>=
wait
.
TimeMSeconds
);
}
else
if
(
wait
.
WaitType
.
Equals
(
8
))
else
if
(
wait
.
WaitType
.
Equals
(
8
))
{
string
posId
=
moveInfo
.
MoveParam
.
PosId
;
int
id
=
moveInfo
.
MoveParam
.
GetStoreId
();
...
...
@@ -130,9 +130,10 @@ namespace OnlineStore.DeviceLibrary
{
int
storeId
=
moveInfo
.
MoveParam
.
GetStoreId
();
wait
.
IsEnd
=
LineServer
.
BoxCanReviceTray
(
storeId
);
}
else
if
(
wait
.
WaitType
.
Equals
(
10
))
}
else
if
(
wait
.
WaitType
.
Equals
(
10
))
{
//
wait.IsEnd = LineManager.Line.SideWay34HasTray().Equals(false);
wait
.
IsEnd
=
LineManager
.
Line
.
SideWay34HasTray
().
Equals
(
false
);
}
if
(
wait
.
IsEnd
&&
moveInfo
.
OneWaitCanEndStep
)
{
...
...
@@ -153,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
{
WarnMsg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"]等待["
+
NotOkMsg
+
"]超时["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
18
);
LogUtil
.
error
(
WarnMsg
,
18
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
,
""
,
WarnMsg
,
moveInfo
.
MoveType
);
}
...
...
@@ -182,7 +183,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NewMove
(
LineMoveType
.
OutStore
);
MoveInfo
.
MoveParam
=
param
;
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_50_StartOutProcess
);
TrayManager
.
AddNeedEmptyTrayNum
();
TrayManager
.
AddNeedEmptyTrayNum
();
return
true
;
}
else
...
...
@@ -212,10 +213,10 @@ namespace OnlineStore.DeviceLibrary
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_50_StartOutProcess
))
{
OutStoreLog
(
"出库: MO_51_BeforeAfterCylinderBefore ( 前后气缸前进 )"
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_51_BeforeAfterCylinderBefore
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_51_BeforeAfterCylinderBefore
);
CylinderMove
(
MoveInfo
,
IO_Type
.
BeforeAfterCylinder_After
,
IO_Type
.
BeforeAfterCylinder_Before
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_51_BeforeAfterCylinderBefore
))
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_51_BeforeAfterCylinderBefore
))
{
OutStoreLog
(
"出库: MO_52_UpDownCylinderDown ( 上下气缸1下降 )"
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_52_UpDownCylinderDown
);
...
...
@@ -309,7 +310,7 @@ namespace OnlineStore.DeviceLibrary
OutStoreLog
(
"出库:(MO_08_UpDownCylinderUp 上下气缸1上升)"
);
this
.
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_60_UpDownCylinderUp
);
UpdownUpMove
();
UpdownUpMove
();
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_60_UpDownCylinderUp
))
{
...
...
@@ -320,9 +321,9 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_06_TopCylinder_Down
);
CylinderMove
(
SecondMoveInfo
,
IO_Type
.
TopCylinder_UP
,
IO_Type
.
TopCylinder_Down
);
LogInfo
(
"【"
+
posId
+
"】出库处理结束,!"
);
LogInfo
(
"【"
+
posId
+
"】出库处理结束,!"
);
lineStatus
=
LineStatus
.
StoreOnline
;
runStatus
=
LineRunStatus
.
Runing
;
runStatus
=
LineRunStatus
.
Runing
;
MoveInfo
.
EndMove
();
}
...
...
@@ -395,14 +396,14 @@ namespace OnlineStore.DeviceLibrary
{
InStoreLog
(
"入库:(MI_09_UpDownCylinderUp,上下气缸1上升)"
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_09_UpDownCylinderUp
);
UpdownUpMove
();
UpdownUpMove
();
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MI_09_UpDownCylinderUp
))
{
int
num
=
MoveInfo
.
MoveParam
.
TrayNumber
;
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_10_WaitBox
);
LogInfo
(
"入库【"
+
posId
+
"】处理(等待移栽):(判断box门口没有盘, 且可以入库),更新盘号【"
+
num
+
"】为空盘"
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitBoxCanReviceTray
());
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitBoxCanReviceTray
());
TrayManager
.
UpdateFixtureValue
(
num
,
false
,
0
);
//阻挡气缸移动
...
...
@@ -445,7 +446,7 @@ namespace OnlineStore.DeviceLibrary
LineServer
.
StartInStore
(
DeviceID
,
MoveInfo
.
MoveParam
);
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MI_14_BeforeAfterCylinderAfter
))
{
{
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
MI_15_SendEnd
);
//判断料仓是否在入库中,如果么有在入库中,需要重新发送入库消息
if
(!
LineServer
.
IsInStorePro
(
DeviceID
))
...
...
@@ -456,7 +457,7 @@ namespace OnlineStore.DeviceLibrary
else
{
InStoreLog
(
"入库:(MI_15_SendEnd , 送料流程完成,料仓已开始入库)"
);
}
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MI_15_SendEnd
))
{
...
...
@@ -493,7 +494,7 @@ namespace OnlineStore.DeviceLibrary
/// <param name="currMoveTrayNum"></param>
/// <returns></returns>
private
bool
CheckIsNeedOutStore
()
{
{
bool
isFull
=
TrayManager
.
IsFixTureFull
(
currMoveTrayNum
);
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
OutStore
)
&&
(
MoveInfo
.
MoveStep
>=
LineMoveStep
.
MO_56_BeforeAfterCylinderAfter
)
&&
(!
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_60_UpDownCylinderUp
)))
...
...
@@ -517,7 +518,7 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
/// <returns></returns>
private
bool
CheckIsNeedInStore
()
{
{
bool
isfull
=
TrayManager
.
IsFixTureFull
(
currMoveTrayNum
);
LogInfo
(
"***************入库*****验证入库编号,托盘号【"
+
currMoveTrayNum
+
"】,isfull【"
+
isfull
+
"】"
);
//FixtureCodeInfo code = GetBox().currInOutFixture;
...
...
@@ -540,7 +541,7 @@ namespace OnlineStore.DeviceLibrary
{
reIndex
=
i
;
currCode
=
cc
;
LogInfo
(
"*******
********入库*****需要入库,托盘号【"
+
currMoveTrayNum
+
"】,是排队列表中的入库信息【"
+
currCode
.
ToStr
()
+
"】 ,
入库移栽"
);
LogInfo
(
"*******
托盘"
+
currMoveTrayNum
+
"需要入库【"
+
currCode
.
ToStr
()
+
"】 ,开始
入库移栽"
);
SecondMoveInfo
.
MoveParam
=
new
InOutParam
(
cc
.
TrayNumber
,
cc
.
WareCode
,
cc
.
PosId
,
cc
.
PlateH
,
cc
.
PlateW
);
break
;
}
...
...
@@ -550,8 +551,8 @@ namespace OnlineStore.DeviceLibrary
waitInStoreList
.
RemoveAt
(
reIndex
);
if
(!
LineServer
.
BoxCanInStore
(
DeviceID
))
{
LogUtil
.
info
(
Name
+
"*******
********需要入库 【"
+
currCode
.
ToStr
()
+
"】 ,料仓未上线或出库中,入库失败
"
);
return
fals
e
;
LogUtil
.
info
(
Name
+
"*******
托盘"
+
currMoveTrayNum
+
"需要入库【"
+
currCode
.
ToStr
()
+
"】,BoxCanInStore验证失败,先移栽再等待料仓可入库,开始入库移栽
"
);
return
tru
e
;
}
else
{
...
...
@@ -567,33 +568,35 @@ namespace OnlineStore.DeviceLibrary
#
region
托盘检测
private
void
StartCheckFixture
()
{
{
int
num
=
TrayManager
.
GetNum
(
DeviceID
);
if
(
IOValue
(
IO_Type
.
Fixture_Check_4
).
Equals
(
IO_VALUE
.
HIGH
))
{
//托盘在两个阻挡内
if
(
num
>
0
)
{
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
{
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
CheckLog
(
"托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_03_StopCylinder2Down
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
SecondMoveInfo
.
EndStepWait
();
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
));
// SecondMoveInfo.EndStepWait();
}
else
{
LogUtil
.
error
(
Name
+
"检测到check4亮,但是为获取到托盘号,StartCheckFixture失败~"
);
}
}
}
else
if
(
IOValue
(
IO_Type
.
TrayCheck
).
Equals
(
IO_VALUE
.
HIGH
))
{
{
//托盘在第一个阻挡处
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_01_StopCylinder1Down
);
CheckLog
(
" 托盘检测:料盘检测 SecondStoreMove(MIO_01_StopCylinder1Down阻挡气缸1-1下降
,等待夹具检测4=1
,最多等待1秒)"
);
CheckLog
(
" 托盘检测:料盘检测 SecondStoreMove(MIO_01_StopCylinder1Down阻挡气缸1-1下降 ,最多等待1秒)"
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Fixture_Check_4
,
IO_VALUE
.
HIGH
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
HIGH
));
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitIO(IO_Type.Fixture_Check_4, IO_VALUE.HIGH));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1500
));
}
}
private
void
CheckFixtureProcess
()
...
...
@@ -617,6 +620,7 @@ namespace OnlineStore.DeviceLibrary
CheckLog
(
"托盘检测(流水线阻挡)SecondStoreMove:(MIO_02_FixtureCheck 阻挡气缸1-1上升,等待夹具检测4=1)"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_03_StopCylinder2Down
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Fixture_Check_4
,
IO_VALUE
.
HIGH
));
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MIO_02_FixtureCheck
))
...
...
@@ -624,7 +628,8 @@ namespace OnlineStore.DeviceLibrary
CheckLog
(
"托盘检测(流水线阻挡)SecondStoreMove:(MIO_03_StopCylinder2Down 阻挡气缸1-1上升)"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_03_StopCylinder2Down
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
SecondMoveInfo
.
EndStepWait
();
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
));
// SecondMoveInfo.EndStepWait();
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MIO_03_StopCylinder2Down
))
{
...
...
@@ -681,12 +686,12 @@ namespace OnlineStore.DeviceLibrary
}
CheckLog
(
"托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_07_WaitCanGo
);
//
if (DeviceID.Equals(2))
//
{
//
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
//
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay());
//
SecondMoveInfo.OneWaitCanEndStep = true;
//
}
if
(
DeviceID
.
Equals
(
2
))
{
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitSideWay
());
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
}
}
}
catch
(
Exception
ex
)
...
...
@@ -761,12 +766,12 @@ namespace OnlineStore.DeviceLibrary
{
CheckLog
(
"托盘放行 SecondStoreMove:(MO_07_WaitCanGo ,移栽2,需要判断是否可以放盘通过,最多等待10000)"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_07_WaitCanGo
);
//
if (DeviceID.Equals(2))
//
{
//
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(10000));
//
SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitSideWay());
//
SecondMoveInfo.OneWaitCanEndStep = true;
//
}
if
(
DeviceID
.
Equals
(
2
))
{
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
10000
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitSideWay
());
SecondMoveInfo
.
OneWaitCanEndStep
=
true
;
}
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_07_WaitCanGo
))
...
...
@@ -774,7 +779,8 @@ namespace OnlineStore.DeviceLibrary
CheckLog
(
"托盘放行 SecondStoreMove:(MO_10_StopCylinder2_Down ,阻挡气缸1-2下降)"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_10_StopCylinder2_Down
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
);
SecondMoveInfo
.
EndStepWait
();
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
HIGH
));
// SecondMoveInfo.EndStepWait();
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_10_StopCylinder2_Down
))
{
...
...
@@ -787,6 +793,7 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_12_StopCylinder_Back
);
CheckLog
(
"托盘放行 SecondStoreMove:(MO_12_StopCylinder_Back , 阻挡气缸1-2上升 )"
);
IOMove
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
LOW
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down2
,
IO_VALUE
.
LOW
));
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
200
));
}
else
if
(
SecondMoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MO_12_StopCylinder_Back
))
...
...
@@ -845,7 +852,7 @@ namespace OnlineStore.DeviceLibrary
public
void
LogInfo
(
string
logInfo
)
{
LogUtil
.
info
(
Name
+
logInfo
);
LogUtil
.
info
(
Name
+
logInfo
);
}
}
}
source/DeviceLibrary/deviceLibrary/halcon/CodeManager.cs
查看文件 @
3547a0c
...
...
@@ -88,17 +88,13 @@ namespace OnlineStore.DeviceLibrary
{
if
(
balserNameList
.
Contains
(
cameraName
))
{
bool
result
=
BaslerCamera
.
Instance
.
IsOpen
;
if
(!
result
)
{
result
=
BaslerCamera
.
Instance
.
Open
(
cameraName
);
LogUtil
.
info
(
"打开相机:"
+
cameraName
+
"("
+
result
+
")"
);
}
bool
result
=
BaslerCamera
.
Instance
.
Open
(
cameraName
);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
if
(
result
)
{
BaslerCamera
.
Instance
.
GrabOne
();
bitm
=
BaslerCamera
.
Instance
.
Image
;
//
BaslerCamera.Instance.Close();
BaslerCamera
.
Instance
.
Close
();
}
else
{
...
...
@@ -107,17 +103,13 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
hikNameList
.
Contains
(
cameraName
))
{
bool
result
=
HIKCamera
.
Instance
.
IsOpen
;
if
(!
result
)
{
result
=
HIKCamera
.
Instance
.
Open
(
cameraName
);
LogUtil
.
info
(
"打开相机:"
+
cameraName
+
"("
+
result
+
")"
);
}
bool
result
=
HIKCamera
.
Instance
.
Open
(
cameraName
);
// LogUtil.info("打开相机:" + cameraName + "(" + result + ")");
if
(
result
)
{
HIKCamera
.
Instance
.
GrabOne
();
bitm
=
HIKCamera
.
Instance
.
Image
;
//
HIKCamera.Instance.Close();
HIKCamera
.
Instance
.
Close
();
}
else
{
...
...
source/DeviceLibrary/server/LineServer.cs
查看文件 @
3547a0c
...
...
@@ -38,7 +38,8 @@ namespace OnlineStore.DeviceLibrary
{
return
true
;
}
}
return
false
;
}
return
false
;
}
/// <summary>
/// 移栽装置拦截托盘时, 判断是否可以入库,入库执行可以入库,出库过程中不能入库
...
...
@@ -54,7 +55,7 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
))
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
{
return
true
;
...
...
@@ -74,18 +75,39 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 判断库位是否验证成功
/// </summary>
public
static
bool
RightInPosId
(
int
id
,
string
posId
)
public
static
bool
RightInPosId
(
int
id
,
string
posId
)
{
BoxInfo
box
=
GetBoxInfo
(
id
);
if
(
box
!=
null
)
{
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
)
if
(
span
.
TotalSeconds
<
ClientKeepSecond
)
{
if
(
box
.
WaitInStoreList
!=
null
&&
box
.
WaitInStoreList
.
Contains
(
posId
))
{
return
true
;
}
}
}
}
return
false
;
}
public
static
bool
IsInStorePro
(
int
id
)
{
BoxInfo
box
=
GetBoxInfo
(
id
);
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
box
!=
null
&&
span
.
TotalSeconds
<
ClientKeepSecond
)
{
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
{
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
))
{
return
true
;
}
}
}
return
false
;
...
...
@@ -101,34 +123,13 @@ namespace OnlineStore.DeviceLibrary
if
(
box
!=
null
)
{
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
)
)
if
(
span
.
TotalSeconds
<
ClientKeepSecond
&&
box
.
HasTray
.
Equals
(
0
)
&&
box
.
SAlarmType
.
Equals
(
LineAlarmType
.
None
)
)
{
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Runing
))
{
return
true
;
}
}
}
return
false
;
}
public
static
bool
IsInStorePro
(
int
id
)
{
BoxInfo
box
=
GetBoxInfo
(
id
);
TimeSpan
span
=
DateTime
.
Now
-
box
.
LastMsgTime
;
if
(
box
!=
null
&&
span
.
TotalSeconds
<
ClientKeepSecond
)
{
LineStatus
status
=
(
LineStatus
)
box
.
SStatus
;
LineRunStatus
runs
=
(
LineRunStatus
)
box
.
SRunStatus
;
if
(
runs
.
Equals
(
LineRunStatus
.
Busy
))
{
if
(
status
.
Equals
(
LineStatus
.
InStoreEnd
)
||
status
.
Equals
(
LineStatus
.
InStoreExecute
))
{
return
true
;
}
}
}
...
...
@@ -147,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
<
ClientKeepSecond
)
{
if
(
LineManager
.
Line
.
CanIntore
(
box
.
ID
))
{
{
result
+=
box
.
CId
+
","
;
}
}
...
...
@@ -176,7 +177,7 @@ namespace OnlineStore.DeviceLibrary
}
}
public
static
void
StopServer
()
{
try
...
...
@@ -192,15 +193,15 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
LOGGER
,
"关闭 监听出错:"
+
ex
.
ToString
());
}
}
public
static
bool
UpdateBoxDebug
(
int
id
,
int
isDebug
)
public
static
bool
UpdateBoxDebug
(
int
id
,
int
isDebug
)
{
if
(
ClientMap
.
ContainsKey
(
id
))
{
Dictionary
<
string
,
object
>
paramList
=
new
Dictionary
<
string
,
object
>();
Dictionary
<
string
,
object
>
paramList
=
new
Dictionary
<
string
,
object
>();
paramList
.
Add
(
S_Cmd
,
cmd_updateDebug
);
int
canOutStore
=
LineManager
.
Line
.
CanOutStore
(
id
)
?
1
:
0
;
paramList
.
Add
(
S_CanOutStore
,
canOutStore
);
paramList
.
Add
(
S_IsDebug
,
isDebug
);
paramList
.
Add
(
S_IsDebug
,
isDebug
);
string
msg
=
ToParamStr
(
paramList
);
Client
client
=
ClientMap
[
id
];
bool
result
=
SendStrToClient
(
client
,
msg
);
...
...
@@ -228,7 +229,7 @@ namespace OnlineStore.DeviceLibrary
bool
result
=
SendStrToClient
(
client
,
msg
);
if
(!
result
)
{
LogUtil
.
error
(
"StartInStore【"
+
id
+
"】【"
+
msg
+
"】失败"
);
LogUtil
.
error
(
"StartInStore【"
+
id
+
"】【"
+
msg
+
"】失败"
);
}
}
return
false
;
...
...
@@ -236,7 +237,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 获取整个料仓的状态
/// </summary>
public
static
Operation
GetInStoreOperation
(
string
message
)
public
static
Operation
GetInStoreOperation
(
string
message
)
{
//构建发送给服务器的对象
Operation
lineOperation
=
new
Operation
();
...
...
@@ -273,21 +274,22 @@ namespace OnlineStore.DeviceLibrary
}
else
{
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
// LogUtil.info("CheckInStorePos【" + id + "】【" + msg + "】发送成功");
}
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"CheckInStorePos【"
+
id
+
"】【"
+
param
.
ToStr
()
+
"】失败"
);
}
return
false
;
}
private
static
bool
SendStrToClient
(
Client
client
,
string
sendMsg
)
private
static
bool
SendStrToClient
(
Client
client
,
string
sendMsg
)
{
if
(
client
!=
null
&&
client
.
ClientSocket
.
Connected
)
{
...
...
@@ -296,7 +298,7 @@ namespace OnlineStore.DeviceLibrary
client
.
ClientSocket
.
Send
(
sendBuffer
);
return
true
;
}
return
false
;
}
private
static
string
ToParamStr
(
Dictionary
<
string
,
object
>
paramList
)
...
...
@@ -306,7 +308,7 @@ namespace OnlineStore.DeviceLibrary
return
result
+
"\r"
;
}
private
static
object
MapLock
=
""
;
private
static
void
SaveBoxClient
(
int
id
,
BoxInfo
box
,
Client
client
)
private
static
void
SaveBoxClient
(
int
id
,
BoxInfo
box
,
Client
client
)
{
lock
(
MapLock
)
{
...
...
@@ -324,19 +326,19 @@ namespace OnlineStore.DeviceLibrary
}
}
private
static
void
tcp_ReviceMsgEvent
(
Client
client
,
string
msg
)
{
{
try
{
if
(
String
.
IsNullOrEmpty
(
msg
))
{
return
;
}
ProcessMsg
(
client
,
msg
);
ProcessMsg
(
client
,
msg
);
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"处理料仓消息【"
+
msg
+
"】出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
"处理料仓消息【"
+
msg
+
"】出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -349,14 +351,14 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
debug
(
"收到【"
+
add
+
"】的消息【"
+
msg
+
"】"
);
StoreSendBean
storeSMsg
=
JsonHelper
.
DeserializeJsonToObject
<
StoreSendBean
>(
msg
);
if
(
storeSMsg
==
null
)
if
(
storeSMsg
==
null
)
{
LogUtil
.
error
(
"收到【"
+
add
+
"】的消息【"
+
msg
+
"】,解析失败"
);
}
else
{
int
id
=
storeSMsg
.
StoreId
;
BoxInfo
box
=
new
BoxInfo
(
storeSMsg
.
StoreId
,
storeSMsg
.
Cid
,
storeSMsg
.
Seq
,
storeSMsg
.
SStatus
,
storeSMsg
.
SRunStatus
,
storeSMsg
.
DoorHasTray
,
storeSMsg
.
AlarmType
,
storeSMsg
.
WaitInStoreList
);
BoxInfo
box
=
new
BoxInfo
(
storeSMsg
.
StoreId
,
storeSMsg
.
Cid
,
storeSMsg
.
Seq
,
storeSMsg
.
SStatus
,
storeSMsg
.
SRunStatus
,
storeSMsg
.
DoorHasTray
,
storeSMsg
.
AlarmType
,
storeSMsg
.
WaitInStoreList
);
SaveBoxClient
(
id
,
box
,
client
);
string
cmd
=
storeSMsg
.
Cmd
;
...
...
@@ -385,16 +387,16 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"SendHeartBack【"
+
id
+
"】【"
+
msg
+
"】失败"
);
}
return
true
;
}
return
false
;
}
private
static
char
cmd_spilt
=
';'
;
private
static
char
cmd_spilt
=
';'
;
private
static
string
cmd_heart
=
"heart"
;
private
static
string
cmd_outend
=
"outend"
;
private
static
string
cmd_startIn
=
"starIn"
;
private
static
string
cmd_updateDebug
=
"updateDebug"
;
private
static
string
cmd_updateDebug
=
"updateDebug"
;
public
static
string
cmd_checStartIn
=
"cmd_checStartIn"
;
...
...
@@ -444,4 +446,4 @@ namespace OnlineStore.DeviceLibrary
public
List
<
string
>
WaitInStoreList
=
new
List
<
string
>();
}
}
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论