Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 03579498
由
LN
编写于
2021-06-30 09:31:18 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
增加运行日志打印
1 个父辈
c94c8fec
全部展开
显示空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
642 行增加
和
192 行删除
source/AssemblyLineClient/App.config
source/AssemblyLineClient/FrmLineStore.cs
source/Common/Common.csproj
source/Common/util/LogUtil.cs
source/Common/util/RunLogUtil.cs
source/DeviceLibrary/assemblyLine/DischargeLine.cs
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
source/DeviceLibrary/assemblyLine/EquipBase.cs
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
source/DeviceLibrary/assemblyLine/FeedingEquip_OutStore.cs
source/DeviceLibrary/assemblyLine/LineBean.cs
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
source/DeviceLibrary/assemblyLine/LineBean_Shunt.cs
source/DeviceLibrary/assemblyLine/LineBean_Shunt2.cs
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/ALineManager.cs
source/DeviceLibrary/model/KTK_Store.cs
source/DeviceLibrary/model/LineMoveInfo.cs
source/DeviceLibrary/model/StoreStep.cs
source/AssemblyLineClient/App.config
查看文件 @
0357949
...
...
@@ -113,6 +113,16 @@
<
conversionPattern
value
=
"[%date][%t]%-5p %m%n"
/>
</
layout
>
</
appender
>
<
appender
name
=
"RunLog"
type
=
"log4net.Appender.RollingFileAppender"
>
<
file
value
=
"logs/log/RunLog-line.log"
/>
<
param
name
=
"Encoding"
value
=
"UTF-8"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyy-MM-dd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
" %m%n"
/>
</
layout
>
</
appender
>
<
logger
name
=
"RollingLogFileAppender"
>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"RollingLogFileAppender"
/>
...
...
@@ -125,6 +135,10 @@
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"AIOBOX"
/>
</
logger
>
<
logger
name
=
"RunLog"
>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"RunLog"
/>
</
logger
>
<!--<
root
>
<
level
value
=
"Info"
/>
<
appender
-
ref
ref
=
"RollingLogFileAppender"
/>
...
...
source/AssemblyLineClient/FrmLineStore.cs
查看文件 @
0357949
...
...
@@ -302,6 +302,7 @@ namespace OnlineStore.AssemblyLine
{
LogUtil
.
info
(
"即将退出程序,停止"
+
lineBean
.
Name
+
"运行 "
);
lineBean
.
StopRun
();
lineBean
.
SetWarnMsg
();
}
foreach
(
EquipBase
equip
in
lineBean
.
AllEquipMap
.
Values
)
{
...
...
@@ -309,6 +310,7 @@ namespace OnlineStore.AssemblyLine
{
LogUtil
.
info
(
"即将退出程序,停止"
+
equip
.
Name
+
"运行 "
);
equip
.
StopRun
();
equip
.
SetWarnMsg
();
}
}
// IOManager.instance.CloseAllDO();
...
...
source/Common/Common.csproj
查看文件 @
0357949
...
...
@@ -65,6 +65,7 @@
<Compile Include="util\NetTCPServer.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="util\RunLogUtil.cs" />
<Compile Include="util\TcpClient.cs" />
<Compile Include="util\TcpServer.cs" />
<Compile Include="util\UdpServer.cs" />
...
...
source/Common/util/LogUtil.cs
查看文件 @
0357949
...
...
@@ -89,7 +89,7 @@ namespace OnlineStore.Common
}
public
static
void
error
(
ILog
log
,
string
errorMsg
,
Exception
ex
=
null
)
{
if
(
errorMsg
.
Trim
().
Equals
(
""
)
&&(
ex
==
null
))
if
(
errorMsg
.
Trim
().
Equals
(
""
)
&&
(
ex
==
null
))
{
return
;
}
...
...
@@ -123,7 +123,7 @@ namespace OnlineStore.Common
}
else
{
LOGGER
.
Debug
(
"ShowLogPro【"
+
msg
+
"】失败,未得到锁"
);
LOGGER
.
Debug
(
"ShowLogPro【"
+
msg
+
"】失败,未得到锁"
);
}
}
private
static
List
<
string
>
logList
=
new
List
<
string
>();
...
...
@@ -204,9 +204,9 @@ namespace OnlineStore.Common
{
debug
(
LOGGER
,
msg
);
}
public
static
void
error
(
string
errorMsg
,
Exception
ex
=
null
)
public
static
void
error
(
string
errorMsg
,
Exception
ex
=
null
)
{
error
(
LOGGER
,
errorMsg
,
ex
);
error
(
LOGGER
,
errorMsg
,
ex
);
}
public
static
void
info
(
string
msg
)
{
...
...
source/Common/util/RunLogUtil.cs
0 → 100644
查看文件 @
0357949
using
log4net
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Runtime.Serialization
;
using
System.Text
;
namespace
OnlineStore.Common
{
public
class
RunLogUtil
{
public
static
readonly
ILog
RunLog
=
LogManager
.
GetLogger
(
"RunLog"
);
public
static
void
ErrorLog
(
ErrorLog
log
)
{
string
jsonStr
=
JsonHelper
.
SerializeObject
(
log
);
RunLog
.
Error
(
jsonStr
);
}
public
static
void
MoveLog
(
MoveLog
log
)
{
//if (log == null || (!log.IsValid()))
//{
// return;
//}
//string jsonStr = JsonHelper.SerializeObject(log);
//RunLog.Info(jsonStr);
}
public
static
void
MoveEndLog
(
MoveEndLog
log
)
{
if
(
log
==
null
||
(!
log
.
IsValid
()))
{
return
;
}
string
jsonStr
=
JsonHelper
.
SerializeObject
(
log
);
RunLog
.
Info
(
jsonStr
);
}
public
static
void
AxisLog
(
AxisMoveLog
log
)
{
string
jsonStr
=
JsonHelper
.
SerializeObject
(
log
);
RunLog
.
Error
(
jsonStr
);
}
}
public
class
BaseLog
{
[
JsonProperty
(
Order
=
0
)]
public
string
Name
{
get
;
set
;
}
=
"四楼环形线"
;
[
JsonProperty
(
Order
=
1
)]
public
string
DeviceName
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
2
)]
public
string
LogType
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
3
)]
public
string
StartTime
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
4
)]
public
string
EndTime
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
5
)]
public
string
timeSpan
{
get
;
set
;
}
=
""
;
}
public
class
ErrorLog
:
BaseLog
{
public
ErrorLog
()
{
this
.
LogType
=
"Error"
;
}
public
ErrorLog
(
string
deviceName
,
string
errType
,
string
errMsg
,
DateTime
startTime
,
DateTime
endTime
,
string
operType
=
""
,
string
posid
=
""
,
string
barcode
=
""
)
{
this
.
LogType
=
"Error"
;
this
.
DeviceName
=
deviceName
.
Trim
();
this
.
ErrorType
=
errType
.
Trim
();
this
.
ErrorMsg
=
errMsg
.
Trim
();
this
.
StartTime
=
startTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
EndTime
=
endTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
OperateType
=
operType
.
Trim
();
this
.
PosId
=
posid
.
Trim
();
this
.
Barcode
=
barcode
.
Trim
();
TimeSpan
span
=
endTime
-
startTime
;
this
.
timeSpan
=
(
Math
.
Round
(
span
.
TotalMinutes
,
2
)).
ToString
();
//两位小数的分钟
}
public
bool
IsValid
()
{
if
(
string
.
IsNullOrEmpty
(
DeviceName
)
||
String
.
IsNullOrEmpty
(
LogType
)
||
string
.
IsNullOrEmpty
(
ErrorType
)
||
string
.
IsNullOrEmpty
(
ErrorMsg
))
{
return
false
;
}
return
true
;
}
[
JsonProperty
(
Order
=
11
)]
public
string
ErrorType
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
12
)]
public
string
ErrorMsg
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
13
)]
public
string
OperateType
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
14
)]
public
string
PosId
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
15
)]
public
string
Barcode
{
get
;
set
;
}
=
""
;
}
public
class
MoveLog
:
BaseLog
{
public
MoveLog
()
{
this
.
LogType
=
"Running"
;
}
public
MoveLog
(
string
deviceName
,
string
moveType
,
string
moveMsg
,
DateTime
startTime
,
DateTime
endTime
,
string
posid
=
""
,
string
barcode
=
""
)
{
this
.
LogType
=
"Running"
;
this
.
DeviceName
=
deviceName
.
Replace
(
"-Move"
,
""
).
Replace
(
"-SMove"
,
""
).
Trim
();
this
.
MoveType
=
moveType
.
Trim
();
this
.
MoveMsg
=
moveMsg
.
Trim
();
this
.
StartTime
=
startTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
EndTime
=
endTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
PosId
=
posid
.
Trim
();
this
.
Barcode
=
barcode
.
Trim
();
TimeSpan
span
=
endTime
-
startTime
;
this
.
timeSpan
=
(
Math
.
Round
(
span
.
TotalMinutes
,
2
)).
ToString
();
//两位小数的分钟
}
public
bool
IsValid
()
{
if
(
string
.
IsNullOrEmpty
(
DeviceName
)
||
String
.
IsNullOrEmpty
(
LogType
)
||
string
.
IsNullOrEmpty
(
MoveType
)
||
string
.
IsNullOrEmpty
(
MoveMsg
))
{
return
false
;
}
return
true
;
}
[
JsonProperty
(
Order
=
11
)]
public
string
MoveType
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
12
)]
public
string
MoveMsg
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
13
)]
public
string
PosId
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
14
)]
public
string
Barcode
{
get
;
set
;
}
=
""
;
}
public
class
MoveEndLog
:
BaseLog
{
public
MoveEndLog
()
{
this
.
LogType
=
"InoutEnd"
;
}
public
MoveEndLog
(
string
deviceName
,
string
moveType
,
DateTime
startTime
,
DateTime
endTime
,
string
posid
=
""
,
string
barcode
=
""
)
{
this
.
LogType
=
"InoutEnd"
;
this
.
DeviceName
=
deviceName
.
Replace
(
"-Move"
,
""
).
Replace
(
"-SMove"
,
""
).
Trim
();
this
.
MoveType
=
moveType
.
Trim
();
this
.
StartTime
=
startTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
EndTime
=
endTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
PosId
=
posid
.
Trim
();
this
.
Barcode
=
barcode
.
Trim
();
TimeSpan
span
=
endTime
-
startTime
;
this
.
timeSpan
=
(
Math
.
Round
(
span
.
TotalMinutes
,
2
)).
ToString
();
//两位小数的分钟
}
public
bool
IsValid
()
{
if
(
string
.
IsNullOrEmpty
(
DeviceName
)
||
string
.
IsNullOrEmpty
(
MoveType
))
{
return
false
;
}
return
true
;
}
[
JsonProperty
(
Order
=
11
)]
public
string
MoveType
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
12
)]
public
string
PosId
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
13
)]
public
string
Barcode
{
get
;
set
;
}
=
""
;
}
public
class
AxisMoveLog
:
BaseLog
{
public
AxisMoveLog
()
{
this
.
LogType
=
"Axis"
;
}
public
AxisMoveLog
(
string
deviceName
,
string
axisName
,
string
moveType
,
int
targetP
,
int
speed
,
DateTime
startTime
,
DateTime
endTime
,
string
posid
=
""
,
string
barcode
=
""
)
{
this
.
LogType
=
"Axis"
;
this
.
DeviceName
=
deviceName
.
Replace
(
"-Move"
,
""
).
Replace
(
"-SMove"
,
""
).
Trim
();
this
.
MoveType
=
moveType
.
Trim
();
this
.
AxisName
=
axisName
;
this
.
TargetPos
=
targetP
;
this
.
StartTime
=
startTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
EndTime
=
endTime
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
);
this
.
PosId
=
posid
.
Trim
();
this
.
Barcode
=
barcode
.
Trim
();
TimeSpan
span
=
endTime
-
startTime
;
this
.
timeSpan
=
(
Math
.
Round
(
span
.
TotalMinutes
,
2
)).
ToString
();
//两位小数的分钟
this
.
Speed
=
speed
;
}
public
bool
IsValid
()
{
if
(
string
.
IsNullOrEmpty
(
DeviceName
)
||
string
.
IsNullOrEmpty
(
MoveType
))
{
return
false
;
}
return
true
;
}
[
JsonProperty
(
Order
=
11
)]
public
string
AxisName
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
12
)]
public
string
MoveType
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
13
)]
public
int
TargetPos
{
get
;
set
;
}
=
0
;
[
JsonProperty
(
Order
=
14
)]
public
int
Speed
{
get
;
set
;
}
[
JsonProperty
(
Order
=
15
)]
public
string
PosId
{
get
;
set
;
}
=
""
;
[
JsonProperty
(
Order
=
16
)]
public
string
Barcode
{
get
;
set
;
}
=
""
;
}
}
source/DeviceLibrary/assemblyLine/DischargeLine.cs
查看文件 @
0357949
...
...
@@ -194,6 +194,7 @@ namespace OnlineStore.DeviceLibrary
}
}
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"复位"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
));
MoveEndS
();
SecondMoveInfo
.
EndMove
();
break
;
...
...
@@ -262,7 +263,7 @@ namespace OnlineStore.DeviceLibrary
Thread
.
Sleep
(
300
);
if
(
IOValue
(
IO_Type
.
DLine_SuddenStop
).
Equals
(
IO_VALUE
.
LOW
))
{
SetWarnMsg
(
Name
+
"收到急停信号,急停报警"
);
SetWarnMsg
(
Name
+
"收到急停信号,急停报警"
,
"急停报警"
);
Alarm
(
LineAlarmType
.
SuddenStop
);
return
;
}
...
...
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
查看文件 @
0357949
...
...
@@ -190,6 +190,8 @@ namespace OnlineStore.DeviceLibrary
int
robotIndex
=
GetRobotIndex
();
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,接驳台有料,调用arriveRobotLocation="
+
robotIndex
+
"["
+
StationInfo_Move
.
CodeStr
+
"]"
);
string
msg
=
SServerManager
.
arriveRobotLocation
(
Name
,
robotIndex
,
StationInfo_Move
.
CodeStr
);
MoveEndS
();
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料结束 ["
+
msg
+
"]"
);
}
...
...
@@ -206,6 +208,7 @@ namespace OnlineStore.DeviceLibrary
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
DON_08_CRun
))
{
SeparateStopRun
();
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"送料"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
,
""
,
StationInfo_Move
.
CodeStr
));
MoveEndS
();
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料结束,停止接驳台皮带线 "
);
}
...
...
source/DeviceLibrary/assemblyLine/EquipBase.cs
查看文件 @
0357949
...
...
@@ -185,19 +185,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
"IOTimeOutProcess出错:"
,
ex
);
}
}
protected
void
ClearTimeoutAlarm
(
string
msg
)
{
if
(
isInSuddenDown
||
isNoAirCheck
)
{
return
;
}
if
(
WarnMsg
.
Contains
(
msg
)
&&
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
{
LogUtil
.
info
(
Name
+
"清理信号超时报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
LineAlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
protected
bool
CanStartRun
()
{
string
canResult
=
LineManager
.
Line
.
CanStart
();
...
...
@@ -380,7 +369,7 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
axis
.
Config
.
BreakOnDO
,
IO_VALUE
.
HIGH
);
return
true
;
}
SetWarnMsg
(
Name
+
msg
);
SetWarnMsg
(
Name
+
msg
,
axis
.
Config
.
DisplayStr
+
"_轴报警"
);
//WarnMsg = DateTime.Now.ToLongTimeString() + " " + Name + msg;
Alarm
(
LineAlarmType
.
AxisAlarm
);
return
false
;
...
...
@@ -443,16 +432,24 @@ namespace OnlineStore.DeviceLibrary
if
(
wait
.
IsHomeMove
)
{
wait
.
IsEnd
=
AxisBean
.
HomeMoveIsEnd
(
moveInfo
,
wait
.
AxisInfo
,
out
msg
);
if
(
wait
.
IsEnd
)
{
RunLogUtil
.
AxisLog
(
new
AxisMoveLog
(
Name
,
wait
.
AxisInfo
.
Explain
,
"回原点"
,
0
,
wait
.
AxisInfo
.
HomeHighSpeed
,
moveInfo
.
LastSetpTime
,
DateTime
.
Now
,
moveInfo
.
MoveParam
.
PosId
,
moveInfo
.
MoveParam
.
WareCode
));
}
}
else
{
wait
.
IsEnd
=
AxisBean
.
ACAxisMoveIsEnd
(
moveInfo
,
wait
.
AxisInfo
,
wait
.
TargetPosition
,
wait
.
TargetSpeed
,
out
msg
);
if
(
wait
.
IsEnd
)
{
RunLogUtil
.
AxisLog
(
new
AxisMoveLog
(
Name
,
wait
.
AxisInfo
.
Explain
,
"绝对运动"
,
wait
.
TargetPosition
,
wait
.
TargetSpeed
,
moveInfo
.
LastSetpTime
,
DateTime
.
Now
,
moveInfo
.
MoveParam
.
PosId
,
moveInfo
.
MoveParam
.
WareCode
));
}
}
if
(!
msg
.
Equals
(
""
))
{
isOk
=
false
;
WarnMsg
=
Name
+
msg
;
string
type
=
moveInfo
.
GetStepDes
()
+
"_轴运动报警"
;
SetWarnMsg
(
msg
,
type
,
moveInfo
);
Alarm
(
LineAlarmType
.
AxisMoveError
);
CheckAlarmProcess
(
moveInfo
,
LineAlarmType
.
AxisMoveError
);
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
14
);
...
...
@@ -477,9 +474,12 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
>
LineManager
.
Config
.
IOSingle_TimerOut
&&
alarmType
<=
LineAlarmType
.
IoSingleTimeOut
)
{
ConfigIO
io
=
baseConfig
.
getWaitIO
(
wait
.
IoType
);
WarnMsg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"] 等待"
+
NotOkMsg
+
" 超时 "
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"秒"
;
string
msg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"] 等待"
+
NotOkMsg
+
" 超时 "
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"秒"
;
LogUtil
.
error
(
MoveInfo
.
Name
+
WarnMsg
,
DeviceID
*
1000
+
13
);
string
type
=
moveInfo
.
GetStepDes
()
+
"_"
+
"超时报警"
;
SetWarnMsg
(
msg
,
type
,
moveInfo
);
//WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "] 等待" + NotOkMsg + " 超时 " + Math.Round(span.TotalSeconds, 1) + "秒";
//LogUtil.error(MoveInfo.Name + WarnMsg, DeviceID * 1000 + 13);
if
(
NoAlarm
())
{
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
...
...
@@ -559,11 +559,11 @@ namespace OnlineStore.DeviceLibrary
if
(
isOk
)
{
moveInfo
.
EndStepWait
();
ClearStepAlarm
(
moveInfo
.
GetStepDes
());
}
else
if
(
span
.
TotalSeconds
>
moveInfo
.
TimeOutSeconds
)
{
WarnMsg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"]等待"
+
NotOkMsg
+
"超时["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
int
second
=
10
;
if
(
IsLowAlarm
(
moveInfo
))
{
...
...
@@ -577,7 +577,12 @@ namespace OnlineStore.DeviceLibrary
{
second
=
10
;
}
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
15
,
second
);
//WarnMsg = moveInfo.Name + "[" + moveInfo.MoveType + "][" + moveInfo.MoveStep + "]等待" + NotOkMsg+ "超时[" + Math.Round(span.TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 15, second);
string
msg
=
moveInfo
.
Name
+
"["
+
moveInfo
.
MoveType
+
"]["
+
moveInfo
.
MoveStep
+
"]等待"
+
NotOkMsg
+
"超时["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
string
type
=
moveInfo
.
GetStepDes
()
+
"_"
+
"超时报警"
;
SetWarnMsg
(
msg
,
type
,
moveInfo
,
second
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
CheckAlarmProcess
(
moveInfo
,
LineAlarmType
.
IoSingleTimeOut
);
}
...
...
@@ -587,6 +592,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil
.
error
(
moveInfo
.
Name
+
" ["
+
moveInfo
.
MoveStep
+
"] CheckWait 出错:"
,
ex
);
}
}
private
bool
IsLowAlarm
(
LineMoveInfo
moveInfo
)
{
//托盘卡的信号不报警,只提示
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip.cs
查看文件 @
0357949
...
...
@@ -291,6 +291,7 @@ namespace OnlineStore.DeviceLibrary
LogInfo
(
"重置完成,出口检测到有料架,调用 "
+
Config
.
AgvOutName
+
" AgvClient.NeedLeave"
);
AgvClient
.
NeedLeave
(
Config
.
AgvOutName
,
LastOutShelfId
,
level
);
}
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"复位"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
));
MoveEndS
();
break
;
default
:
break
;
...
...
@@ -557,9 +558,10 @@ namespace OnlineStore.DeviceLibrary
}
else
{
WarnMsg
=
Name
+
"TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸"
;
//WarnMsg = Name + "TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸";
//LogUtil.error(Name + "TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸");
SetWarnMsg
(
"TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸"
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
LogUtil
.
error
(
Name
+
"TrayLCylinderAfter:提升轴当前不在下降位置P2,不后退定位气缸"
);
}
}
if
(
moveinfo
!=
null
)
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_InStore.cs
查看文件 @
0357949
...
...
@@ -436,8 +436,8 @@ namespace OnlineStore.DeviceLibrary
{
if
(
SecondMoveInfo
.
IsTimeOut
(
15
))
{
WarnMsg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待入库托盘超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnM
sg
+
",暂时放托盘离开"
);
string
msg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待入库托盘超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
m
sg
+
",暂时放托盘离开"
);
TrayMoveOk
();
}
}
...
...
@@ -449,20 +449,19 @@ namespace OnlineStore.DeviceLibrary
{
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_201_WaitOutEnd
);
}
//如果当前无料串,或者料串已离开,直接放行 托盘
else
if
(
SecondMoveInfo
.
IsTimeOut
(
30
))
{
WarnM
sg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待出库移栽超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnM
sg
+
",暂时放托盘离开"
);
string
m
sg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待出库移栽超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
m
sg
+
",暂时放托盘离开"
);
TrayMoveOk
();
}
else
if
(
SecondMoveInfo
.
IsTimeOut
(
20
))
{
WarnMsg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待出库移栽超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
21
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
SecondMoveInfo
,
"等待出库移栽超时"
);
//WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待出库移栽超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
}
...
...
@@ -792,9 +791,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
(
60
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveStep
+
"] 扫码执行结束超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
30
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"扫码执行结束超时"
);
//WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 扫码执行结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 30);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_14_CylinderTake
))
...
...
@@ -1001,9 +1001,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
(
180
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
SLog
+
"]等待空托盘到达超时["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
22
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"等待空托盘到达超时"
);
//WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 22);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
FI_26_CylinderDown
))
...
...
@@ -1191,9 +1192,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
(
15
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveStep
+
"] 获取库位号超时 "
+
getPosIdMsg
+
" ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
30
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"获取库位号超时 "
+
getPosIdMsg
+
""
);
//WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveStep + "] 获取库位号超时 " + getPosIdMsg + " [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 30);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
...
...
@@ -1447,9 +1449,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
(
60
))
{
WarnMsg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待预扫码结束超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
21
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"等待预扫码结束超时"
);
//WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待预扫码结束超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
...
...
@@ -1499,8 +1502,9 @@ namespace OnlineStore.DeviceLibrary
}
else
{
WarnMsg
=
Name
+
"提升轴运动报警。上升到P3点已重复"
+
LoopCount
+
"次,仍未检测到料盘信号"
;
LogUtil
.
error
(
WarnMsg
);
//WarnMsg = Name + "提升轴运动报警。上升到P3点已重复" + LoopCount + "次,仍未检测到料盘信号";
//LogUtil.error(WarnMsg);
SetWarnMsg
(
"提升轴运动报警。上升到P3点已重复"
+
LoopCount
+
"次,仍未检测到料盘信号"
,
"提升轴运动报警,未检测到料盘信号"
);
Alarm
(
LineAlarmType
.
AxisMoveError
);
}
return
;
...
...
source/DeviceLibrary/assemblyLine/FeedingEquip_OutStore.cs
查看文件 @
0357949
...
...
@@ -744,9 +744,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
(
60
))
{
WarnMsg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待给服务器发送afterPut完成超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
21
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"等待给服务器发送afterPut完成超时"
);
//WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveStep + "] 等待给服务器发送afterPut完成超时 [" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 21);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
}
...
...
source/DeviceLibrary/assemblyLine/LineBean.cs
查看文件 @
0357949
...
...
@@ -719,7 +719,7 @@ namespace OnlineStore.DeviceLibrary
Thread
.
Sleep
(
300
);
if
(
IOValue
(
IO_Type
.
SuddenStop_BTN
).
Equals
(
IO_VALUE
.
LOW
))
{
SetWarnMsg
(
"收到急停信号,报警急停"
);
SetWarnMsg
(
"收到急停信号,报警急停"
,
"急停报警"
);
Alarm
(
LineAlarmType
.
SuddenStop
);
}
//});
...
...
@@ -865,7 +865,7 @@ namespace OnlineStore.DeviceLibrary
{
if
((
DateTime
.
Now
-
lastAirCloseTime
).
TotalSeconds
>
Config
.
AirCheckSeconds
)
{
SetWarnMsg
(
"持续"
+
Config
.
AirCheckSeconds
+
"秒未检测到气压信号"
);
SetWarnMsg
(
"持续"
+
Config
.
AirCheckSeconds
+
"秒未检测到气压信号"
,
"未检测到气压信号"
);
//SendAlarmCode(0, LineAlarm.NoAirCheck);
airValue
=
IO_VALUE
.
LOW
;
Alarm
(
LineAlarmType
.
NoAirCheck
);
...
...
@@ -1028,8 +1028,8 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
span
.
TotalSeconds
>
120
)
{
Warn
Msg
=
Name
+
"["
+
MoveInfo
.
MoveStep
+
"]["
+
msg
+
"]已等待["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
903
);
string
w
Msg
=
Name
+
"["
+
MoveInfo
.
MoveStep
+
"]["
+
msg
+
"]已等待["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
SetWarnMsg
(
wMsg
,
$
"{msg}超时"
,
MoveInfo
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
}
}
...
...
source/DeviceLibrary/assemblyLine/LineBean_Partial.cs
查看文件 @
0357949
...
...
@@ -110,9 +110,9 @@ namespace OnlineStore.DeviceLibrary
if
(
span
.
TotalSeconds
>
LineManager
.
Config
.
IOSingle_TimerOut
&&
NoAlarm
())
{
ConfigIO
io
=
baseConfig
.
getWaitIO
(
wait
.
IoType
);
WarnMsg
=
Name
+
"["
+
checkWaitInfo
.
MoveStep
+
"]等待"
+
NotOkMsg
+
" 超时"
;
string
warnMsg
=
checkWaitInfo
.
Name
+
"["
+
checkWaitInfo
.
MoveStep
+
"]等待"
+
NotOkMsg
+
" 超时"
;
SetWarnMsg
(
warnMsg
,
checkWaitInfo
.
GetStepDes
()+
"_超时报警"
,
checkWaitInfo
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
LogUtil
.
error
(
MoveInfo
.
Name
+
WarnMsg
,
901
);
}
//超过报警时长
else
if
(
rwSpan
.
TotalSeconds
>
5
&&
span
.
TotalSeconds
>
6
&&
span
.
TotalSeconds
<
LineManager
.
Config
.
IOSingle_TimerOut
*
2
)
...
...
@@ -183,11 +183,12 @@ namespace OnlineStore.DeviceLibrary
if
(
isOk
)
{
checkWaitInfo
.
EndStepWait
();
ClearStepAlarm
(
checkWaitInfo
.
GetStepDes
());
}
else
if
(
span
.
TotalSeconds
>
checkWaitInfo
.
TimeOutSeconds
)
{
War
nMsg
=
checkWaitInfo
.
Name
+
"["
+
checkWaitInfo
.
MoveStep
+
"]["
+
NotOkMsg
+
"]已等待["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
900
);
string
wa
nMsg
=
checkWaitInfo
.
Name
+
"["
+
checkWaitInfo
.
MoveStep
+
"]["
+
NotOkMsg
+
"]已等待["
+
Math
.
Round
(
span
.
TotalSeconds
,
1
)
+
"]秒"
;
SetWarnMsg
(
wanMsg
,
checkWaitInfo
.
GetStepDes
()+
"_超时报警"
,
checkWaitInfo
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
}
}
...
...
source/DeviceLibrary/assemblyLine/LineBean_Shunt.cs
查看文件 @
0357949
...
...
@@ -285,9 +285,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
Shunt_MoveInfo
.
IsTimeOut
(
120
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
SLog
+
"]等待分流横移2可以上升["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
12
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
Shunt_MoveInfo
,
"等待分流横移2可以上升"
);
//WarnMsg = Shunt_MoveInfo.Name + "[" + Shunt_MoveInfo.MoveType + "][" + Shunt_MoveInfo.SLog + "]等待分流横移2可以上升[" + Math.Round(Shunt_MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
if
(
Shunt_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
Shunt07_Top2Up
))
...
...
source/DeviceLibrary/assemblyLine/LineBean_Shunt2.cs
查看文件 @
0357949
...
...
@@ -337,9 +337,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
Shunt2_MoveInfo
.
IsTimeOut
(
120
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
SLog
+
"]等待分流横移22可以上升["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
12
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
Shunt2_MoveInfo
,
"等待分流横移2可以上升"
);
//WarnMsg = Shunt2_MoveInfo.Name + "[" + Shunt2_MoveInfo.MoveType + "][" + Shunt2_MoveInfo.SLog + "]等待分流横移22可以上升[" + Math.Round(Shunt2_MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
if
(
Shunt2_MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
Shunt07_Top2Up
))
...
...
source/DeviceLibrary/assemblyLine/MoveEquip.cs
查看文件 @
0357949
...
...
@@ -161,6 +161,7 @@ namespace OnlineStore.DeviceLibrary
}
else
{
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"复位"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
));
ResetEnd
();
}
...
...
source/DeviceLibrary/assemblyLine/MoveEquip_Partial.cs
查看文件 @
0357949
...
...
@@ -249,6 +249,8 @@ namespace OnlineStore.DeviceLibrary
CylinderMove
(
SecondMoveInfo
,
IO_Type
.
TopCylinder_UP
,
IO_Type
.
TopCylinder_Down
);
OutLog
(
"出库处理结束!"
);
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"出库"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
,
MoveInfo
.
MoveParam
.
PosId
,
MoveInfo
.
MoveParam
.
WareCode
));
MoveEndS
();
}
...
...
@@ -275,9 +277,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
(
300
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
SLog
+
"]等待空托盘到达超时["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
12
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"等待空托盘到达超时"
);
//WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.SLog + "]等待空托盘到达超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
return
false
;
}
return
false
;
...
...
@@ -521,13 +524,14 @@ namespace OnlineStore.DeviceLibrary
if
(
sendCount
>=
3
)
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveStep
+
"] "
+
" 等待BOX开始入库超时 已发送"
+
sendCount
+
"次"
;
LogUtil
.
error
(
WarnMsg
);
SetWarnMsg
(
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveStep
+
"] "
+
" 等待BOX开始入库超时 已发送"
+
sendCount
+
"次"
,
"等待BOX开始入库超时"
)
;
//
LogUtil.error(WarnMsg);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
}
}
else
{
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"入库"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
,
MoveInfo
.
MoveParam
.
PosId
,
MoveInfo
.
MoveParam
.
WareCode
));
sendCount
=
0
;
LogInfo
(
"入库【"
+
posId
+
"】处理(移栽)全部完成!"
);
MoveEndS
();
...
...
@@ -535,6 +539,7 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
MI_16_SendEnd
))
{
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"入库"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
,
MoveInfo
.
MoveParam
.
PosId
,
MoveInfo
.
MoveParam
.
WareCode
));
LogInfo
(
"入库【"
+
posId
+
"】处理(移栽)全部完成!"
);
MoveEndS
();
}
...
...
@@ -1072,8 +1077,8 @@ namespace OnlineStore.DeviceLibrary
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MIO_09_WaitLetFixtureGo
);
}
else
if
(
SecondMoveInfo
.
IsTimeOut
(
30
))
{
WarnM
sg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待开始入库超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnM
sg
+
",暂时放托盘离开"
);
string
m
sg
=
SecondMoveInfo
.
Name
+
"["
+
SecondMoveInfo
.
MoveStep
+
"] 等待开始入库超时 ["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
m
sg
+
",暂时放托盘离开"
);
SecondMoveInfo
.
NextMoveStep
(
LineMoveStep
.
MO_14_TopDown
);
InLog
(
"放托盘(放开阻挡): "
+
MoveInfo
.
SLog
+
" 入库超时,放托盘离开,顶升气缸1下降"
);
CylinderMove
(
SecondMoveInfo
,
IO_Type
.
TopCylinder_UP
,
IO_Type
.
TopCylinder_Down
);
...
...
@@ -1131,9 +1136,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
SecondMoveInfo
.
IsTimeOut
(
120
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
SLog
+
"]等待分流横移1空闲["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
12
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
SecondMoveInfo
,
"等待分流横移1空闲"
);
//WarnMsg = SecondMoveInfo.Name + "[" + SecondMoveInfo.MoveType + "][" + SecondMoveInfo.SLog + "]等待分流横移1空闲[" + Math.Round(SecondMoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 12);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
...
...
source/DeviceLibrary/assemblyLine/ProvidingEquip.cs
查看文件 @
0357949
...
...
@@ -133,6 +133,7 @@ namespace OnlineStore.DeviceLibrary
CylinderMove
(
MoveInfo
,
IO_Type
.
ClampCylinder_Slack
,
IO_Type
.
ClampCylinder_Tighten
);
break
;
case
LineMoveStep
.
MH_OtherCylinderBack
:
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"复位"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
));
MoveInfo
.
EndMove
();
SecondMoveInfo
.
EndMove
();
LogInfo
(
MoveInfo
.
MoveType
+
" 完成!"
);
...
...
source/DeviceLibrary/assemblyLine/ProvidingEquip_Partial.cs
查看文件 @
0357949
...
...
@@ -423,8 +423,9 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
SecondMoveInfo
.
IsTimeOut
(
30
))
{
WarnMsg
=
Name
+
TrayDisableManager
.
ProWarnMsg
+
"["
+
currTrayNum
+
"], 请处理并启用托盘,已超时["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
20
);
MoveTimeoutAlarm
(
SecondMoveInfo
,
"等待处理并启用托盘超时"
);
//WarnMsg = Name + TrayDisableManager.ProWarnMsg+ "[" + currTrayNum + "], 请处理并启用托盘,已超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
}
else
{
...
...
@@ -639,10 +640,10 @@ namespace OnlineStore.DeviceLibrary
PO_07_CylinderBefore
();
}
}
else
if
(
MoveInfo
.
MoveStep
.
Equals
(
LineMoveStep
.
PO_05_ClampCheck
))
{
PO_07_CylinderBefore
();
}
//
else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_05_ClampCheck))
//
{
//
PO_07_CylinderBefore();
//
}
//else if (MoveInfo.MoveStep.Equals(LineMoveStep.PO_06_WaitBox))
//{
// MoveInfo.NextMoveStep(LineMoveStep.PO_07_CylinderBefore);
...
...
@@ -681,9 +682,10 @@ namespace OnlineStore.DeviceLibrary
}
else
if
(
MoveInfo
.
IsTimeOut
())
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
MoveStep
+
"]等待 皮带线可放料 "
+
"超时["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
20
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"等待皮带线可放料超时"
);
//WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 皮带线可放料 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
else
...
...
@@ -707,14 +709,16 @@ namespace OnlineStore.DeviceLibrary
{
if
(
afterPutCutOK
)
{
RunLogUtil
.
MoveEndLog
(
new
MoveEndLog
(
Name
,
"出库"
,
MoveInfo
.
MoveStartTime
,
DateTime
.
Now
,
MoveInfo
.
MoveParam
.
PosId
,
MoveInfo
.
MoveParam
.
WareCode
));
OutLog
(
"出料【"
+
posId
+
"】处理完成!"
);
MoveEndS
();
}
else
if
(
MoveInfo
.
IsTimeOut
(
60
))
{
WarnMsg
=
MoveInfo
.
Name
+
"["
+
MoveInfo
.
MoveType
+
"]["
+
MoveInfo
.
MoveStep
+
"]等待 给服务器发送afterPutCutTask完成 "
+
"超时["
+
Math
.
Round
(
MoveInfo
.
StepSpan
().
TotalSeconds
,
1
)
+
"]秒"
;
LogUtil
.
error
(
WarnMsg
,
DeviceID
*
1000
+
20
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
MoveTimeoutAlarm
(
MoveInfo
,
"等待给服务器发送afterPutCutTask完成超时"
);
//WarnMsg = MoveInfo.Name + "[" + MoveInfo.MoveType + "][" + MoveInfo.MoveStep + "]等待 给服务器发送afterPutCutTask完成 " + "超时[" + Math.Round(MoveInfo.StepSpan().TotalSeconds, 1) + "]秒";
//LogUtil.error(WarnMsg, DeviceID * 1000 + 20);
//Alarm(LineAlarmType.IoSingleTimeOut);
}
}
}
...
...
source/DeviceLibrary/assemblymanager/ALineManager.cs
查看文件 @
0357949
...
...
@@ -3,6 +3,7 @@ using OnlineStore.Common;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -24,8 +25,11 @@ namespace OnlineStore.DeviceLibrary
public
LineManager
()
{
}
public
static
void
CheckEnum
(
Type
type
)
public
static
Dictionary
<
string
,
string
>
StepDesMap
=
new
Dictionary
<
string
,
string
>();
public
static
void
CheckEnum
(
Type
type
,
bool
isStep
=
false
)
{
if
(
type
.
IsEnum
)
{
List
<
int
>
valueList
=
new
List
<
int
>();
...
...
@@ -34,11 +38,18 @@ namespace OnlineStore.DeviceLibrary
{
if
(
valueList
.
Contains
(
item
))
{
LogUtil
.
error
(
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码!程序退出。"
);
LogUtil
.
error
(
type
.
Name
+
"枚举值:"
+
item
+
"重复存在,请检查代码!程序退出。"
);
Application
.
Exit
();
break
;
}
valueList
.
Add
(
item
);
if
(
isStep
)
{
LineMoveStep
en
=
(
LineMoveStep
)
item
;
string
des
=
EnumDesHelper
.
GetStepDes
(
en
);
StepDesMap
.
Add
(
en
.
ToString
(),
des
);
}
}
}
}
...
...
@@ -72,13 +83,13 @@ namespace OnlineStore.DeviceLibrary
{
IsConnectServer
=
true
;
}
CheckEnum
(
typeof
(
LineMoveStep
));
CheckEnum
(
typeof
(
LineMoveStep
)
,
true
);
CheckEnum
(
typeof
(
LineStatus
));
CheckEnum
(
typeof
(
LineRunStatus
));
isInit
=
true
;
string
lineType
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
Line_Type
);
LogUtil
.
info
(
" 类型="
+
lineType
+
",开始加载 配置"
);
LogUtil
.
info
(
" 类型="
+
lineType
+
",开始加载 配置"
);
if
(
lineType
==
DeviceType
.
Line
)
{
string
appPath
=
Application
.
StartupPath
;
...
...
@@ -93,7 +104,7 @@ namespace OnlineStore.DeviceLibrary
{
string
nameStr
=
i
.
ToString
().
PadLeft
(
2
,
'0'
);
string
config
=
appPath
+
moveEquipConfig
.
Replace
(
".csv"
,
"_"
+
nameStr
+
".csv"
);
MoveEquip_Config
moveConfig
=
CSVConfigReader
.
LoadMoveConfig
(
i
,
DeviceType
.
MoveEquip
,
config
);
MoveEquip_Config
moveConfig
=
CSVConfigReader
.
LoadMoveConfig
(
i
,
DeviceType
.
MoveEquip
,
config
);
int
subType
=
i
;
// moveConfig.SetIO(subType);
moveECMap
.
Add
(
i
,
moveConfig
);
...
...
@@ -111,7 +122,7 @@ namespace OnlineStore.DeviceLibrary
{
int
subType
=
100
+
i
;
string
config
=
appPath
+
feedingEquipConfig
.
Replace
(
".csv"
,
"_"
+
i
+
".csv"
);
FeedingEquip_Config
moveConfig
=
CSVConfigReader
.
LoadFeedingConfig
(
subType
,
DeviceType
.
FeedingEquip
,
config
);
FeedingEquip_Config
moveConfig
=
CSVConfigReader
.
LoadFeedingConfig
(
subType
,
DeviceType
.
FeedingEquip
,
config
);
moveConfig
.
SetIO
(
subType
);
feedingECMap
.
Add
(
subType
,
moveConfig
);
allConfigMap
.
Add
(
subType
,
moveConfig
);
...
...
@@ -123,7 +134,7 @@ namespace OnlineStore.DeviceLibrary
{
int
subType
=
200
+
i
;
string
config
=
appPath
+
providingEquipConfig
.
Replace
(
".csv"
,
"_"
+
i
+
".csv"
);
ProvidingEquip_Config
moveConfig
=
CSVConfigReader
.
LoadProvidingConfig
(
subType
,
DeviceType
.
ProvidingEquip
,
config
);
ProvidingEquip_Config
moveConfig
=
CSVConfigReader
.
LoadProvidingConfig
(
subType
,
DeviceType
.
ProvidingEquip
,
config
);
moveConfig
.
SetIO
(
subType
);
providingECMap
.
Add
(
subType
,
moveConfig
);
allConfigMap
.
Add
(
subType
,
moveConfig
);
...
...
@@ -135,7 +146,7 @@ namespace OnlineStore.DeviceLibrary
{
int
subType
=
300
+
i
;
string
config
=
appPath
+
dischargeLineConfig
.
Replace
(
".csv"
,
"_"
+
i
+
".csv"
);
DischargeLine_Config
moveConfig
=
CSVConfigReader
.
LoadDischargeLineConfig
(
subType
,
DeviceType
.
DischargeLine
,
config
);
DischargeLine_Config
moveConfig
=
CSVConfigReader
.
LoadDischargeLineConfig
(
subType
,
DeviceType
.
DischargeLine
,
config
);
moveConfig
.
SetIO
(
subType
);
disChargeLineMap
.
Add
(
subType
,
moveConfig
);
allConfigMap
.
Add
(
subType
,
moveConfig
);
...
...
@@ -143,7 +154,7 @@ namespace OnlineStore.DeviceLibrary
Config
.
SetIO
(
1000
);
Line
=
new
LineBean
(
Config
,
moveECMap
,
feedingECMap
,
providingECMap
,
disChargeLineMap
);
LoadTrayCheck
();
LogUtil
.
info
(
"加载 完成!"
);
LogUtil
.
info
(
"加载 完成!"
);
return
true
;
}
}
...
...
@@ -154,7 +165,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
,
ex
);
LogUtil
.
error
(
"出错:"
,
ex
);
MessageBox
.
Show
(
ex
.
ToString
(),
"加载配置错误(请检查配置)"
);
Application
.
Exit
();
}
...
...
@@ -169,9 +180,9 @@ namespace OnlineStore.DeviceLibrary
//位置配置到文件中
string
appPath
=
Application
.
StartupPath
;
string
moveEquipConfig
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ConfigPath_MoveEquip
);
string
configStr
=
appPath
+
moveEquipConfig
.
Replace
(
".csv"
,
"_"
+
config
.
Id
.
ToString
().
PadLeft
(
2
,
'0'
)
+
".csv"
);
string
configStr
=
appPath
+
moveEquipConfig
.
Replace
(
".csv"
,
"_"
+
config
.
Id
.
ToString
().
PadLeft
(
2
,
'0'
)
+
".csv"
);
allConfigMap
[
config
.
Id
]
=
config
;
bool
result
=
CSVConfigReader
.
SaveConfig
(
configStr
,
config
,
typeof
(
MoveEquip_Config
));
bool
result
=
CSVConfigReader
.
SaveConfig
(
configStr
,
config
,
typeof
(
MoveEquip_Config
));
if
(!
result
)
{
LogUtil
.
error
(
"保存配置文件失败:"
+
configStr
);
...
...
@@ -179,7 +190,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
,
ex
);
LogUtil
.
error
(
"出错:"
,
ex
);
}
}
public
static
void
SaveFeedingEquipConfig
(
FeedingEquip_Config
config
)
...
...
@@ -191,9 +202,9 @@ namespace OnlineStore.DeviceLibrary
string
moveEquipConfig
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
ConfigPath_FeedingEquip
);
int
id
=
config
.
Id
-
100
;
string
configStr
=
appPath
+
moveEquipConfig
.
Replace
(
".csv"
,
"_"
+
id
+
".csv"
);
string
configStr
=
appPath
+
moveEquipConfig
.
Replace
(
".csv"
,
"_"
+
id
+
".csv"
);
allConfigMap
[
config
.
Id
]
=
config
;
bool
result
=
CSVConfigReader
.
SaveConfig
(
configStr
,
config
,
typeof
(
FeedingEquip_Config
));
bool
result
=
CSVConfigReader
.
SaveConfig
(
configStr
,
config
,
typeof
(
FeedingEquip_Config
));
if
(!
result
)
{
LogUtil
.
error
(
"保存配置文件失败:"
+
configStr
);
...
...
@@ -201,7 +212,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
,
ex
);
LogUtil
.
error
(
"出错:"
,
ex
);
}
}
public
static
void
SaveProvidingEquipConfig
(
ProvidingEquip_Config
config
)
...
...
@@ -214,7 +225,7 @@ namespace OnlineStore.DeviceLibrary
int
id
=
config
.
Id
-
200
;
string
configStr
=
appPath
+
moveEquipConfig
.
Replace
(
".csv"
,
"_"
+
id
+
".csv"
);
allConfigMap
[
config
.
Id
]
=
config
;
bool
result
=
CSVConfigReader
.
SaveConfig
(
configStr
,
config
,
typeof
(
ProvidingEquip_Config
));
bool
result
=
CSVConfigReader
.
SaveConfig
(
configStr
,
config
,
typeof
(
ProvidingEquip_Config
));
if
(!
result
)
{
LogUtil
.
error
(
"保存配置文件失败:"
+
configStr
);
...
...
@@ -222,7 +233,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
,
ex
);
LogUtil
.
error
(
"出错:"
,
ex
);
}
}
...
...
@@ -245,7 +256,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"出错:"
,
ex
);
LogUtil
.
error
(
"出错:"
,
ex
);
}
}
...
...
@@ -262,7 +273,7 @@ namespace OnlineStore.DeviceLibrary
{
string
config
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
UseTrayCheck
);
string
[]
array
=
config
.
Split
(
','
);
foreach
(
string
st
in
array
)
foreach
(
string
st
in
array
)
{
try
{
...
...
@@ -284,7 +295,7 @@ namespace OnlineStore.DeviceLibrary
}
useTrayCheck
.
Add
(
id
);
string
config
=
""
;
foreach
(
int
i
in
useTrayCheck
)
foreach
(
int
i
in
useTrayCheck
)
{
config
+=
i
+
","
;
}
...
...
source/DeviceLibrary/model/KTK_Store.cs
查看文件 @
0357949
...
...
@@ -28,10 +28,9 @@ namespace OnlineStore.DeviceLibrary
/// 9=出库执行,10=出仓完成,11=出库失败
/// </summary>
public
LineStatus
lineStatus
=
LineStatus
.
ResetMove
;
/// <summary>
/// 提示消息,一般发给服务器后清空(LineBean表示报警提示消息,BoxBean表示出入库失败的原因记录)
/// </summary>
public
string
WarnMsg
=
""
;
private
WarnParam
warnParam
=
new
WarnParam
();
public
DeviceConfig
baseConfig
=
null
;
public
string
Name
{
get
;
set
;
}
public
int
DeviceID
{
get
;
set
;
}
...
...
@@ -132,7 +131,7 @@ namespace OnlineStore.DeviceLibrary
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"BusyMoveProcess出错:"
,
ex
);
LogUtil
.
error
(
"BusyMoveProcess出错:"
,
ex
);
}
isInPro
=
false
;
}
...
...
@@ -198,9 +197,9 @@ namespace OnlineStore.DeviceLibrary
}
if
(
alarmType
.
Equals
(
LineAlarmType
.
None
))
{
return
true
;
return
true
;
}
return
false
;
return
false
;
}
/// <summary>
/// 开始运行
...
...
@@ -214,7 +213,7 @@ namespace OnlineStore.DeviceLibrary
/// 报警
/// </summary>
/// <param name="alarmType"></param>
public
abstract
void
Alarm
(
LineAlarmType
alarmType
);
public
abstract
void
Alarm
(
LineAlarmType
alarmType
);
/// <summary>
/// 重置(夹料装置状态不变)
/// </summary>
...
...
@@ -223,7 +222,7 @@ namespace OnlineStore.DeviceLibrary
/// <summary>
/// 停止所有运动
/// </summary>
internal
abstract
void
StopMove
(
);
internal
abstract
void
StopMove
();
/// <summary>
/// 重置处理
...
...
@@ -273,37 +272,8 @@ namespace OnlineStore.DeviceLibrary
protected
abstract
void
InStoreProcess
();
#
endregion
public
void
SetWarnMsg
(
string
msg
=
""
)
{
if
(
String
.
IsNullOrEmpty
(
msg
).
Equals
(
false
))
{
if
(
WarnMsg
.
Equals
(
msg
))
{
if
(
msg
.
StartsWith
(
Name
))
{
LogUtil
.
error
(
msg
,
801
);
}
else
{
LogUtil
.
error
(
Name
+
msg
,
801
);
}
}
else
{
if
(
msg
.
StartsWith
(
Name
))
{
LogUtil
.
error
(
msg
);
}
else
{
LogUtil
.
error
(
Name
+
msg
);
}
}
}
WarnMsg
=
msg
;
}
public
string
GetRunStr
(
)
public
string
GetRunStr
()
{
string
sta
=
"运行中"
;
string
aa
=
""
;
...
...
@@ -368,7 +338,7 @@ namespace OnlineStore.DeviceLibrary
if
(
isInSuddenDown
)
{
aa
=
"急停中"
;
}
else
if
(
isNoAirCheck
)
}
else
if
(
isNoAirCheck
)
{
aa
=
"无气压信号"
;
}
...
...
@@ -457,7 +427,7 @@ namespace OnlineStore.DeviceLibrary
}
public
bool
CylinderIsOk
(
string
IoLowType
,
string
IoHighType
)
{
if
(
IOManager
.
DIValue
(
IoLowType
,
DeviceID
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOManager
.
DIValue
(
IoHighType
,
DeviceID
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
IOManager
.
DIValue
(
IoLowType
,
DeviceID
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOManager
.
DIValue
(
IoHighType
,
DeviceID
).
Equals
(
IO_VALUE
.
HIGH
))
{
return
true
;
}
return
false
;
...
...
@@ -520,9 +490,9 @@ namespace OnlineStore.DeviceLibrary
IOMove
(
IoLowType
,
IO_VALUE
.
LOW
);
IOMove
(
IoHighType
,
IO_VALUE
.
HIGH
);
}
}
catch
(
Exception
ex
)
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
Name
+
"CylinderMove ["
+
moveInfo
.
Name
+
"] ["
+
IoLowType
+
"] ["
+
IoHighType
+
"] ["
+
isCheckMove
+
"] 出错:"
+
ex
.
ToString
());
LogUtil
.
error
(
Name
+
"CylinderMove ["
+
moveInfo
.
Name
+
"] ["
+
IoLowType
+
"] ["
+
IoHighType
+
"] ["
+
isCheckMove
+
"] 出错:"
+
ex
.
ToString
());
}
}
...
...
@@ -555,7 +525,7 @@ namespace OnlineStore.DeviceLibrary
IO_VALUE
tValue
=
value
.
Equals
(
IO_VALUE
.
HIGH
)
?
IO_VALUE
.
LOW
:
IO_VALUE
.
HIGH
;
if
(
IOValue
(
IoType
).
Equals
(
tValue
).
Equals
(
false
))
{
if
(
IoType
.
Equals
(
IO_Type
.
StopCylinder_Down1
).
Equals
(
false
)
&&
IoType
.
Equals
(
IO_Type
.
SW_StopDown
).
Equals
(
false
))
if
(
IoType
.
Equals
(
IO_Type
.
StopCylinder_Down1
).
Equals
(
false
)
&&
IoType
.
Equals
(
IO_Type
.
SW_StopDown
).
Equals
(
false
))
{
LogUtil
.
info
(
Name
+
"定时回写IO: ["
+
IoType
+
"]=["
+
value
+
"],["
+
baseConfig
.
Id
+
"],msTime="
+
msTime
);
}
...
...
@@ -601,6 +571,143 @@ namespace OnlineStore.DeviceLibrary
return
false
;
}
}
/// <summary>
/// 设置报警消息,报警类型,清除报警时记录日志
/// </summary>
/// <param name="msg"></param>
/// <param name="logtype"></param>
/// <param name="logseconds"></param>
public
void
SetWarnMsg
(
string
msg
=
""
,
string
alarmType
=
""
,
LineMoveInfo
moveInfo
=
null
,
int
logseconds
=
10
)
{
int
logtype
=
801
;
if
(
moveInfo
!=
null
)
{
logtype
=
DeviceID
*
10000
+
(
int
)
moveInfo
.
MoveStep
;
}
if
(
String
.
IsNullOrEmpty
(
msg
).
Equals
(
false
))
{
if
(
WarnMsg
.
Equals
(
msg
))
{
if
(
msg
.
StartsWith
(
Name
))
{
LogUtil
.
error
(
msg
,
logtype
,
logseconds
);
}
else
{
LogUtil
.
error
(
Name
+
msg
,
logtype
,
logseconds
);
}
}
else
{
if
(
msg
.
StartsWith
(
Name
))
{
LogUtil
.
error
(
msg
);
}
else
{
LogUtil
.
error
(
Name
+
msg
);
}
}
}
if
(!
warnParam
.
AlarmType
.
Equals
(
alarmType
))
{
//报警类型不一致,若之前不是空,记录日志
if
(!
String
.
IsNullOrEmpty
(
warnParam
.
AlarmType
))
{
RunLogUtil
.
ErrorLog
(
new
ErrorLog
(
Name
,
warnParam
.
AlarmType
,
WarnMsg
,
warnParam
.
StartTime
,
DateTime
.
Now
,
warnParam
.
OperteType
,
warnParam
.
PosId
,
warnParam
.
Barcode
));
}
//更新开始时间
warnParam
.
StartTime
=
DateTime
.
Now
;
if
(
moveInfo
!=
null
)
{
warnParam
.
PosId
=
moveInfo
.
MoveParam
?.
PosId
;
warnParam
.
Barcode
=
moveInfo
.
MoveParam
?.
WareCode
;
warnParam
.
OperteType
=
moveInfo
.
GetMoveType
();
}
else
{
warnParam
.
PosId
=
""
;
warnParam
.
Barcode
=
""
;
warnParam
.
OperteType
=
""
;
}
}
WarnMsg
=
msg
;
warnParam
.
AlarmType
=
alarmType
;
}
protected
void
MoveTimeoutAlarm
(
LineMoveInfo
move
,
string
alarmType
)
{
SetWarnMsg
(
move
.
Name
+
"["
+
move
.
GetMoveType
()
+
"]["
+
move
.
SLog
+
"] "
+
alarmType
+
" ["
+
FormUtil
.
GetSpanStr
(
move
.
StepSpan
())
+
"]"
,
alarmType
,
move
);
Alarm
(
LineAlarmType
.
IoSingleTimeOut
);
}
protected
void
ClearTimeoutAlarm
(
string
msg
)
{
if
(
isInSuddenDown
||
isNoAirCheck
)
{
return
;
}
if
(
WarnMsg
.
Contains
(
msg
)
&&
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
))
{
LogUtil
.
info
(
Name
+
"清理信号超时报警【"
+
WarnMsg
+
"】 "
);
alarmType
=
LineAlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
protected
void
ClearStepAlarm
(
string
stepDes
)
{
if
(
isInSuddenDown
||
isNoAirCheck
)
{
return
;
}
if
(
String
.
IsNullOrEmpty
(
WarnMsg
).
Equals
(
false
)
&&
String
.
IsNullOrEmpty
(
warnParam
.
AlarmType
).
Equals
(
false
))
{
if
(
alarmType
.
Equals
(
LineAlarmType
.
IoSingleTimeOut
)){
string
alarmTypeStr
=
stepDes
+
"_超时报警"
;
if
(
warnParam
.
AlarmType
.
Equals
(
alarmTypeStr
))
{
LogUtil
.
info
(
Name
+
$
"步骤{stepDes}结束,清理【{ WarnMsg }】 "
);
alarmType
=
LineAlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
else
if
(
alarmType
.
Equals
(
LineAlarmType
.
AxisMoveError
))
{
string
alarmTypeStr
=
stepDes
+
"_轴运动报警"
;
if
(
warnParam
.
AlarmType
.
Equals
(
alarmTypeStr
))
{
LogUtil
.
info
(
Name
+
$
"步骤{stepDes}结束,清理【{ WarnMsg }】 "
);
alarmType
=
LineAlarmType
.
None
;
SetWarnMsg
(
""
);
}
}
}
}
}
public
class
WarnParam
{
public
WarnParam
()
{
}
public
WarnParam
(
string
alarmType
,
DateTime
startTime
,
string
operType
,
string
posId
,
string
barcode
)
{
this
.
AlarmType
=
alarmType
;
this
.
StartTime
=
startTime
;
this
.
OperteType
=
operType
;
this
.
PosId
=
posId
;
this
.
Barcode
=
barcode
;
}
public
string
AlarmType
=
""
;
public
DateTime
StartTime
=
DateTime
.
Now
;
public
string
OperteType
=
""
;
public
string
PosId
=
""
;
public
string
Barcode
=
""
;
}
}
source/DeviceLibrary/model/LineMoveInfo.cs
查看文件 @
0357949
...
...
@@ -3,6 +3,7 @@ using OnlineStore.DeviceLibrary;
using
OnlineStore.LoadCSVLibrary
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
...
...
@@ -36,6 +37,9 @@ namespace OnlineStore.DeviceLibrary
public
DateTime
LastSetpTime
{
get
;
set
;
}
public
DateTime
MoveStartTime
{
get
;
set
;
}
/// <summary>
/// =true表示满足一个等待条件,就可以完成此步骤的等待
/// </summary>
...
...
@@ -82,6 +86,22 @@ namespace OnlineStore.DeviceLibrary
{
get
{
return
moveStep
;
}
}
public
string
GetStepDes
()
{
string
currName
=
moveStep
.
ToString
();
try
{
if
(
LineManager
.
StepDesMap
.
ContainsKey
(
currName
))
{
return
LineManager
.
StepDesMap
[
currName
];
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"GetStepDes 出错:"
+
ex
.
ToString
());
}
return
currName
;
}
public
string
SLog
{
get
{
return
" "
+
MoveStep
+
" "
;
}
...
...
@@ -100,8 +120,31 @@ namespace OnlineStore.DeviceLibrary
TimeSpan
span
=
DateTime
.
Now
-
LastSetpTime
;
return
span
;
}
public
string
GetMoveType
()
{
switch
(
moveType
)
{
case
LineMoveType
.
CheckFixture
:
return
"托盘处理"
;
break
;
case
LineMoveType
.
InStore
:
return
"入料"
;
break
;
case
LineMoveType
.
OutStore
:
return
"出料"
;
break
;
case
LineMoveType
.
Reset
:
return
"复位"
;
break
;
case
LineMoveType
.
ReturnHome
:
return
"回原"
;
break
;
}
return
""
;
}
public
void
NextMoveStep
(
LineMoveStep
step
)
{
StepMoveLog
();
PreMoveStep
=
moveStep
;
moveStep
=
step
;
LastSetpTime
=
DateTime
.
Now
;
...
...
@@ -111,6 +154,18 @@ namespace OnlineStore.DeviceLibrary
OneWaitCanEndStep
=
false
;
CanWhileCount
=
5
;
}
private
void
StepMoveLog
()
{
try
{
RunLogUtil
.
MoveLog
(
new
MoveLog
(
Name
,
GetMoveType
(),
GetStepDes
(),
LastSetpTime
,
DateTime
.
Now
,
MoveParam
.
PosId
,
MoveParam
.
WareCode
));
}
catch
(
Exception
ex
)
{
}
}
/// <summary>
/// 当前步骤执行完成
/// </summary>
...
...
@@ -128,6 +183,7 @@ namespace OnlineStore.DeviceLibrary
WaitList
=
new
List
<
WaitResultInfo
>();
WriteIoList
=
new
List
<
WriteIOInfo
>();
MoveNum
++;
MoveStartTime
=
DateTime
.
Now
;
}
public
void
NewMove
(
LineMoveType
type
,
InOutParam
param
)
{
...
...
@@ -137,9 +193,11 @@ namespace OnlineStore.DeviceLibrary
LastSetpTime
=
DateTime
.
Now
;
WaitList
=
new
List
<
WaitResultInfo
>();
WriteIoList
=
new
List
<
WriteIOInfo
>();
MoveStartTime
=
DateTime
.
Now
;
}
public
void
EndMove
()
{
StepMoveLog
();
this
.
moveType
=
LineMoveType
.
None
;
this
.
MoveParam
=
null
;
moveStep
=
LineMoveStep
.
Wait
;
...
...
@@ -217,40 +275,40 @@ namespace OnlineStore.DeviceLibrary
wait
.
IsEnd
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitStell
(
byte
slvAddr
,
int
targetPosition
,
int
speed
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
10
;
wait
.
WaitType
=
WaitEnum
.
W004_StellMove
;
wait
.
SlvAddr
=
slvAddr
;
wait
.
IsHomeMove
=
false
;
wait
.
TargetPosition
=
targetPosition
;
wait
.
TargetSpeed
=
speed
;
wait
.
IsEnd
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitStellHome
(
byte
slvAddr
,
int
targetPosition
,
int
speed
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
10
;
wait
.
WaitType
=
WaitEnum
.
W004_StellMove
;
wait
.
SlvAddr
=
slvAddr
;
wait
.
IsHomeMove
=
true
;
wait
.
TargetPosition
=
0
;
wait
.
TargetSpeed
=
speed
;
wait
.
IsEnd
=
false
;
return
wait
;
}
public
static
WaitResultInfo
WaitShuoKe
(
int
slvAddr
,
int
targetPosition
,
bool
isHome
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
wait
.
CanWhileMoveCount
=
0
;
wait
.
WaitType
=
WaitEnum
.
W005_ShuoKe
;
wait
.
SlvAddr
=(
byte
)
slvAddr
;
wait
.
TargetPosition
=
targetPosition
;
wait
.
IsHomeMove
=
isHome
;
return
wait
;
}
//
public static WaitResultInfo WaitStell(byte slvAddr, int targetPosition, int speed)
//
{
//
WaitResultInfo wait = new WaitResultInfo();
//
wait.CanWhileMoveCount =10;
//
wait.WaitType = WaitEnum.W004_StellMove;
//
wait.SlvAddr = slvAddr;
//
wait.IsHomeMove = false;
//
wait.TargetPosition = targetPosition;
//
wait.TargetSpeed = speed;
//
wait.IsEnd = false;
//
return wait;
//
}
//
public static WaitResultInfo WaitStellHome(byte slvAddr, int targetPosition, int speed)
//
{
//
WaitResultInfo wait = new WaitResultInfo();
//
wait.CanWhileMoveCount = 10;
//
wait.WaitType = WaitEnum.W004_StellMove;
//
wait.SlvAddr = slvAddr;
//
wait.IsHomeMove = true;
//
wait.TargetPosition = 0;
//
wait.TargetSpeed = speed;
//
wait.IsEnd = false;
//
return wait;
//
}
//
public static WaitResultInfo WaitShuoKe(int slvAddr, int targetPosition, bool isHome)
//
{
//
WaitResultInfo wait = new WaitResultInfo();
//
wait.CanWhileMoveCount = 0;
//
wait.WaitType = WaitEnum.W005_ShuoKe;
//
wait.SlvAddr =(byte) slvAddr;
//
wait.TargetPosition = targetPosition;
//
wait.IsHomeMove = isHome;
//
return wait;
//
}
public
static
WaitResultInfo
WaitTime
(
int
MScends
)
{
WaitResultInfo
wait
=
new
WaitResultInfo
();
...
...
@@ -573,9 +631,5 @@ namespace OnlineStore.DeviceLibrary
/// 移栽装置的停止,需要先远点返回,然后停止
/// </summary>
StopMove
=
5
,
///// <summary>
///// 移栽检测托盘
///// </summary>
//CheckFixture=6,
}
}
source/DeviceLibrary/model/StoreStep.cs
查看文件 @
0357949
此文件的差异被折叠,
点击展开。
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论