Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO827-AutoScanAndLabel
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1a0fe5f3
由
刘韬
编写于
2021-02-23 13:24:33 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
优化状态显示
1 个父辈
1eb794b3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
250 行增加
和
155 行删除
AutoScanAndLabel/Form1.Designer.cs
AutoScanAndLabel/Form1.cs
AutoScanAndLabel/LogControl.Designer.cs
AutoScanAndLabel/SettingControl.Designer.cs
AutoScanAndLabel/SettingControl.cs
Common/Common.csproj
Common/util/AcSerialBean.cs
DeviceLibrary/AutoScanAndLabel/AxisBean.cs
DeviceLibrary/AutoScanAndLabel/Common.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _Common.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LedProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _MiddleProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _Printer.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
DeviceLibrary/AutoScanAndLabel/MoveInfo.cs
DeviceLibrary/AutoScanAndLabel/RobotManage.cs
DeviceLibrary/Config/general.config
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/ElectricGripper.cs
DeviceLibrary/DeviceLibrary/IOManager.cs
LoadCVSLibrary/storeConfig/config/Robot_Config.cs
AutoScanAndLabel/Form1.Designer.cs
查看文件 @
1a0fe5f
...
@@ -36,13 +36,13 @@ namespace AutoScanAndLabel
...
@@ -36,13 +36,13 @@ namespace AutoScanAndLabel
this
.
退出
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
退出
ToolStripMenuItem
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabPage1
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
tabPage1
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
cb_IgnoreGratingSignal
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
cb_IgnoreSafecheck
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
cb_IgnoreSafecheck
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
groupBox1
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox1
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
stateView
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
stateView
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
listView1
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_stop
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_run
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
cb_IgnoreGratingSignal
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
menuStrip1
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
this
.
tabPage1
.
SuspendLayout
();
...
@@ -98,10 +98,10 @@ namespace AutoScanAndLabel
...
@@ -98,10 +98,10 @@ namespace AutoScanAndLabel
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
tabControl1
.
Controls
.
Add
(
this
.
tabPage1
);
this
.
tabControl1
.
Controls
.
Add
(
this
.
tabPage1
);
this
.
tabControl1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
tabControl1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
tabControl1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
106
);
this
.
tabControl1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
90
);
this
.
tabControl1
.
Name
=
"tabControl1"
;
this
.
tabControl1
.
Name
=
"tabControl1"
;
this
.
tabControl1
.
SelectedIndex
=
0
;
this
.
tabControl1
.
SelectedIndex
=
0
;
this
.
tabControl1
.
Size
=
new
System
.
Drawing
.
Size
(
1350
,
605
);
this
.
tabControl1
.
Size
=
new
System
.
Drawing
.
Size
(
1350
,
599
);
this
.
tabControl1
.
TabIndex
=
1
;
this
.
tabControl1
.
TabIndex
=
1
;
//
//
// tabPage1
// tabPage1
...
@@ -111,11 +111,22 @@ namespace AutoScanAndLabel
...
@@ -111,11 +111,22 @@ namespace AutoScanAndLabel
this
.
tabPage1
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
tabPage1
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
tabPage1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
30
);
this
.
tabPage1
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
30
);
this
.
tabPage1
.
Name
=
"tabPage1"
;
this
.
tabPage1
.
Name
=
"tabPage1"
;
this
.
tabPage1
.
Size
=
new
System
.
Drawing
.
Size
(
1342
,
5
71
);
this
.
tabPage1
.
Size
=
new
System
.
Drawing
.
Size
(
1342
,
5
65
);
this
.
tabPage1
.
TabIndex
=
0
;
this
.
tabPage1
.
TabIndex
=
0
;
this
.
tabPage1
.
Text
=
"信息"
;
this
.
tabPage1
.
Text
=
"信息"
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
this
.
tabPage1
.
UseVisualStyleBackColor
=
true
;
//
//
// cb_IgnoreGratingSignal
//
this
.
cb_IgnoreGratingSignal
.
AutoSize
=
true
;
this
.
cb_IgnoreGratingSignal
.
Location
=
new
System
.
Drawing
.
Point
(
653
,
73
);
this
.
cb_IgnoreGratingSignal
.
Name
=
"cb_IgnoreGratingSignal"
;
this
.
cb_IgnoreGratingSignal
.
Size
=
new
System
.
Drawing
.
Size
(
125
,
25
);
this
.
cb_IgnoreGratingSignal
.
TabIndex
=
2
;
this
.
cb_IgnoreGratingSignal
.
Text
=
"忽略安全光栅"
;
this
.
cb_IgnoreGratingSignal
.
UseVisualStyleBackColor
=
true
;
this
.
cb_IgnoreGratingSignal
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
cb_IgnoreGratingSignal_CheckedChanged
);
//
// cb_IgnoreSafecheck
// cb_IgnoreSafecheck
//
//
this
.
cb_IgnoreSafecheck
.
AutoSize
=
true
;
this
.
cb_IgnoreSafecheck
.
AutoSize
=
true
;
...
@@ -132,7 +143,7 @@ namespace AutoScanAndLabel
...
@@ -132,7 +143,7 @@ namespace AutoScanAndLabel
this
.
groupBox1
.
Controls
.
Add
(
this
.
stateView
);
this
.
groupBox1
.
Controls
.
Add
(
this
.
stateView
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
21
,
32
);
this
.
groupBox1
.
Location
=
new
System
.
Drawing
.
Point
(
21
,
32
);
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Name
=
"groupBox1"
;
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
598
,
225
);
this
.
groupBox1
.
Size
=
new
System
.
Drawing
.
Size
(
611
,
225
);
this
.
groupBox1
.
TabIndex
=
1
;
this
.
groupBox1
.
TabIndex
=
1
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
TabStop
=
false
;
this
.
groupBox1
.
Text
=
"运行状态"
;
this
.
groupBox1
.
Text
=
"运行状态"
;
...
@@ -146,7 +157,7 @@ namespace AutoScanAndLabel
...
@@ -146,7 +157,7 @@ namespace AutoScanAndLabel
this
.
stateView
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
25
);
this
.
stateView
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
25
);
this
.
stateView
.
MultiSelect
=
false
;
this
.
stateView
.
MultiSelect
=
false
;
this
.
stateView
.
Name
=
"stateView"
;
this
.
stateView
.
Name
=
"stateView"
;
this
.
stateView
.
Size
=
new
System
.
Drawing
.
Size
(
592
,
197
);
this
.
stateView
.
Size
=
new
System
.
Drawing
.
Size
(
605
,
197
);
this
.
stateView
.
TabIndex
=
0
;
this
.
stateView
.
TabIndex
=
0
;
this
.
stateView
.
UseCompatibleStateImageBehavior
=
false
;
this
.
stateView
.
UseCompatibleStateImageBehavior
=
false
;
//
//
...
@@ -161,14 +172,14 @@ namespace AutoScanAndLabel
...
@@ -161,14 +172,14 @@ namespace AutoScanAndLabel
this
.
listView1
.
MultiSelect
=
false
;
this
.
listView1
.
MultiSelect
=
false
;
this
.
listView1
.
Name
=
"listView1"
;
this
.
listView1
.
Name
=
"listView1"
;
this
.
listView1
.
ShowGroups
=
false
;
this
.
listView1
.
ShowGroups
=
false
;
this
.
listView1
.
Size
=
new
System
.
Drawing
.
Size
(
834
,
1
34
);
this
.
listView1
.
Size
=
new
System
.
Drawing
.
Size
(
834
,
1
18
);
this
.
listView1
.
TabIndex
=
2
;
this
.
listView1
.
TabIndex
=
2
;
this
.
listView1
.
UseCompatibleStateImageBehavior
=
false
;
this
.
listView1
.
UseCompatibleStateImageBehavior
=
false
;
//
//
// btn_stop
// btn_stop
//
//
this
.
btn_stop
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_stop
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_stop
.
Location
=
new
System
.
Drawing
.
Point
(
149
,
4
7
);
this
.
btn_stop
.
Location
=
new
System
.
Drawing
.
Point
(
149
,
4
2
);
this
.
btn_stop
.
Name
=
"btn_stop"
;
this
.
btn_stop
.
Name
=
"btn_stop"
;
this
.
btn_stop
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
37
);
this
.
btn_stop
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
37
);
this
.
btn_stop
.
TabIndex
=
3
;
this
.
btn_stop
.
TabIndex
=
3
;
...
@@ -179,7 +190,7 @@ namespace AutoScanAndLabel
...
@@ -179,7 +190,7 @@ namespace AutoScanAndLabel
// btn_run
// btn_run
//
//
this
.
btn_run
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_run
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btn_run
.
Location
=
new
System
.
Drawing
.
Point
(
25
,
4
7
);
this
.
btn_run
.
Location
=
new
System
.
Drawing
.
Point
(
25
,
4
2
);
this
.
btn_run
.
Name
=
"btn_run"
;
this
.
btn_run
.
Name
=
"btn_run"
;
this
.
btn_run
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
37
);
this
.
btn_run
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
37
);
this
.
btn_run
.
TabIndex
=
4
;
this
.
btn_run
.
TabIndex
=
4
;
...
@@ -187,23 +198,12 @@ namespace AutoScanAndLabel
...
@@ -187,23 +198,12 @@ namespace AutoScanAndLabel
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
UseVisualStyleBackColor
=
true
;
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
this
.
btn_run
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_run_Click
);
//
//
// cb_IgnoreGratingSignal
//
this
.
cb_IgnoreGratingSignal
.
AutoSize
=
true
;
this
.
cb_IgnoreGratingSignal
.
Location
=
new
System
.
Drawing
.
Point
(
653
,
73
);
this
.
cb_IgnoreGratingSignal
.
Name
=
"cb_IgnoreGratingSignal"
;
this
.
cb_IgnoreGratingSignal
.
Size
=
new
System
.
Drawing
.
Size
(
125
,
25
);
this
.
cb_IgnoreGratingSignal
.
TabIndex
=
2
;
this
.
cb_IgnoreGratingSignal
.
Text
=
"忽略安全光栅"
;
this
.
cb_IgnoreGratingSignal
.
UseVisualStyleBackColor
=
true
;
this
.
cb_IgnoreGratingSignal
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
cb_IgnoreGratingSignal_CheckedChanged
);
//
// Form1
// Form1
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
14F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
14F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1350
,
711
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1350
,
689
);
this
.
Controls
.
Add
(
this
.
btn_stop
);
this
.
Controls
.
Add
(
this
.
btn_stop
);
this
.
Controls
.
Add
(
this
.
btn_run
);
this
.
Controls
.
Add
(
this
.
btn_run
);
this
.
Controls
.
Add
(
this
.
listView1
);
this
.
Controls
.
Add
(
this
.
listView1
);
...
...
AutoScanAndLabel/Form1.cs
查看文件 @
1a0fe5f
...
@@ -42,19 +42,6 @@ namespace AutoScanAndLabel
...
@@ -42,19 +42,6 @@ namespace AutoScanAndLabel
//codeInfos.Add(new CodeInfo("", 528, 406));
//codeInfos.Add(new CodeInfo("", 528, 406));
codeInfos
.
Add
(
new
CodeInfo
(
""
,
925
,
520
));
codeInfos
.
Add
(
new
CodeInfo
(
""
,
925
,
520
));
//codeInfos.Add(new CodeInfo("", 564, 684));
//codeInfos.Add(new CodeInfo("", 564, 684));
var
p
=
Common
.
CalcLabelPoint
(
codeInfos
,
new
Point
(
672
,
456
),
200
);
//MessageBox.Show(p.ToString());
//Point p1 = new Point(100, 100);
//Point p2 = new Point(1, 99);
//double a =Common.getAngle(p1, p2);
//a = a < 0 ? 360 - a : a;
////a = a - 180;
///MessageBox.Show(a.ToString());
//double d = 100;
//var x2 = p2.X + d * Math.Cos(a / 180 * Math.PI);
//var y2 = p2.Y + d * Math.Sin(a / 180 * Math.PI);
//MessageBox.Show(new Point((int)x2, (int)y2).ToString());
//MessageBox.Show(Common.PointRotate(p1, p2,83d/180*Math.PI).ToString());
btn_run
.
Enabled
=
false
;
btn_run
.
Enabled
=
false
;
btn_stop
.
Enabled
=
false
;
btn_stop
.
Enabled
=
false
;
...
@@ -87,12 +74,13 @@ namespace AutoScanAndLabel
...
@@ -87,12 +74,13 @@ namespace AutoScanAndLabel
c3
.
Text
=
"步骤"
;
c3
.
Text
=
"步骤"
;
c3
.
Width
=
100
;
c3
.
Width
=
100
;
ColumnHeader
c4
=
new
ColumnHeader
();
ColumnHeader
c4
=
new
ColumnHeader
();
c
3
.
Text
=
"信息"
;
c
4
.
Text
=
"信息"
;
c
3
.
Width
=
3
00
;
c
4
.
Width
=
4
00
;
stateView
.
Columns
.
Add
(
c1
);
stateView
.
Columns
.
Add
(
c1
);
stateView
.
Columns
.
Add
(
c2
);
stateView
.
Columns
.
Add
(
c2
);
stateView
.
Columns
.
Add
(
c3
);
stateView
.
Columns
.
Add
(
c3
);
stateView
.
Columns
.
Add
(
c4
);
stateView
.
ColumnWidthChanging
+=
listView_ColumnWidthChanging
;
stateView
.
ColumnWidthChanging
+=
listView_ColumnWidthChanging
;
#
endregion
#
endregion
...
@@ -121,12 +109,17 @@ namespace AutoScanAndLabel
...
@@ -121,12 +109,17 @@ namespace AutoScanAndLabel
}
}
void
SetState
(
List
<
MoveInfo
>
moveInfoList
)
void
SetState
(
List
<
MoveInfo
>
moveInfoList
)
{
{
this
.
SuspendLayout
();
stateView
.
Items
.
Clear
();
stateView
.
Items
.
Clear
();
foreach
(
MoveInfo
moveInfo
in
moveInfoList
)
foreach
(
MoveInfo
moveInfo
in
moveInfoList
)
{
{
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
moveInfo
.
Name
,
moveInfo
.
MoveStep
.
ToString
()
});
ListViewItem
lvi
=
new
ListViewItem
(
new
string
[]
{
""
,
moveInfo
.
Name
,
moveInfo
.
MoveStep
.
ToString
()
,
moveInfo
.
GetStateStr
()
});
stateView
.
Items
.
Add
(
lvi
);
stateView
.
Items
.
Add
(
lvi
);
}
}
ListViewItem
lvi1
=
new
ListViewItem
(
new
string
[]
{
""
,
"Printer"
,
RobotManage
.
mainMachine
.
LastPrintStatus
.
ToString
(),
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
PrinterName
)
});
stateView
.
Items
.
Add
(
lvi1
);
this
.
ResumeLayout
(
true
);
}
}
private
void
AddForm
(
string
text
,
UserControl
form
)
private
void
AddForm
(
string
text
,
UserControl
form
)
{
{
...
@@ -155,11 +148,12 @@ namespace AutoScanAndLabel
...
@@ -155,11 +148,12 @@ namespace AutoScanAndLabel
(
sender
as
ToolStripMenuItem
).
Text
=
!
RobotManage
.
IsDebug
?
"启用调试模式"
:
"停用调试模式"
;
(
sender
as
ToolStripMenuItem
).
Text
=
!
RobotManage
.
IsDebug
?
"启用调试模式"
:
"停用调试模式"
;
RobotManage
.
Init
();
//
RobotManage.Init();
if
(
RobotManage
.
IsDebug
)
if
(
RobotManage
.
IsDebug
)
{
{
addTablePage
();
addTablePage
();
RobotManage
.
LoadDebug
();
}
}
else
{
else
{
for
(
int
i
=
tabControl1
.
TabPages
.
Count
-
1
;
i
>
0
;
i
--)
for
(
int
i
=
tabControl1
.
TabPages
.
Count
-
1
;
i
>
0
;
i
--)
...
@@ -198,6 +192,7 @@ namespace AutoScanAndLabel
...
@@ -198,6 +192,7 @@ namespace AutoScanAndLabel
}
}
void
SetMsg
(
List
<
Msg
>
msgs
)
void
SetMsg
(
List
<
Msg
>
msgs
)
{
{
this
.
SuspendLayout
();
listView1
.
Items
.
Clear
();
listView1
.
Items
.
Clear
();
foreach
(
Msg
msg
in
msgs
)
foreach
(
Msg
msg
in
msgs
)
{
{
...
@@ -208,6 +203,7 @@ namespace AutoScanAndLabel
...
@@ -208,6 +203,7 @@ namespace AutoScanAndLabel
lvi
.
ForeColor
=
Color
.
Red
;
lvi
.
ForeColor
=
Color
.
Red
;
listView1
.
Items
.
Add
(
lvi
);
listView1
.
Items
.
Add
(
lvi
);
}
}
this
.
ResumeLayout
(
true
);
}
}
bool
userpause
=
false
;
bool
userpause
=
false
;
...
@@ -218,7 +214,8 @@ namespace AutoScanAndLabel
...
@@ -218,7 +214,8 @@ namespace AutoScanAndLabel
{
{
RobotManage
.
Start
();
RobotManage
.
Start
();
userpause
=
false
;
userpause
=
false
;
(
sender
as
Button
).
Text
=
"暂停运行"
;
if
(
RobotManage
.
isRunning
)
(
sender
as
Button
).
Text
=
"暂停运行"
;
}
}
else
if
(!
userpause
)
else
if
(!
userpause
)
{
{
...
...
AutoScanAndLabel/LogControl.Designer.cs
查看文件 @
1a0fe5f
...
@@ -38,7 +38,6 @@ namespace AutoScanAndLabel
...
@@ -38,7 +38,6 @@ namespace AutoScanAndLabel
this
.
logBox
.
Font
=
new
System
.
Drawing
.
Font
(
"新宋体"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
logBox
.
Font
=
new
System
.
Drawing
.
Font
(
"新宋体"
,
10.5F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
logBox
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
logBox
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
logBox
.
Name
=
"logBox"
;
this
.
logBox
.
Name
=
"logBox"
;
this
.
logBox
.
ShortcutsEnabled
=
false
;
this
.
logBox
.
Size
=
new
System
.
Drawing
.
Size
(
746
,
495
);
this
.
logBox
.
Size
=
new
System
.
Drawing
.
Size
(
746
,
495
);
this
.
logBox
.
TabIndex
=
0
;
this
.
logBox
.
TabIndex
=
0
;
this
.
logBox
.
Text
=
""
;
this
.
logBox
.
Text
=
""
;
...
...
AutoScanAndLabel/SettingControl.Designer.cs
查看文件 @
1a0fe5f
...
@@ -38,7 +38,6 @@ namespace AutoScanAndLabel
...
@@ -38,7 +38,6 @@ namespace AutoScanAndLabel
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
tableLayoutPanel1
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
tableLayoutPanel1
=
new
System
.
Windows
.
Forms
.
TableLayoutPanel
();
this
.
label3
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btnSavePos
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnSavePos
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
...
@@ -142,16 +141,6 @@ namespace AutoScanAndLabel
...
@@ -142,16 +141,6 @@ namespace AutoScanAndLabel
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
273
,
387
);
this
.
tableLayoutPanel1
.
Size
=
new
System
.
Drawing
.
Size
(
273
,
387
);
this
.
tableLayoutPanel1
.
TabIndex
=
102
;
this
.
tableLayoutPanel1
.
TabIndex
=
102
;
//
//
// label3
//
this
.
label3
.
BackColor
=
System
.
Drawing
.
SystemColors
.
ActiveCaptionText
;
this
.
label3
.
Location
=
new
System
.
Drawing
.
Point
(
107
,
259
);
this
.
label3
.
Name
=
"label3"
;
this
.
label3
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
23
);
this
.
label3
.
TabIndex
=
109
;
this
.
label3
.
Text
=
"label3"
;
this
.
label3
.
TextAlign
=
System
.
Drawing
.
ContentAlignment
.
MiddleLeft
;
//
// btnSavePos
// btnSavePos
//
//
this
.
btnSavePos
.
Location
=
new
System
.
Drawing
.
Point
(
583
,
422
);
this
.
btnSavePos
.
Location
=
new
System
.
Drawing
.
Point
(
583
,
422
);
...
@@ -166,7 +155,6 @@ namespace AutoScanAndLabel
...
@@ -166,7 +155,6 @@ namespace AutoScanAndLabel
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Controls
.
Add
(
this
.
btnSavePos
);
this
.
Controls
.
Add
(
this
.
btnSavePos
);
this
.
Controls
.
Add
(
this
.
label3
);
this
.
Controls
.
Add
(
this
.
groupBox3
);
this
.
Controls
.
Add
(
this
.
groupBox3
);
this
.
Controls
.
Add
(
this
.
chbAutoRun
);
this
.
Controls
.
Add
(
this
.
chbAutoRun
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
this
.
Controls
.
Add
(
this
.
groupBox1
);
...
@@ -192,7 +180,6 @@ namespace AutoScanAndLabel
...
@@ -192,7 +180,6 @@ namespace AutoScanAndLabel
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRun
;
private
System
.
Windows
.
Forms
.
CheckBox
chbAutoRun
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox3
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox3
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel1
;
private
System
.
Windows
.
Forms
.
TableLayoutPanel
tableLayoutPanel1
;
private
System
.
Windows
.
Forms
.
Label
label3
;
private
System
.
Windows
.
Forms
.
Button
btnSavePos
;
private
System
.
Windows
.
Forms
.
Button
btnSavePos
;
}
}
}
}
AutoScanAndLabel/SettingControl.cs
查看文件 @
1a0fe5f
...
@@ -111,22 +111,35 @@ namespace AutoScanAndLabel
...
@@ -111,22 +111,35 @@ namespace AutoScanAndLabel
private
void
TextBox_TextChanged
(
object
sender
,
EventArgs
e
)
private
void
TextBox_TextChanged
(
object
sender
,
EventArgs
e
)
{
{
var
s
=
(
sender
as
TextBox
);
var
s
=
(
sender
as
TextBox
);
if
(
s
.
Tag
.
ToString
()
!=
"Int32"
)
if
(
s
.
Tag
.
ToString
()
==
"Int32"
)
return
;
{
if
(!
int
.
TryParse
(
s
.
Text
,
out
_
))
if
(!
int
.
TryParse
(
s
.
Text
,
out
_
))
s
.
Text
=
lastvalue
;
}
else
if
(
s
.
Tag
.
ToString
()
==
"Double"
)
{
{
s
.
Text
=
lastvalue
;
if
(!
double
.
TryParse
(
s
.
Text
,
out
_
))
s
.
Text
=
lastvalue
;
}
}
s
.
SelectionStart
=
lastselectindex
;
}
}
string
lastvalue
=
""
;
string
lastvalue
=
""
;
int
lastselectindex
=
0
;
private
void
TextBox_KeyPress
(
object
sender
,
KeyPressEventArgs
e
)
private
void
TextBox_KeyPress
(
object
sender
,
KeyPressEventArgs
e
)
{
{
var
s
=
(
sender
as
TextBox
);
var
s
=
(
sender
as
TextBox
);
if
(
s
.
Tag
.
ToString
()
!=
"Int32"
)
if
(
s
.
Tag
.
ToString
()
==
"Int32"
)
return
;
{
if
(
int
.
TryParse
(
s
.
Text
,
out
_
))
if
(
int
.
TryParse
(
s
.
Text
,
out
_
))
lastvalue
=
s
.
Text
;
lastvalue
=
s
.
Text
;
}
else
if
(
s
.
Tag
.
ToString
()
==
"Double"
)
{
if
(
double
.
TryParse
(
s
.
Text
,
out
_
))
lastvalue
=
s
.
Text
;
}
lastselectindex
=
s
.
SelectionStart
;
}
}
private
void
SettingControl_Load
(
object
sender
,
EventArgs
e
)
private
void
SettingControl_Load
(
object
sender
,
EventArgs
e
)
...
@@ -203,6 +216,8 @@ namespace AutoScanAndLabel
...
@@ -203,6 +216,8 @@ namespace AutoScanAndLabel
{
{
if
(
pi
.
PropertyType
.
Name
==
"Int32"
)
if
(
pi
.
PropertyType
.
Name
==
"Int32"
)
pi
.
SetValue
(
RobotManage
.
Config
,
int
.
Parse
(
textBox
.
Text
));
pi
.
SetValue
(
RobotManage
.
Config
,
int
.
Parse
(
textBox
.
Text
));
else
if
(
pi
.
PropertyType
.
Name
==
"Double"
)
pi
.
SetValue
(
RobotManage
.
Config
,
double
.
Parse
(
textBox
.
Text
));
else
else
pi
.
SetValue
(
RobotManage
.
Config
,
textBox
.
Text
);
pi
.
SetValue
(
RobotManage
.
Config
,
textBox
.
Text
);
}
}
...
...
Common/Common.csproj
查看文件 @
1a0fe5f
...
@@ -54,7 +54,6 @@
...
@@ -54,7 +54,6 @@
<Compile Include="bean\Bean.cs" />
<Compile Include="bean\Bean.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="Setting_Init.cs" />
<Compile Include="util\AcSerialBean.cs" />
<Compile Include="util\ConfigAppSettings.cs" />
<Compile Include="util\ConfigAppSettings.cs" />
<Compile Include="util\FormUtil.cs" />
<Compile Include="util\FormUtil.cs" />
<Compile Include="util\JsonHelper.cs" />
<Compile Include="util\JsonHelper.cs" />
...
...
Common/util/AcSerialBean.cs
deleted
100644 → 0
查看文件 @
1eb794b
此文件的差异被折叠,
点击展开。
DeviceLibrary/AutoScanAndLabel/AxisBean.cs
查看文件 @
1a0fe5f
...
@@ -11,6 +11,7 @@ namespace DeviceLibrary
...
@@ -11,6 +11,7 @@ namespace DeviceLibrary
{
{
public
class
AxisBean
public
class
AxisBean
{
{
public
static
List
<
AxisBean
>
List
=
new
List
<
AxisBean
>();
public
ConfigMoveAxis
Config
=
null
;
public
ConfigMoveAxis
Config
=
null
;
public
static
int
TimeoutInterval
=
500
;
public
static
int
TimeoutInterval
=
500
;
/// <summary>
/// <summary>
...
@@ -23,6 +24,7 @@ namespace DeviceLibrary
...
@@ -23,6 +24,7 @@ namespace DeviceLibrary
{
{
this
.
Config
=
axisConfig
;
this
.
Config
=
axisConfig
;
AxisName
=
deviceName
+
" "
+
Config
.
Explain
+
"["
+
Config
.
DeviceName
+
"-"
+
Config
.
GetAxisValue
()
+
"]"
;
AxisName
=
deviceName
+
" "
+
Config
.
Explain
+
"["
+
Config
.
DeviceName
+
"-"
+
Config
.
GetAxisValue
()
+
"]"
;
List
.
Add
(
this
);
}
}
public
bool
Open
(
bool
isCheck
,
out
string
Msg
)
public
bool
Open
(
bool
isCheck
,
out
string
Msg
)
...
@@ -33,8 +35,7 @@ namespace DeviceLibrary
...
@@ -33,8 +35,7 @@ namespace DeviceLibrary
AxisManager
.
AlarmClear
(
portName
,
slvAddr
);
AxisManager
.
AlarmClear
(
portName
,
slvAddr
);
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
50
);
AxisManager
.
ServoOn
(
portName
,
slvAddr
);
AxisManager
.
ServoOn
(
portName
,
slvAddr
);
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
500
);
//打开所有轴
//打开所有轴
if
(
isCheck
)
if
(
isCheck
)
{
{
...
@@ -300,7 +301,7 @@ namespace DeviceLibrary
...
@@ -300,7 +301,7 @@ namespace DeviceLibrary
}
}
#
endregion
#
endregion
public
static
bool
RunMultiAxis
(
bool
isCheck
,
out
string
msg
,
params
AxisBean
[]
axisArray
)
public
static
bool
RunMultiAxis
(
bool
isCheck
,
out
string
msg
,
List
<
AxisBean
>
axisArray
)
{
{
msg
=
""
;
msg
=
""
;
foreach
(
AxisBean
axis
in
axisArray
)
foreach
(
AxisBean
axis
in
axisArray
)
...
@@ -313,17 +314,23 @@ namespace DeviceLibrary
...
@@ -313,17 +314,23 @@ namespace DeviceLibrary
return
false
;
return
false
;
}
}
}
}
Thread
.
Sleep
(
50
0
);
Thread
.
Sleep
(
50
);
return
true
;
return
true
;
}
}
public
static
void
StopMultiAxis
(
List
<
AxisBean
>
axisArray
)
public
static
void
CloseMultiAxis
(
params
AxisBean
[]
axisArray
)
{
{
foreach
(
AxisBean
axis
in
axisArray
)
foreach
(
AxisBean
axis
in
axisArray
)
{
{
axis
.
SuddenStop
();
axis
.
SuddenStop
();
Thread
.
Sleep
(
50
);
Thread
.
Sleep
(
10
);
}
}
public
static
void
CloseMultiAxis
(
List
<
AxisBean
>
axisArray
)
{
foreach
(
AxisBean
axis
in
axisArray
)
{
axis
.
ServoOff
();
axis
.
ServoOff
();
Thread
.
Sleep
(
10
);
}
}
}
}
...
...
DeviceLibrary/AutoScanAndLabel/Common.cs
查看文件 @
1a0fe5f
...
@@ -43,23 +43,7 @@ namespace DeviceLibrary
...
@@ -43,23 +43,7 @@ namespace DeviceLibrary
double
mb_y
=
pt2
.
Y
-
pt1
.
Y
;
double
mb_y
=
pt2
.
Y
-
pt1
.
Y
;
double
rotation
=
Math
.
Atan2
(
mb_y
,
mb_x
);
double
rotation
=
Math
.
Atan2
(
mb_y
,
mb_x
);
/*
if (pt2.Y >= pt1.Y) {
if (pt2.X >= pt1.X) { }
else
{
rotation = Math.PI - rotation;
}
} else {
if (pt2.X >= pt1.X)
{
rotation = 2 * Math.PI - rotation;
}
else
{
rotation = Math.PI + rotation;
}
}*/
rotation
=
rotation
/
Math
.
PI
*
180
;
rotation
=
rotation
/
Math
.
PI
*
180
;
return
rotation
;
return
rotation
;
//double angle = 360 - rotation + 90;
//double angle = 360 - rotation + 90;
...
@@ -105,7 +89,7 @@ namespace DeviceLibrary
...
@@ -105,7 +89,7 @@ namespace DeviceLibrary
return
new
Point
((
int
)
x2
,
(
int
)
y2
);
return
new
Point
((
int
)
x2
,
(
int
)
y2
);
}
}
public
static
Point
CalcLabelPoint
(
List
<
CodeInfo
>
codeInfos
,
Point
org
,
int
widthOffset
)
{
public
static
Point
CalcLabelPoint
(
List
<
CodeInfo
>
codeInfos
,
Point
org
,
int
widthOffset
,
out
int
labelAngle
)
{
//Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
//Point Right_Batch_Point = new Point(RobotManage.Config.Right_Batch_X, RobotManage.Config.Right_Batch_Y);
Point
Right_Batch_Point
=
org
;
Point
Right_Batch_Point
=
org
;
List
<
int
>
angles
=
new
List
<
int
>();
List
<
int
>
angles
=
new
List
<
int
>();
...
@@ -115,6 +99,7 @@ namespace DeviceLibrary
...
@@ -115,6 +99,7 @@ namespace DeviceLibrary
//c.Y = op.Y;
//c.Y = op.Y;
Point
op
=
new
Point
(
c
.
X
,
c
.
Y
);
Point
op
=
new
Point
(
c
.
X
,
c
.
Y
);
var
a
=
(
int
)
getAngle
(
Right_Batch_Point
,
op
);
var
a
=
(
int
)
getAngle
(
Right_Batch_Point
,
op
);
a
+=
ConfigHelper
.
Config
.
Get
<
int
>(
"AngleChange"
);
a
=
a
<
0
?
360
+
a
:
a
;
a
=
a
<
0
?
360
+
a
:
a
;
angles
.
Add
(
a
);
angles
.
Add
(
a
);
});
});
...
@@ -135,10 +120,10 @@ namespace DeviceLibrary
...
@@ -135,10 +120,10 @@ namespace DeviceLibrary
bigangles
=
angles
[
i
];
bigangles
=
angles
[
i
];
}
}
}
}
var
a2
=
bigangles
+
biglen
/
2
;
labelAngle
=
bigangles
+
biglen
/
2
;
a2
=
a2
>
360
?
360
-
a2
:
a2
;
labelAngle
=
labelAngle
>
360
?
360
-
labelAngle
:
labelAngle
;
var
p2
=
PointWithAngle
(
org
,
a2
,
widthOffset
);
var
p2
=
PointWithAngle
(
org
,
labelAngle
,
widthOffset
);
return
p2
;
return
p2
;
}
}
}
}
...
@@ -155,8 +140,8 @@ namespace DeviceLibrary
...
@@ -155,8 +140,8 @@ namespace DeviceLibrary
foreach
(
var
m
in
msg
)
foreach
(
var
m
in
msg
)
LogUtil
.
info
(
m
.
msgtxt
);
LogUtil
.
info
(
m
.
msgtxt
);
}
}
List
<
Msg
>
mm
=
new
List
<
Msg
>(
msg
);
return
m
sg
;
return
m
m
;
}
}
public
static
void
add
(
string
m
,
MsgLevel
ml
)
public
static
void
add
(
string
m
,
MsgLevel
ml
)
{
{
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _Common.cs
查看文件 @
1a0fe5f
...
@@ -13,22 +13,20 @@ namespace DeviceLibrary
...
@@ -13,22 +13,20 @@ namespace DeviceLibrary
{
{
public
void
StopMove
(
bool
ServoOff
=
false
)
public
void
StopMove
(
bool
ServoOff
=
false
)
{
{
runStatus
=
RunStatus
.
Stop
;
ResetMoveInfo
.
EndMove
();
ResetMoveInfo
.
EndMove
();
RightMoveInfo
.
EndMove
();
RightMoveInfo
.
EndMove
();
LeftMoveInfo
.
EndMove
();
LeftMoveInfo
.
EndMove
();
LabelMoveInfo
.
EndMove
();
LabelMoveInfo
.
EndMove
();
MiddleMoveInfo
.
EndMove
();
MiddleMoveInfo
.
EndMove
();
AxisBean
.
CloseMultiAxis
(
new
AxisBean
[]
{
Take_Middle_Axis
,
Take_UpDown_Axis
,
Left_Batch_Axis
,
Right_Batch_Axis
,
Label_X_Axis
,
Label_Y_Axis
,
Label_Z_Axis
,
Label_R_Axis
}
);
AxisBean
.
StopMultiAxis
(
AxisBean
.
List
);
if
(!
ServoOff
)
if
(
ServoOff
)
return
;
AxisBean
.
CloseMultiAxis
(
AxisBean
.
List
);
foreach
(
ConfigMoveAxis
configMoveAxis
in
Config
.
moveAxisList
)
AxisManager
.
ServoOff
(
""
,
configMoveAxis
.
GetAxisValue
());
}
}
public
void
OpenAllServo
()
public
void
OpenAllServo
()
{
{
AxisBean
.
RunMultiAxis
(
true
,
out
_
,
new
AxisBean
[]
{
Take_Middle_Axis
,
Take_UpDown_Axis
,
Left_Batch_Axis
,
Right_Batch_Axis
,
Label_X_Axis
,
Label_Y_Axis
,
Label_Z_Axis
,
Label_R_Axis
}
);
AxisBean
.
RunMultiAxis
(
true
,
out
_
,
AxisBean
.
List
);
}
}
int
logType
=
1000
;
int
logType
=
1000
;
...
@@ -204,7 +202,7 @@ namespace DeviceLibrary
...
@@ -204,7 +202,7 @@ namespace DeviceLibrary
LogUtil
.
error
(
Name
+
" 报警,报警类型:"
+
alarmType
);
LogUtil
.
error
(
Name
+
" 报警,报警类型:"
+
alarmType
);
this
.
alarmType
=
alarmType
;
this
.
alarmType
=
alarmType
;
if
(
alarmType
.
Equals
(
AlarmType
.
AxisAlarm
)
|
alarmType
.
Equals
(
AlarmType
.
AxisMoveError
))
if
(
alarmType
.
Equals
(
AlarmType
.
AxisAlarm
)
|
|
alarmType
.
Equals
(
AlarmType
.
AxisMoveError
))
{
{
LogUtil
.
error
(
Name
+
"轴报警, 停止运动, 打开报警灯"
);
LogUtil
.
error
(
Name
+
"轴报警, 停止运动, 打开报警灯"
);
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LabelProcess.cs
查看文件 @
1a0fe5f
...
@@ -49,8 +49,10 @@ namespace DeviceLibrary
...
@@ -49,8 +49,10 @@ namespace DeviceLibrary
}
}
break
;
break
;
case
MoveStep
.
Lbl10
:
case
MoveStep
.
Lbl10
:
//照片中料盘中心点像素位置
Point
Right_Batch_Point
=
new
Point
(
RobotManage
.
Config
.
Right_Batch_X
,
RobotManage
.
Config
.
Right_Batch_Y
);
Point
Right_Batch_Point
=
new
Point
(
RobotManage
.
Config
.
Right_Batch_X
,
RobotManage
.
Config
.
Right_Batch_Y
);
int
widthOffset
=
Config
.
Label_Offset_Pixel_7
;
//不同尺寸料盘需要在照片上便宜的贴标像素
int
widthOffset
=
Config
.
Label_Offset_Pixel_7
;
switch
(
LabelMoveInfo
.
MoveParam
.
PlateW
)
{
switch
(
LabelMoveInfo
.
MoveParam
.
PlateW
)
{
case
13
:
case
13
:
widthOffset
=
Config
.
Label_Offset_Pixel_13
;
widthOffset
=
Config
.
Label_Offset_Pixel_13
;
...
@@ -59,11 +61,22 @@ namespace DeviceLibrary
...
@@ -59,11 +61,22 @@ namespace DeviceLibrary
widthOffset
=
Config
.
Label_Offset_Pixel_15
;
widthOffset
=
Config
.
Label_Offset_Pixel_15
;
break
;
break
;
}
}
Point
p
=
Common
.
CalcLabelPoint
(
LabelMoveInfo
.
MoveParam
.
codeInfos
,
Right_Batch_Point
,
widthOffset
);
//计算照片中贴标的像素位置
Point
p1
=
new
Point
(
p
.
X
*
Config
.
Cam_Pixel_X_Ratio
,
p
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
);
Point
p
=
Common
.
CalcLabelPoint
(
LabelMoveInfo
.
MoveParam
.
codeInfos
,
Right_Batch_Point
,
widthOffset
,
out
int
labelAngle
);
LabelMoveInfo
.
log
(
$
"计算贴标像素点位为{p},轴点位为{p1},盘宽{LabelMoveInfo.MoveParam.PlateW}"
);
//匹配照片角度与贴标旋转轴的角度差
labelAngle
+=
Config
.
Label_R_Angle_Diff
;
//计算贴标角度的脉冲值
int
labelAxisPos
=
Config
.
Label_R_360
/
360
*
labelAngle
;
//计算像素点位与中心点的差
Point
p1
=
new
Point
(
p
.
X
-
Right_Batch_Point
.
X
,
p
.
Y
-
Right_Batch_Point
.
Y
);
//计算像素*脉冲像素比得到脉冲值+中心点基准脉冲
p1
.
X
=
(
int
)(
p1
.
X
*
Config
.
Cam_Pixel_X_Ratio
)
+
Config
.
Label_X_Base
;
p1
.
Y
=
(
int
)(
p1
.
Y
*
Config
.
Cam_Pixel_Y_Ratio
)
+
Config
.
Label_Y_Base
;
LabelMoveInfo
.
log
(
$
"计算贴标像素点位为{p},轴点位为{p1},角度{labelAngle},R轴{labelAxisPos},盘宽{LabelMoveInfo.MoveParam.PlateW}"
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
p
.
X
,
Config
.
Label_X_P2_speed
);
Label_X_Axis
.
AbsMove
(
LabelMoveInfo
,
p
.
X
,
Config
.
Label_X_P2_speed
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
p
.
Y
,
Config
.
Label_Y_P2_speed
);
Label_Y_Axis
.
AbsMove
(
LabelMoveInfo
,
p
.
Y
,
Config
.
Label_Y_P2_speed
);
Label_R_Axis
.
AbsMove
(
LabelMoveInfo
,
labelAxisPos
,
Config
.
Label_R_P2_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P3
,
Config
.
Label_Z_P3_speed
);
Label_Z_Axis
.
AbsMove
(
LabelMoveInfo
,
Config
.
Label_Z_P3
,
Config
.
Label_Z_P3_speed
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl11
);
LabelMoveInfo
.
NextMoveStep
(
MoveStep
.
Lbl11
);
LabelMoveInfo
.
log
(
"Label_XYZ转到贴标点."
);
LabelMoveInfo
.
log
(
"Label_XYZ转到贴标点."
);
...
@@ -90,6 +103,17 @@ namespace DeviceLibrary
...
@@ -90,6 +103,17 @@ namespace DeviceLibrary
}
}
}
}
string
LabelState
()
{
string
state
=
""
;
if
(
LabelMoveInfo
.
MoveStep
>=
MoveStep
.
Lbl_Printted
)
{
state
+=
"标签已打印,当前ReelID:"
+
LabelMoveInfo
.
MoveParam
.
WareCode
;
}
if
(
LabelMoveInfo
.
MoveStep
==
MoveStep
.
Lbl01
)
{
state
+=
"等待标签打印"
;
}
return
state
;
}
}
}
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LedProcess.cs
查看文件 @
1a0fe5f
...
@@ -18,7 +18,6 @@ namespace DeviceLibrary
...
@@ -18,7 +18,6 @@ namespace DeviceLibrary
Led
RunningLed
;
Led
RunningLed
;
Led
RightLed
;
Led
RightLed
;
Led
LeftLed
;
Led
LeftLed
;
List
<
Led
>
LedGroup
;
System
.
Threading
.
Timer
ledtimer
;
System
.
Threading
.
Timer
ledtimer
;
void
LedProcessInit
()
void
LedProcessInit
()
...
@@ -56,28 +55,29 @@ namespace DeviceLibrary
...
@@ -56,28 +55,29 @@ namespace DeviceLibrary
||
alarmType
==
AlarmType
.
AxisMoveError
)
{
||
alarmType
==
AlarmType
.
AxisMoveError
)
{
AlarmLed
.
LedState
=
LedState
.
on
;
AlarmLed
.
LedState
=
LedState
.
on
;
}
}
if
(
runStatus
==
RunStatus
.
Running
)
//右侧料串已空
{
if
(
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
//右侧料串已空
RightLed
.
LedState
=
LedState
.
blink
;
if
(
RightMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
RightShelfNoTray
)
else
RightLed
.
LedState
=
LedState
.
blink
;
RightLed
.
LedState
=
LedState
.
off
;
else
//左侧料串已满
RightLed
.
LedState
=
LedState
.
off
;
if
(
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
//左侧料串已满
LeftLed
.
LedState
=
LedState
.
blink
;
if
(
LeftMoveInfo
.
IsStep
(
MoveStep
.
Wait
)
&&
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
)
&&
LeftShelfNoTray
)
else
LeftLed
.
LedState
=
LedState
.
blink
;
LeftLed
.
LedState
=
LedState
.
off
;
else
LeftLed
.
LedState
=
LedState
.
off
;
LedGroup
.
ForEach
((
x
)
=>
{
x
.
run
();
});
}
Led
.
LedGroup
.
ForEach
((
x
)
=>
{
x
.
run
();
});
}
}
}
}
public
class
Led
{
public
class
Led
{
public
static
List
<
Led
>
LedGroup
=
new
List
<
Led
>();
public
LedState
LedState
=
LedState
.
off
;
public
LedState
LedState
=
LedState
.
off
;
ushort
ledio
;
ushort
ledio
;
public
Led
(
ushort
io
)
{
public
Led
(
ushort
io
)
{
ledio
=
io
;
ledio
=
io
;
LedGroup
.
Add
(
this
);
}
}
IO_VALUE
iovalue
;
IO_VALUE
iovalue
;
IO_VALUE
lastiovalue
;
IO_VALUE
lastiovalue
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
查看文件 @
1a0fe5f
...
@@ -12,6 +12,7 @@ namespace DeviceLibrary
...
@@ -12,6 +12,7 @@ namespace DeviceLibrary
partial
class
MainMachine
partial
class
MainMachine
{
{
bool
LeftShelfNoTray
=
false
;
bool
LeftShelfNoTray
=
false
;
int
LeftCount
=
0
;
void
LeftProcess
()
void
LeftProcess
()
{
{
if
(
CheckWait
(
LeftMoveInfo
))
if
(
CheckWait
(
LeftMoveInfo
))
...
@@ -20,6 +21,7 @@ namespace DeviceLibrary
...
@@ -20,6 +21,7 @@ namespace DeviceLibrary
switch
(
LeftMoveInfo
.
MoveStep
)
switch
(
LeftMoveInfo
.
MoveStep
)
{
{
case
MoveStep
.
L01
:
case
MoveStep
.
L01
:
LeftCount
=
0
;
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L03
);
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L03
);
LeftBatchAxisToP2
(
true
);
LeftBatchAxisToP2
(
true
);
LeftMoveInfo
.
log
(
$
"批量轴上升到P2位置,第一次提升,LeftStartMovePosition={LeftStartMovePosition}"
);
LeftMoveInfo
.
log
(
$
"批量轴上升到P2位置,第一次提升,LeftStartMovePosition={LeftStartMovePosition}"
);
...
@@ -57,6 +59,7 @@ namespace DeviceLibrary
...
@@ -57,6 +59,7 @@ namespace DeviceLibrary
case
MoveStep
.
L10_WaitReelPut
:
case
MoveStep
.
L10_WaitReelPut
:
break
;
break
;
case
MoveStep
.
L11_ReelPutted
:
case
MoveStep
.
L11_ReelPutted
:
LeftCount
++;
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L12
);
LeftMoveInfo
.
NextMoveStep
(
MoveStep
.
L12
);
LeftBatchAxisToP2
(
false
);
LeftBatchAxisToP2
(
false
);
LeftMoveInfo
.
log
(
$
"料盘已放入,批量轴上升,LeftStartMovePosition={LeftStartMovePosition}"
);
LeftMoveInfo
.
log
(
$
"料盘已放入,批量轴上升,LeftStartMovePosition={LeftStartMovePosition}"
);
...
@@ -171,7 +174,25 @@ namespace DeviceLibrary
...
@@ -171,7 +174,25 @@ namespace DeviceLibrary
}
}
}
}
string
LeftState
()
{
string
state
=
""
;
if
(
IOValue
(
IO_Type
.
LeftEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
state
+=
$
"有料窜,已提取{RightCount}张料盘"
;
if
(
LeftShelfNoTray
)
state
+=
",料串已清空"
;
else
state
+=
"."
;
state
+=
"当前ReelID:"
+
LeftMoveInfo
.
MoveParam
.
WareCode
;
}
else
{
return
"无料窜"
;
}
return
state
;
}
int
LeftStartMovePosition
=
0
;
int
LeftStartMovePosition
=
0
;
void
LeftBatchAxisToP2
(
bool
isFirstMove
=
true
)
void
LeftBatchAxisToP2
(
bool
isFirstMove
=
true
)
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _MiddleProcess.cs
查看文件 @
1a0fe5f
...
@@ -159,6 +159,16 @@ namespace DeviceLibrary
...
@@ -159,6 +159,16 @@ namespace DeviceLibrary
}
}
}
}
string
MiddleState
()
{
string
state
=
""
;
if
(
MiddleMoveInfo
.
MoveStep
==
MoveStep
.
M_Standby
||
MiddleMoveInfo
.
MoveStep
==
MoveStep
.
Wait
)
state
+=
"等待中"
;
else
state
+=
"当前ReelID:"
+
MiddleMoveInfo
.
MoveParam
.
WareCode
;
return
state
;
}
}
}
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _Printer.cs
查看文件 @
1a0fe5f
...
@@ -31,7 +31,7 @@ namespace DeviceLibrary
...
@@ -31,7 +31,7 @@ namespace DeviceLibrary
}*/
}*/
}
}
Asa
.
PrintLabel
.
PrinterStatus
LastPrintStatus
=
Asa
.
PrintLabel
.
PrinterStatus
.
Unknown
;
public
Asa
.
PrintLabel
.
PrinterStatus
LastPrintStatus
=
Asa
.
PrintLabel
.
PrinterStatus
.
Unknown
;
void
Print_PrintStatusChanged
(
Asa
.
PrintLabel
.
PrinterStatus
sta
,
string
msg
)
void
Print_PrintStatusChanged
(
Asa
.
PrintLabel
.
PrinterStatus
sta
,
string
msg
)
{
{
if
(
sta
.
Equals
(
LastPrintStatus
).
Equals
(
false
))
if
(
sta
.
Equals
(
LastPrintStatus
).
Equals
(
false
))
...
@@ -57,7 +57,7 @@ namespace DeviceLibrary
...
@@ -57,7 +57,7 @@ namespace DeviceLibrary
}
}
LastPrintStatus
=
sta
;
LastPrintStatus
=
sta
;
}
}
public
string
LastPrintLabel
=
""
;
void
StartPrintLabel
(
string
wareCode
,
string
wareCount
,
string
FactoryCode
=
""
)
void
StartPrintLabel
(
string
wareCode
,
string
wareCount
,
string
FactoryCode
=
""
)
{
{
try
try
...
@@ -70,6 +70,7 @@ namespace DeviceLibrary
...
@@ -70,6 +70,7 @@ namespace DeviceLibrary
text
.
Add
(
"DateTime"
,
System
.
DateTime
.
Now
.
ToString
(
"F"
));
text
.
Add
(
"DateTime"
,
System
.
DateTime
.
Now
.
ToString
(
"F"
));
text
.
Add
(
"FactoryCode"
,
FactoryCode
);
text
.
Add
(
"FactoryCode"
,
FactoryCode
);
LastPrintLabel
=
wareCode
;
RobotManage
.
PrintBean
.
Print
(
text
);
RobotManage
.
PrintBean
.
Print
(
text
);
LogUtil
.
info
(
"PrintLabel 打印标签 StartPrintLabel 结束 "
);
LogUtil
.
info
(
"PrintLabel 打印标签 StartPrintLabel 结束 "
);
}
}
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
查看文件 @
1a0fe5f
...
@@ -13,6 +13,7 @@ namespace DeviceLibrary
...
@@ -13,6 +13,7 @@ namespace DeviceLibrary
partial
class
MainMachine
partial
class
MainMachine
{
{
bool
RightShelfNoTray
=
false
;
bool
RightShelfNoTray
=
false
;
int
RightCount
=
0
;
void
RightProcess
()
void
RightProcess
()
{
{
if
(
CheckWait
(
RightMoveInfo
))
if
(
CheckWait
(
RightMoveInfo
))
...
@@ -21,6 +22,7 @@ namespace DeviceLibrary
...
@@ -21,6 +22,7 @@ namespace DeviceLibrary
switch
(
RightMoveInfo
.
MoveStep
)
switch
(
RightMoveInfo
.
MoveStep
)
{
{
case
MoveStep
.
R01
:
case
MoveStep
.
R01
:
RightCount
=
0
;
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R03
);
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R03
);
RightBatchAxisToP2
(
true
);
RightBatchAxisToP2
(
true
);
RightMoveInfo
.
log
(
$
"批量轴上升到P2位置,第一次提升,RightStartMovePosition={RightStartMovePosition}"
);
RightMoveInfo
.
log
(
$
"批量轴上升到P2位置,第一次提升,RightStartMovePosition={RightStartMovePosition}"
);
...
@@ -98,6 +100,7 @@ namespace DeviceLibrary
...
@@ -98,6 +100,7 @@ namespace DeviceLibrary
case
MoveStep
.
R10_WaitReelLeave
:
case
MoveStep
.
R10_WaitReelLeave
:
break
;
break
;
case
MoveStep
.
R11_NextReel
:
case
MoveStep
.
R11_NextReel
:
RightCount
++;
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R02
);
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
R02
);
RightMoveInfo
.
log
(
$
"料盘已取走,开始准备下一盘料"
);
RightMoveInfo
.
log
(
$
"料盘已取走,开始准备下一盘料"
);
break
;
break
;
...
@@ -190,7 +193,25 @@ namespace DeviceLibrary
...
@@ -190,7 +193,25 @@ namespace DeviceLibrary
break
;
break
;
}
}
}
}
string
RightState
()
{
string
state
=
""
;
if
(
IOValue
(
IO_Type
.
RightEnd_Check
).
Equals
(
IO_VALUE
.
HIGH
))
{
state
+=
$
"有料窜,已提取{RightCount}张料盘"
;
if
(
RightShelfNoTray
)
state
+=
",料串已清空"
;
else
state
+=
"."
;
state
+=
"当前ReelID:"
+
RightMoveInfo
.
MoveParam
.
WareCode
;
}
else
{
return
"无料窜"
;
}
return
state
;
}
/// <summary>
/// <summary>
/// 扫码线程
/// 扫码线程
/// </summary>
/// </summary>
...
@@ -214,13 +235,7 @@ namespace DeviceLibrary
...
@@ -214,13 +235,7 @@ namespace DeviceLibrary
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
RightCameraName
});
LastCodeList
=
CodeManager
.
CameraScan
(
new
List
<
string
>
{
Config
.
RightCameraName
});
}
}
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
IOMove
(
IO_Type
.
Camera_Led
,
IO_VALUE
.
LOW
);
//Point Right_Batch_Point = new Point(Config.Right_Batch_X, Config.Right_Batch_Y);
//LastCodeList.ForEach((c)=> {
// Point op = Common.PointRotate(Right_Batch_Point, new Point(c.X, c.Y), 83d / 180 * Math.PI);
// c.X = op.X;
// c.Y = op.Y;
//});
return
LastCodeList
;
return
LastCodeList
;
}));
}));
}
}
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
查看文件 @
1a0fe5f
...
@@ -40,7 +40,6 @@ namespace DeviceLibrary
...
@@ -40,7 +40,6 @@ namespace DeviceLibrary
MoveInfo
LabelMoveInfo
;
MoveInfo
LabelMoveInfo
;
MoveInfo
MiddleMoveInfo
;
MoveInfo
MiddleMoveInfo
;
List
<
MoveInfo
>
moveInfoList
;
public
delegate
void
ProcessMsg
(
List
<
Msg
>
msg
);
public
delegate
void
ProcessMsg
(
List
<
Msg
>
msg
);
public
event
ProcessMsg
ProcessMsgEvent
;
public
event
ProcessMsg
ProcessMsgEvent
;
...
@@ -71,22 +70,26 @@ namespace DeviceLibrary
...
@@ -71,22 +70,26 @@ namespace DeviceLibrary
public
MainMachine
(
Robot_Config
_config
)
{
public
MainMachine
(
Robot_Config
_config
)
{
Config
=
_config
;
Config
=
_config
;
ResetMoveInfo
=
new
MoveInfo
(
"重置"
);
RightMoveInfo
=
new
MoveInfo
(
"右侧取料"
);
RightMoveInfo
=
new
MoveInfo
(
"右侧取料"
);
RightMoveInfo
.
SetStateDelegate
(
RightState
);
MiddleMoveInfo
=
new
MoveInfo
(
"移栽"
);
MiddleMoveInfo
.
SetStateDelegate
(
MiddleState
);
LeftMoveInfo
=
new
MoveInfo
(
"左侧收料"
);
LeftMoveInfo
=
new
MoveInfo
(
"左侧收料"
);
LeftMoveInfo
.
SetStateDelegate
(
LeftState
);
LabelMoveInfo
=
new
MoveInfo
(
"贴标"
);
LabelMoveInfo
=
new
MoveInfo
(
"贴标"
);
MiddleMoveInfo
=
new
MoveInfo
(
"移栽"
);
LabelMoveInfo
.
SetStateDelegate
(
LabelState
);
ResetMoveInfo
=
new
MoveInfo
(
"重置"
);
moveInfoList
=
new
List
<
MoveInfo
>
{
RightMoveInfo
,
MiddleMoveInfo
,
LabelMoveInfo
,
LeftMoveInfo
,
ResetMoveInfo
};
#
region
初始化
led
灯
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_HddLed
].
GetIOAddr
());
AlarmLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
Alarm_HddLed
].
GetIOAddr
());
StandbyLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
RunSign_HddLed
].
GetIOAddr
());
StandbyLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
RunSign_HddLed
].
GetIOAddr
());
RunningLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
AutoRun_HddLed
].
GetIOAddr
());
RunningLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
AutoRun_HddLed
].
GetIOAddr
());
RightLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
RightState_Led
].
GetIOAddr
());
RightLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
RightState_Led
].
GetIOAddr
());
LeftLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
LeftState_Led
].
GetIOAddr
());
LeftLed
=
new
Led
(
Config
.
DOList
[
IO_Type
.
LeftState_Led
].
GetIOAddr
());
LedGroup
=
new
List
<
Led
>
{
AlarmLed
,
StandbyLed
,
RunningLed
,
RightLed
,
LeftLed
};
#
endregion
#
region
初始化伺服轴
Take_Middle_Axis
=
new
AxisBean
(
Config
.
Take_Middle_Axis
,
Name
);
Take_Middle_Axis
=
new
AxisBean
(
Config
.
Take_Middle_Axis
,
Name
);
Take_UpDown_Axis
=
new
AxisBean
(
Config
.
Take_UpDown_Axis
,
Name
);
Take_UpDown_Axis
=
new
AxisBean
(
Config
.
Take_UpDown_Axis
,
Name
);
Left_Batch_Axis
=
new
AxisBean
(
Config
.
Left_Batch_Axis
,
Name
);
Left_Batch_Axis
=
new
AxisBean
(
Config
.
Left_Batch_Axis
,
Name
);
...
@@ -95,7 +98,7 @@ namespace DeviceLibrary
...
@@ -95,7 +98,7 @@ namespace DeviceLibrary
Label_Y_Axis
=
new
AxisBean
(
Config
.
Label_Y_Axis
,
Name
);
Label_Y_Axis
=
new
AxisBean
(
Config
.
Label_Y_Axis
,
Name
);
Label_Z_Axis
=
new
AxisBean
(
Config
.
Label_Z_Axis
,
Name
);
Label_Z_Axis
=
new
AxisBean
(
Config
.
Label_Z_Axis
,
Name
);
Label_R_Axis
=
new
AxisBean
(
Config
.
Label_R_Axis
,
Name
);
Label_R_Axis
=
new
AxisBean
(
Config
.
Label_R_Axis
,
Name
);
#
endregion
electricClamp
=
RobotManage
.
electricGripper
;
electricClamp
=
RobotManage
.
electricGripper
;
...
@@ -103,14 +106,14 @@ namespace DeviceLibrary
...
@@ -103,14 +106,14 @@ namespace DeviceLibrary
LedProcessInit
();
LedProcessInit
();
}
}
/// <summary>
/// <summary>
/// 整机启动变量
/// 整机启动变量
,设置为false后将退出线程,只在停止时调用
/// </summary>
/// </summary>
bool
mstart
=
true
;
bool
mstart
=
true
;
public
void
Run
()
{
public
void
Run
()
{
mstart
=
true
;
mstart
=
true
;
while
(
mstart
)
{
while
(
mstart
)
{
try
try
{
{
canRunning
=
DeviceCheck
();
canRunning
=
DeviceCheck
();
if
(
canRunning
)
if
(
canRunning
)
{
{
...
@@ -133,14 +136,15 @@ namespace DeviceLibrary
...
@@ -133,14 +136,15 @@ namespace DeviceLibrary
HomeReset
();
HomeReset
();
}
}
}
}
catch
(
Exception
ex
){
catch
(
Exception
ex
)
{
Msg
.
add
(
ex
.
Message
,
MsgLevel
.
warning
);
Msg
.
add
(
ex
.
Message
,
MsgLevel
.
warning
);
}
}
finally
{
finally
{
ProcessMsgEvent
?.
Invoke
(
Msg
.
get
());
ProcessMsgEvent
?.
Invoke
(
Msg
.
get
());
ProcessMoveinfoEvent
?.
Invoke
(
moveInfo
List
);
ProcessMoveinfoEvent
?.
Invoke
(
MoveInfo
.
List
);
Msg
.
clear
();
Msg
.
clear
();
}
}
}
}
LogUtil
.
info
(
"主线程已退出."
);
LogUtil
.
info
(
"主线程已退出."
);
}
}
...
@@ -234,10 +238,13 @@ namespace DeviceLibrary
...
@@ -234,10 +238,13 @@ namespace DeviceLibrary
ok
=
false
;
ok
=
false
;
}
}
if
(
IOValue
(
IO_Type
.
GratingSignal_Check
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
GratingSignal_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
{
Msg
.
add
(
"安全光栅被遮挡"
,
MsgLevel
.
warning
);
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
)
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LeftCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
ok
=
false
;
ok
=
false
;
Msg
.
add
(
"安全光栅被遮挡"
+(!
ok
?
"[忽略]"
:
""
),
MsgLevel
.
warning
);
}
}
if
(
IOValue
(
IO_Type
.
HasNgBox
).
Equals
(
IO_VALUE
.
LOW
))
if
(
IOValue
(
IO_Type
.
HasNgBox
).
Equals
(
IO_VALUE
.
LOW
))
{
{
...
...
DeviceLibrary/AutoScanAndLabel/MoveInfo.cs
查看文件 @
1a0fe5f
...
@@ -10,6 +10,7 @@ namespace DeviceLibrary
...
@@ -10,6 +10,7 @@ namespace DeviceLibrary
{
{
public
class
MoveInfo
public
class
MoveInfo
{
{
public
static
List
<
MoveInfo
>
List
=
new
List
<
MoveInfo
>();
public
int
TimeOutSeconds
=
60
;
public
int
TimeOutSeconds
=
60
;
public
MoveInfo
(
string
name
)
public
MoveInfo
(
string
name
)
{
{
...
@@ -17,6 +18,8 @@ namespace DeviceLibrary
...
@@ -17,6 +18,8 @@ namespace DeviceLibrary
this
.
moveStep
=
MoveStep
.
Wait
;
this
.
moveStep
=
MoveStep
.
Wait
;
IsInWait
=
false
;
IsInWait
=
false
;
this
.
Name
=
name
;
this
.
Name
=
name
;
List
.
Add
(
this
);
}
}
public
string
Name
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
...
@@ -30,13 +33,23 @@ namespace DeviceLibrary
...
@@ -30,13 +33,23 @@ namespace DeviceLibrary
MoveStep
moveStep
;
MoveStep
moveStep
;
public
int
CanWhileCount
=
0
;
public
int
CanWhileCount
=
0
;
delegate
string
StateDelegate
();
StateDelegate
stateDelegate
;
public
void
SetStateDelegate
(
Func
<
string
>
target
)
{
stateDelegate
=
new
StateDelegate
(
target
);
}
public
String
GetStateStr
()
{
if
(
stateDelegate
!=
null
)
return
stateDelegate
.
Invoke
();
return
""
;
}
public
MoveStep
MoveStep
public
MoveStep
MoveStep
{
{
get
{
return
moveStep
;
}
get
{
return
moveStep
;
}
}
}
public
int
ErrorLogType
{
get
;
internal
set
;
}
public
void
NewMove
(
MoveStep
step
)
public
void
NewMove
(
MoveStep
step
)
{
{
this
.
MoveParam
=
new
LabelParam
();
this
.
MoveParam
=
new
LabelParam
();
...
...
DeviceLibrary/AutoScanAndLabel/RobotManage.cs
查看文件 @
1a0fe5f
...
@@ -27,6 +27,7 @@ namespace DeviceLibrary
...
@@ -27,6 +27,7 @@ namespace DeviceLibrary
public
static
void
Init
()
{
public
static
void
Init
()
{
try
try
{
{
mainMachine
=
null
;
string
msg
=
""
;
string
msg
=
""
;
string
configFile
=
Path
.
Combine
(
baseDir
,
"config\\Config.csv"
);
string
configFile
=
Path
.
Combine
(
baseDir
,
"config\\Config.csv"
);
...
@@ -55,12 +56,16 @@ namespace DeviceLibrary
...
@@ -55,12 +56,16 @@ namespace DeviceLibrary
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
LoadFinishEvent
?.
Invoke
(
false
,
ex
.
Message
);
}
}
}
}
public
static
void
LoadDebug
()
{
LoadFinishEvent
?.
Invoke
(
true
,
"打开调试模式"
);
}
public
static
void
Start
()
{
public
static
void
Start
()
{
Init
();
//
Init();
if
(!
IsLoadOk
)
if
(!
IsLoadOk
)
{
{
LogUtil
.
info
(
"系统还未加载完毕,无法启动"
);
LogUtil
.
info
(
"系统还未加载完毕,无法启动"
);
if
(!
IsDebug
)
return
;
}
}
mainThread
=
new
Thread
(
new
ThreadStart
(
mainMachine
.
Run
));
mainThread
=
new
Thread
(
new
ThreadStart
(
mainMachine
.
Run
));
mainThread
.
Start
();
mainThread
.
Start
();
...
...
DeviceLibrary/Config/general.config
0 → 100644
查看文件 @
1a0fe5f
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
config
ver
=
"10"
>
<
item
key
=
"App_Title"
ver
=
"10"
value
=
"自动贴标机"
/>
<
item
key
=
"PrinterName"
ver
=
"10"
value
=
"Microsoft Print to PDF"
/>
<
item
key
=
"LabelName"
ver
=
"10"
value
=
"457"
/>
<
item
key
=
"AngleChange "
ver
=
"10"
value
=
"83"
/>
<
item
key
=
"ElectricGripperPort"
ver
=
"10"
value
=
"COM12"
/>
</
config
>
\ No newline at end of file
\ No newline at end of file
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
1a0fe5f
...
@@ -118,5 +118,10 @@
...
@@ -118,5 +118,10 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</Content>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<None Include="Config\general.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
\ No newline at end of file
\ No newline at end of file
DeviceLibrary/DeviceLibrary/ElectricGripper.cs
查看文件 @
1a0fe5f
...
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
...
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
namespace
DeviceLibrary
namespace
DeviceLibrary
{
{
public
class
ElectricGripper
public
class
ElectricGripper
{
{
private
Neotel
.
Rmaxis
axis
;
private
Neotel
.
Rmaxis
axis
;
...
...
DeviceLibrary/DeviceLibrary/IOManager.cs
查看文件 @
1a0fe5f
...
@@ -26,7 +26,7 @@ namespace DeviceLibrary
...
@@ -26,7 +26,7 @@ namespace DeviceLibrary
{
{
ConfigIO
configIo
=
StoreManager
.
Config
.
DOList
[
ioType
];
ConfigIO
configIo
=
StoreManager
.
Config
.
DOList
[
ioType
];
instance
.
WriteSingleDO
(
configIo
.
DeviceName
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
instance
.
WriteSingleDO
(
configIo
.
DeviceName
,
configIo
.
SlaveID
,
configIo
.
GetIOAddr
(),
ioValue
);
Thread
.
Sleep
(
60
);
//
Thread.Sleep(60);
}
}
else
else
{
{
...
...
LoadCVSLibrary/storeConfig/config/Robot_Config.cs
查看文件 @
1a0fe5f
...
@@ -113,12 +113,12 @@ namespace OnlineStore.LoadCSVLibrary
...
@@ -113,12 +113,12 @@ namespace OnlineStore.LoadCSVLibrary
/// PRO,20,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
/// PRO,20,图像/X轴比值,Cam_Pixel_X_Ratio,6,,,,,,,,,,,,
/// </summary>
/// </summary>
[
ConfigProAttribute
(
"Cam_Pixel_X_Ratio"
)]
[
ConfigProAttribute
(
"Cam_Pixel_X_Ratio"
)]
public
int
Cam_Pixel_X_Ratio
{
get
;
set
;
}
public
double
Cam_Pixel_X_Ratio
{
get
;
set
;
}
/// <summary>
/// <summary>
/// PRO,20,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
/// PRO,20,图像/Y轴比值,Cam_Pixel_Y_Ratio,5,,,,,,,,,,,,
/// </summary>
/// </summary>
[
ConfigProAttribute
(
"Cam_Pixel_Y_Ratio"
)]
[
ConfigProAttribute
(
"Cam_Pixel_Y_Ratio"
)]
public
int
Cam_Pixel_Y_Ratio
{
get
;
set
;
}
public
double
Cam_Pixel_Y_Ratio
{
get
;
set
;
}
/// <summary>
/// <summary>
/// PRO,20,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
/// PRO,20,像素偏离位置7寸,Label_Offset_Pixel_7,200,,,,,,,,,,,,
/// </summary>
/// </summary>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论