Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO1007_XLC_Store
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 43513024
由
刘韬
编写于
2021-12-29 17:17:19 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
821c9a8e
隐藏空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
100 行增加
和
38 行删除
Common/util/LogUtil.cs
DeviceLibrary/DeviceLibrary/Camera.cs
DeviceLibrary/DeviceLibrary/IOMonitor.cs
DeviceLibrary/DeviceLibrary/OKLEController.cs
DeviceLibrary/theMachine/BoxTransport.cs
DeviceLibrary/theMachine/JobList.cs
DeviceLibrary/theMachine/MainMachine _BtnProcess.cs
DeviceLibrary/theMachine/MainMachine _Common.cs
DeviceLibrary/theMachine/MainMachine _IN.cs
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
DeviceLibrary/theMachine/MainMachine _Out.cs
DeviceLibrary/theMachine/MainMachine.cs
DeviceLibrary/theMachine/RobotManage.cs
TheMachine/Form1.cs
Common/util/LogUtil.cs
查看文件 @
4351302
...
...
@@ -137,6 +137,7 @@ namespace OnlineStore.Common
lastlog
=
msg
;
}
}
[
System
.
Runtime
.
InteropServices
.
DllImport
(
"kernel32.dll"
,
CharSet
=
System
.
Runtime
.
InteropServices
.
CharSet
.
Auto
)]
public
static
extern
void
OutputDebugString
(
string
message
);
}
}
DeviceLibrary/DeviceLibrary/Camera.cs
查看文件 @
4351302
...
...
@@ -82,6 +82,7 @@ public class HIKCamera
}
void
startCamera
()
{
int
errorsleeptime
=
5000
;
camerathreadrun
=
true
;
while
(
camerathreadrun
)
{
...
...
@@ -91,18 +92,22 @@ public class HIKCamera
if
(
bmp
!=
null
)
{
errortimes
=
0
;
errorsleeptime
=
5000
;
camera_event
?.
Invoke
(
this
,
bmp
);
}
else
if
(
bmp
==
null
&&
errortimes
<
5
)
{
errortimes
++;
LogUtil
.
error
(
Name
+
$
"相机获取图像出错,{errortimes}"
);
Thread
.
Sleep
(
5000
);
Thread
.
Sleep
(
errorsleeptime
);
}
else
if
(
errortimes
==
5
)
{
camera
.
Open
();
errortimes
++;
camera
.
Close
(
DeviceName
);
Thread
.
Sleep
(
1000
);
camera
.
Open
(
DeviceName
);
errortimes
=
0
;
errorsleeptime
=
errorsleeptime
*
2
;
LogUtil
.
error
(
Name
+
$
"相机错误次数过多,重新打开,{errortimes}"
);
}
else
if
(
errortimes
==
6
)
...
...
@@ -117,7 +122,11 @@ public class HIKCamera
errortimes
++;
}
}
camera
.
Close
();
try
{
camera
.
Close
(
DeviceName
);
}
catch
{
}
camera
.
Dispose
();
}
public
void
CameraGrabOne
(
string
filename
)
...
...
DeviceLibrary/DeviceLibrary/IOMonitor.cs
查看文件 @
4351302
...
...
@@ -37,7 +37,7 @@ namespace DeviceLibrary
continue
;
}
//
LogUtil.OutputDebugString($"IOMonitor: {timediff.TotalMilliseconds},{iOMonitorStrut.Interval},last_iO_VALUE:{iOMonitorStrut.last_iO_VALUE},IOVALUE:{current_iovalue},Need:{iOMonitorStrut.iO_VALUE}");
LogUtil
.
OutputDebugString
(
$
"IOMonitor: {timediff.TotalMilliseconds},{iOMonitorStrut.Interval},last_iO_VALUE:{iOMonitorStrut.last_iO_VALUE},IOVALUE:{current_iovalue},Need:{iOMonitorStrut.iO_VALUE}"
);
if
(
timediff
.
TotalMilliseconds
>
iOMonitorStrut
.
Interval
&&
iOMonitorStrut
.
last_iO_VALUE
!=
current_iovalue
&&
current_iovalue
==
iOMonitorStrut
.
iO_VALUE
)
{
...
...
@@ -55,7 +55,8 @@ namespace DeviceLibrary
else
if
(
iOMonitorStrut
.
last_iO_VALUE
==
current_iovalue
)
{
iOMonitorStrut
.
deboundCount
=
0
;
}
}
else
iOMonitorStrut
.
last_iO_VALUE
=
current_iovalue
;
}
}
...
...
DeviceLibrary/DeviceLibrary/OKLEController.cs
查看文件 @
4351302
...
...
@@ -107,6 +107,7 @@ public class OKLEController
}
public
static
double
SetZero
(
string
port
)
{
return
0
;
double
weight
=
0d
;
AcSerialBean
sb
=
GetSerialBean
(
port
);
if
(
sb
==
null
)
...
...
DeviceLibrary/theMachine/BoxTransport.cs
查看文件 @
4351302
...
...
@@ -29,14 +29,17 @@ namespace DeviceLibrary
{
Config
=
_Config
;
mainMachine
=
_mainMachine
;
MoveInfo
=
new
MoveInfo
(
"行走机构"
);
MoveInfo
=
new
MoveInfo
(
"行走机构"
,
false
);
#
region
初始化伺服轴
XAxis
=
_mainMachine
.
XAxis
;
YAxis
=
_mainMachine
.
YAxis
;
ZAxis
=
_mainMachine
.
ZAxis
;
#
endregion
}
public
void
Reset
()
{
MoveInfo
.
NewMove
(
MoveStep
.
Wait
);
MoveInfo
.
log
(
"执行重置"
);
}
StoreMoveType
storeMoveType
=
StoreMoveType
.
None
;
string
WareCode
=
""
;
public
bool
Start
(
BoxStorePosition
from
,
BoxStorePosition
to
,
StoreMoveType
_storeMoveType
,
string
warecode
)
...
...
DeviceLibrary/theMachine/JobList.cs
查看文件 @
4351302
...
...
@@ -11,18 +11,30 @@ namespace DeviceLibrary
class
OutStoreJobList
{
static
ConcurrentQueue
<
JobInfo
>
jobInfos
=
new
ConcurrentQueue
<
JobInfo
>();
public
static
void
Enqueue
(
JobInfo
jobInfo
)
{
var
l
=
jobInfos
.
ToList
().
Find
((
x
)
=>
{
return
x
.
PosId
==
jobInfo
.
PosId
;
});
if
(
l
==
null
)
static
string
lastoutpos
=
""
;
public
static
void
Enqueue
(
JobInfo
jobInfo
)
{
lock
(
jobInfos
)
{
jobInfos
.
Enqueue
(
jobInfo
);
LogUtil
.
info
(
"出库任务加入队列:"
+
jobInfo
.
ToStr
());
}
else
LogUtil
.
info
(
"出库任务已存在队列中:"
+
jobInfo
.
ToStr
());
if
(
lastoutpos
==
jobInfo
.
PosId
)
return
;
var
l
=
jobInfos
.
ToList
().
Find
((
x
)
=>
{
return
x
.
PosId
==
jobInfo
.
PosId
;
});
if
(
l
==
null
)
{
jobInfos
.
Enqueue
(
jobInfo
);
LogUtil
.
info
(
"出库任务加入队列:"
+
jobInfo
.
ToStr
());
}
else
LogUtil
.
info
(
"出库任务已存在队列中:"
+
jobInfo
.
ToStr
());
}
}
public
static
bool
Dequeue
(
out
JobInfo
jobInfo
)
{
return
jobInfos
.
TryDequeue
(
out
jobInfo
);
if
(
jobInfos
.
TryDequeue
(
out
jobInfo
))
{
lastoutpos
=
jobInfo
.
PosId
;
return
true
;
}
return
false
;
}
public
static
int
Count
{
get
=>
jobInfos
.
Count
;
...
...
DeviceLibrary/theMachine/MainMachine _BtnProcess.cs
查看文件 @
4351302
...
...
@@ -15,13 +15,31 @@ namespace DeviceLibrary
{
void
BtnProcess
()
{
//
右
侧按钮按下,有料,出料
//
A
侧按钮按下,有料,出料
if
(
InMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
InStart_BTN
).
Equals
(
IO_VALUE
.
HIGH
))
{
}
//B侧按钮按下,有料,出料
if
(
IOValue
(
IO_Type
.
OutLeave_BTN
).
Equals
(
IO_VALUE
.
HIGH
))
{
}
}
void
OutLeave_BTN
()
{
if
(
IOValue
(
IO_Type
.
OutExitCar_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
LogUtil
.
info
(
"踩下出口脚踏开关,线体运行5秒,出口阻挡下降"
);
LineOut
.
LineRun
(
"btnout"
,
5
);
CylinderMove
(
null
,
IO_Type
.
OutExitStop_Down
,
IO_Type
.
OutExitStop_Up
,
IO_VALUE
.
LOW
);
Thread
.
Sleep
(
5000
);
CylinderMove
(
null
,
IO_Type
.
OutExitStop_Down
,
IO_Type
.
OutExitStop_Up
,
IO_VALUE
.
HIGH
);
}
else
{
LogUtil
.
info
(
"踩下出口脚踏开关,出口没有对接小车结束"
);
}
}
}
}
DeviceLibrary/theMachine/MainMachine _Common.cs
查看文件 @
4351302
...
...
@@ -80,7 +80,7 @@ namespace DeviceLibrary
else
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W002_IOValue
))
{
ConfigIO
io
=
RobotManage
.
Config
.
getWaitIO
(
wait
.
IoType
);
NotOkMsg
=
" 等待【"
+
io
.
DisplayStr
+
"】=【"
+
wait
.
IoValue
+
"】"
;
NotOkMsg
=
MoveInfo
.
Name
+
" 等待【"
+
io
.
DisplayStr
+
"】=【"
+
wait
.
IoValue
+
"】"
;
wait
.
IsEnd
=
IOManager
.
IOValue
(
wait
.
IoType
).
Equals
(
wait
.
IoValue
);
if
(!
wait
.
IsEnd
)
{
...
...
@@ -88,7 +88,7 @@ namespace DeviceLibrary
if
(
span
.
TotalMilliseconds
>
timeOutMs
&&
NoAlarm
())
{
WarnMsg
=
Name
+
"["
+
MoveInfo
.
MoveStep
+
"] 等待("
+
io
.
DisplayStr
+
"="
+
wait
.
IoValue
+
") 超时"
;
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveStep
+
"] 等待("
+
io
.
DisplayStr
+
"="
+
wait
.
IoValue
+
") 超时"
;
Msg
.
add
(
WarnMsg
,
MsgLevel
.
warning
);
if
(
NoAlarm
())
...
...
@@ -139,7 +139,7 @@ namespace DeviceLibrary
}
else
if
(
span
.
TotalSeconds
>
MoveInfo
.
TimeOutSeconds
)
{
WarnMsg
=
Name
+
"["
+
MoveInfo
.
MoveStep
+
"]等待"
+
NotOkMsg
+
"超时["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveStep
+
"]等待"
+
NotOkMsg
+
"超时["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
int
second
=
(
int
)(
MoveInfo
.
TimeOutSeconds
/
span
.
TotalSeconds
)
*
10
;
if
(
second
>
120
)
...
...
DeviceLibrary/theMachine/MainMachine _IN.cs
查看文件 @
4351302
...
...
@@ -166,7 +166,7 @@ namespace DeviceLibrary
}
break
;
case
MoveStep
.
In07
:
if
(
IOValue
(
IO_Type
.
InOverHead_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
IOValue
(
IO_Type
.
InOverHead_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
LineIn
.
LineStop
(
"work"
);
InMoveInfo
.
log
(
$
"X18检测到物料超高,停止滚筒"
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InOverHead
);
...
...
@@ -196,11 +196,14 @@ namespace DeviceLibrary
}
break
;
case
MoveStep
.
In09
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In
WaitBoxLeave
);
InMoveInfo
.
NextMoveStep
(
MoveStep
.
In
10
);
InSideLift
.
LiftUp
(
InMoveInfo
);
InMoveInfo
.
log
(
"顶升上升,等待周转箱到位"
);
InMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
InEndMaterialTop_Check
,
IO_VALUE
.
HIGH
));
break
;
case
MoveStep
.
In10
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
InWaitBoxLeave
);
break
;
case
MoveStep
.
InWaitBoxLeave
:
Msg
.
add
(
"周转箱等待入库"
,
MsgLevel
.
info
);
ServerCM
.
storeStatus
=
StoreStatus
.
InStoreExecute
;
...
...
@@ -215,16 +218,16 @@ namespace DeviceLibrary
Msg
.
add
(
"X18检测到物料超高,请取出周转箱"
,
MsgLevel
.
warning
);
if
(
IOMonitor
.
IODebound
(
IO_Type
.
InStopMaterial_Check
,
Config
,
IO_VALUE
.
LOW
))
{
CylinderMove
(
InMoveInfo
,
IO_Type
.
InStop_Down
,
IO_Type
.
InStop_Up
,
IO_VALUE
.
HIGH
);
InMoveInfo
.
Ne
xtMoveStep
(
MoveStep
.
Wait
);
InMoveInfo
.
Ne
wMove
(
MoveStep
.
Wait
);
}
break
;
case
MoveStep
.
InReset
:
InMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
InMoveInfo
.
log
(
"入库线体状态重置"
);
CylinderMove
(
InMoveInfo
,
IO_Type
.
InStop_Down
,
IO_Type
.
InStop_Up
,
IO_VALUE
.
HIGH
);
CylinderMove
(
InMoveInfo
,
IO_Type
.
InMaterialLocation_Bck
,
IO_Type
.
InMaterialLocation_Fwd
,
IO_VALUE
.
LOW
);
InSideLift
.
LiftDown
(
InMoveInfo
);
LineIn
.
LineStop
(
"work"
);
LineIn
.
LineStop
(
"work"
);
InMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
InMoveInfo
.
log
(
"入库线体状态重置"
);
break
;
default
:
InMoveInfo
.
log
(
$
"未找到对应步骤:{InMoveInfo.MoveStep}"
);
...
...
DeviceLibrary/theMachine/MainMachine _IOMonitor.cs
查看文件 @
4351302
...
...
@@ -56,7 +56,7 @@ namespace DeviceLibrary
if
(
IOValue
(
IO_Type
.
OutExit_SafetyGrating
).
Equals
(
IO_VALUE
.
LOW
))
{
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
&&
IOValue
(
IO_Type
.
InFron
tCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
&&
IOValue
(
IO_Type
.
OutExi
tCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
ok
=
false
;
LineOut
.
Pause
();
...
...
DeviceLibrary/theMachine/MainMachine _Out.cs
查看文件 @
4351302
...
...
@@ -58,13 +58,13 @@ namespace DeviceLibrary
OutMoveInfo
.
log
(
$
"顶升机构下降"
);
}
break
;
case
MoveStep
.
Out01
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out02
);
case
MoveStep
.
Out01
:
if
(
IOMonitor
.
IODebound
(
IO_Type
.
OutStopMaterial_Check
,
Config
,
IO_VALUE
.
LOW
,
2000
)
&&
IOMonitor
.
IODebound
(
IO_Type
.
OutExitMaterial_Check
,
Config
,
IO_VALUE
.
LOW
,
2000
))
{
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out02
);
LineOut
.
LineRun
(
"out"
,
999
);
CylinderMove
(
OutMoveInfo
,
IO_Type
.
OutStop_Down
,
IO_Type
.
OutStop_Up
,
IO_VALUE
.
LOW
);
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Out
Exit
Material_Check
,
IO_VALUE
.
HIGH
));
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Out
Stop
Material_Check
,
IO_VALUE
.
HIGH
));
OutMoveInfo
.
log
(
$
"线体转动"
);
}
else
...
...
@@ -74,18 +74,25 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Out02
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out03
);
LineOut
.
LineRun
(
"work"
,
6
);
OutMoveInfo
.
log
(
$
"料箱抵达出口"
);
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
LineOut
.
LineRun
(
"out"
,
6
);
OutMoveInfo
.
log
(
$
"料箱抵达出口等待阻挡信号X33消失"
);
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
OutStopMaterial_Check
,
IO_VALUE
.
LOW
));
break
;
case
MoveStep
.
Out03
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out04
);
LineOut
.
LineRun
(
"out"
,
5
);
OutMoveInfo
.
log
(
$
"料箱抵达出口再运行5秒"
);
OutMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
break
;
case
MoveStep
.
Out04
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Out05
);
CylinderMove
(
OutMoveInfo
,
IO_Type
.
OutStop_Down
,
IO_Type
.
OutStop_Up
,
IO_VALUE
.
HIGH
);
OutSideLift
.
Lift
Down
(
OutMoveInfo
);
OutSideLift
.
Lift
Up
(
OutMoveInfo
);
OutMoveInfo
.
log
(
$
"出料中间阻挡升起"
);
ServerCM
.
SendStoreState
(
StoreMoveInfo
.
MoveParam
.
PosID
,
StoreStatus
.
OutStoreEnd
);
break
;
case
MoveStep
.
Out0
4
:
case
MoveStep
.
Out0
5
:
OutMoveInfo
.
NextMoveStep
(
MoveStep
.
Wait
);
break
;
default
:
...
...
DeviceLibrary/theMachine/MainMachine.cs
查看文件 @
4351302
...
...
@@ -121,6 +121,7 @@ namespace DeviceLibrary
AlarmBuzzer
.
SetOnOffAction
(()
=>{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
IOMonitor
.
RegisterIO
(
IO_Type
.
OutLeave_BTN
,
Config
,
IO_VALUE
.
HIGH
,
OutLeave_BTN
,
2500
,
100
);
LedProcessInit
();
}
private
(
bool
,
string
)
ZAxis_interference
(
int
from
,
int
to
)
...
...
@@ -357,8 +358,13 @@ namespace DeviceLibrary
case
MoveStep
.
HEND_HomeReset
:
OKLEController
.
SetZero
(
Config
.
WeightSensorPort
);
forceHome
=
false
;
InMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
OutMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
StoreMoveInfo
.
NewMove
(
MoveStep
.
Wait
);
boxTransport
.
Reset
();
ResetMoveInfo
.
log
(
"回原完成"
);
ResetMoveInfo
.
EndMove
();
runStatus
=
RunStatus
.
Running
;
ServerCM
.
storeStatus
=
StoreStatus
.
StoreOnline
;
break
;
...
...
DeviceLibrary/theMachine/RobotManage.cs
查看文件 @
4351302
...
...
@@ -69,6 +69,7 @@ namespace DeviceLibrary
msg
+=
$
"称重传感器初始化失败 Port:{Config.WeightSensorPort}\n"
;
}
}
OKLEController
.
SetZero
(
Config
.
WeightSensorPort
);
if
(!
CameraA
.
LoadCameraConfig
(
"CameraA"
,
out
string
errmsg
))
{
IsLoadOk
=
false
;
...
...
TheMachine/Form1.cs
查看文件 @
4351302
...
...
@@ -399,7 +399,7 @@ namespace TheMachine
private
void
btn_inreset_Click
(
object
sender
,
EventArgs
e
)
{
if
(
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
InStopMaterial_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
InOverHead_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
InOverHead_Check
).
Equals
(
IO_VALUE
.
LOW
)
||
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
InEndMaterialBottom_Check
).
Equals
(
IO_VALUE
.
HIGH
)
||
RobotManage
.
mainMachine
.
IOValue
(
IO_Type
.
InEndMaterialTop_Check
).
Equals
(
IO_VALUE
.
HIGH
)
)
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论