Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
张东亮
/
NS200
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
图表
网络
创建新的问题
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit b99a1c3f
由
夏萍
编写于
2024-11-08 10:53:16 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
1ad17547
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
500 行增加
和
159 行删除
AutoScanAndLabel/AboutBox1.Designer.cs
AutoScanAndLabel/Form1.cs
Common/util/UnifiedDataHandler.cs
DeviceLibrary/AGVManager.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _BtnProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _IOMonitor.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _MiddleProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
DeviceLibrary/AutoScanAndLabel/MoveStep.cs
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/DataUploadUtil.cs
DeviceLibrary/DeviceLibrary/PrinterHelper.cs
DeviceLibrary/DeviceLibrary/RemoteDecodeHelper.cs
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
AutoScanAndLabel/AboutBox1.Designer.cs
查看文件 @
b99a1c3
...
...
@@ -50,8 +50,7 @@ namespace AutoScanAndLabel
this
.
tableLayoutPanel
.
Controls
.
Add
(
this
.
textBoxDescription
,
1
,
4
);
this
.
tableLayoutPanel
.
Controls
.
Add
(
this
.
okButton
,
1
,
5
);
this
.
tableLayoutPanel
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
tableLayoutPanel
.
Location
=
new
System
.
Drawing
.
Point
(
14
,
12
);
this
.
tableLayoutPanel
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
5
,
4
,
5
);
this
.
tableLayoutPanel
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
8
);
this
.
tableLayoutPanel
.
Name
=
"tableLayoutPanel"
;
this
.
tableLayoutPanel
.
RowCount
=
6
;
this
.
tableLayoutPanel
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
10F
));
...
...
@@ -60,17 +59,17 @@ namespace AutoScanAndLabel
this
.
tableLayoutPanel
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
10F
));
this
.
tableLayoutPanel
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
50F
));
this
.
tableLayoutPanel
.
RowStyles
.
Add
(
new
System
.
Windows
.
Forms
.
RowStyle
(
System
.
Windows
.
Forms
.
SizeType
.
Percent
,
10F
));
this
.
tableLayoutPanel
.
Size
=
new
System
.
Drawing
.
Size
(
624
,
367
);
this
.
tableLayoutPanel
.
Size
=
new
System
.
Drawing
.
Size
(
417
,
245
);
this
.
tableLayoutPanel
.
TabIndex
=
0
;
//
// labelProductName
//
this
.
labelProductName
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
labelProductName
.
Location
=
new
System
.
Drawing
.
Point
(
9
0
,
0
);
this
.
labelProductName
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
9
,
0
,
4
,
0
);
this
.
labelProductName
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
24
);
this
.
labelProductName
.
Location
=
new
System
.
Drawing
.
Point
(
6
0
,
0
);
this
.
labelProductName
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
,
0
,
3
,
0
);
this
.
labelProductName
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
16
);
this
.
labelProductName
.
Name
=
"labelProductName"
;
this
.
labelProductName
.
Size
=
new
System
.
Drawing
.
Size
(
530
,
24
);
this
.
labelProductName
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
16
);
this
.
labelProductName
.
TabIndex
=
19
;
this
.
labelProductName
.
Text
=
"产品名称"
;
this
.
labelProductName
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleLeft
;
...
...
@@ -78,11 +77,11 @@ namespace AutoScanAndLabel
// labelVersion
//
this
.
labelVersion
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
labelVersion
.
Location
=
new
System
.
Drawing
.
Point
(
90
,
36
);
this
.
labelVersion
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
9
,
0
,
4
,
0
);
this
.
labelVersion
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
24
);
this
.
labelVersion
.
Location
=
new
System
.
Drawing
.
Point
(
60
,
24
);
this
.
labelVersion
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
,
0
,
3
,
0
);
this
.
labelVersion
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
16
);
this
.
labelVersion
.
Name
=
"labelVersion"
;
this
.
labelVersion
.
Size
=
new
System
.
Drawing
.
Size
(
530
,
24
);
this
.
labelVersion
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
16
);
this
.
labelVersion
.
TabIndex
=
0
;
this
.
labelVersion
.
Tag
=
"not"
;
this
.
labelVersion
.
Text
=
"版本"
;
...
...
@@ -92,11 +91,11 @@ namespace AutoScanAndLabel
// labelCopyright
//
this
.
labelCopyright
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
labelCopyright
.
Location
=
new
System
.
Drawing
.
Point
(
90
,
72
);
this
.
labelCopyright
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
9
,
0
,
4
,
0
);
this
.
labelCopyright
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
24
);
this
.
labelCopyright
.
Location
=
new
System
.
Drawing
.
Point
(
60
,
48
);
this
.
labelCopyright
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
,
0
,
3
,
0
);
this
.
labelCopyright
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
16
);
this
.
labelCopyright
.
Name
=
"labelCopyright"
;
this
.
labelCopyright
.
Size
=
new
System
.
Drawing
.
Size
(
530
,
24
);
this
.
labelCopyright
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
16
);
this
.
labelCopyright
.
TabIndex
=
21
;
this
.
labelCopyright
.
Text
=
"版权"
;
this
.
labelCopyright
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleLeft
;
...
...
@@ -104,11 +103,11 @@ namespace AutoScanAndLabel
// labelCompanyName
//
this
.
labelCompanyName
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
labelCompanyName
.
Location
=
new
System
.
Drawing
.
Point
(
90
,
108
);
this
.
labelCompanyName
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
9
,
0
,
4
,
0
);
this
.
labelCompanyName
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
24
);
this
.
labelCompanyName
.
Location
=
new
System
.
Drawing
.
Point
(
60
,
72
);
this
.
labelCompanyName
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
,
0
,
3
,
0
);
this
.
labelCompanyName
.
MaximumSize
=
new
System
.
Drawing
.
Size
(
0
,
16
);
this
.
labelCompanyName
.
Name
=
"labelCompanyName"
;
this
.
labelCompanyName
.
Size
=
new
System
.
Drawing
.
Size
(
530
,
24
);
this
.
labelCompanyName
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
16
);
this
.
labelCompanyName
.
TabIndex
=
22
;
this
.
labelCompanyName
.
Text
=
"公司名称"
;
this
.
labelCompanyName
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleLeft
;
...
...
@@ -116,13 +115,13 @@ namespace AutoScanAndLabel
// textBoxDescription
//
this
.
textBoxDescription
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
textBoxDescription
.
Location
=
new
System
.
Drawing
.
Point
(
90
,
14
9
);
this
.
textBoxDescription
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
9
,
5
,
4
,
5
);
this
.
textBoxDescription
.
Location
=
new
System
.
Drawing
.
Point
(
60
,
9
9
);
this
.
textBoxDescription
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
6
,
3
,
3
,
3
);
this
.
textBoxDescription
.
Multiline
=
true
;
this
.
textBoxDescription
.
Name
=
"textBoxDescription"
;
this
.
textBoxDescription
.
ReadOnly
=
true
;
this
.
textBoxDescription
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Both
;
this
.
textBoxDescription
.
Size
=
new
System
.
Drawing
.
Size
(
530
,
173
);
this
.
textBoxDescription
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
116
);
this
.
textBoxDescription
.
TabIndex
=
23
;
this
.
textBoxDescription
.
TabStop
=
false
;
this
.
textBoxDescription
.
Text
=
"说明"
;
...
...
@@ -131,10 +130,9 @@ namespace AutoScanAndLabel
//
this
.
okButton
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
okButton
.
DialogResult
=
System
.
Windows
.
Forms
.
DialogResult
.
Cancel
;
this
.
okButton
.
Location
=
new
System
.
Drawing
.
Point
(
508
,
332
);
this
.
okButton
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
5
,
4
,
5
);
this
.
okButton
.
Location
=
new
System
.
Drawing
.
Point
(
339
,
222
);
this
.
okButton
.
Name
=
"okButton"
;
this
.
okButton
.
Size
=
new
System
.
Drawing
.
Size
(
112
,
3
0
);
this
.
okButton
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
2
0
);
this
.
okButton
.
TabIndex
=
24
;
this
.
okButton
.
Text
=
"确定(&O)"
;
this
.
okButton
.
Click
+=
new
System
.
EventHandler
(
this
.
okButton_Click
);
...
...
@@ -142,16 +140,15 @@ namespace AutoScanAndLabel
// AboutBox1
//
this
.
AcceptButton
=
this
.
okButton
;
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
9F
,
18
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
652
,
39
1
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
435
,
26
1
);
this
.
Controls
.
Add
(
this
.
tableLayoutPanel
);
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
FixedDialog
;
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
4
,
5
,
4
,
5
);
this
.
MaximizeBox
=
false
;
this
.
MinimizeBox
=
false
;
this
.
Name
=
"AboutBox1"
;
this
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
14
,
12
,
14
,
12
);
this
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
9
,
8
,
9
,
8
);
this
.
ShowIcon
=
false
;
this
.
ShowInTaskbar
=
false
;
this
.
StartPosition
=
System
.
Windows
.
Forms
.
FormStartPosition
.
CenterParent
;
...
...
AutoScanAndLabel/Form1.cs
查看文件 @
b99a1c3
...
...
@@ -18,6 +18,7 @@ using static RemoteDecodeHelper_mod;
using
Newtonsoft.Json
;
using
System.Drawing.Imaging
;
using
PrintLabel
;
using
OnlineStore.Common.util
;
namespace
AutoScanAndLabel
{
...
...
@@ -403,6 +404,7 @@ namespace AutoScanAndLabel
else
if
(!
userpause
)
{
userpause
=
true
;
btn_stop
.
Enabled
=
true
;
RobotManage
.
UserPause
(
userpause
);
LogUtil
.
info
(
"用户按下暂停1"
);
}
...
...
@@ -410,6 +412,7 @@ namespace AutoScanAndLabel
{
userpause
=
false
;
RobotManage
.
UserPause
(
userpause
);
btn_stop
.
Enabled
=
true
;
LogUtil
.
info
(
"用户取消暂停2"
);
}
...
...
@@ -820,11 +823,15 @@ namespace AutoScanAndLabel
tabControl1
.
TabPages
[
tc
-
i
].
Parent
=
null
;
}
}
int
LeftCount
=
0
;
private
void
btnUploadTest_Click
(
object
sender
,
EventArgs
e
)
{
FrmUploadTest
frmUploadTest
=
new
FrmUploadTest
();
frmUploadTest
.
ShowDialog
();
//FrmUploadTest frmUploadTest = new FrmUploadTest();
//frmUploadTest.ShowDialog();
//UnifiedDataHandler.RecordPrintNg(false, false, out string[] strarrys);
//int Xoffset = RobotManage.Config.Label_XOffset;
//int Yoffset = RobotManage.Config.Label_YOffset;
ConfigHelper
.
Config
.
Set
<
int
>(
"LeftCount"
,
LeftCount
++);
}
}
}
\ No newline at end of file
Common/util/UnifiedDataHandler.cs
查看文件 @
b99a1c3
...
...
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using
System.Drawing
;
using
System.Drawing.Imaging
;
using
System.IO
;
using
System.Linq
;
using
System.Net.Http
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
...
...
@@ -36,15 +37,17 @@ namespace OnlineStore.Common.util
{
string
json
=
File
.
ReadAllText
(
txtpath
);
if
(!
string
.
IsNullOrWhiteSpace
(
json
))
if
(!
string
.
IsNullOrWhiteSpace
(
json
)
&&
!
json
.
All
(
c
=>
c
==
'\0'
)
)
{
string
[]
strings
=
JsonConvert
.
DeserializeObject
<
string
[
]>
(
json
);
if
(
strings
[
0
]
==
DateTime
.
Today
.
ToString
(
"dd-MM-yyyy"
))
if
(
strings
.
Length
>
0
)
{
strs
[
0
]
=
strings
[
0
];
strs
[
1
]
=
strings
[
1
];
strs
[
2
]
=
strings
[
2
];
if
(
strings
[
0
]
==
DateTime
.
Today
.
ToString
(
"dd-MM-yyyy"
))
{
strs
[
0
]
=
strings
[
0
];
strs
[
1
]
=
strings
[
1
];
strs
[
2
]
=
strings
[
2
];
}
}
}
}
...
...
DeviceLibrary/AGVManager.cs
查看文件 @
b99a1c3
...
...
@@ -173,6 +173,8 @@ namespace DeviceLibrary
else
{
RobotManage
.
mainMachine
.
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
//等待agv到位后执行,启动料串离开
LogUtil
.
info
(
"AGVManager:下料请求,等待agv到位后执行,启动料串离开"
);
}
}
else
if
(
DeviceCheckDto
.
UNLOAD_DONE
.
Equals
(
deviceCheckDto
.
operate
))
//下料完成
...
...
@@ -349,23 +351,29 @@ namespace DeviceLibrary
}
static
void
sendAgvLog
(
string
msg
)
{
Task
.
Factory
.
StartNew
(()
=>
if
(
ServerCommunication
.
EnableHttpServer
)
{
Task
.
Factory
.
StartNew
(()
=>
{
while
(!
RobotManage
.
mainMachine
.
ServerCM
.
SendAgvLog
(
msg
))
{
Thread
.
Sleep
(
500
);
}
});
}
}
static
void
sendOpMimoCmd
(
string
opMsg
,
Dictionary
<
string
,
string
>
op
)
{
Task
.
Factory
.
StartNew
(()
=>
if
(
ServerCommunication
.
EnableHttpServer
)
{
while
(!
RobotManage
.
mainMachine
.
ServerCM
.
OpMIMO
(
opMsg
,
op
))
Task
.
Factory
.
StartNew
(()
=>
{
Thread
.
Sleep
(
500
);
}
});
while
(!
RobotManage
.
mainMachine
.
ServerCM
.
OpMIMO
(
opMsg
,
op
))
{
Thread
.
Sleep
(
500
);
}
});
}
}
/// <summary>
/// 创建AGV运输任务
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _BtnProcess.cs
查看文件 @
b99a1c3
...
...
@@ -15,22 +15,24 @@ namespace DeviceLibrary
{
void
BtnProcess
()
{
string
isskiptest
=
ConfigHelper
.
Config
.
Get
(
"Hardwareversion"
,
"V2"
);
if
(
isskiptest
==
"V2"
)
string
isskiptest
=
ConfigHelper
.
Config
.
Get
(
"Hardwareversion"
,
"V2"
);
string
newagvdispose
=
ConfigHelper
.
Config
.
Get
(
"HardwareversionofAGV"
,
"V2"
);
if
(
isskiptest
==
"V2"
)
{
//硬件v2版本,已经去除料车检测X11的io
if
((
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)||
RightMoveInfo
.
IsStep
(
MoveStep
.
REND
))
if
((
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
RightMoveInfo
.
IsStep
(
MoveStep
.
REND
))
&&
IOValue
(
IO_Type
.
Right_BTN
).
Equals
(
IO_VALUE
.
HIGH
))
{
//有料,出料,无料,进料
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
LogUtil
.
info
(
"BtnProcess:进料串感应到有料,进料口确认"
);
}
else
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R40_InShelf
);
}
}
}
if
((
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
LeftMoveInfo
.
IsStep
(
MoveStep
.
LEND
)
||
LeftMoveInfo
.
IsStep
(
MoveStep
.
L10_WaitReelPut
))
...
...
@@ -43,7 +45,39 @@ namespace DeviceLibrary
else
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L60_InShelf
);
}
}
}
}
else
if
(
newagvdispose
==
"V2"
)
{
if
((
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
RightMoveInfo
.
IsStep
(
MoveStep
.
REND
))
&&
IOValue
(
IO_Type
.
Right_BTN
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
//有料,出料,无料,进料
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
LogUtil
.
info
(
"BtnProcess:进料串感应到有料,进料口确认"
);
}
else
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R40_InShelf
);
}
}
if
((
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
LeftMoveInfo
.
IsStep
(
MoveStep
.
LEND
)
||
LeftMoveInfo
.
IsStep
(
MoveStep
.
L10_WaitReelPut
))
&&
IOValue
(
IO_Type
.
Left_BTN
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
LeftCar_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L50_OutShelf
);
}
else
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L60_InShelf
);
}
}
}
else
...
...
@@ -55,6 +89,7 @@ namespace DeviceLibrary
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
LogUtil
.
info
(
"BtnProcess:进料串感应到有料,进料口确认,检测到小车"
);
}
//右侧按钮按下,无料,阻挡下降
else
if
(
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
...
...
@@ -78,7 +113,7 @@ namespace DeviceLibrary
{
CylinderMove
(
null
,
IO_Type
.
LeftStopUP
,
IO_Type
.
LeftStopDown
);
}
}
}
}
}
}
DeviceLibrary/AutoScanAndLabel/MainMachine _IOMonitor.cs
查看文件 @
b99a1c3
...
...
@@ -10,36 +10,79 @@ namespace DeviceLibrary
{
//agv感应io处理逻辑
string
isskiptest
=
ConfigHelper
.
Config
.
Get
(
"Hardwareversion"
,
"V2"
);
//新的AGV信号处理逻辑
string
newagvdispose
=
ConfigHelper
.
Config
.
Get
(
"HardwareversionofAGV"
,
"V2"
);
if
(
isskiptest
==
"V2"
)
{
if
((
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
RightMoveInfo
.
IsStep
(
MoveStep
.
REND
)))
{
// && IOValue(IO_Type.FeedAGV_Feed).Equals(IO_VALUE.LOW) && IOValue(IO_Type.FeedAGV_Feed).Equals(IO_VALUE.LOW)
//无料且无agv送料请求转到进料步骤
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
FeedAGV_Feed
).
Equals
(
IO_VALUE
.
LOW
))
{
//Msg.add("入料口有料串,请将料串先取出!", MsgLevel.warning);
RightMoveInfo
.
NewMove
(
MoveStep
.
R40_InShelf
);
}
//有料无AGV进料请求转到出料步骤
else
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
FeedAGV_Receiving
).
Equals
(
IO_VALUE
.
LOW
))
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
LogUtil
.
info
(
"IOMonitor:进料串感应到有料"
);
}
}
if
((
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
LeftMoveInfo
.
IsStep
(
MoveStep
.
LEND
)))
{
//&& && IOValue(IO_Type.DischargeAGV_Receiving).Equals(IO_VALUE.LOW)
//无料且无agv收料请求转到进料步骤
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
LOW
)&&
IOValue
(
IO_Type
.
DischargeAGV_Feeding
).
Equals
(
IO_VALUE
.
LOW
))
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L60_InShelf
);
}
else
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
DischargeAGV_Receiving
).
Equals
(
IO_VALUE
.
LOW
))
//有料无AGV收料请求转到出料步骤
else
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
DischargeAGV_Receiving
).
Equals
(
IO_VALUE
.
LOW
))
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L50_OutShelf
);
}
}
}
if
(
newagvdispose
==
"V2"
)
{
if
((
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
RightMoveInfo
.
IsStep
(
MoveStep
.
REND
)))
{
//按下确认按钮有料串出没有进
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
(
IOValue
(
IO_Type
.
Right_BTN
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOValue
(
IO_Type
.
DischargeAGV_Feeding
).
Equals
(
IO_VALUE
.
HIGH
)))
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R40_InShelf
);
}
else
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
(
IOValue
(
IO_Type
.
Right_BTN
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOValue
(
IO_Type
.
FeedAGV_Receiving
).
Equals
(
IO_VALUE
.
HIGH
)))
{
RightMoveInfo
.
NewMove
(
MoveStep
.
R30_OutShelf
);
}
}
if
((
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
||
LeftMoveInfo
.
IsStep
(
MoveStep
.
LEND
)))
{
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LeftCar_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
(
IOValue
(
IO_Type
.
DischargeAGV_Feeding
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOValue
(
IO_Type
.
Left_BTN
).
Equals
(
IO_VALUE
.
HIGH
)))
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L60_InShelf
);
}
else
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
LeftCar_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
(
IOValue
(
IO_Type
.
DischargeAGV_Receiving
).
Equals
(
IO_VALUE
.
HIGH
)
||
IOValue
(
IO_Type
.
Left_BTN
).
Equals
(
IO_VALUE
.
HIGH
)))
{
LeftMoveInfo
.
NewMove
(
MoveStep
.
L50_OutShelf
);
}
}
}
//等待步骤且进料前端有料后端无料进入进料步骤
if
(
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
RightFornt_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -47,6 +90,7 @@ namespace DeviceLibrary
RightMoveInfo
.
NewMove
(
MoveStep
.
R40_InShelf
);
LogUtil
.
info
(
"IOMonitor:右侧检测到入料信号"
);
}
//等待步骤且料串到位且并非料盘取完的步骤转到上料步骤
if
(
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
!
RightShelfNoTray
)
...
...
@@ -55,7 +99,7 @@ namespace DeviceLibrary
LogUtil
.
info
(
"IOMonitor:右侧有新料,准备上料"
);
}
//等待步骤且前端有料后端无料进入进料步骤
if
(
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
LeftFornt_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
LOW
))
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
查看文件 @
b99a1c3
...
...
@@ -19,11 +19,14 @@ namespace DeviceLibrary
{
Point
Label_p3
;
LabelParam
CurrentPrintInfo
=
null
;
LabelParam
CurrentPrintInfo
=
null
;
double
size_7_radiusratio
=
ConfigHelper
.
Config
.
Get
<
double
>(
"Labeling_size_7_radiusratio"
,
0.7
);
enum
LabelFailReason
{
PrintFailure
,
SuckerFailure
enum
LabelFailReason
{
PrintFailure
,
SuckerFailure
}
LabelFailReason
labelFailReason
=
LabelFailReason
.
PrintFailure
;
void
LabelProcess
()
...
...
@@ -33,11 +36,13 @@ namespace DeviceLibrary
switch
(
LabelMoveInfo
.
MoveStep
)
{
//取标签流程,等待打印标签
case
MoveStep
.
Lbl01
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl02
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P1
,
Config
.
Label_X_P1_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P2
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_X到待机点,Label_Y到贴标前点"
);
//Label_Z_Axis.AbsMove(LabelMoveInfo, Config.Label_Z_P2, Config.Label_Z_P2_speed);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P1
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_X到待机点,Label_Z到待机点"
);
break
;
case
MoveStep
.
Lbl02
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl02_1
);
...
...
@@ -48,21 +53,35 @@ namespace DeviceLibrary
case
MoveStep
.
Lbl02_1
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl02_2
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_X_P2
,
Config
.
Label_X_P2_speed
);
LabelMoveInfo
.
log
(
"Label_X转到取标点,等待标签打印完毕"
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P2
,
Config
.
Label_Z_P2_speed
);
LabelMoveInfo
.
log
(
"Label_X转到取标点,Label_Z转到取标点,等待标签打印完毕"
);
break
;
case
MoveStep
.
Lbl02_2
:
//补一个空白流程, 防止提前检测到Lbl_WaitPrintInfo步骤
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_WaitPrintInfo
);
LabelMoveInfo
.
log
(
"等待标签打印完毕"
);
break
;
//在中间步骤跳出,中间步骤进入到旋转轴到p3
case
MoveStep
.
Lbl_WaitPrintInfo
:
LabelMoveInfo
.
log
(
"等待打印标签信息"
);
break
;
//中间步骤旋转轴到p3接收打印信息后,开始打印
case
MoveStep
.
Lbl_PrintLabel
:
if
(
CurrentPrintInfo
==
null
)
{
if
(
CurrentPrintInfo
==
null
)
{
LabelMoveInfo
.
log
(
"等待接收打印标签信息"
);
return
;
}
string
newversion2
=
ConfigHelper
.
Config
.
Get
(
"HardwareversionofAGV"
,
"V2"
);
if
(
newversion2
==
"V2"
)
{
if
(
IOValue
(
IO_Type
.
HasPrinter
).
Equals
(
IO_VALUE
.
HIGH
))
{
LabelMoveInfo
.
log
(
"标签没取走不打印标签"
);
return
;
}
}
var
kv
=
CurrentPrintInfo
.
Keyword
.
Select
(
k
=>
$
"{k.Key}={k.Value}"
).
ToArray
();
LabelMoveInfo
.
log
(
"调用 PrintLabel 打印标签 StartPrintLabel ,["
+
string
.
Join
(
", "
,
kv
)
+
"] 开始"
);
...
...
@@ -75,20 +94,28 @@ namespace DeviceLibrary
//数据保存到共享文件夹
DataUploadUtil
.
LabelUpload
(
CurrentPrintInfo
.
Keyword
);
}
else
{
else
{
LabelMoveInfo
.
log
(
"PrintLabel 失败 "
+
msg
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_PrintFail
);
labelFailReason
=
LabelFailReason
.
PrintFailure
;
}
break
;
//等待打印完成,v2靠传感器检测,其他的靠方法返回
case
MoveStep
.
Lbl_WaitPrint
:
string
version
=
ConfigHelper
.
Config
.
Get
(
"Hardwareversion"
,
"V2"
);
string
newversion
=
ConfigHelper
.
Config
.
Get
(
"HardwareversionofAGV"
,
"V2"
);
bool
detectLabel
=
false
;
if
(
version
==
"V2"
)
{
if
(
IOValue
(
IO_Type
.
HasPrinter
).
Equals
(
IO_VALUE
.
HIGH
))
detectLabel
=
true
;
}
else
if
(
newversion
==
"V2"
)
{
if
(
IOValue
(
IO_Type
.
HasPrinter
).
Equals
(
IO_VALUE
.
HIGH
))
detectLabel
=
true
;
}
else
{
var
isPrinted
=
RobotManage
.
printerHelper
.
IsLabelOnPeeler
();
...
...
@@ -100,7 +127,7 @@ namespace DeviceLibrary
if
(
detectLabel
)
{
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl_Printted
);
LabelMoveInfo
.
errlog
(
"标签打印完成"
);
LabelMoveInfo
.
errlog
(
"标签打印完成"
);
}
else
if
(
LabelMoveInfo
.
IsTimeOut
(
15
))
{
...
...
@@ -114,9 +141,10 @@ namespace DeviceLibrary
LabelMoveInfo
.
log
(
"等待标签打印"
);
}
break
;
//打印失败
case
MoveStep
.
Lbl_PrintFail
:
if
(
labelFailReason
==
LabelFailReason
.
SuckerFailure
)
Msg
.
add
(
crc
.
GetString
(
"Res0129.0e13d0de"
,
"标签打印失败,请检查打印机状态,关门后将自动重试"
),
MsgLevel
.
alarm
);
Msg
.
add
(
crc
.
GetString
(
"Res0129.0e13d0de"
,
"标签打印失败,请检查打印机状态,关门后将自动重试"
),
MsgLevel
.
alarm
);
else
if
(
labelFailReason
==
LabelFailReason
.
SuckerFailure
)
Msg
.
add
(
crc
.
GetString
(
"Res0130.c3836615"
,
"标签吸取失败,请检查,关门后将自动重试"
),
MsgLevel
.
alarm
);
if
(
IOValue
(
IO_Type
.
LeftBackDoor_Check
).
Equals
(
IO_VALUE
.
LOW
)
||
IOValue
(
IO_Type
.
RightBackDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -127,7 +155,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
Lbl_PrintFail_02
:
if
(
labelFailReason
==
LabelFailReason
.
SuckerFailure
)
Msg
.
add
(
crc
.
GetString
(
"Res0129.0e13d0de"
,
"标签打印失败,请检查打印机状态,关门后将自动重试"
),
MsgLevel
.
warning
);
Msg
.
add
(
crc
.
GetString
(
"Res0129.0e13d0de"
,
"标签打印失败,请检查打印机状态,关门后将自动重试"
),
MsgLevel
.
warning
);
else
if
(
labelFailReason
==
LabelFailReason
.
SuckerFailure
)
Msg
.
add
(
crc
.
GetString
(
"Res0130.c3836615"
,
"标签吸取失败,请检查,关门后将自动重试"
),
MsgLevel
.
warning
);
if
(
IOValue
(
IO_Type
.
LeftBackDoor_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
IOValue
(
IO_Type
.
RightBackDoor_Check
).
Equals
(
IO_VALUE
.
LOW
))
...
...
@@ -136,6 +164,7 @@ namespace DeviceLibrary
LabelMoveInfo
.
log
(
"维护门已关闭"
);
}
break
;
//打印成功,在轴到p3点取标签,到p2点
case
MoveStep
.
Lbl_Printted
:
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl03
);
IOMove
(
IO_Type
.
LabelCylinder_Work
,
IO_VALUE
.
HIGH
);
...
...
@@ -153,13 +182,19 @@ namespace DeviceLibrary
//CylinderMove(LabelMoveInfo, IO_Type.LabelCylinder_Fwd, IO_Type.LabelCylinder_Bck);
LabelMoveInfo
.
log
(
"标签打印完毕,取标气缸上升,取起标签."
);
break
;
//靠传感器或方法判断取标签
case
MoveStep
.
Lbl05
:
string
versions
=
ConfigHelper
.
Config
.
Get
(
"Hardwareversion"
,
"V2"
);
string
newversions
=
ConfigHelper
.
Config
.
Get
(
"HardwareversionofAGV"
,
"V2"
);
bool
IsLabelLeave
;
if
(
versions
==
"V2"
)
{
IsLabelLeave
=
IOValue
(
IO_Type
.
HasPrinter
).
Equals
(
IO_VALUE
.
LOW
);
}
else
if
(
newversions
==
"V2"
)
{
IsLabelLeave
=
IOValue
(
IO_Type
.
HasPrinter
).
Equals
(
IO_VALUE
.
LOW
);
}
else
{
var
ip
=
RobotManage
.
printerHelper
.
IsLabelOnPeeler
();
...
...
@@ -181,7 +216,7 @@ namespace DeviceLibrary
Msg
.
add
(
crc
.
GetString
(
"Res0122.62c858d3"
,
"标签取起失败!"
),
MsgLevel
.
alarm
);
}
break
;
//计算贴标位置,贴标完成回去
case
MoveStep
.
Lbl10
:
if
(!
Label_Y_Axis
.
IsSafe
(
Config
.
Label_Y_P3
,
out
msg
))
{
...
...
@@ -224,7 +259,7 @@ namespace DeviceLibrary
//else
//{ }
LabelMoveInfo
.
MoveParam
.
NewXYAngle
.
TryGetValue
(
"IsCodeUsed"
,
out
int
idnex
);
if
(
idnex
==
-
1
)
if
(
idnex
==
-
1
)
{
idnex
=
0
;
}
...
...
@@ -242,13 +277,14 @@ namespace DeviceLibrary
if
(
newpoint
.
TryGetValue
(
"PointX"
,
out
var
pointX
)
&&
newpoint
.
TryGetValue
(
"PointY"
,
out
var
pointY
))
{
p
=
new
Point
(
pointX
,
pointY
);
LogUtil
.
info
(
$
"PointX:[{pointX}],PointY:[{pointY}]"
);
}
if
(
newpoint
.
TryGetValue
(
"Angle"
,
out
var
Angle
))
{
labelAngle
=
Angle
;
}
Common
.
RenderedImage
(
LabelMoveInfo
.
MoveParam
,
Right_Batch_Point
,
p
);
LogUtil
.
info
(
$
"NS200接收贴标位置{p};角度={labelAngle}"
);
LogUtil
.
info
(
$
"NS200接收贴标位置{p};角度={labelAngle}"
);
}
if
(
labelAngle
>
350
&&
labelAngle
<
355
)
...
...
@@ -261,9 +297,26 @@ namespace DeviceLibrary
LogUtil
.
info
(
$
"完整贴标脉冲{labelAxisPos}"
);
//计算像素点位与中心点的差
Label_p3
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
int
xDiff
=
(
int
)(
Label_p3
.
X
*
Config
.
Cam_Pixel_X_Ratio
);
int
yDiff
=
(
int
)(
Label_p3
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
);
if
(
LabelMoveInfo
.
MoveParam
.
PlateW
==
7
)
{
LabelMoveInfo
.
log
(
"当前盘为7寸"
);
double
x
=
xDiff
;
double
y
=
yDiff
;
int
radiusDistance
=(
int
)
Math
.
Sqrt
(
x
*
x
+
y
*
y
);
LabelMoveInfo
.
log
(
$
"贴标点到圆心距离为{radiusDistance}"
);
if
(
radiusDistance
>
88900
*
size_7_radiusratio
)
{
Label_p3
.
X
=
(
int
)(
Label_p3
.
X
*
size_7_radiusratio
);
Label_p3
.
Y
=
(
int
)(
Label_p3
.
Y
*
size_7_radiusratio
);
xDiff
=
(
int
)(
Label_p3
.
X
*
Config
.
Cam_Pixel_X_Ratio
);
yDiff
=
(
int
)(
Label_p3
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
);
LabelMoveInfo
.
log
(
$
"由于{LabelMoveInfo.MoveParam.PlateW}寸贴标可能超出边缘缩小坐标"
);
}
}
Label_p3
.
X
=
xDiff
+
Config
.
Label_X_P3
;
Label_p3
.
Y
=
yDiff
+
Config
.
Label_Y_P3
;
if
(
Label_p3
.
Y
>
710000
)
...
...
@@ -271,6 +324,11 @@ namespace DeviceLibrary
LabelMoveInfo
.
log
(
$
"计算Y轴脉冲:{Label_p3.Y};"
);
Label_p3
.
Y
=
710000
;
}
if
(
Label_p3
.
X
<
-
40000
)
{
LabelMoveInfo
.
log
(
$
"计算Y轴脉冲:{Label_p3.X},超过负极限-40000,更改为-40000"
);
Label_p3
.
X
=
-
40000
;
}
//labelAxisPos += 85700;
LabelMoveInfo
.
log
(
$
"计算贴标像素点位为{p},轴点位为{Label_p3},X脉冲差值={xDiff},Y脉冲差值={yDiff},角度{labelAngle},R轴{labelAxisPos},盘宽{LabelMoveInfo.MoveParam.PlateW};角度脉冲{labelAxisPos}"
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl10_1
);
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
查看文件 @
b99a1c3
...
...
@@ -17,6 +17,26 @@ namespace DeviceLibrary
int
LeftCount
=
0
;
public
bool
SafeReleaseLeftShelf
=
false
;
int
Uppre
=
-
1000
;
int
Uplast
=
-
1000
;
int
step
=
0
;
/// <summary>
/// 料盘高度单位脉冲
/// </summary>
public
int
PlwHight
{
get
{
int
hight
=
0
;
//if (Uppre != -1000 && Uplast != -1000&&step==3)
if
(
Uppre
!=
-
1000
&&
Uplast
!=
-
1000
&&
step
==
2
)
{
hight
=
Math
.
Abs
(
Uplast
-
Uppre
)
+
2000
;
RightMoveInfo
.
log
(
$
"料盘高度计算:hight:{hight},Uppre:{Uppre},Uplast:{Uplast}"
);
}
return
hight
;
}
}
void
LeftProcess
()
{
if
(
CheckWait
(
LeftMoveInfo
))
...
...
@@ -24,6 +44,7 @@ namespace DeviceLibrary
switch
(
LeftMoveInfo
.
MoveStep
)
{
//阻挡上升,轴到p2
case
MoveStep
.
L01
:
LeftCount
=
0
;
LeftShelfNoTray
=
false
;
...
...
@@ -31,17 +52,22 @@ namespace DeviceLibrary
CylinderMove
(
null
,
IO_Type
.
LeftStopDown
,
IO_Type
.
LeftStopUP
);
LeftBatchAxisToP2
(
true
);
LeftMoveInfo
.
log
(
$
"批量轴上升到P2位置,第一次提升,LeftStartMovePosition={LeftStartMovePosition}"
);
step
=
1
;
break
;
//没有这个步骤
case
MoveStep
.
L02
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L03
);
LeftBatchAxisToP2
(
false
);
LeftMoveInfo
.
log
(
$
"批量轴上升到P2位置,二次提升,LeftStartMovePosition={LeftStartMovePosition}"
);
break
;
//轴下降一点
case
MoveStep
.
L03
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L04
);
//int currpot = Left_Batch_Axis.GetAclPosition();
LeftBatchAxisDown
();
LeftMoveInfo
.
log
(
$
"批量轴下降固定值"
);
break
;
//根据轴位置判断去料串满步骤还是不满步骤
case
MoveStep
.
L04
:
var
currpos
=
Left_Batch_Axis
.
GetAclPosition
();
if
(
currpos
<=
Config
.
Left_Batch_P1
)
...
...
@@ -54,16 +80,26 @@ namespace DeviceLibrary
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L10_WaitReelPut
);
}
break
;
//等中间步骤抓盘
case
MoveStep
.
L10_WaitReelPut
:
Msg
.
add
(
crc
.
GetString
(
"Res0095"
,
"左侧空闲中"
),
MsgLevel
.
info
);
break
;
//中间步骤给盘,下降一点,获取盘信息
case
MoveStep
.
L11_ReelPutted
:
LeftCount
++;
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L12
);
LeftBatchAxisDown
();
LabelMoveInfo
.
MoveParam
=
LeftMoveInfo
.
MoveParam
.
clone
();
LeftMoveInfo
.
log
(
$
"左侧料盘已放入,批量轴下降固定值"
);
if
(
step
==
2
)
{
LeftCount
++;
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L12
);
LeftBatchAxisDown
();
LabelMoveInfo
.
MoveParam
=
LeftMoveInfo
.
MoveParam
.
clone
();
LeftMoveInfo
.
log
(
$
"左侧料盘已放入,批量轴下降固定值"
);
}
else
{
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L11_ReelPutted
);
}
break
;
//防意外
case
MoveStep
.
L12
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L13
);
//LeftBatchAxisToP2(false);
...
...
@@ -72,10 +108,23 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
L13
:
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L20_WaitLabel
);
LeftMoveInfo
.
log
(
$
"批量轴完成上升,等待贴标"
);
int
currpot
=
Left_Batch_Axis
.
GetAclPosition
();
//if (step == 1)
//{
// Uppre = currpot;
// step = 2;
//}
//else if (step == 2)
//{
// Uplast = currpot;
// step = 3;
//}
LeftMoveInfo
.
log
(
$
"批量轴完成上升,等待贴标当前位置{currpot},步骤step:{step},Uppre:{Uppre},Uplast:{Uplast}"
);
break
;
//等贴标,由贴标流程跳出
case
MoveStep
.
L20_WaitLabel
:
break
;
//贴标完成,没有释放料串时进入判断料串满/不满流程
case
MoveStep
.
L30_LabelFinish
:
if
(
SafeReleaseLeftShelf
)
{
...
...
@@ -86,11 +135,19 @@ namespace DeviceLibrary
}
else
{
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L04
);
LeftBatchAxisDown
();
LeftMoveInfo
.
log
(
$
"贴标完成,批量轴下降固定值"
);
if
(
step
==
2
)
{
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L04
);
LeftBatchAxisDown
();
LeftMoveInfo
.
log
(
$
"贴标完成,批量轴下降固定值"
);
}
else
{
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L30_LabelFinish
);
}
}
break
;
//满了下降到p1点,没有agv运输时挡停下降
case
MoveStep
.
L40_ShelfFull
:
LeftShelfNoTray
=
true
;
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
LEND
);
...
...
@@ -110,7 +167,7 @@ namespace DeviceLibrary
LeftMoveInfo
.
log
(
$
"结束运动"
);
break
;
//}
//料串出料流程
//料串出料流程
,下降到p1,挡停下降,滚筒反转到后端检测低电平再转10秒,到前端检测低电平再转10秒,再等3秒,再等0.5秒后反转停止
//switch (LeftMoveInfo.MoveStep)
//{
case
MoveStep
.
L50_OutShelf
:
...
...
@@ -148,7 +205,7 @@ namespace DeviceLibrary
LeftMoveInfo
.
log
(
$
"电滚停止"
);
break
;
//}
//料串入料流程
//料串入料流程
,轴下降到p1,挡停下降,滚筒正转到后端检测高电平后再转60秒,再转1秒,再转0.5秒停止,进入上料流程
//switch (LeftMoveInfo.MoveStep)
//{
case
MoveStep
.
L60_InShelf
:
...
...
@@ -270,7 +327,15 @@ namespace DeviceLibrary
/// </summary>
void
LeftBatchAxisDown
()
{
int
targetP1
=
Left_Batch_Axis
.
GetAclPosition
()
-
ConfigHelper
.
Config
.
Get
(
"LeftAxisDownValue"
,
50
)
*
Config
.
Left_Batch_ChangeValue
;
if
(
PlwHight
>
5000
)
{
int
currpoint
=
Left_Batch_Axis
.
GetAclPosition
();
int
countPleHight
=
PlwHight
/
Config
.
Right_Batch_ChangeValue
*
Config
.
Left_Batch_ChangeValue
;
targetP1
=
currpoint
-
countPleHight
;
LeftMoveInfo
.
log
(
$
"出料提升机构,获取到料盘高度脉冲{PlwHight},当前位置{currpoint},计算盘高{countPleHight}"
);
}
int
targetSpeed
=
Config
.
Left_Batch_P1_speed
;
if
(
targetP1
<=
0
)
{
...
...
@@ -284,15 +349,15 @@ namespace DeviceLibrary
/// <summary>
/// 下降在上升以后,上升指定阈值,防止感应器失效
/// </summary>
void
LeftAxisRiseMax
()
void
LeftAxisRiseMax
()
{
//1.获取当前私服下降后的脉冲
LeftStartMovePosition
=
Left_Batch_Axis
.
GetAclPosition
();
//2.获取下降的高度、冗余高度、一毫米的脉冲值
int
downvalue
=
ConfigHelper
.
Config
.
Get
(
"LeftAxisDownValue"
,
50
);
int
redundancy
=
ConfigHelper
.
Config
.
Get
(
"LeftAxisRiseRedundancyValue"
,
10
);
int
redundancy
=
ConfigHelper
.
Config
.
Get
(
"LeftAxisRiseRedundancyValue"
,
10
);
int
change
=
Config
.
Left_Batch_ChangeValue
;
int
totalpulse
=(
downvalue
+
redundancy
)*
change
;
int
totalpulse
=
(
downvalue
+
redundancy
)
*
change
;
int
targetP2
=
LeftStartMovePosition
+
totalpulse
;
LeftMoveInfo
.
log
(
$
"下降固定值后提升,感应器亮或提升固定值:当前私服高度={LeftStartMovePosition},下降的固定高度={downvalue},"
+
$
"上升最大高度={redundancy},每毫米脉冲={change},上升脉冲为{targetP2},P2={Config.Left_Batch_P2}"
);
...
...
@@ -300,7 +365,7 @@ namespace DeviceLibrary
LeftMoveInfo
.
TimeOutSeconds
=
200
;
LeftMoveInfo
.
CanWhileCount
=
0
;
// 需要增加定时器,获取验证信号并停止伺服
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitBatchAxisMove
(
Config
.
Left_Batch_Axis
,
targetP2
,
targetSpeed
));
Config
.
Left_Batch_Axis
.
TargetPosition
=
targetP2
;
Left_Batch_Axis
.
AbsMove
(
null
,
targetP2
,
targetSpeed
);
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _MiddleProcess.cs
查看文件 @
b99a1c3
...
...
@@ -22,6 +22,7 @@ namespace DeviceLibrary
switch
(
MiddleMoveInfo
.
MoveStep
)
{
case
MoveStep
.
M_Standby
:
//如果右侧可取料那么那么移动轴到p2点,夹爪释放。获取右侧的标签信息,右侧标签信息复位,否则等待
if
(
RightMoveInfo
.
MoveStep
==
MoveStep
.
R10_WaitReelLeave
)
{
MiddleMoveInfo
.
NextMoveStep
(
MoveStep
.
M02
);
...
...
@@ -39,6 +40,7 @@ namespace DeviceLibrary
MiddleMoveInfo
.
log
(
"等待右侧可以取料"
);
}
break
;
//z轴移动到p3点,抓取,返回p2点
case
MoveStep
.
M02
:
MiddleMoveInfo
.
NextMoveStep
(
MoveStep
.
M03
);
Take_UpDown_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_UpDown_P3
,
Config
.
Take_UpDown_P3_speed
);
...
...
@@ -56,6 +58,7 @@ namespace DeviceLibrary
Take_UpDown_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_UpDown_P2
,
Config
.
Take_UpDown_P2_speed
);
MiddleMoveInfo
.
log
(
"上下轴返回P2点"
);
break
;
//如果抓取完成或者定位低电平,进入下一步,右侧进行下一盘;如果左侧空闲,存在NG或抓取失败人工处理,如果右侧进料确认右侧进入继续取料步骤,如果中间ng轴会p1点否则继续下一个流程
case
MoveStep
.
M05
:
if
(
clampTool
.
IsClamp
()
||
IOValue
(
IO_Type
.
RightTop_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
...
...
@@ -72,10 +75,12 @@ namespace DeviceLibrary
if
(
MiddleMoveInfo
.
MoveParam
.
IsNg
)
{
Msg
.
add
(
crc
.
GetString
(
"Res0096"
,
"抓料失败请手动处理,请将料盘放入:NG箱,按右侧按钮继续"
),
MsgLevel
.
alarm
);
MiddleMoveInfo
.
log
(
"抓料失败请手动处理,请将料盘放入:NG箱,按右侧按钮继续"
);
}
else
{
Msg
.
add
(
crc
.
GetString
(
"Res0097"
,
"抓料失败请手动处理,请将料盘放入: 左侧料串,按右侧按钮继续"
),
MsgLevel
.
alarm
);
MiddleMoveInfo
.
log
(
"抓料失败请手动处理,请将料盘放入: 左侧料串,按右侧按钮继续"
);
}
if
(
IOValue
(
IO_Type
.
Right_BTN
).
Equals
(
IO_VALUE
.
HIGH
))
...
...
@@ -96,6 +101,7 @@ namespace DeviceLibrary
MiddleMoveInfo
.
log
(
"抓料失败,等待左侧允许放料"
);
}
break
;
//NG料进入NG流程,正常入正常流程
case
MoveStep
.
M06
:
if
(
MiddleMoveInfo
.
MoveParam
.
IsNg
)
{
...
...
@@ -119,6 +125,7 @@ namespace DeviceLibrary
{
Msg
.
add
(
msg
,
MsgLevel
.
info
);
}
//左侧空闲,等待贴标流程为打印标签,复制信息给标签流程,进入下一步,移动旋转轴到p3
else
if
(
LeftMoveInfo
.
MoveStep
==
MoveStep
.
L10_WaitReelPut
)
{
if
(
true
||
clampTool
.
IsClamp
())
...
...
@@ -150,11 +157,13 @@ namespace DeviceLibrary
Msg
.
add
(
crc
.
GetString
(
"Res0098"
,
"等待左侧允许放料"
),
MsgLevel
.
info
);
}
break
;
//z轴到p4
case
MoveStep
.
M08
:
MiddleMoveInfo
.
NextMoveStep
(
MoveStep
.
M09
);
Take_UpDown_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_UpDown_P4
,
Config
.
Take_UpDown_P4_speed
);
MiddleMoveInfo
.
log
(
"左侧允许放料,上下轴到P4"
);
break
;
//夹爪释放复制信息给左侧流程,左侧进入到收到料流程
case
MoveStep
.
M09
:
if
(
clampTool
.
Release
())
{
...
...
@@ -171,6 +180,7 @@ namespace DeviceLibrary
}
Msg
.
add
(
crc
.
GetString
(
"Res0050"
,
"等待夹爪放松"
),
MsgLevel
.
info
);
break
;
//待机流程
case
MoveStep
.
M10
:
MiddleMoveInfo
.
NextMoveStep
(
MoveStep
.
M_ReturnToP1
);
Take_UpDown_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_UpDown_P1
,
Config
.
Take_UpDown_P1_speed
);
...
...
@@ -181,7 +191,13 @@ namespace DeviceLibrary
Take_Middle_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_Middle_P1
,
Config
.
Take_Middle_P1_speed
);
MiddleMoveInfo
.
log
(
"放料完成,旋转轴返回待机点"
);
break
;
//NG流程
case
MoveStep
.
M20_ToNgBox
:
MiddleMoveInfo
.
NextMoveStep
(
MoveStep
.
M20_1_ToNgBox
);
Take_UpDown_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_UpDown_P1
,
Config
.
Take_UpDown_P1_speed
);
MiddleMoveInfo
.
log
(
"NG时上下轴转到P1"
);
break
;
case
MoveStep
.
M20_1_ToNgBox
:
MiddleMoveInfo
.
NextMoveStep
(
MoveStep
.
M21
);
Take_Middle_Axis
.
AbsMove
(
MiddleMoveInfo
,
Config
.
Take_Middle_P5
,
Config
.
Take_Middle_P5_speed
);
MiddleMoveInfo
.
log
(
"旋转轴转到P5 NG位置"
);
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
查看文件 @
b99a1c3
...
...
@@ -6,6 +6,7 @@ using OnlineStore.LoadCSVLibrary;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Threading
;
using
System.Threading.Tasks
;
namespace
DeviceLibrary
...
...
@@ -15,6 +16,7 @@ namespace DeviceLibrary
public
bool
RightShelfNoTray
=
false
;
int
RightCount
=
0
;
public
volatile
bool
SafeReleaseRightShelf
=
false
;
void
RightProcess
()
{
if
(
CheckWait
(
RightMoveInfo
))
...
...
@@ -22,6 +24,7 @@ namespace DeviceLibrary
//常规上料扫码流程
switch
(
RightMoveInfo
.
MoveStep
)
{
//进料口阻挡下降,提升轴先快速上升后缓速调整位置
case
MoveStep
.
R01
:
RightCount
=
0
;
RightShelfNoTray
=
false
;
...
...
@@ -32,15 +35,22 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
R02
:
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R03
);
Uppre
=
Right_Batch_Axis
.
GetAclPosition
();
step
=
1
;
RightBatchAxisToP2
(
false
);
RightMoveInfo
.
log
(
$
"批量轴上升到P2位置,二次提升,RightStartMovePosition={RightStartMovePosition}"
);
break
;
case
MoveStep
.
R03
:
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R04
);
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R04
);
Uplast
=
Right_Batch_Axis
.
GetAclPosition
();
step
=
2
;
RightMoveInfo
.
log
(
$
"批量轴上升到P2位置到位,当前位置{Uplast}"
);
break
;
//如果定位上升并且特定中间步骤偶,开始扫码
case
MoveStep
.
R04
:
if
(
IOValue
(
IO_Type
.
RightTop_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
RightShelfNoTray
.
Equals
(
false
))
{
if
(
MiddleMoveInfo
.
MoveStep
>=
MoveStep
.
M09
||
MiddleMoveInfo
.
MoveStep
<
MoveStep
.
M02
)
{
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R06_GettedReelInfo
);
...
...
@@ -50,6 +60,7 @@ namespace DeviceLibrary
}
else
{
//不是结束取料,当误差过大时消除误差
if
(
RightShelfNoTray
.
Equals
(
false
))
{
//判断当前位置是否在指定的位置
...
...
@@ -64,16 +75,19 @@ namespace DeviceLibrary
return
;
}
}
//否则进入无料步骤
//无料盘
//RightShelfNoTray = true;
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R12_ShelfNoTray
);
RightMoveInfo
.
log
(
$
"批量轴已上升到顶,料串已空."
);
}
break
;
//正常扫码流程,获取扫码信息,标记是否NG,进入取盘流程
case
MoveStep
.
R06_GettedReelInfo
:
if
(
RightScanTask
.
IsCompleted
)
{
var
(
x
,
k
,
s
,
b
)
=
RightScanTask
.
Result
;
//返回扫码信息,关键字,图片路径,坐标
var
(
x
,
k
,
s
,
b
)
=
RightScanTask
.
Result
;
if
(
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
SaveReelPhoto
,
false
))
{
string
d
=
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
ReelPhotoSaveDir
);
...
...
@@ -81,16 +95,26 @@ namespace DeviceLibrary
string
df
=
Path
.
Combine
(
d
,
fn
);
File
.
Copy
(
s
,
df
);
}
int
pointX
=-
1
;
int
pointY
=
-
1
;
int
pointX
=
-
1
;
int
pointY
=
-
1
;
b
.
TryGetValue
(
"PointX"
,
out
pointX
);
b
.
TryGetValue
(
"PointY"
,
out
pointY
);
if
(
x
.
Count
==
0
||
pointX
<=
0
||
pointY
<=
0
)
if
(
x
.
Count
==
0
||
pointX
<=
0
||
pointY
<=
0
)
{
RightMoveInfo
.
log
(
$
"未识别到有效二维码,转入NG箱;pointX={pointX};pointY={pointY}"
);
RightMoveInfo
.
MoveParam
.
IsNg
=
true
;
ServerCM
.
SendNGInfo
(
crc
.
GetString
(
"Res0128.e5d9ef10"
,
"模版匹配失败"
));
UnifiedDataHandler
.
RecordPrintNg
(
false
,
false
,
out
string
[]
strarrys
);
if
(
ServerCommunication
.
EnableHttpServer
)
{
if
(
Monitor
.
TryEnter
(
ServerCM
.
serverclock
,
TimeSpan
.
FromSeconds
(
5
)))
{
ServerCM
.
SendNGInfo
(
crc
.
GetString
(
"Res0128.e5d9ef10"
,
"模版匹配失败"
));
}
else
{
RightMoveInfo
.
log
(
$
"上传服务器NG状态超时"
);
}
}
UnifiedDataHandler
.
RecordPrintNg
(
false
,
false
,
out
string
[]
strarrys
);
}
else
{
...
...
@@ -115,11 +139,13 @@ namespace DeviceLibrary
RightMoveInfo
.
log
(
$
"等待扫码超时"
);
}
break
;
//等待中间流程跳出这个步骤
case
MoveStep
.
R10_WaitReelLeave
:
Msg
.
add
(
crc
.
GetString
(
"Res0099"
,
"等待料盘取走"
),
MsgLevel
.
info
);
break
;
case
MoveStep
.
R11_NextReel
:
RightCount
++;
//处于释放状态转到无料料流程,否则回到取料流程
if
(
SafeReleaseRightShelf
)
{
SafeReleaseRightShelf
=
false
;
...
...
@@ -133,6 +159,7 @@ namespace DeviceLibrary
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
}
break
;
//无料流程,轴下降到P1点,如果用AGV运输料串那么进料口阻挡下降,进入到结束流程(会进入到出料串流程)
case
MoveStep
.
R12_ShelfNoTray
:
RightShelfNoTray
=
true
;
ConfigHelper
.
Config
.
Set
(
Setting_Init
.
SaveReelPhoto
,
false
);
...
...
@@ -146,14 +173,14 @@ namespace DeviceLibrary
{
CylinderMove
(
LeftMoveInfo
,
IO_Type
.
RightStopUP
,
IO_Type
.
RightStopDown
);
RightMoveInfo
.
log
(
$
"料串已取完, 批量轴下降到P1,阻挡下降"
);
}
}
break
;
case
MoveStep
.
REND
:
RightMoveInfo
.
log
(
$
"结束运动"
);
RightMoveInfo
.
EndMove
();
break
;
//}
//料串出料流程
//料串出料流程
,下降到P1点,阻挡下降,滚筒反转,等待到位后端检测为低电平延时3秒,等待到位前端检测为低电平延时3秒,延时0.5秒反转停止,进入结束步骤
//switch (RightMoveInfo.MoveStep)
//{
case
MoveStep
.
R30_OutShelf
:
...
...
@@ -187,7 +214,7 @@ namespace DeviceLibrary
RightMoveInfo
.
log
(
$
"电滚停止"
);
break
;
//}
//料串入料流程
//料串入料流程
,轴下降到P1点,阻挡下降,滚筒正转,等待后端到位检测高电平延时5秒,0.5秒后滚筒正转停,阻挡上升,进入上料料流程
//switch (RightMoveInfo.MoveStep)
//{
case
MoveStep
.
R40_InShelf
:
...
...
@@ -205,7 +232,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
RightMoto_Reverse
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
);
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
RightEnd_Check
,
IO_VALUE
.
HIGH
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5
*
1000
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5
*
1000
));
//RightMoveInfo.TimeOutSeconds = 60;
//RightMoveInfo.OneWaitCanEndStep = true;
RightMoveInfo
.
log
(
$
"等待料串到位"
);
...
...
@@ -242,14 +269,14 @@ namespace DeviceLibrary
string
state
=
""
;
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
state
+=
string
.
Format
(
crc
.
GetString
(
"Res0123.d86f0192"
,
"有料串,已提取{0}张料盘"
),
RightCount
);
state
+=
string
.
Format
(
crc
.
GetString
(
"Res0123.d86f0192"
,
"有料串,已提取{0}张料盘"
),
RightCount
);
if
(
RightShelfNoTray
)
state
+=
crc
.
GetString
(
"Res0100"
,
",料串已清空. "
)
+
"\r\n"
;
state
+=
crc
.
GetString
(
"Res0100"
,
",料串已清空. "
)
+
"\r\n"
;
else
state
+=
"."
;
state
+=
crc
.
GetString
(
"Res0045"
,
"当前ReelID:"
)
+
RightMoveInfo
.
MoveParam
.
WareCode
;
}
}
else
{
return
crc
.
GetString
(
"Res0046"
,
"无料串"
);
...
...
@@ -322,6 +349,6 @@ namespace DeviceLibrary
//开始检测信号
Right_Batch_Axis
.
BatchAxisStartCheck
(
IO_Type
.
RightTop_Check
,
IO_VALUE
.
HIGH
);
}
int
RightEndMovePosition
=
0
;
int
RightEndMovePosition
=
0
;
}
}
\ No newline at end of file
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
查看文件 @
b99a1c3
...
...
@@ -250,52 +250,84 @@ namespace DeviceLibrary
switch
(
ResetMoveInfo
.
MoveStep
)
{
case
MoveStep
.
H01_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_HomeReset
);
//MoveInfo.WaitList.Add(WaitResultInfo.WaitTime(1000));
ResetMoveInfo
.
log
(
"正在回原"
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H01_1_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H01_HomeReset"
);
SafeReleaseLeftShelf
=
false
;
Label_Z_Axis
.
HomeMove
(
ResetMoveInfo
);
Take_UpDown_Axis
.
HomeMove
(
ResetMoveInfo
);
IOMove
(
IO_Type
.
Device_Led
,
IO_VALUE
.
HIGH
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
break
;
case
MoveStep
.
H01_1_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H01_2_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H01_1_HomeReset"
);
Take_Middle_Axis
.
HomeMove
(
ResetMoveInfo
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
break
;
case
MoveStep
.
H01_2_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H01_2_HomeReset"
);
Label_Z_Axis
.
HomeMove
(
ResetMoveInfo
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
break
;
case
MoveStep
.
H02_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H0
3
_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原"
);
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H0
2_1
_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原
H02_HomeReset
"
);
Label_Z_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_Z_P1
,
Config
.
Label_Z_P1_speed
);
Left_Batch_Axis
.
HomeMove
(
ResetMoveInfo
);
Right_Batch_Axis
.
HomeMove
(
ResetMoveInfo
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
break
;
case
MoveStep
.
H02_1_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_2_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H02_1_HomeReset"
);
Label_R_Axis
.
HomeMove
(
ResetMoveInfo
);
Label_X_Axis
.
HomeMove
(
ResetMoveInfo
);
//Label_Y_Axis.HomeMove(ResetMoveInfo);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
2000
));
break
;
case
MoveStep
.
H02_2_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H02_3_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H02_2_HomeReset"
);
Label_R_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_R_P1
,
Config
.
Label_R_P1_speed
);
Label_X_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_X_P1
,
Config
.
Label_X_P1_speed
);
//Label_Y_Axis.HomeMove(ResetMoveInfo);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
5000
));
break
;
case
MoveStep
.
H02_3_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H03_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H02_3_HomeReset"
);
Label_Y_Axis
.
HomeMove
(
ResetMoveInfo
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
break
;
case
MoveStep
.
H03_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H04_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原"
);
Label_
R_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_R_P1
,
Config
.
Label_R
_P1_speed
);
ResetMoveInfo
.
log
(
"正在回原
H03_HomeReset
"
);
Label_
Y_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_Y_P1
,
Config
.
Label_Y
_P1_speed
);
break
;
case
MoveStep
.
H04_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H05_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原"
);
Take_UpDown_Axis
.
HomeMove
(
ResetMoveInfo
);
ResetMoveInfo
.
log
(
"正在回原
H04_HomeReset
"
);
//
Take_UpDown_Axis.HomeMove(ResetMoveInfo);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
1000
));
break
;
case
MoveStep
.
H05_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H06_HomeReset
);
Take_Middle_Axis
.
HomeMove
(
ResetMoveInfo
);
Label_X_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_X_P1
,
Config
.
Label_X_P1_speed
);
Label_Y_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Label_Y_P1
,
Config
.
Label_Y_P1_speed
);
ResetMoveInfo
.
log
(
"正在回原H05_HomeReset"
);
//Take_Middle_Axis.HomeMove(ResetMoveInfo);
//Label_X_Axis.AbsMove(ResetMoveInfo, Config.Label_X_P1, Config.Label_X_P1_speed);
//Label_Y_Axis.AbsMove(ResetMoveInfo, Config.Label_Y_P1, Config.Label_Y_P1_speed);
Right_Batch_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Right_Batch_P1
,
Config
.
Right_Batch_P1_speed
);
Left_Batch_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Left_Batch_P1
,
Config
.
Left_Batch_P1_speed
);
ResetMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
500
));
break
;
case
MoveStep
.
H06_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H07_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原"
);
ResetMoveInfo
.
log
(
"正在回原
H06_HomeReset
"
);
Take_UpDown_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Take_UpDown_P1
,
Config
.
Take_UpDown_P1_speed
);
break
;
case
MoveStep
.
H07_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
H08_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H07_HomeReset"
);
Take_Middle_Axis
.
AbsMove
(
ResetMoveInfo
,
Config
.
Take_Middle_P1
,
Config
.
Take_Middle_P1_speed
);
ResetMoveInfo
.
log
(
"正在回原 进出料口滚筒正转5秒"
);
IOMove
(
IO_Type
.
LeftMoto_Reverse
,
IO_VALUE
.
LOW
);
...
...
@@ -306,6 +338,7 @@ namespace DeviceLibrary
break
;
case
MoveStep
.
H08_HomeReset
:
ResetMoveInfo
.
NextMoveStep
(
MoveStep
.
HEND_HomeReset
);
ResetMoveInfo
.
log
(
"正在回原H08_HomeReset"
);
ResetMoveInfo
.
log
(
"正在回原 阻挡气缸判断"
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
LOW
);
...
...
DeviceLibrary/AutoScanAndLabel/MoveStep.cs
查看文件 @
b99a1c3
...
...
@@ -12,7 +12,12 @@ namespace DeviceLibrary
Wait
,
//回原流程
H01_HomeReset
,
H01_1_HomeReset
,
H01_2_HomeReset
,
H02_HomeReset
,
H02_1_HomeReset
,
H02_2_HomeReset
,
H02_3_HomeReset
,
H03_HomeReset
,
H04_HomeReset
,
H05_HomeReset
,
...
...
@@ -92,6 +97,7 @@ namespace DeviceLibrary
M09
,
M10
,
M20_ToNgBox
,
M20_1_ToNgBox
,
M21
,
M22
,
M23
,
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
b99a1c3
...
...
@@ -23,7 +23,7 @@ namespace DeviceLibrary
public
class
CodeManager
{
public
static
string
CodeType
=
ConfigAppSettings
.
GetValue
(
Setting_Init
.
CodeType
);
private
static
int
QRCodeCount
=
ConfigAppSettings
.
GetIntValue
(
Setting_Init
.
QRCodeCount
);
//
private static int QRCodeCount = ConfigAppSettings.GetIntValue(Setting_Init.QRCodeCount);
public
static
List
<
string
>
cameraNameList
=
new
List
<
string
>();
public
static
List
<
string
>
codeTypeList
=
new
List
<
string
>();
public
static
List
<
string
>
hikNameList
=
new
List
<
string
>();
...
...
@@ -108,7 +108,7 @@ namespace DeviceLibrary
}
Camera
.
Type
=
cameraType
;
Camera
.
_cam
.
Load
();
LogUtil
.
error
(
$
"本次加载相机类型为:{camname}"
);
LogUtil
.
info
(
$
"本次加载相机类型为:{camname}"
);
}
catch
(
Exception
ex
)
{
...
...
DeviceLibrary/DeviceLibrary/DataUploadUtil.cs
查看文件 @
b99a1c3
...
...
@@ -168,7 +168,7 @@ namespace DeviceLibrary
string
con
=
line
;
fileContainer
.
CreateFile
(
fileName
,
con
);
lastFileInfo
=
"["
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)
+
"]: "
+
fileName
+
"\t"
+
line
;
LogUtil
.
error
(
$
"共享文件夹{smb_path} 创建文件{fileName}完成 "
);
LogUtil
.
info
(
$
"共享文件夹{smb_path} 创建文件{fileName}完成 "
);
}
else
...
...
DeviceLibrary/DeviceLibrary/PrinterHelper.cs
查看文件 @
b99a1c3
...
...
@@ -21,7 +21,9 @@ namespace DeviceLibrary
int
dpi
=
100
;
public
static
bool
istscprin
=
ConfigHelper
.
Config
.
Get
(
"Hardwareversion"
,
"V2"
)==
"V2"
;
public
PrintDevice
printDevice
=
ConfigHelper
.
Config
.
Get
(
"PrintDevice"
,
istscprin
?
PrintDevice
.
TSC
:
PrintDevice
.
Zebra
);
public
static
bool
newistscprin
=
ConfigHelper
.
Config
.
Get
(
"HardwareversionofAGV"
,
"V2"
)
==
"V2"
;
//public PrintDevice printDevice = ConfigHelper.Config.Get("PrintDevice", istscprin ? PrintDevice.TSC : PrintDevice.Zebra);
public
PrintDevice
printDevice
=
ConfigHelper
.
Config
.
Get
(
"PrintDevice"
,
istscprin
?
PrintDevice
.
TSC
:
(
newistscprin
?
PrintDevice
.
TSC
:
PrintDevice
.
Zebra
));
public
enum
PrintDevice
{
TSC
,
Zebra
,
...
...
DeviceLibrary/DeviceLibrary/RemoteDecodeHelper.cs
查看文件 @
b99a1c3
using
CodeLibrary
;
using
DeviceLibrary
;
using
HalconDotNet
;
using
IDHIKCamera
;
using
Newtonsoft.Json
;
using
OnlineStore.Common
;
using
OnlineStore.LoadCSVLibrary
;
...
...
@@ -92,11 +93,22 @@ public class RemoteDecodeHelper_mod
}
#
region
扫码相机请求
ns100
方法
public
static
WebResultCode
NeoSacnRequest
(
Bitmap
bitmap
,
List
<
CodeInfo
>
codeInfos
,
int
PlateW
)
public
static
WebResultCode
NeoSacnRequest
(
Bitmap
bitmap
,
List
<
Code
Library
.
Code
Info
>
codeInfos
,
int
PlateW
)
{
WebResultCode
resultCode
=
null
;
try
{
var
deg
=
codeInfos
[
0
].
Orientation
;
//if (codeInfos[0].CodeType == "QR Code")
//{
// deg += 90;
// if (deg > 360)
// deg = deg - 360;
// LogUtil.info("QR Code转换后角度:" + deg);
//}
//codeInfos[0].Orientation = deg;
CheckAndRunServer
();
BitmapData
bitmapData
=
new
BitmapData
();
string
iamgestr
=
BitmapToBase64
(
bitmap
);
...
...
DeviceLibrary/DeviceLibrary/ServerCommunication.cs
查看文件 @
b99a1c3
using
ConfigHelper
;
using
HalconDotNet
;
using
Newtonsoft.Json
;
using
OnlineStore
;
...
...
@@ -24,6 +25,7 @@ namespace DeviceLibrary
public
class
ServerCommunication
{
volatile
StoreStatus
_storeStatus
=
StoreStatus
.
Debugging
;
public
static
bool
EnableHttpServer
=
Config
.
Get
<
bool
>(
"EnableHttpServer"
,
true
);
public
StoreStatus
storeStatus
{
get
=>
_storeStatus
;
...
...
@@ -42,7 +44,7 @@ namespace DeviceLibrary
string
WarnMsg
=
""
;
private
System
.
Timers
.
Timer
serverConnectTimer
=
new
System
.
Timers
.
Timer
();
object
serverclock
=
new
object
();
public
object
serverclock
=
new
object
();
public
ServerCommunication
()
{
serverConnectTimer
.
Interval
=
1000
;
...
...
@@ -60,8 +62,18 @@ namespace DeviceLibrary
if
(!
RobotManage
.
isRunning
)
return
;
SendLineStatus
();
if
(
ServerCommunication
.
EnableHttpServer
)
{
if
(
Monitor
.
TryEnter
(
serverclock
,
TimeSpan
.
FromSeconds
(
5
)))
{
SendLineStatus
();
}
else
{
LogUtil
.
error
(
"上传SendLineStatus超时"
);
}
}
}
public
void
ProcessMsg
(
List
<
Msg
>
msg
)
...
...
@@ -226,62 +238,78 @@ namespace DeviceLibrary
}
public
bool
SendAgvLog
(
string
msg
)
{
if
(!
server
.
ToLower
().
StartsWith
(
"http"
))
{
return
false
;
}
lock
(
serverclock
)
if
(
Monitor
.
TryEnter
(
serverclock
,
TimeSpan
.
FromSeconds
(
5
)))
{
Operation
operation
=
getLineBoxStatus
();
if
(!
server
.
ToLower
().
StartsWith
(
"http"
))
{
return
false
;
}
lock
(
serverclock
)
{
Operation
operation
=
getLineBoxStatus
();
//operation.logList = new List<AgvLogInfo>
//{
// new AgvLogInfo(msg)
//};
//LogUtil.info(JsonHelper.SerializeObject(operation));
//operation.logList = new List<AgvLogInfo>
//{
// new AgvLogInfo(msg)
//};
//LogUtil.info(JsonHelper.SerializeObject(operation));
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
5000
);
if
(
resultOperation
==
null
)
{
LogUtil
.
info
(
$
"SendAgvLog error:{msg}"
);
return
false
;
if
(
resultOperation
==
null
)
{
LogUtil
.
info
(
$
"SendAgvLog error:{msg}"
);
return
false
;
}
LogUtil
.
info
(
$
"SendAgvLog success:{msg}"
);
}
LogUtil
.
info
(
$
"SendAgvLog success:{msg}"
);
return
true
;
}
else
{
LogUtil
.
info
(
$
"SendAgvLog 超时"
);
return
false
;
}
return
true
;
}
string
mimoCid
=
ConfigHelper
.
Config
.
Get
(
"MIMO_CID"
,
"01"
);
public
bool
OpMIMO
(
string
msg
,
Dictionary
<
string
,
string
>
operate
)
{
if
(
!
server
.
ToLower
().
StartsWith
(
"http"
))
if
(
Monitor
.
TryEnter
(
serverclock
,
TimeSpan
.
FromSeconds
(
5
)
))
{
return
false
;
}
lock
(
serverclock
)
{
Operation
operation
=
getLineBoxStatus
();
if
(!
server
.
ToLower
().
StartsWith
(
"http"
))
{
return
false
;
}
lock
(
serverclock
)
{
Operation
operation
=
getLineBoxStatus
();
//operation.mimoOpMap = new Dictionary<string, Dictionary<string, string>>();
//Dictionary<string, string> op = new Dictionary<string, string>
//{
// { "Y10", "open" }
//};
//operation.mimoOpMap.Add("1", op);
//operation.mimoOpMap = new Dictionary<string, Dictionary<string, string>>();
//Dictionary<string, string> op = new Dictionary<string, string>
//{
// { "Y10", "open" }
//};
//operation.mimoOpMap.Add("1", op);
//operation.mimoOpMap.Add(mimoCid, operate);
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
//operation.mimoOpMap.Add(mimoCid, operate);
LogUtil
.
info
(
JsonHelper
.
SerializeObject
(
operation
));
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
1000
);
Operation
resultOperation
=
HttpHelper
.
Post
(
GetPostApi
(),
operation
,
1000
);
if
(
resultOperation
==
null
)
{
LogUtil
.
info
(
$
"OpMIMO error:{msg}"
);
return
false
;
if
(
resultOperation
==
null
)
{
LogUtil
.
info
(
$
"OpMIMO error:{msg}"
);
return
false
;
}
LogUtil
.
info
(
$
"OpMIMO success:{msg}"
);
}
LogUtil
.
info
(
$
"OpMIMO success:{msg}"
);
return
true
;
}
else
{
LogUtil
.
info
(
$
"OpMIMO超时"
);
return
false
;
}
return
true
;
}
public
int
queueTaskCount
=
-
1
;
ConcurrentQueue
<
string
>
commandResultMsg
=
new
ConcurrentQueue
<
string
>();
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论