Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit c2ca5243
由
几米阳光
编写于
2018-11-13 17:23:10 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
光栅修改
1 个父辈
9100311f
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
98 行增加
和
64 行删除
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
source/DeviceLibrary/store/KTK_Store.cs
source/DeviceLibrary/PanasonicServo/ACServerManager_Partial.cs
查看文件 @
c2ca524
...
@@ -208,9 +208,9 @@ namespace OnlineStore.DeviceLibrary
...
@@ -208,9 +208,9 @@ namespace OnlineStore.DeviceLibrary
if
(
data
==
null
)
if
(
data
==
null
)
{
{
return
;
return
;
}
}
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
50
,
8
);
byte
[]
returnData
=
SendCommand
(
portName
,
data
,
50
,
8
);
if
(
returnData
!=
null
)
if
(
returnData
!=
null
)
{
{
string
strSend
=
""
;
string
strSend
=
""
;
for
(
int
i
=
0
;
i
<
returnData
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
returnData
.
Length
;
i
++)
...
@@ -231,6 +231,10 @@ namespace OnlineStore.DeviceLibrary
...
@@ -231,6 +231,10 @@ namespace OnlineStore.DeviceLibrary
/// <returns>返回值的长度</returns>
/// <returns>返回值的长度</returns>
public
static
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
)
public
static
byte
[]
SendCommand
(
string
portName
,
byte
[]
data
,
int
outTime
,
int
reviceLength
)
{
{
if
(
outTime
>
80
)
{
outTime
=
80
;
}
byte
[]
returnData
=
null
;
byte
[]
returnData
=
null
;
try
try
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean.cs
查看文件 @
c2ca524
...
@@ -3,6 +3,7 @@ using OnlineStore.Common;
...
@@ -3,6 +3,7 @@ using OnlineStore.Common;
using
OnlineStore.LoadCSVLibrary
;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
...
@@ -725,27 +726,29 @@ namespace OnlineStore.DeviceLibrary
...
@@ -725,27 +726,29 @@ namespace OnlineStore.DeviceLibrary
//}
//}
}
}
private
bool
InProcess
=
false
;
private
bool
InProcess
=
false
;
private
DateTime
preProcessTime
=
DateTime
.
Now
;
//
private DateTime preProcessTime = DateTime.Now;
private
bool
IsChongfu
=
false
;
private
bool
IsChongfu
=
false
;
private
Stopwatch
stopwatch
=
new
Stopwatch
();
protected
override
void
timersTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
protected
override
void
timersTimer_Elapsed
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
{
if
(
InProcess
)
if
(
InProcess
)
{
{
TimeSpan
span
=
DateTime
.
Now
-
preProcessTime
;
//
TimeSpan span = DateTime.Now - preProcessTime;
if
(
s
pan
.
TotalMinutes
<
1
)
if
(
s
topwatch
.
Elapsed
.
TotalMinutes
<
1
)
{
{
return
;
return
;
}
}
else
else
{
{
LogUtil
.
error
(
"主定时器:InProcess已等待"
+
s
pan
.
ToString
()
+
"重新处理"
);
LogUtil
.
error
(
"主定时器:InProcess已等待"
+
s
topwatch
.
Elapsed
.
ToString
()
+
"重新处理"
);
IsChongfu
=
true
;
IsChongfu
=
true
;
}
}
}
}
try
try
{
{
InProcess
=
true
;
InProcess
=
true
;
preProcessTime
=
DateTime
.
Now
;
//preProcessTime = DateTime.Now;
stopwatch
.
Restart
();
IoCheckProcess
();
IoCheckProcess
();
ShowTimeLog
(
"IoCheckProcess"
);
ShowTimeLog
(
"IoCheckProcess"
);
TimerProcess
();
TimerProcess
();
...
@@ -769,7 +772,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -769,7 +772,7 @@ namespace OnlineStore.DeviceLibrary
{
{
if
(
IsChongfu
)
if
(
IsChongfu
)
{
{
LogUtil
.
info
(
"【"
+
info
+
"】 处理完成,耗时:"
+
(
DateTime
.
Now
-
preProcessTime
)
.
ToString
());
LogUtil
.
info
(
"【"
+
info
+
"】 处理完成,耗时:"
+
stopwatch
.
Elapsed
.
ToString
());
}
}
}
}
//private void LedProcess()
//private void LedProcess()
...
@@ -1002,34 +1005,61 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1002,34 +1005,61 @@ namespace OnlineStore.DeviceLibrary
//}
//}
}
}
private
int
NeedCheckSafetyLight
=
0
;
private
object
safetyInProcess
=
""
;
/// <summary>
/// <summary>
/// 光栅处理
/// 光栅处理
/// </summary>
/// </summary>
private
void
SafetyLightProcess
()
private
void
SafetyLightProcess
()
{
{
//遮挡光栅信号
if
(
Monitor
.
TryEnter
(
safetyInProcess
))
if
(
KNDIOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
LOW
))
{
{
try
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
)&&
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_10_DeviceToDoor
))
{
{
if
(
NeedCheckSafetyLight
.
Equals
(
1
))
//遮挡光栅信号
if
(
KNDIOValue
(
IO_Type
.
SafetyLightCurtains
).
Equals
(
IO_VALUE
.
LOW
))
{
{
ACServerManager
.
SuddenStop
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
if
(
NeedCheckSafetyLight
.
Equals
(
1
))
NeedCheckSafetyLight
=
2
;
{
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
)
&&
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_10_DeviceToDoor
))
{
NeedCheckSafetyLight
=
2
;
LOGGER
.
Info
(
"出库SO_10_DeviceToDoor运动中,光栅被遮挡,停止进出轴运动"
);
ACServerManager
.
SuddenStop
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
}
else
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
InStore
)
&&
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SI_05_DeviceToDoor
))
{
NeedCheckSafetyLight
=
2
;
LOGGER
.
Info
(
"入库SI_05_DeviceToDoor运动中,光栅被遮挡,停止进出轴运动"
);
ACServerManager
.
SuddenStop
(
Config
.
InOut_Axis
.
DeviceName
,
Config
.
InOut_Axis
.
GetAxisValue
());
}
}
}
}
}
else
}
else
{
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
)
&&
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_10_DeviceToDoor
))
{
if
(
NeedCheckSafetyLight
.
Equals
(
2
))
{
{
SO_10_DeviceToDoorPro
();
if
(
NeedCheckSafetyLight
.
Equals
(
2
))
{
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
OutStore
)
&&
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_10_DeviceToDoor
))
{
LOGGER
.
Info
(
"出库SO_10_DeviceToDoor运动中,光栅已恢复,继续进出轴运动"
);
SO_10_DeviceToDoorPro
();
}
else
if
(
StoreMove
.
MoveType
.
Equals
(
StoreMoveType
.
InStore
)
&&
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SI_05_DeviceToDoor
))
{
LOGGER
.
Info
(
"入库SI_05_DeviceToDoor运动中,光栅已恢复,继续进出轴运动"
);
SI_05_DeviceToDoor
();
}
}
}
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"光栅处理出错:"
+
ex
.
ToString
());
}
finally
{
Monitor
.
Exit
(
safetyInProcess
);
}
}
}
}
public
void
TimerProcess
()
public
void
TimerProcess
()
{
{
...
@@ -1221,7 +1251,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -1221,7 +1251,7 @@ namespace OnlineStore.DeviceLibrary
//在回原点,复位,出入库时,检测报警间隔减小
//在回原点,复位,出入库时,检测报警间隔减小
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Busy
)
||
storeRunStatus
.
Equals
(
StoreRunStatus
.
HomeMoving
)
||
storeRunStatus
.
Equals
(
StoreRunStatus
.
Reset
))
if
(
storeRunStatus
.
Equals
(
StoreRunStatus
.
Busy
)
||
storeRunStatus
.
Equals
(
StoreRunStatus
.
HomeMoving
)
||
storeRunStatus
.
Equals
(
StoreRunStatus
.
Reset
))
{
{
if
(
span
.
TotalSeconds
<
0.5
)
if
(
span
.
TotalSeconds
<
1
)
{
{
return
false
;
return
false
;
}
}
...
...
source/DeviceLibrary/acSingleStore/AC_SA_BoxBean_Partial.cs
查看文件 @
c2ca524
...
@@ -297,6 +297,13 @@ namespace OnlineStore.DeviceLibrary
...
@@ -297,6 +297,13 @@ namespace OnlineStore.DeviceLibrary
OpenDoorAndWait
();
OpenDoorAndWait
();
InOutBackToP1
(
moveP
.
InOut_P1
);
InOutBackToP1
(
moveP
.
InOut_P1
);
}
}
private
void
SI_05_DeviceToDoor
()
{
InStoreLog
(
"入库:SI_05 叉子进入入料口,进出轴至P2(进料口取料点) "
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SI_05_DeviceToDoor
);
ACAxisMove
(
Config
.
InOut_Axis
,
StoreMove
.
MoveParam
.
MoveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
NeedCheckSafetyLight
=
1
;
}
protected
override
void
InStoreProcess
()
protected
override
void
InStoreProcess
()
{
{
LineMoveP
moveP
=
StoreMove
.
MoveParam
.
MoveP
;
LineMoveP
moveP
=
StoreMove
.
MoveParam
.
MoveP
;
...
@@ -350,19 +357,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -350,19 +357,19 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
InStoreLog
(
"入库:SI_05 叉子进入入料口,进出轴至P2(进料口取料点) "
);
SI_05_DeviceToDoor
();
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SI_05_DeviceToDoor
);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
}
}
}
}
else
if
(
StoreMove
.
MoveStep
==
StoreMoveStep
.
SI_04_CompressWare
)
else
if
(
StoreMove
.
MoveStep
==
StoreMoveStep
.
SI_04_CompressWare
)
{
{
InStoreLog
(
"入库:SI_05 叉子进入入料口,进出轴至P2(进料口取料点) "
);
//InStoreLog("入库:SI_05 叉子进入入料口,进出轴至P2(进料口取料点) ");
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SI_05_DeviceToDoor
);
//StoreMove.NextMoveStep(StoreMoveStep.SI_05_DeviceToDoor);
ACAxisMove
(
Config
.
InOut_Axis
,
moveP
.
InOut_P2
,
Config
.
InOutAxis_P2_Speed
);
//ACAxisMove(Config.InOut_Axis, moveP.InOut_P2, Config.InOutAxis_P2_Speed);
SI_05_DeviceToDoor
();
}
}
else
if
(
StoreMove
.
MoveStep
==
StoreMoveStep
.
SI_05_DeviceToDoor
)
else
if
(
StoreMove
.
MoveStep
==
StoreMoveStep
.
SI_05_DeviceToDoor
)
{
{
NeedCheckSafetyLight
=
0
;
InStoreLog
(
"入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) "
);
InStoreLog
(
"入库:SI_06 拿物品,压紧轴至P2(压紧点)) 升降轴至P7(进料口取料缓冲点) "
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SI_06_DoorWarToDevice
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SI_06_DoorWarToDevice
);
ComMoveToPosition
(
moveP
.
ComPress_P2
);
ComMoveToPosition
(
moveP
.
ComPress_P2
);
...
@@ -661,7 +668,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -661,7 +668,7 @@ namespace OnlineStore.DeviceLibrary
{
{
OutStoreLog
(
"出库:SO_11 放下物品,升降轴至P8(进料口出料缓冲点) "
);
OutStoreLog
(
"出库:SO_11 放下物品,升降轴至P8(进料口出料缓冲点) "
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SO_11_DevicePutWare
);
StoreMove
.
NextMoveStep
(
StoreMoveStep
.
SO_11_DevicePutWare
);
NeedCheckSafetyLight
=
0
;
ComMoveToPosition
(
moveP
.
ComPress_P1
);
ComMoveToPosition
(
moveP
.
ComPress_P1
);
//if (IsHasCompress_Axis)
//if (IsHasCompress_Axis)
//{
//{
...
...
source/DeviceLibrary/store/KTK_Store.cs
查看文件 @
c2ca524
...
@@ -44,6 +44,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -44,6 +44,8 @@ namespace OnlineStore.DeviceLibrary
/// 是否没有检测到气压
/// 是否没有检测到气压
/// </summary>
/// </summary>
public
bool
isNoAirCheck
=
false
;
public
bool
isNoAirCheck
=
false
;
protected
int
NeedCheckSafetyLight
=
0
;
/// <summary>
/// <summary>
/// 是否再报警中
/// 是否再报警中
/// </summary>
/// </summary>
...
@@ -92,34 +94,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -92,34 +94,7 @@ namespace OnlineStore.DeviceLibrary
{
{
return
new
TimeSpan
(
0
);
return
new
TimeSpan
(
0
);
}
}
}
}
///// <summary>
///// 获取轴已运行时间
///// </summary>
///// <returns></returns>
//public TimeSpan GetAxisRunTime(int axisNo)
//{
// TimeSpan span = new TimeSpan(0);
// try
// {
// if (AxisRunTimeMap.ContainsKey(axisNo))
// {
// Dictionary<DateTime, DateTime> moveMap = AxisRunTimeMap[axisNo];
// if (moveMap != null && moveMap.Count > 0)
// {
// foreach (DateTime key in moveMap.Keys)
// {
// span += moveMap[key] - key;
// }
// }
// }
// }
// catch (Exception ex)
// {
// LogUtil.error(LOGGER, ex.ToString());
// }
// return span;
//}
protected
void
AddAxisMoveTime
(
ConfigMoveAxis
axis
)
protected
void
AddAxisMoveTime
(
ConfigMoveAxis
axis
)
{
{
...
@@ -276,18 +251,36 @@ namespace OnlineStore.DeviceLibrary
...
@@ -276,18 +251,36 @@ namespace OnlineStore.DeviceLibrary
string
deviceName
=
moveAxis
.
DeviceName
;
string
deviceName
=
moveAxis
.
DeviceName
;
short
axisNo
=
moveAxis
.
GetAxisValue
();
short
axisNo
=
moveAxis
.
GetAxisValue
();
bool
isOk
=
ACServerManager
.
GetBusyStatus
(
deviceName
,
axisNo
).
Equals
(
0
);
//如果是进出轴,并且光栅被遮挡,直接返回false
if
(
NeedCheckSafetyLight
.
Equals
(
2
))
{
if
(
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_10_DeviceToDoor
)
||
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SI_05_DeviceToDoor
))
{
return
false
;
}
}
bool
isOk
=
ACServerManager
.
GetBusyStatus
(
deviceName
,
axisNo
).
Equals
(
0
);
int
outCount
=
ACServerManager
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
outCount
=
ACServerManager
.
GetActualtPosition
(
deviceName
,
axisNo
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
int
errorCount
=
Math
.
Abs
(
outCount
-
targetPosition
);
if
(
isOk
)
if
(
isOk
)
{
{
if
(
errorCount
>
moveAxis
.
CanErrorCountMax
)
if
(
errorCount
>
moveAxis
.
CanErrorCountMax
)
{
{
if
(
NeedCheckSafetyLight
.
Equals
(
2
))
{
if
(
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SO_10_DeviceToDoor
)
||
StoreMove
.
MoveStep
.
Equals
(
StoreMoveStep
.
SI_05_DeviceToDoor
))
{
return
false
;
}
}
//判断是否需要重新运动
//判断是否需要重新运动
if
(
StoreMove
.
CanWhileCount
>
0
)
if
(
StoreMove
.
CanWhileCount
>
0
)
{
{
LogUtil
.
error
(
LOGGER
,
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
LogUtil
.
error
(
LOGGER
,
moveAxis
.
DisplayStr
+
"目标位置["
+
targetPosition
+
"]当前位置["
+
outCount
+
"],误差过大,重新开始运动,剩余["
+
StoreMove
.
CanWhileCount
+
"]次"
);
"],误差过大,重新开始运动,剩余["
+
StoreMove
.
CanWhileCount
+
"]次"
);
//LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]重新开始运动");
//LogUtil.error(LOGGER, StoreName + " storeMoveStep=" + StoreMove.MoveStep + moveAxis.DisplayStr + "目标位置[" + targetPosition + "]重新开始运动");
ACServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
);
ACServerManager
.
AbsMove
(
moveAxis
.
DeviceName
,
moveAxis
.
GetAxisValue
(),
targetPosition
,
targetSpeed
);
...
@@ -304,7 +297,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -304,7 +297,7 @@ namespace OnlineStore.DeviceLibrary
}
}
else
else
{
{
return
true
;
return
true
;
}
}
}
}
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论