Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 36387ea6
由
LN
编写于
2020-03-06 09:28:17 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
rfid加重连。阻挡下降优化。
1 个父辈
789d6116
显示空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
80 行增加
和
31 行删除
source/DeviceLibrary/assemblyLine/MoveEquip.cs
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
source/DeviceLibrary/assemblyLine/ProvidingEquip.cs
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
source/DeviceLibrary/assemblymanager/TrayManager.cs
source/DeviceLibrary/deviceLibrary/RFID/RFIDReader.cs
source/DeviceLibrary/assemblyLine/MoveEquip.cs
查看文件 @
36387ea
...
...
@@ -169,6 +169,8 @@ namespace OnlineStore.DeviceLibrary
/// </summary>
internal
override
void
StopMove
()
{
trayCheck2LowWait
.
Stop
();
trayCheckWait
.
Stop
();
//如果正在出库中,需要减去托盘号
if
(
MoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
OutStore
))
{
...
...
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
36387ea
...
...
@@ -2,6 +2,7 @@
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
...
...
@@ -463,6 +464,8 @@ namespace OnlineStore.DeviceLibrary
#
endregion
#
region
托盘检测
private
Stopwatch
trayCheckWait
=
new
Stopwatch
();
private
Stopwatch
trayCheck2LowWait
=
new
Stopwatch
();
private
object
lockObj
=
""
;
private
void
StartCheckFixture
()
{
...
...
@@ -472,19 +475,30 @@ namespace OnlineStore.DeviceLibrary
{
if
(
SecondMoveInfo
.
MoveType
.
Equals
(
LineMoveType
.
None
).
Equals
(
false
))
{
LogUtil
.
error
(
Name
+
" StartCheckFixture "
+
" 不在空闲中,直接返回 "
);
LogUtil
.
error
(
Name
+
" StartCheckFixture "
+
" 不在空闲中,直接返回 "
);
return
;
}
if
(
IOValue
(
IO_Type
.
StopCylinder_Check2
).
Equals
(
IO_VALUE
.
HIGH
))
{
trayCheck2LowWait
.
Stop
();
if
(
TrayManager
.
checkWatch
(
trayCheckWait
,
TrayManager
.
SwTrayWaitTime
,
true
))
{
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_03_Stop2Down
);
CheckLog
(
"托盘阻挡"
+
SecondMoveInfo
.
SLog
+
" 阻挡气缸1-1上升)"
);
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
));
}
else
if
(
IOValue
(
IO_Type
.
StopCylinder_Check1
).
Equals
(
IO_VALUE
.
HIGH
))
}
else
{
bool
check2IsOk
=
TrayManager
.
checkWatch
(
trayCheck2LowWait
,
TrayManager
.
SwTrayWaitTime
,
false
);
if
(
IOValue
(
IO_Type
.
StopCylinder_Check1
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
TrayManager
.
checkWatch
(
trayCheckWait
,
TrayManager
.
SwTrayWaitTime
,
false
)
&&
check2IsOk
)
{
trayCheckWait
.
Stop
();
trayCheck2LowWait
.
Stop
();
//托盘在第一个阻挡处
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
...
...
@@ -496,6 +510,12 @@ namespace OnlineStore.DeviceLibrary
// SecondMoveInfo.WaitList.Add(WaitResultInfo.WaitTime(TrayManager.StopDownWaitTime));
}
}
else
{
trayCheckWait
.
Stop
();
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
" StartCheckFixture "
+
" 出错:"
+
ex
.
ToString
());
...
...
source/DeviceLibrary/assemblyLine/ProvidingEquip.cs
查看文件 @
36387ea
...
...
@@ -154,6 +154,7 @@ namespace OnlineStore.DeviceLibrary
internal
override
void
StopMove
()
{
trayCheck2LowWait
.
Stop
();
trayCheckWait
.
Stop
();
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
...
...
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
查看文件 @
36387ea
...
...
@@ -33,7 +33,7 @@ namespace OnlineStore.DeviceLibrary
}
internal
DateTime
lastStopDown
=
DateTime
.
Now
;
private
Stopwatch
trayCheckWait
=
new
Stopwatch
();
private
Stopwatch
trayCheck2LowWait
=
new
Stopwatch
();
private
object
lockObj
=
""
;
private
void
StartCheckFixture
()
{
...
...
@@ -50,7 +50,8 @@ namespace OnlineStore.DeviceLibrary
//int num = TrayManager.GetTrayNum(DeviceID);
if
(
IOValue
(
IO_Type
.
StopCylinder_Check2
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
TrayManager
.
checkWatch
(
trayCheckWait
,
TrayManager
.
SwTrayWaitTime
,
true
)
&&
canProcess
)
trayCheck2LowWait
.
Stop
();
if
(
TrayManager
.
checkWatch
(
trayCheckWait
,
TrayManager
.
SwTrayWaitTime
,
false
)
&&
canProcess
)
{
trayCheckWait
.
Stop
();
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
...
...
@@ -59,14 +60,17 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
);
SecondMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
StopCylinder_Down1
,
IO_VALUE
.
LOW
));
}
}
else
if
(
IOValue
(
IO_Type
.
StopCylinder_Check1
).
Equals
(
IO_VALUE
.
HIGH
)
&&
(
DateTime
.
Now
-
lastStopDown
).
TotalSeconds
>
3
)
else
{
if
(
TrayManager
.
checkWatch
(
trayCheckWait
,
TrayManager
.
SwTrayWaitTime
,
true
)
&&
canProcess
)
bool
check2Ok
=
TrayManager
.
checkWatch
(
trayCheck2LowWait
,
TrayManager
.
SwTrayWaitTime
,
false
);
if
(
IOValue
(
IO_Type
.
StopCylinder_Check1
).
Equals
(
IO_VALUE
.
HIGH
)
&&
(
DateTime
.
Now
-
lastStopDown
).
TotalSeconds
>
3
)
{
if
(
TrayManager
.
checkWatch
(
trayCheckWait
,
TrayManager
.
SwTrayWaitTime
,
false
)
&&
check2Ok
&&
canProcess
)
{
lastStopDown
=
DateTime
.
Now
;
trayCheckWait
.
Stop
();
trayCheck2LowWait
.
Stop
();
lastStopDown
=
DateTime
.
Now
;
//托盘在第一个阻挡处
SecondMoveInfo
.
NewMove
(
LineMoveType
.
CheckFixture
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_00_Stop1Down
);
...
...
@@ -84,6 +88,7 @@ namespace OnlineStore.DeviceLibrary
trayCheckWait
.
Stop
();
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
" StartCheckFixture "
+
" 出错:"
+
ex
.
ToString
());
...
...
source/DeviceLibrary/assemblymanager/TrayManager.cs
查看文件 @
36387ea
...
...
@@ -216,7 +216,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
watch
.
ElapsedMilliseconds
>=
targetMs
)
{
if
(
isStop
)
{
watch
.
Stop
();
}
return
true
;
}
return
false
;
...
...
source/DeviceLibrary/deviceLibrary/RFID/RFIDReader.cs
查看文件 @
36387ea
...
...
@@ -13,7 +13,7 @@ namespace Asa.RFID
{
public
static
readonly
ILog
LOGGER
=
LogManager
.
GetLogger
(
"TheRFID"
);
private
System
.
Threading
.
Thread
tScan
;
//
private System.Threading.Thread tScan;
private
bool
loop
;
private
string
IP
=
""
;
private
byte
addr
;
...
...
@@ -49,7 +49,7 @@ namespace Asa.RFID
IsConnect
=
false
;
try
{
tScan
.
Abort
();
//
tScan.Abort();
}
catch
(
Exception
ex
)
{
LOGGER
.
Info
(
"Close tScan["
+
IP
+
"] error :"
+
ex
.
ToString
());
...
...
@@ -104,8 +104,9 @@ namespace Asa.RFID
public
void
FindMode
()
{
loop
=
true
;
tScan
=
new
System
.
Threading
.
Thread
(
new
System
.
Threading
.
ThreadStart
(
Scan
));
tScan
.
Start
();
//tScan = new System.Threading.Thread(new System.Threading.ThreadStart(Scan));
//tScan.Start();
Task
.
Factory
.
StartNew
(
Scan
);
}
private
void
Scan
()
...
...
@@ -115,12 +116,24 @@ namespace Asa.RFID
bool
rtn
=
FindRFID
();
if
(
rtn
)
{
ReadRFID
();
int
result
=
ReadRFID
();
if
(
result
.
Equals
(
0
))
{
byte
[]
bb
=
new
byte
[]
{
_buff
[
0
],
_buff
[
1
],
_buff
[
2
]
};
string
dataStr
=
byteToStr
(
bb
,
bb
.
Length
);
LOGGER
.
Info
(
IP
+
" Scan Data:"
+
dataStr
);
Received
?.
Invoke
(
IP
,
bb
);
}
else
if
(
result
.
Equals
(
14
))
{
LOGGER
.
Error
(
IP
+
" ReadRFID 返回 "
+
result
+
", 需要重连,调用close ,等待100后重连"
);
Close
();
System
.
Threading
.
Thread
.
Sleep
(
100
);
Open
();
FindMode
();
break
;
}
}
System
.
Threading
.
Thread
.
Sleep
(
100
);
}
}
...
...
@@ -183,24 +196,24 @@ namespace Asa.RFID
return
false
;
}
public
byte
[]
Read
(
bool
isNeedFind
=
false
)
{
if
(
isNeedFind
)
{
FindRFID
();
}
if
(
IsExist
)
{
ReadRFID
();
return
_buff
;
}
else
{
LOGGER
.
Info
(
IP
+
" Read: IsExist=false "
);
}
return
null
;
}
private
void
ReadRFID
()
//
public byte[] Read(bool isNeedFind = false)
//
{
//
if (isNeedFind)
//
{
//
FindRFID();
//
}
//
if (IsExist)
//
{
//
ReadRFID();
//
return _buff;
//
}
//
else
//
{
//
LOGGER.Info(IP + " Read: IsExist=false ");
//
}
//
return null;
//
}
private
int
ReadRFID
()
{
try
{
...
...
@@ -232,17 +245,22 @@ namespace Asa.RFID
Array
.
Copy
(
data
,
0
,
_buff
,
0
,
data
.
Length
);
string
dataStr
=
byteToStr
(
data
,
data
.
Length
);
LOGGER
.
Info
(
IP
+
" ReadMultipleBlock: Length: "
+
data
.
Length
+
" Data:"
+
dataStr
);
}
else
if
(
ErrCode
==
14
)
{
LOGGER
.
Error
(
IP
+
" ReadMultipleBlock: ErrCode: "
+
ErrCode
+
",需要重连"
);
}
else
{
LOGGER
.
Info
(
IP
+
" ReadMultipleBlock: ErrCode: "
+
ErrCode
);
}
return
ErrCode
;
}
catch
(
Exception
ex
)
{
LOGGER
.
Error
(
IP
+
"ReadRFID Error:"
+
ex
.
ToString
());
}
return
-
1
;
}
private
string
byteToStr
(
byte
[]
data
,
int
len
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论