Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
RC1250-AssemblyLine
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 4925708c
由
LN
编写于
2020-05-26 09:22:37 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
皮带线停止增加事件触发。
1 个父辈
164fd4bf
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
79 行增加
和
63 行删除
source/AssemblyLineClient/FrmLineStore.cs
source/DeviceLibrary/assemblyLine/DischargeLine.cs
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
source/DeviceLibrary/assemblyLine/OutTrayLineBean.cs
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOXManager.cs
source/DeviceLibrary/deviceLibrary/IO/IOManager.cs
source/AssemblyLineClient/FrmLineStore.cs
查看文件 @
4925708
...
@@ -446,6 +446,7 @@ namespace OnlineStore.AssemblyLine
...
@@ -446,6 +446,7 @@ namespace OnlineStore.AssemblyLine
MessageBox
.
Show
(
"已复制日志到粘贴板!"
);
MessageBox
.
Show
(
"已复制日志到粘贴板!"
);
}
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
DateTime
lastLogTime
=
DateTime
.
Now
;
PerformanceCounter
curtime
=
null
;
private
void
LogM
()
private
void
LogM
()
{
{
try
try
...
@@ -454,23 +455,19 @@ namespace OnlineStore.AssemblyLine
...
@@ -454,23 +455,19 @@ namespace OnlineStore.AssemblyLine
if
(
sp
.
TotalMinutes
>
10
)
if
(
sp
.
TotalMinutes
>
10
)
{
{
lastLogTime
=
DateTime
.
Now
;
lastLogTime
=
DateTime
.
Now
;
Process
[]
processes
=
Process
.
GetProcesses
();
long
totalMemery
=
0
;
StringBuilder
sbResult
=
new
StringBuilder
();
var
prevCpuTime
=
TimeSpan
.
Zero
;
int
interval
=
1000
;
foreach
(
Process
process
in
processes
)
{
if
(
process
.
ProcessName
.
EndsWith
(
"AssemblyLine"
))
{
sbResult
.
AppendFormat
(
DateTime
.
Now
.
ToLongTimeString
()
+
", 名称:{0} 内存:{1}M "
,
process
.
ProcessName
,
process
.
PrivateMemorySize64
/
1024
/
1024F
);
totalMemery
+=
process
.
PrivateMemorySize64
/
1024
;
double
value
=
(
process
.
TotalProcessorTime
-
prevCpuTime
).
TotalMilliseconds
/
interval
/
Environment
.
ProcessorCount
;
sbResult
.
AppendFormat
(
" CPU : "
+
Math
.
Round
(
value
,
2
)
+
"%"
);
// string result = string.Format("进程总数 {0} 个,共占内存:{1}MB \n", processes.Length, totalMemery / 1024) + sbResult.ToString();
LogUtil
.
info
(
sbResult
.
ToString
());
}
Process
process
=
Process
.
GetCurrentProcess
();
if
(
curtime
==
null
)
{
curtime
=
new
PerformanceCounter
(
"Process"
,
"% Processor Time"
,
process
.
ProcessName
);
}
if
(
process
!=
null
)
{
StringBuilder
sbResult
=
new
StringBuilder
();
PerformanceCounter
pf1
=
new
PerformanceCounter
(
"Process"
,
"Working Set - Private"
,
process
.
ProcessName
);
sbResult
.
AppendFormat
(
DateTime
.
Now
.
ToLongTimeString
()
+
", 名称:{0} 内存:{1}M "
,
process
.
ProcessName
,
Math
.
Round
(
pf1
.
NextValue
()
/
1024
/
1024F
,
2
));
sbResult
.
AppendFormat
(
", CPU : {0} %"
,
curtime
.
NextValue
());
LogUtil
.
info
(
sbResult
.
ToString
());
}
}
}
}
}
}
...
@@ -478,7 +475,7 @@ namespace OnlineStore.AssemblyLine
...
@@ -478,7 +475,7 @@ namespace OnlineStore.AssemblyLine
{
{
LogUtil
.
error
(
"LogM Error: "
,
ex
);
LogUtil
.
error
(
"LogM Error: "
,
ex
);
}
}
}
}
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
private
void
timer1_Tick
(
object
sender
,
EventArgs
e
)
{
{
LogM
();
LogM
();
...
...
source/DeviceLibrary/assemblyLine/DischargeLine.cs
查看文件 @
4925708
...
@@ -56,7 +56,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -56,7 +56,7 @@ namespace OnlineStore.DeviceLibrary
TrayLine1
=
new
OutTrayLineBean
(
330
+
((
id
-
1
)
*
3
+
1
),
"皮带线"
+
"_"
+
((
id
-
1
)
*
3
+
1
)
+
" "
,
IO_Type
.
ExitLocation_Check1
,
IO_Type
.
ExitTray_Check1
,
IO_Type
.
DLine_Run1
,
IO_Type
.
MiddleTray_Check3
,
this
.
DeviceID
);
TrayLine1
=
new
OutTrayLineBean
(
330
+
((
id
-
1
)
*
3
+
1
),
"皮带线"
+
"_"
+
((
id
-
1
)
*
3
+
1
)
+
" "
,
IO_Type
.
ExitLocation_Check1
,
IO_Type
.
ExitTray_Check1
,
IO_Type
.
DLine_Run1
,
IO_Type
.
MiddleTray_Check3
,
this
.
DeviceID
);
TrayLine2
=
new
OutTrayLineBean
(
330
+((
id
-
1
)
*
3
+
2
),
"皮带线"
+
"_"
+
((
id
-
1
)
*
3
+
2
)
+
" "
,
IO_Type
.
ExitLocation_Check2
,
IO_Type
.
ExitTray_Check2
,
IO_Type
.
DLine_Run2
,
IO_Type
.
EntryTray_Check3
,
this
.
DeviceID
);
TrayLine2
=
new
OutTrayLineBean
(
330
+((
id
-
1
)
*
3
+
2
),
"皮带线"
+
"_"
+
((
id
-
1
)
*
3
+
2
)
+
" "
,
IO_Type
.
ExitLocation_Check2
,
IO_Type
.
ExitTray_Check2
,
IO_Type
.
DLine_Run2
,
IO_Type
.
EntryTray_Check3
,
this
.
DeviceID
);
}
}
Line3Turn
=
new
LineTurnBean
(
DeviceID
);
Line3Turn
=
new
LineTurnBean
(
DeviceID
,
IO_Type
.
DLine_Run3
,
IO_Type
.
Location_Check3
);
if
((
DeviceID
%
100
).
Equals
(
1
))
if
((
DeviceID
%
100
).
Equals
(
1
))
{
{
Line3MaxPosition
=
13
;
Line3MaxPosition
=
13
;
...
@@ -423,7 +423,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -423,7 +423,7 @@ namespace OnlineStore.DeviceLibrary
//判断皮带三还有料盘,需要转动一个工位
//判断皮带三还有料盘,需要转动一个工位
UpdateLastP
();
UpdateLastP
();
LogUtil
.
debug
(
hengyiName
+
"空闲,且流水线还有料盘,转动一个工位"
);
LogUtil
.
debug
(
hengyiName
+
"空闲,且流水线还有料盘,转动一个工位"
);
Line3Turn
.
StartLineRun
(
IO_Type
.
DLine_Run3
,
IO_Type
.
Location_Check3
,
Line3EndProcess
);
Line3Turn
.
StartLineRun
(
Line3EndProcess
);
}
}
}
}
private
void
UpdateLastP
()
private
void
UpdateLastP
()
...
...
source/DeviceLibrary/assemblyLine/DischargeLine_Partial.cs
查看文件 @
4925708
...
@@ -318,7 +318,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -318,7 +318,7 @@ namespace OnlineStore.DeviceLibrary
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_05_LineRun
);
MoveInfo
.
NextMoveStep
(
LineMoveStep
.
DON_05_LineRun
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,NG->接驳台,转动接驳台皮带"
);
LogUtil
.
info
(
hengyiName
+
MoveInfo
.
SLog
+
"送料,NG->接驳台,转动接驳台皮带"
);
// IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
// IOMove(IO_Type.SeparateDevice_Run, IO_VALUE.HIGH);
Line3Turn
.
StartLineRun
(
IO_Type
.
DLine_Run3
,
IO_Type
.
Location_Check3
,
Line3EndProcess
);
Line3Turn
.
StartLineRun
(
Line3EndProcess
);
SeparateLineRun
(
MoveInfo
);
SeparateLineRun
(
MoveInfo
);
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
3000
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Location_Check3
,
IO_VALUE
.
HIGH
));
MoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
Location_Check3
,
IO_VALUE
.
HIGH
));
...
...
source/DeviceLibrary/assemblyLine/OutTrayLineBean.cs
查看文件 @
4925708
此文件的差异被折叠,
点击展开。
source/DeviceLibrary/deviceLibrary/IO/AIOBOX/AIOBOXManager.cs
查看文件 @
4925708
...
@@ -28,19 +28,19 @@ namespace OnlineStore.DeviceLibrary
...
@@ -28,19 +28,19 @@ namespace OnlineStore.DeviceLibrary
private
object
DILock
=
""
;
private
object
DILock
=
""
;
private
object
DOLock
=
""
;
private
object
DOLock
=
""
;
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
public
override
void
ConnectionIOList
(
List
<
string
>
DIONameList
)
{
{
foreach
(
string
ip
in
DIONameList
)
foreach
(
string
ip
in
DIONameList
)
{
{
ConnectionIP
(
ip
);
ConnectionIP
(
ip
);
}
}
}
}
private
bool
isProcess
=
false
;
private
bool
isProcess
=
false
;
private
DateTime
lastTime
=
DateTime
.
Now
;
private
DateTime
lastTime
=
DateTime
.
Now
;
public
void
ConnectionIP
(
string
ioIp
)
public
void
ConnectionIP
(
string
ioIp
)
{
{
AIOBOX
aioBox
=
null
;
AIOBOX
aioBox
=
null
;
...
@@ -97,29 +97,29 @@ namespace OnlineStore.DeviceLibrary
...
@@ -97,29 +97,29 @@ namespace OnlineStore.DeviceLibrary
aioBox
=
new
AIOBOX
(
Asa
.
IOModule
.
Box_Type
.
DI
,
DILength
,
Asa
.
IOModule
.
Box_Type
.
DO
,
DOLength
);
aioBox
=
new
AIOBOX
(
Asa
.
IOModule
.
Box_Type
.
DI
,
DILength
,
Asa
.
IOModule
.
Box_Type
.
DO
,
DOLength
);
aioBox
.
IP
=
ioIp
;
aioBox
.
IP
=
ioIp
;
aioBox
.
Upload
=
true
;
aioBox
.
Upload
=
true
;
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DI_Changed_Event
+=
AioBox_DI_Changed_Event
;
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
aioBox
.
DO_Changed_Event
+=
AioBox_DO_Changed_Event
;
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
+
aioBox
.
ErrInfo
);
LogUtil
.
info
(
"开始连接:"
+
logName
+
":"
+
aioBox
.
ErrInfo
);
aioBox
.
Connect
();
aioBox
.
Connect
();
AIOMap
.
Add
(
ioIp
,
aioBox
);
AIOMap
.
Add
(
ioIp
,
aioBox
);
Thread
.
Sleep
(
5
);
Thread
.
Sleep
(
5
);
//读取所有的DO
//读取所有的DO
ReadAllDI
(
ioIp
,
0
);
ReadAllDI
(
ioIp
,
0
);
Thread
.
Sleep
(
5
);
Thread
.
Sleep
(
5
);
GC
.
Collect
();
GC
.
Collect
();
}
}
catch
(
Exception
error
)
catch
(
Exception
error
)
{
{
LogUtil
.
error
(
LOGGER
,
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
LogUtil
.
error
(
LOGGER
,
"连接IO模块 "
+
logName
+
" 出错:"
+
error
.
ToString
());
}
}
}
}
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
DateTime
lastLogTime
=
DateTime
.
Now
;
private
void
AioBox_Log_Out_Event
(
AIOBOX
box
,
string
[]
s
)
private
void
AioBox_Log_Out_Event
(
AIOBOX
box
,
string
[]
s
)
{
{
foreach
(
string
str
in
s
)
foreach
(
string
str
in
s
)
...
@@ -202,17 +202,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -202,17 +202,8 @@ namespace OnlineStore.DeviceLibrary
if
(!(
oldList
[
i
].
Equals
(
newList
[
i
])))
if
(!(
oldList
[
i
].
Equals
(
newList
[
i
])))
{
{
needUpdate
=
true
;
needUpdate
=
true
;
//if (IsAxisCheckDI(ip, i))
//{
// // LogUtil.info("AIOBOXManager UpdateDI [" + ip + "][" + i + "],从" + oldList[i] + "变为" + newList[i]);
//}
break
;
break
;
}
}
//if (needUpdate && i >= 2)
//{
// break;
//}
}
}
}
}
if
(
needUpdate
)
if
(
needUpdate
)
...
@@ -225,6 +216,28 @@ namespace OnlineStore.DeviceLibrary
...
@@ -225,6 +216,28 @@ namespace OnlineStore.DeviceLibrary
}
}
DIValueMap
.
Add
(
ip
,
newList
);
DIValueMap
.
Add
(
ip
,
newList
);
}
}
try
{
if
(
oldList
!=
null
&&
newList
!=
null
)
{
foreach
(
ConfigIO
io
in
DIChangeMap
.
Keys
)
{
if
(
io
.
IO_IP
.
Equals
(
ip
))
{
IO_VALUE
oldV
=
GetBox_Value
(
oldList
[
io
.
GetIOAddr
()]);
IO_VALUE
newV
=
GetBox_Value
(
newList
[
io
.
GetIOAddr
()]);
if
(!
oldV
.
Equals
(
newV
))
{
DIChangeMap
[
io
].
Invoke
(
ip
,
io
.
GetIOAddr
(),
oldV
,
newV
);
}
}
}
}
}
catch
(
Exception
ex
)
{
LogUtil
.
error
(
"UpdateAllDI处理事件出错:"
+
ex
.
ToString
());
}
}
}
}
}
}
}
...
@@ -238,7 +251,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -238,7 +251,7 @@ namespace OnlineStore.DeviceLibrary
newList
.
AddRange
(
sta
);
newList
.
AddRange
(
sta
);
List
<
Box_Sta
>
oldList
=
null
;
List
<
Box_Sta
>
oldList
=
null
;
DOValueMap
.
TryGetValue
(
ip
,
out
oldList
);
DOValueMap
.
TryGetValue
(
ip
,
out
oldList
);
if
(
oldList
==
null
||
oldList
.
Count
.
Equals
(
newList
.
Count
).
Equals
(
false
))
if
(
oldList
==
null
||
oldList
.
Count
.
Equals
(
newList
.
Count
).
Equals
(
false
))
{
{
needUpdate
=
true
;
needUpdate
=
true
;
...
@@ -449,7 +462,8 @@ namespace OnlineStore.DeviceLibrary
...
@@ -449,7 +462,8 @@ namespace OnlineStore.DeviceLibrary
if
(
sta
.
Equals
(
Box_Sta
.
On
))
if
(
sta
.
Equals
(
Box_Sta
.
On
))
{
{
value
=
IO_VALUE
.
HIGH
;
value
=
IO_VALUE
.
HIGH
;
}
else
}
else
{
{
value
=
IO_VALUE
.
LOW
;
value
=
IO_VALUE
.
LOW
;
}
}
...
@@ -458,7 +472,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -458,7 +472,7 @@ namespace OnlineStore.DeviceLibrary
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LogUtil
.
error
(
" 第【"
+
i
+
"】次 GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
,
ex
);
LogUtil
.
error
(
" 第【"
+
i
+
"】次 GetDIValue ["
+
ioIP
+
"] ["
+
StartAddress
+
"] 出错:"
,
ex
);
}
}
}
}
return
value
;
return
value
;
...
@@ -495,6 +509,18 @@ namespace OnlineStore.DeviceLibrary
...
@@ -495,6 +509,18 @@ namespace OnlineStore.DeviceLibrary
return
Box_Sta
.
Off
;
return
Box_Sta
.
Off
;
}
}
}
}
private
IO_VALUE
GetBox_Value
(
Box_Sta
onOff
)
{
if
(
onOff
.
Equals
(
Box_Sta
.
On
))
{
return
IO_VALUE
.
HIGH
;
}
else
{
return
IO_VALUE
.
LOW
;
}
}
private
AIOBOX
getAIO
(
string
ioIp
)
private
AIOBOX
getAIO
(
string
ioIp
)
{
{
...
...
source/DeviceLibrary/deviceLibrary/IO/IOManager.cs
查看文件 @
4925708
...
@@ -10,6 +10,17 @@ namespace OnlineStore.DeviceLibrary
...
@@ -10,6 +10,17 @@ namespace OnlineStore.DeviceLibrary
{
{
public
abstract
class
IOManager
public
abstract
class
IOManager
{
{
public
delegate
void
DIChangeDelegate
(
string
ioIP
,
ushort
index
,
IO_VALUE
oldValue
,
IO_VALUE
newValue
);
internal
static
Dictionary
<
ConfigIO
,
DIChangeDelegate
>
DIChangeMap
=
new
Dictionary
<
ConfigIO
,
DIChangeDelegate
>();
public
static
void
AddDIEvent
(
string
diType
,
int
subType
,
DIChangeDelegate
del
)
{
ConfigIO
Di
=
GetDI
(
diType
,
subType
);
if
(
Di
!=
null
)
{
DIChangeMap
.
Add
(
Di
,
del
);
}
}
public
static
IOManager
instance
=
null
;
public
static
IOManager
instance
=
null
;
public
abstract
void
ConnectionIOList
(
List
<
string
>
dIODeviceNameList
);
public
abstract
void
ConnectionIOList
(
List
<
string
>
dIODeviceNameList
);
...
@@ -21,25 +32,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -21,25 +32,7 @@ namespace OnlineStore.DeviceLibrary
{
{
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
ConfigIO
configIo
=
GetDO
(
ioType
,
subType
);
if
(
configIo
!=
null
)
if
(
configIo
!=
null
)
{
{
//try
//{
// //如果是出料四阻挡下降,添加日志
// if ((configIo.IO_IP.Equals("192.168.101.49") || configIo.IO_IP.Equals("192.168.101.41")) && configIo.GetIOAddr().Equals(4))
// {
// if (ioValue.Equals(IO_VALUE.HIGH))
// {
// LogUtil.info("IOMove: ioValue= " + ioValue + ", [ " + subType + "] [" + ioType + "] [" + configIo.IO_IP + "][4]");
// }
// else if (instance.GetDOValue(configIo.IO_IP, configIo.SlaveID, configIo.GetIOAddr()).Equals(IO_VALUE.HIGH))
// { //如果上次是high,打印
// LogUtil.info("IOMove: ioValue= " + ioValue + ", [ " + subType + "] [" + ioType + "][" + configIo.IO_IP + "][4]");
// }
// }
//}catch(Exception ex)
//{
//}
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
instance
.
WriteSingleDO
(
configIo
.
IO_IP
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
Thread
.
Sleep
(
10
);
Thread
.
Sleep
(
10
);
}
}
...
@@ -105,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
...
@@ -105,7 +98,7 @@ namespace OnlineStore.DeviceLibrary
}
}
return
ioValue
;
return
ioValue
;
}
}
private
static
ConfigIO
GetDI
(
string
ioType
,
int
subType
)
internal
static
ConfigIO
GetDI
(
string
ioType
,
int
subType
)
{
{
ConfigIO
configIo
=
null
;
ConfigIO
configIo
=
null
;
if
(
subType
<=
0
)
if
(
subType
<=
0
)
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论