Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
AutoCountMachine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 37648967
由
LN
编写于
2020-09-16 16:32:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
取放料和贴标速度优化
1 个父辈
ad45b768
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
187 行增加
和
46 行删除
RC1266-AutoCountMachine/source/AutoCountClient/FrmRobotMain.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/EquipBase.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip.cs
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Partial.cs
RC1266-AutoCountMachine/source/AutoCountClient/FrmRobotMain.cs
查看文件 @
3764896
...
@@ -13,6 +13,7 @@ using System.Drawing;
...
@@ -13,6 +13,7 @@ using System.Drawing;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Linq
;
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
...
@@ -399,12 +400,37 @@ namespace OnlineStore.AutoCountClient
...
@@ -399,12 +400,37 @@ namespace OnlineStore.AutoCountClient
}
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
DateTime
lastLogTime
=
DateTime
.
Now
;
PerformanceCounter
curtime
=
null
;
PerformanceCounter
curtime
=
null
;
private
void
LogM
()
#
region
内存回收
[
DllImport
(
"kernel32.dll"
,
EntryPoint
=
"SetProcessWorkingSetSize"
)]
public
static
extern
int
SetProcessWorkingSetSize
(
IntPtr
process
,
int
minSize
,
int
maxSize
);
/// <summary>
/// 释放内存
/// </summary>
public
static
void
ClearMemory
()
{
try
{
GC
.
Collect
();
GC
.
WaitForPendingFinalizers
();
if
(
Environment
.
OSVersion
.
Platform
==
PlatformID
.
Win32NT
)
{
SetProcessWorkingSetSize
(
System
.
Diagnostics
.
Process
.
GetCurrentProcess
().
Handle
,
-
1
,
-
1
);
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"ClearMemory 出错:"
+
ex
.
ToString
());
}
}
#
endregion
private
void
LogM
()
{
{
try
try
{
{
TimeSpan
sp
=
DateTime
.
Now
-
lastLogTime
;
TimeSpan
sp
=
DateTime
.
Now
-
lastLogTime
;
if
(
sp
.
TotalMinutes
>
20
)
if
(
sp
.
TotalMinutes
>
5
)
{
{
lastLogTime
=
DateTime
.
Now
;
lastLogTime
=
DateTime
.
Now
;
...
@@ -421,6 +447,8 @@ namespace OnlineStore.AutoCountClient
...
@@ -421,6 +447,8 @@ namespace OnlineStore.AutoCountClient
sbResult
.
AppendFormat
(
", CPU : {0} %"
,
curtime
.
NextValue
()
/
Environment
.
ProcessorCount
);
sbResult
.
AppendFormat
(
", CPU : {0} %"
,
curtime
.
NextValue
()
/
Environment
.
ProcessorCount
);
LogUtil
.
info
(
sbResult
.
ToString
());
LogUtil
.
info
(
sbResult
.
ToString
());
}
}
ClearMemory
();
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/EquipBase.cs
查看文件 @
3764896
...
@@ -91,6 +91,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -91,6 +91,7 @@ namespace OnlineStore.DeviceLibrary
private
DateTime
lastProTimer
=
DateTime
.
Now
;
private
DateTime
lastProTimer
=
DateTime
.
Now
;
public
void
TimerProcess
()
public
void
TimerProcess
()
{
{
OnTimerProcess
();
TimeSpan
span
=
DateTime
.
Now
-
lastProTimer
;
TimeSpan
span
=
DateTime
.
Now
-
lastProTimer
;
if
(
isInPro
&&
span
.
TotalSeconds
<
TimerMaxSeconds
)
if
(
isInPro
&&
span
.
TotalSeconds
<
TimerMaxSeconds
)
...
@@ -117,8 +118,14 @@ namespace OnlineStore.DeviceLibrary
...
@@ -117,8 +118,14 @@ namespace OnlineStore.DeviceLibrary
{
{
LogUtil
.
error
(
Name
+
"TimerProcess出错:"
,
ex
);
LogUtil
.
error
(
Name
+
"TimerProcess出错:"
,
ex
);
}
}
finally
{
isInPro
=
false
;
}
}
protected
virtual
void
OnTimerProcess
()
{
isInPro
=
false
;
}
}
protected
DateTime
preIoTimerOutTime
=
DateTime
.
Now
;
protected
DateTime
preIoTimerOutTime
=
DateTime
.
Now
;
protected
virtual
void
IOTimeOutProcess
()
protected
virtual
void
IOTimeOutProcess
()
...
@@ -280,7 +287,6 @@ namespace OnlineStore.DeviceLibrary
...
@@ -280,7 +287,6 @@ namespace OnlineStore.DeviceLibrary
#
region
CheckWait
处理
#
region
CheckWait
处理
private
DateTime
preCheckAxisTime
=
DateTime
.
Now
;
protected
DateTime
preRWTime
=
DateTime
.
Now
;
protected
DateTime
preRWTime
=
DateTime
.
Now
;
internal
void
CheckWait
(
RobotMoveInfo
moveInfo
)
internal
void
CheckWait
(
RobotMoveInfo
moveInfo
)
{
{
...
@@ -310,10 +316,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -310,10 +316,10 @@ namespace OnlineStore.DeviceLibrary
NotOkMsg
=
" ["
+
wait
.
ToStr
()
+
"] "
;
NotOkMsg
=
" ["
+
wait
.
ToStr
()
+
"] "
;
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W001_AxisMove
))
if
(
wait
.
WaitType
.
Equals
(
WaitEnum
.
W001_AxisMove
))
{
{
TimeSpan
axisSpan
=
DateTime
.
Now
-
preCheckAxisTime
;
TimeSpan
axisSpan
=
DateTime
.
Now
-
moveInfo
.
preCheckAxisTime
;
if
(
axisSpan
.
TotalSeconds
>
1
)
if
(
axisSpan
.
TotalSeconds
>
1
)
{
{
preCheckAxisTime
=
DateTime
.
Now
;
moveInfo
.
preCheckAxisTime
=
DateTime
.
Now
;
string
msg
=
""
;
string
msg
=
""
;
if
(
wait
.
IsHomeMove
)
if
(
wait
.
IsHomeMove
)
{
{
...
@@ -450,10 +456,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -450,10 +456,10 @@ namespace OnlineStore.DeviceLibrary
{
{
level
=
WorkLogLevel
;
level
=
WorkLogLevel
;
}
}
if
(
level
<=
WorkLogLevel
)
//
if (level <= WorkLogLevel)
{
//
{
level
=
WorkLogLevel
;
//
level = WorkLogLevel;
}
//
}
string
code
=
""
;
string
code
=
""
;
if
(
MoveInfo
.
MoveParam
!=
null
&&
MoveInfo
.
MoveParam
.
WareCode
!=
null
)
if
(
MoveInfo
.
MoveParam
!=
null
&&
MoveInfo
.
MoveParam
.
WareCode
!=
null
)
{
{
...
@@ -478,7 +484,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -478,7 +484,7 @@ namespace OnlineStore.DeviceLibrary
{
{
level
=
SecWorkLogLevel
;
level
=
SecWorkLogLevel
;
}
}
level
=
SecWorkLogLevel
;
//
level = SecWorkLogLevel;
string
code
=
SecMoveInfo
.
MoveParam
!=
null
?
SecMoveInfo
.
MoveParam
.
WareCode
:
""
;
string
code
=
SecMoveInfo
.
MoveParam
!=
null
?
SecMoveInfo
.
MoveParam
.
WareCode
:
""
;
if
(
level
.
Equals
(
1
))
if
(
level
.
Equals
(
1
))
{
{
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip.cs
查看文件 @
3764896
...
@@ -124,7 +124,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -124,7 +124,7 @@ namespace OnlineStore.DeviceLibrary
alarmType
=
AlarmType
.
None
;
alarmType
=
AlarmType
.
None
;
isInSuddenDown
=
false
;
isInSuddenDown
=
false
;
isNoAirCheck
=
false
;
isNoAirCheck
=
false
;
TimerMaxSeconds
=
0
;
MoveInfo
.
NextMoveStep
(
StepEnum
.
OMR01_MoveZHome
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
OMR01_MoveZHome
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
WorkLog
(
"取料Z轴原点返回"
);
WorkLog
(
"取料Z轴原点返回"
);
...
@@ -148,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -148,7 +148,7 @@ namespace OnlineStore.DeviceLibrary
isInPro
=
false
;
isInPro
=
false
;
}
}
protected
override
void
ResetProcess
()
protected
override
void
ResetProcess
()
{
{
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Reset
)
||
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
RHome
))
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Reset
)
||
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
RHome
))
...
@@ -377,36 +377,126 @@ namespace OnlineStore.DeviceLibrary
...
@@ -377,36 +377,126 @@ namespace OnlineStore.DeviceLibrary
}
}
}
}
#
endregion
#
endregion
private
bool
moveInPro
=
false
;
private
bool
secInPro
=
false
;
protected
override
void
BusyMoveProcess
()
private
bool
shelfInPro
=
false
;
private
DateTime
moveLastTime
=
DateTime
.
Now
;
private
DateTime
secLastTime
=
DateTime
.
Now
;
private
DateTime
shelfLastTime
=
DateTime
.
Now
;
protected
override
void
OnTimerProcess
()
{
{
if
(
MoveStop
)
if
(
MoveStop
)
{
{
return
;
return
;
}
}
int
seconds
=
3
;
if
(
runStatus
.
Equals
(
RobotRunStatus
.
HomeMoving
)
||
runStatus
.
Equals
(
RobotRunStatus
.
Reset
))
TimeSpan
shelfSpan
=
DateTime
.
Now
-
shelfLastTime
;
if
(!
shelfInPro
||
shelfSpan
.
TotalSeconds
>
seconds
)
{
{
ResetProcess
();
shelfInPro
=
true
;
shelfLastTime
=
DateTime
.
Now
;
try
{
if
(
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
ShelfPro
))
{
ShelfMoveProcess
();
}
else
if
(
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Reset
)
||
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
RHome
))
{
BatchResetMovePro
();
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
" OnTimerProcess 出错:"
,
ex
);
}
finally
{
shelfInPro
=
false
;
}
}
}
else
TimeSpan
secSpan
=
DateTime
.
Now
-
secLastTime
;
if
(!
secInPro
||
secSpan
.
TotalSeconds
>
seconds
)
{
{
if
(
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
ShelfPro
))
secInPro
=
true
;
secLastTime
=
DateTime
.
Now
;
try
{
if
(
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Labelling
))
{
LabellingProcess
();
}
else
if
(
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Reset
)
||
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
RHome
))
{
SecMoveResetPro
();
}
}
catch
(
Exception
ex
)
{
{
ShelfMoveProcess
(
);
LogUtil
.
error
(
Name
+
"TimerProcess出错:"
,
ex
);
}
}
if
(
SecMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Labelling
))
finally
{
{
LabellingProcess
()
;
secInPro
=
false
;
}
}
}
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
))
TimeSpan
moveSpan
=
DateTime
.
Now
-
moveLastTime
;
if
(!
moveInPro
||
moveSpan
.
TotalSeconds
>
seconds
)
{
moveInPro
=
true
;
moveLastTime
=
DateTime
.
Now
;
try
{
{
WorkingProcess
();
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Working
))
{
WorkingProcess
();
}
else
if
(
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
Reset
)
||
MoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
RHome
))
{
MoveResetPro
();
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"TimerProcess出错:"
,
ex
);
}
finally
{
moveInPro
=
false
;
}
}
}
}
}
}
//protected override void BusyMoveProcess()
//{
// if (MoveStop)
// {
// return;
// }
// if (runStatus.Equals(RobotRunStatus.HomeMoving) || runStatus.Equals(RobotRunStatus.Reset))
// {
// ResetProcess();
// }
// else
// {
// if (ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro))
// {
// ShelfMoveProcess();
// }
// if (SecMoveInfo.MoveType.Equals(RobotMoveType.Labelling))
// {
// LabellingProcess();
// }
// if (MoveInfo.MoveType.Equals(RobotMoveType.Working))
// {
// WorkingProcess();
// }
// }
//}
private
Stopwatch
needEnterWatch
=
new
Stopwatch
();
private
Stopwatch
needEnterWatch
=
new
Stopwatch
();
private
Stopwatch
needLeaveWatch
=
new
Stopwatch
();
private
Stopwatch
needLeaveWatch
=
new
Stopwatch
();
protected
override
void
BaseTimerProcess
()
protected
override
void
BaseTimerProcess
()
...
@@ -415,7 +505,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -415,7 +505,7 @@ namespace OnlineStore.DeviceLibrary
{
{
return
;
return
;
}
}
BusyMoveProcess
();
//
BusyMoveProcess();
if
(
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
)
&&
ShelfMoveInfo
.
IsInWait
.
Equals
(
false
))
if
(
ShelfMoveInfo
.
MoveType
.
Equals
(
RobotMoveType
.
None
)
&&
ShelfMoveInfo
.
IsInWait
.
Equals
(
false
))
{
{
...
@@ -484,7 +574,33 @@ namespace OnlineStore.DeviceLibrary
...
@@ -484,7 +574,33 @@ namespace OnlineStore.DeviceLibrary
}
}
GratingSignalProcess
();
GratingSignalProcess
();
}
}
protected
override
void
IOTimeOutProcess
()
{
try
{
TimeSpan
span
=
DateTime
.
Now
-
preIoTimerOutTime
;
if
(
span
.
TotalSeconds
>
3
&&
alarmType
.
Equals
(
AlarmType
.
IoSingleTimeOut
))
{
preIoTimerOutTime
=
DateTime
.
Now
;
if
(
runStatus
<
RobotRunStatus
.
Runing
||
isInSuddenDown
||
isNoAirCheck
)
{
return
;
}
//若BOX和出料都没有在等待Io的过程中则此Io超时异常可能已经处理过
if
(
MoveInfo
.
IsInWait
.
Equals
(
false
)
&&
SecMoveInfo
.
IsInWait
.
Equals
(
false
)&&
ShelfMoveInfo
.
IsInWait
.
Equals
(
false
))
{
LogUtil
.
info
(
Name
+
"清理信号超时报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
AlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"IOTimeOutProcess出错:"
,
ex
);
}
}
internal
override
void
StopMove
()
internal
override
void
StopMove
()
{
{
AgvClient
.
SetStatus
(
Config
.
AgvInName
);
AgvClient
.
SetStatus
(
Config
.
AgvInName
);
...
...
RC1266-AutoCountMachine/source/DeviceLibrary/bean/OutputEquip_Partial.cs
查看文件 @
3764896
...
@@ -282,20 +282,21 @@ namespace OnlineStore.DeviceLibrary
...
@@ -282,20 +282,21 @@ namespace OnlineStore.DeviceLibrary
if
(
shelfOk
||
debugOk
)
if
(
shelfOk
||
debugOk
)
{
{
MoveInfo
.
NextMoveStep
(
StepEnum
.
OT12_MoveXToP3
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
OT12_MoveXToP3
);
WorkLog
(
"放料:料串可放料,取料X轴移动到P3 "
);
WorkLog
(
"放料:料串可放料,取料X轴移动到P3
["
+
Config
.
MoveX_P3
+
"]
"
);
MoveXAxis
.
AbsMove
(
MoveInfo
,
Config
.
MoveX_P3
,
Config
.
MoveX_P3Speed
);
MoveXAxis
.
AbsMove
(
MoveInfo
,
Config
.
MoveX_P3
,
Config
.
MoveX_P3Speed
);
ClearTimeoutAlarm
(
"等待出料料串准备完成"
);
ClearTimeoutAlarm
(
"等待出料料串准备完成"
);
if
(
shelfOk
)
if
(
shelfOk
)
{
{
int
trayHeight
=
MoveInfo
.
MoveParam
.
PlateH
;
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OS_21_BatchDownH
);
ShelfMoveInfo
.
NextMoveStep
(
StepEnum
.
OS_21_BatchDownH
);
int
currP
=
BatchAxis
.
GetAclPosition
();
int
currP
=
BatchAxis
.
GetAclPosition
();
int
targetP
=
currP
-
(
MoveInfo
.
MoveParam
.
PlateH
+
20
)
*
Config
.
Height_ChangeValue
;
int
targetP
=
currP
-
(
trayHeight
+
20
)
*
Config
.
Height_ChangeValue
;
if
(
targetP
<
Config
.
BatchAxisP2
)
if
(
targetP
<
Config
.
BatchAxisP2
)
{
{
targetP
=
Config
.
BatchAxisP2
;
targetP
=
Config
.
BatchAxisP2
;
}
}
ShelfWorkLog
(
"放料: 提升轴下降指定高度 : 盘高【"
+
MoveInfo
.
MoveParam
.
PlateH
+
"】实时位置【"
+
currP
+
"】目标位置【"
+
targetP
+
"】"
);
ShelfWorkLog
(
"放料: 提升轴下降指定高度 : 盘高【"
+
trayHeight
+
"】实时位置【"
+
currP
+
"】目标位置【"
+
targetP
+
"】"
);
BatchAxis
.
AbsMove
(
ShelfMoveInfo
,
targetP
,
Config
.
BatchAxis_P2Speed
);
BatchAxis
.
AbsMove
(
ShelfMoveInfo
,
targetP
,
Config
.
BatchAxis_P2Speed
);
}
}
}
}
...
@@ -309,22 +310,12 @@ namespace OnlineStore.DeviceLibrary
...
@@ -309,22 +310,12 @@ namespace OnlineStore.DeviceLibrary
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT12_MoveXToP3
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT12_MoveXToP3
))
{
{
//bool shelfOk = ShelfMoveInfo.MoveType.Equals(RobotMoveType.ShelfPro) && ShelfMoveInfo.IsStep(StepEnum.OS_22_WaitTray);
//bool debugOk = ShelfMoveInfo.MoveType.Equals(RobotMoveType.None) && MoveInfo.MoveParam.IsTest;
//if (shelfOk || debugOk)
//{
// ClearTimeoutAlarm("等待出料料串可放料");
MoveInfo
.
NextMoveStep
(
StepEnum
.
OT13_MoveZToP3
);
MoveInfo
.
NextMoveStep
(
StepEnum
.
OT13_MoveZToP3
);
WorkLog
(
"放料:取料Z轴下降到P3 "
);
int
p
=
Config
.
GetMoveZP3
(
MoveInfo
.
MoveParam
.
PlateH
);
MoveZAxis
.
AbsMove
(
MoveInfo
,
Config
.
GetMoveZP3
(
MoveInfo
.
MoveParam
.
PlateH
),
Config
.
MoveZ_P3Speed
);
WorkLog
(
"放料:取料Z轴下降到P3 ["
+
p
+
"] "
,
1
);
//}
MoveZAxis
.
AbsMove
(
MoveInfo
,
p
,
Config
.
MoveZ_P3Speed
);
//else if (MoveInfo.IsTimeOut(60))
//{
CheckStartLabel
();
// WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "]" + "等待出料料串可放料(OS_22_WaitTray)超时[" + FormUtil.GetSpanStr(MoveInfo.StepSpan()) + "]";
// LogUtil.error(WarnMsg, MoveInfo.ErrorLogType, MoveInfo.logSeconds());
// Alarm(AlarmType.IoSingleTimeOut);
//}
//CheckStartLabel();
}
}
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT13_MoveZToP3
))
else
if
(
MoveInfo
.
IsStep
(
StepEnum
.
OT13_MoveZToP3
))
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论