Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
刘韬
/
SO827-AutoScanAndLabel
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 31aa5458
由
刘韬
编写于
2022-12-23 10:54:00 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
8f19e344
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
615 行增加
和
78 行删除
AutoScanAndLabel/AutoScanAndLabel.csproj
AutoScanAndLabel/SettingControl.Designer.cs
AutoScanAndLabel/SettingControl.cs
AutoScanAndLabel/UC/ListEditControl.cs
AutoScanAndLabel/UC_U1.Designer.cs
AutoScanAndLabel/UC_U1.cs
AutoScanAndLabel/UC_U1.resx
Common/Setting_Init.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
DeviceLibrary/DeviceLibrary.csproj
DeviceLibrary/DeviceLibrary/CodeManager.cs
DeviceLibrary/DeviceLibrary/RemoteDecodeHelper.cs
DeviceLibrary/userControl/AxisMoveControl.cs
AutoScanAndLabel/AutoScanAndLabel.csproj
查看文件 @
31aa545
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<TargetFrameworkProfile />
<TargetFrameworkProfile />
</PropertyGroup>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>
x64
</PlatformTarget>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<Optimize>false</Optimize>
...
@@ -130,6 +130,12 @@
...
@@ -130,6 +130,12 @@
<Compile Include="UC\ListEditControl.Designer.cs">
<Compile Include="UC\ListEditControl.Designer.cs">
<DependentUpon>ListEditControl.cs</DependentUpon>
<DependentUpon>ListEditControl.cs</DependentUpon>
</Compile>
</Compile>
<Compile Include="UC_U1.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UC_U1.Designer.cs">
<DependentUpon>UC_U1.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AboutBox1.resx">
<EmbeddedResource Include="AboutBox1.resx">
<DependentUpon>AboutBox1.cs</DependentUpon>
<DependentUpon>AboutBox1.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
...
@@ -168,6 +174,9 @@
...
@@ -168,6 +174,9 @@
<EmbeddedResource Include="UC\ListEditControl.resx">
<EmbeddedResource Include="UC\ListEditControl.resx">
<DependentUpon>ListEditControl.cs</DependentUpon>
<DependentUpon>ListEditControl.cs</DependentUpon>
</EmbeddedResource>
</EmbeddedResource>
<EmbeddedResource Include="UC_U1.resx">
<DependentUpon>UC_U1.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="app.manifest" />
<None Include="Properties\Settings.settings">
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<Generator>SettingsSingleFileGenerator</Generator>
...
...
AutoScanAndLabel/SettingControl.Designer.cs
查看文件 @
31aa545
...
@@ -38,13 +38,15 @@ namespace AutoScanAndLabel
...
@@ -38,13 +38,15 @@ namespace AutoScanAndLabel
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
chbAutoRun
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
btn_labelDebug
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_labelDebug
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox2
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
listEdit_pn
=
new
AutoScanAndLabel
.
UC
.
ListEditControl
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox3
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
listEditControl1
=
new
AutoScanAndLabel
.
UC
.
ListEditControl
();
this
.
txt_code
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txt_code
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
btn_codetest
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btn_codetest
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
label_matchdebugstring
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label_matchdebugstring
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
groupBox4
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
groupBox4
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
button1
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
uC_U11
=
new
AutoScanAndLabel
.
UC_U1
();
this
.
listEditControl1
=
new
AutoScanAndLabel
.
UC
.
ListEditControl
();
this
.
listEdit_pn
=
new
AutoScanAndLabel
.
UC
.
ListEditControl
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox1
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox2
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
this
.
groupBox3
.
SuspendLayout
();
...
@@ -142,18 +144,6 @@ namespace AutoScanAndLabel
...
@@ -142,18 +144,6 @@ namespace AutoScanAndLabel
this
.
groupBox2
.
TabStop
=
false
;
this
.
groupBox2
.
TabStop
=
false
;
this
.
groupBox2
.
Text
=
"PN匹配规则"
;
this
.
groupBox2
.
Text
=
"PN匹配规则"
;
//
//
// listEdit_pn
//
this
.
listEdit_pn
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
listEdit_pn
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
listEdit_pn
.
ListFile
=
"config/pn.list"
;
this
.
listEdit_pn
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
listEdit_pn
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
5
);
this
.
listEdit_pn
.
Name
=
"listEdit_pn"
;
this
.
listEdit_pn
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
158
);
this
.
listEdit_pn
.
TabIndex
=
3
;
this
.
listEdit_pn
.
DataRefresh
+=
new
System
.
EventHandler
(
this
.
listEdit_pn_DataRefresh
);
//
// groupBox3
// groupBox3
//
//
this
.
groupBox3
.
Controls
.
Add
(
this
.
listEditControl1
);
this
.
groupBox3
.
Controls
.
Add
(
this
.
listEditControl1
);
...
@@ -164,18 +154,6 @@ namespace AutoScanAndLabel
...
@@ -164,18 +154,6 @@ namespace AutoScanAndLabel
this
.
groupBox3
.
TabStop
=
false
;
this
.
groupBox3
.
TabStop
=
false
;
this
.
groupBox3
.
Text
=
"QTY匹配规则"
;
this
.
groupBox3
.
Text
=
"QTY匹配规则"
;
//
//
// listEditControl1
//
this
.
listEditControl1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
listEditControl1
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
listEditControl1
.
ListFile
=
"config/qty.list"
;
this
.
listEditControl1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
listEditControl1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
5
);
this
.
listEditControl1
.
Name
=
"listEditControl1"
;
this
.
listEditControl1
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
208
);
this
.
listEditControl1
.
TabIndex
=
3
;
this
.
listEditControl1
.
DataRefresh
+=
new
System
.
EventHandler
(
this
.
listEdit_pn_DataRefresh
);
//
// txt_code
// txt_code
//
//
this
.
txt_code
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
24
);
this
.
txt_code
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
24
);
...
@@ -212,9 +190,52 @@ namespace AutoScanAndLabel
...
@@ -212,9 +190,52 @@ namespace AutoScanAndLabel
this
.
groupBox4
.
TabStop
=
false
;
this
.
groupBox4
.
TabStop
=
false
;
this
.
groupBox4
.
Text
=
"条码匹配测试"
;
this
.
groupBox4
.
Text
=
"条码匹配测试"
;
//
//
// button1
//
this
.
button1
.
Location
=
new
System
.
Drawing
.
Point
(
182
,
378
);
this
.
button1
.
Name
=
"button1"
;
this
.
button1
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
23
);
this
.
button1
.
TabIndex
=
10
;
this
.
button1
.
Text
=
"button1"
;
this
.
button1
.
UseVisualStyleBackColor
=
true
;
this
.
button1
.
Click
+=
new
System
.
EventHandler
(
this
.
button1_Click
);
//
// uC_U11
//
this
.
uC_U11
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
246
);
this
.
uC_U11
.
Name
=
"uC_U11"
;
this
.
uC_U11
.
Size
=
new
System
.
Drawing
.
Size
(
383
,
167
);
this
.
uC_U11
.
TabIndex
=
9
;
//
// listEditControl1
//
this
.
listEditControl1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
listEditControl1
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
listEditControl1
.
ListFile
=
"config/qty.list"
;
this
.
listEditControl1
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
listEditControl1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
5
);
this
.
listEditControl1
.
Name
=
"listEditControl1"
;
this
.
listEditControl1
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
208
);
this
.
listEditControl1
.
TabIndex
=
3
;
this
.
listEditControl1
.
DataRefresh
+=
new
System
.
EventHandler
(
this
.
listEdit_pn_DataRefresh
);
//
// listEdit_pn
//
this
.
listEdit_pn
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
listEdit_pn
.
Font
=
new
System
.
Drawing
.
Font
(
"宋体"
,
12F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
listEdit_pn
.
ListFile
=
"config/pn.list"
;
this
.
listEdit_pn
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
17
);
this
.
listEdit_pn
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
5
);
this
.
listEdit_pn
.
Name
=
"listEdit_pn"
;
this
.
listEdit_pn
.
Size
=
new
System
.
Drawing
.
Size
(
354
,
158
);
this
.
listEdit_pn
.
TabIndex
=
3
;
this
.
listEdit_pn
.
DataRefresh
+=
new
System
.
EventHandler
(
this
.
listEdit_pn_DataRefresh
);
//
// SettingControl
// SettingControl
//
//
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
None
;
this
.
Controls
.
Add
(
this
.
button1
);
this
.
Controls
.
Add
(
this
.
uC_U11
);
this
.
Controls
.
Add
(
this
.
groupBox4
);
this
.
Controls
.
Add
(
this
.
groupBox4
);
this
.
Controls
.
Add
(
this
.
groupBox3
);
this
.
Controls
.
Add
(
this
.
groupBox3
);
this
.
Controls
.
Add
(
this
.
groupBox2
);
this
.
Controls
.
Add
(
this
.
groupBox2
);
...
@@ -252,5 +273,7 @@ namespace AutoScanAndLabel
...
@@ -252,5 +273,7 @@ namespace AutoScanAndLabel
private
System
.
Windows
.
Forms
.
Button
btn_codetest
;
private
System
.
Windows
.
Forms
.
Button
btn_codetest
;
private
System
.
Windows
.
Forms
.
Label
label_matchdebugstring
;
private
System
.
Windows
.
Forms
.
Label
label_matchdebugstring
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox4
;
private
System
.
Windows
.
Forms
.
GroupBox
groupBox4
;
private
UC_U1
uC_U11
;
private
System
.
Windows
.
Forms
.
Button
button1
;
}
}
}
}
AutoScanAndLabel/SettingControl.cs
查看文件 @
31aa545
...
@@ -73,7 +73,10 @@ namespace AutoScanAndLabel
...
@@ -73,7 +73,10 @@ namespace AutoScanAndLabel
private
void
btn_labeledit_Click
(
object
sender
,
EventArgs
e
)
private
void
btn_labeledit_Click
(
object
sender
,
EventArgs
e
)
{
{
RobotManage
.
PrintBean
.
EditLabel
();
//RobotManage.PrintBean.EditLabel();
PrintLabel
.
FrmLabel
frmLabel
=
new
PrintLabel
.
FrmLabel
();
frmLabel
.
desc
=
"453634563"
;
frmLabel
.
ShowDialog
();
RobotManage_LoadFinishEvent
(
true
,
""
);
RobotManage_LoadFinishEvent
(
true
,
""
);
RobotManage
.
LoadPrintSetting
();
RobotManage
.
LoadPrintSetting
();
}
}
...
@@ -153,5 +156,12 @@ namespace AutoScanAndLabel
...
@@ -153,5 +156,12 @@ namespace AutoScanAndLabel
Common
.
codeProcess
(
labelParam
,
out
string
debugstring
);
Common
.
codeProcess
(
labelParam
,
out
string
debugstring
);
label_matchdebugstring
.
Text
=
debugstring
;
label_matchdebugstring
.
Text
=
debugstring
;
}
}
private
void
button1_Click
(
object
sender
,
EventArgs
e
)
{
RemoteDecodeHelper_mod
.
RemoteDecodeParam
remoteDecodeParam
=
new
RemoteDecodeHelper_mod
.
RemoteDecodeParam
();
var
bmp
=
new
Bitmap
(
"d:\\72f60ab3-d7df-49ca-b885-842787e8fd72.jpg"
);
var
cc
=
RemoteDecodeHelper_mod
.
DecodeRequest
(
bmp
,
remoteDecodeParam
);
}
}
}
}
}
AutoScanAndLabel/UC/ListEditControl.cs
查看文件 @
31aa545
...
@@ -81,6 +81,9 @@ namespace AutoScanAndLabel.UC
...
@@ -81,6 +81,9 @@ namespace AutoScanAndLabel.UC
private
void
ListEditControl_Load
(
object
sender
,
EventArgs
e
)
private
void
ListEditControl_Load
(
object
sender
,
EventArgs
e
)
{
{
if
(
DesignMode
)
return
;
if
(!
File
.
Exists
(
listfile
))
if
(!
File
.
Exists
(
listfile
))
return
;
return
;
stringlist
.
AddRange
(
File
.
ReadAllLines
(
listfile
).
ToList
().
FindAll
((
s
)=>
{
return
!
string
.
IsNullOrWhiteSpace
(
s
);
}).
ToArray
());
stringlist
.
AddRange
(
File
.
ReadAllLines
(
listfile
).
ToList
().
FindAll
((
s
)=>
{
return
!
string
.
IsNullOrWhiteSpace
(
s
);
}).
ToArray
());
...
...
AutoScanAndLabel/UC_U1.Designer.cs
0 → 100644
查看文件 @
31aa545
namespace
AutoScanAndLabel
{
partial
class
UC_U1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private
void
InitializeComponent
()
{
this
.
label_dir
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
btn_selectdir
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
txt_reelphotodir
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
cb_exportreephoto
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
gb
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
gb
.
SuspendLayout
();
this
.
SuspendLayout
();
//
// label_dir
//
this
.
label_dir
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
label_dir
.
AutoSize
=
true
;
this
.
label_dir
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
53
);
this
.
label_dir
.
Name
=
"label_dir"
;
this
.
label_dir
.
Size
=
new
System
.
Drawing
.
Size
(
83
,
12
);
this
.
label_dir
.
TabIndex
=
16
;
this
.
label_dir
.
Text
=
"图像保存目录:"
;
//
// btn_selectdir
//
this
.
btn_selectdir
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btn_selectdir
.
Location
=
new
System
.
Drawing
.
Point
(
355
,
71
);
this
.
btn_selectdir
.
Name
=
"btn_selectdir"
;
this
.
btn_selectdir
.
Size
=
new
System
.
Drawing
.
Size
(
65
,
23
);
this
.
btn_selectdir
.
TabIndex
=
15
;
this
.
btn_selectdir
.
Text
=
"浏览"
;
this
.
btn_selectdir
.
UseVisualStyleBackColor
=
true
;
this
.
btn_selectdir
.
Click
+=
new
System
.
EventHandler
(
this
.
btn_selectdir_Click
);
//
// txt_reelphotodir
//
this
.
txt_reelphotodir
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
txt_reelphotodir
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
74
);
this
.
txt_reelphotodir
.
Name
=
"txt_reelphotodir"
;
this
.
txt_reelphotodir
.
ReadOnly
=
true
;
this
.
txt_reelphotodir
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
21
);
this
.
txt_reelphotodir
.
TabIndex
=
14
;
//
// cb_exportreephoto
//
this
.
cb_exportreephoto
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)(((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
cb_exportreephoto
.
AutoSize
=
true
;
this
.
cb_exportreephoto
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
20
);
this
.
cb_exportreephoto
.
Name
=
"cb_exportreephoto"
;
this
.
cb_exportreephoto
.
Size
=
new
System
.
Drawing
.
Size
(
264
,
16
);
this
.
cb_exportreephoto
.
TabIndex
=
13
;
this
.
cb_exportreephoto
.
Text
=
"自动拍摄并保存料盘图像. 勾选后仅本次有效"
;
this
.
cb_exportreephoto
.
UseVisualStyleBackColor
=
true
;
//
// gb
//
this
.
gb
.
Controls
.
Add
(
this
.
cb_exportreephoto
);
this
.
gb
.
Controls
.
Add
(
this
.
btn_selectdir
);
this
.
gb
.
Controls
.
Add
(
this
.
label_dir
);
this
.
gb
.
Controls
.
Add
(
this
.
txt_reelphotodir
);
this
.
gb
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
gb
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
gb
.
Name
=
"gb"
;
this
.
gb
.
Size
=
new
System
.
Drawing
.
Size
(
431
,
148
);
this
.
gb
.
TabIndex
=
17
;
this
.
gb
.
TabStop
=
false
;
this
.
gb
.
Text
=
"料盘图像导出"
;
//
// UC_U1
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
Controls
.
Add
(
this
.
gb
);
this
.
Name
=
"UC_U1"
;
this
.
Size
=
new
System
.
Drawing
.
Size
(
431
,
148
);
this
.
Load
+=
new
System
.
EventHandler
(
this
.
UC_U1_Load
);
this
.
gb
.
ResumeLayout
(
false
);
this
.
gb
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
}
#
endregion
private
System
.
Windows
.
Forms
.
Label
label_dir
;
private
System
.
Windows
.
Forms
.
Button
btn_selectdir
;
private
System
.
Windows
.
Forms
.
TextBox
txt_reelphotodir
;
private
System
.
Windows
.
Forms
.
CheckBox
cb_exportreephoto
;
private
System
.
Windows
.
Forms
.
GroupBox
gb
;
}
}
AutoScanAndLabel/UC_U1.cs
0 → 100644
查看文件 @
31aa545
using
OnlineStore.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
namespace
AutoScanAndLabel
{
public
partial
class
UC_U1
:
UserControl
{
public
UC_U1
()
{
InitializeComponent
();
}
private
void
btn_selectdir_Click
(
object
sender
,
EventArgs
e
)
{
FolderBrowserDialog
folderBrowserDialog
=
new
FolderBrowserDialog
();
folderBrowserDialog
.
ShowNewFolderButton
=
true
;
if
(
folderBrowserDialog
.
ShowDialog
()
==
DialogResult
.
OK
)
{
txt_reelphotodir
.
Text
=
folderBrowserDialog
.
SelectedPath
;
}
}
private
void
UC_U1_Load
(
object
sender
,
EventArgs
e
)
{
ConfigHelper
.
Config
.
PropertyBind
(
Setting_Init
.
ReelPhotoSaveDir
,
txt_reelphotodir
,
"Text"
,
"TextChanged"
);
ConfigHelper
.
Config
.
PropertyBind
(
Setting_Init
.
SaveReelPhoto
,
cb_exportreephoto
,
"Checked"
,
"CheckedChanged"
);
}
}
}
AutoScanAndLabel/UC_U1.resx
0 → 100644
查看文件 @
31aa545
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
\ No newline at end of file
Common/Setting_Init.cs
查看文件 @
31aa545
...
@@ -46,6 +46,8 @@ namespace OnlineStore.Common
...
@@ -46,6 +46,8 @@ namespace OnlineStore.Common
public
static
string
StickingPosJudgment
=
"StickingPosJudgment"
;
public
static
string
StickingPosJudgment
=
"StickingPosJudgment"
;
public
static
string
GratingSignal
=
" GratingSignal"
;
public
static
string
GratingSignal
=
" GratingSignal"
;
public
static
string
SaveReelPhoto
=
"SaveReelPhoto"
;
public
static
string
ReelPhotoSaveDir
=
"ReelPhotoSaveDir"
;
/// <summary>
/// <summary>
/// 启用贴标功能
/// 启用贴标功能
/// </summary>
/// </summary>
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _LeftProcess.cs
查看文件 @
31aa545
...
@@ -169,6 +169,7 @@ namespace DeviceLibrary
...
@@ -169,6 +169,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
LeftMoto_Run
,
IO_VALUE
.
HIGH
);
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LeftEnd_Check
,
IO_VALUE
.
HIGH
));
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
LeftEnd_Check
,
IO_VALUE
.
HIGH
));
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
60000
));
LeftMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
60000
));
LeftMoveInfo
.
TimeOutSeconds
=
60
;
LeftMoveInfo
.
OneWaitCanEndStep
=
true
;
LeftMoveInfo
.
OneWaitCanEndStep
=
true
;
LeftMoveInfo
.
log
(
$
"等待料串到位"
);
LeftMoveInfo
.
log
(
$
"等待料串到位"
);
break
;
break
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine _RightProcess.cs
查看文件 @
31aa545
...
@@ -8,6 +8,7 @@ using System.Drawing;
...
@@ -8,6 +8,7 @@ using System.Drawing;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.IO
;
namespace
DeviceLibrary
namespace
DeviceLibrary
{
{
...
@@ -85,6 +86,13 @@ namespace DeviceLibrary
...
@@ -85,6 +86,13 @@ namespace DeviceLibrary
if
(
RightScanTask
.
IsCompleted
)
if
(
RightScanTask
.
IsCompleted
)
{
{
var
(
x
,
s
)
=
RightScanTask
.
Result
;
var
(
x
,
s
)
=
RightScanTask
.
Result
;
if
(
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
SaveReelPhoto
,
false
))
{
string
d
=
ConfigHelper
.
Config
.
Get
(
Setting_Init
.
ReelPhotoSaveDir
);
string
fn
=
Path
.
GetFileName
(
s
);
string
df
=
Path
.
Combine
(
d
,
fn
);
File
.
Copy
(
s
,
df
);
}
if
(
x
.
Count
==
0
)
if
(
x
.
Count
==
0
)
{
{
RightMoveInfo
.
log
(
$
"未识别到有效二维码,转入NG箱"
);
RightMoveInfo
.
log
(
$
"未识别到有效二维码,转入NG箱"
);
...
@@ -131,6 +139,7 @@ namespace DeviceLibrary
...
@@ -131,6 +139,7 @@ namespace DeviceLibrary
break
;
break
;
case
MoveStep
.
R12_ShelfNoTray
:
case
MoveStep
.
R12_ShelfNoTray
:
RightShelfNoTray
=
true
;
RightShelfNoTray
=
true
;
ConfigHelper
.
Config
.
Set
(
Setting_Init
.
SaveReelPhoto
,
false
);
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
REND
);
RightMoveInfo
.
NextMoveStep
(
MoveStep
.
REND
);
Right_Batch_Axis
.
AbsMove
(
RightMoveInfo
,
Config
.
Right_Batch_P1
,
Config
.
Right_Batch_P1_speed
);
Right_Batch_Axis
.
AbsMove
(
RightMoveInfo
,
Config
.
Right_Batch_P1
,
Config
.
Right_Batch_P1_speed
);
RightMoveInfo
.
log
(
$
"料串已取完, 批量轴下降到P1"
);
RightMoveInfo
.
log
(
$
"料串已取完, 批量轴下降到P1"
);
...
@@ -193,6 +202,7 @@ namespace DeviceLibrary
...
@@ -193,6 +202,7 @@ namespace DeviceLibrary
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
);
IOMove
(
IO_Type
.
RightMoto_Run
,
IO_VALUE
.
HIGH
);
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
RightEnd_Check
,
IO_VALUE
.
HIGH
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitIO
(
IO_Type
.
RightEnd_Check
,
IO_VALUE
.
HIGH
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
60000
));
RightMoveInfo
.
WaitList
.
Add
(
WaitResultInfo
.
WaitTime
(
60000
));
RightMoveInfo
.
TimeOutSeconds
=
60
;
RightMoveInfo
.
OneWaitCanEndStep
=
true
;
RightMoveInfo
.
OneWaitCanEndStep
=
true
;
RightMoveInfo
.
log
(
$
"等待料串到位"
);
RightMoveInfo
.
log
(
$
"等待料串到位"
);
break
;
break
;
...
...
DeviceLibrary/AutoScanAndLabel/MainMachine.cs
查看文件 @
31aa545
...
@@ -107,7 +107,7 @@ namespace DeviceLibrary
...
@@ -107,7 +107,7 @@ namespace DeviceLibrary
Label_Y_Axis
.
interference
+=
Label_Y_Axis_interference
;
Label_Y_Axis
.
interference
+=
Label_Y_Axis_interference
;
Take_Middle_Axis
.
interference
+=
Take_Middle_Axis_interference
;
Take_Middle_Axis
.
interference
+=
Take_Middle_Axis_interference
;
electricClamp
=
RobotManage
.
electricGripper
;
electricClamp
=
RobotManage
.
electricGripper
;
CodeManager
.
LoadCamera
(
true
);
AlarmBuzzer
.
SetOnOffAction
(()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
AlarmBuzzer
.
SetOnOffAction
(()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
HIGH
);
},
()
=>
{
IOMove
(
IO_Type
.
Alarm_Buzzer
,
IO_VALUE
.
LOW
);
});
InitPrint
();
InitPrint
();
...
@@ -117,7 +117,7 @@ namespace DeviceLibrary
...
@@ -117,7 +117,7 @@ namespace DeviceLibrary
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
private
void
Crc_LanguageChangeEvent
(
object
sender
,
EventArgs
e
)
{
{
RightMoveInfo
.
Name
=
(
crc
.
GetString
(
"Res0039"
,
"右侧取料"
));
RightMoveInfo
.
Name
=
(
crc
.
GetString
(
"Res0039"
,
"右侧取料"
));
MiddleMoveInfo
.
Name
=
(
crc
.
GetString
(
"Res0042"
,
"移栽"
));
MiddleMoveInfo
.
Name
=
(
crc
.
GetString
(
"Res0042"
,
"移栽"
));
LeftMoveInfo
.
Name
=
(
crc
.
GetString
(
"Res0051"
,
"左侧放料"
));
LeftMoveInfo
.
Name
=
(
crc
.
GetString
(
"Res0051"
,
"左侧放料"
));
...
@@ -313,6 +313,8 @@ namespace DeviceLibrary
...
@@ -313,6 +313,8 @@ namespace DeviceLibrary
break
;
break
;
}
}
}
}
bool
isAgvRun
{
get
=>
LeftMoveInfo
.
MoveStep
>=
MoveStep
.
L60_InShelf
||
LeftMoveInfo
.
MoveStep
>=
MoveStep
.
L50_OutShelf
||
RightMoveInfo
.
MoveStep
>=
MoveStep
.
R30_OutShelf
||
RightMoveInfo
.
MoveStep
>=
MoveStep
.
R40_InShelf
;
}
public
bool
IgnoreSafecheck
=
false
;
public
bool
IgnoreSafecheck
=
false
;
public
bool
IgnoreGratingSignal
=
false
;
public
bool
IgnoreGratingSignal
=
false
;
...
@@ -328,7 +330,7 @@ namespace DeviceLibrary
...
@@ -328,7 +330,7 @@ namespace DeviceLibrary
}
}
else
if
(
IOValue
(
IO_Type
.
GratingSignal_Check
).
Equals
(
IO_VALUE
.
LOW
))
else
if
(
IOValue
(
IO_Type
.
GratingSignal_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
{
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
if
(!
IgnoreSafecheck
&&
!
IgnoreGratingSignal
&&
!
isAgvRun
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
RightCar_Check
).
Equals
(
IO_VALUE
.
LOW
)
&&
IOValue
(
IO_Type
.
LeftCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
&&
IOValue
(
IO_Type
.
LeftCar_Check
).
Equals
(
IO_VALUE
.
LOW
))
{
{
...
...
DeviceLibrary/DeviceLibrary.csproj
查看文件 @
31aa545
...
@@ -50,6 +50,7 @@
...
@@ -50,6 +50,7 @@
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL" />
<Reference Include="RmaxisV2, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<Reference Include="RmaxisV2, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<SpecificVersion>False</SpecificVersion>
<HintPath>..\AutoScanAndLabel\bin\Debug\RmaxisV2.dll</HintPath>
<HintPath>..\AutoScanAndLabel\bin\Debug\RmaxisV2.dll</HintPath>
...
@@ -101,6 +102,7 @@
...
@@ -101,6 +102,7 @@
<Compile Include="DeviceLibrary\HC\HCIOManager.cs" />
<Compile Include="DeviceLibrary\HC\HCIOManager.cs" />
<Compile Include="DeviceLibrary\I_IOManager.cs" />
<Compile Include="DeviceLibrary\I_IOManager.cs" />
<Compile Include="DeviceLibrary\IOManager.cs" />
<Compile Include="DeviceLibrary\IOManager.cs" />
<Compile Include="DeviceLibrary\RemoteDecodeHelper.cs" />
<Compile Include="DeviceLibrary\ZebraPrinter.cs" />
<Compile Include="DeviceLibrary\ZebraPrinter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="userControl\AxisMoveControl.cs">
<Compile Include="userControl\AxisMoveControl.cs">
...
...
DeviceLibrary/DeviceLibrary/CodeManager.cs
查看文件 @
31aa545
...
@@ -79,7 +79,7 @@ namespace DeviceLibrary
...
@@ -79,7 +79,7 @@ namespace DeviceLibrary
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
StackTrace
);
LogUtil
.
error
(
"解析摄像机配置出错:"
+
ex
.
StackTrace
);
}
}
}
}
p
rivate
static
void
LoadCamera
(
bool
isReLoad
)
p
ublic
static
void
LoadCamera
(
bool
isReLoad
)
{
{
if
(
isReLoad
||
Camera
.
_cam
==
null
)
if
(
isReLoad
||
Camera
.
_cam
==
null
)
{
{
...
@@ -152,65 +152,38 @@ namespace DeviceLibrary
...
@@ -152,65 +152,38 @@ namespace DeviceLibrary
Bitmap
bmp
=
null
;
Bitmap
bmp
=
null
;
try
try
{
{
bool
nohalcon
=
fals
e
;
bool
nohalcon
=
tru
e
;
ho_Image
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
,
out
bmp
,
nohalcon
);
_
=
Camera
.
_cam
.
CaptureOnImage
(
cameraName
,
out
bmp
,
nohalcon
);
//HalconDotNet.HOperatorSet.RotateImage()
//HalconDotNet.HOperatorSet.RotateImage()
if
(
ho_Image
==
null
&&
!
nohalcon
)
if
(
bmp
==
null
)
{
{
LogUtil
.
error
(
" 【"
+
cameraName
+
"】取图片失败["
+
Camera
.
_cam
.
ErrInfo
+
"],关闭相机"
);
LogUtil
.
error
(
" 【"
+
cameraName
+
"】取图片失败["
+
Camera
.
_cam
.
ErrInfo
+
"],关闭相机"
);
CloseCamera
(
cameraNam
e
);
LoadCamera
(
tru
e
);
continue
;
continue
;
}
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
LogUtil
.
info
(
" 【"
+
cameraName
+
"】取图片完成,开始扫码"
);
string
r
=
""
;
string
r
=
""
;
RemoteDecodeHelper_mod
.
RemoteDecodeParam
remoteDecodeParam
=
new
RemoteDecodeHelper_mod
.
RemoteDecodeParam
();
var
cc
=
RemoteDecodeHelper_mod
.
DecodeRequest
(
bmp
,
remoteDecodeParam
);
//bmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
if
(
cc
==
null
)
//List<CodeInfo> tlci = EyemDecode2.Decoder(ref bmp);
//foreach (CodeInfo code in tlci)
//{
// LogUtil.info(" 【" + cameraName + "】[eyemDecode]" + code.CodeType + "(X: " + code.X + ",Y: " + code.Y + ") " + code.CodeStr);
// //string str = CodeManager.ReplaceCode(code.CodeStr);
// lock (codeList)
// {
// if (!codeList.Contains(code))
// {
// codeList.Add(code);
// r = r + "##" + code.CodeStr;
// }
// }
//}
List
<
CodeInfo
>
cc
=
new
List
<
CodeInfo
>();
foreach
(
string
codeType
in
codeTypeList
)
{
{
//判断是否是一维码
LogUtil
.
info
(
" 【"
+
cameraName
+
"】调用外部转码失败"
);
if
(
codeType
.
ToLower
().
Equals
(
"barcode"
))
}
{
else
if
(
cc
.
ErrorCode
!=
0
)
cc
=
HDCodeHelper
.
DecodeBarCode
(
ho_Image
);
{
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】调用外部转码错误:"
+
cc
.
ErrorCode
+
","
+
cc
.
Msg
);
else
}
{
else
cc
=
HDCodeHelper
.
DecodeCode
(
ho_Image
,
codeType
,
GetCodeParamFilePath
(
codeType
),
QRCodeCount
,
3000
);
{
cc
.
ForEach
((
x
)
=>
{
x
.
CodeType
=
codeType
;
});
foreach
(
var
code
in
cc
.
workCodeInfo
)
}
LogUtil
.
info
(
" 【"
+
cameraName
+
"】[Halcon]"
+
codeType
+
","
+
QRCodeCount
+
","
+
cc
.
Count
);
foreach
(
CodeInfo
c
in
cc
)
{
{
LogUtil
.
info
(
" 【"
+
cameraName
+
"】[Halcon]"
+
c
.
CodeType
+
"(X: "
+
c
.
X
+
",Y: "
+
c
.
Y
+
") "
+
c
.
CodeStr
);
codeList
.
Add
(
new
CodeInfo
(
code
.
Text
,(
int
)
code
.
Center
.
X
,
(
int
)
code
.
Center
.
Y
,
code
.
CodeType
));
c
.
CodeStr
=
CodeManager
.
ReplaceCode
(
c
.
CodeStr
);
r
=
r
+
"##"
+
code
.
CodeType
+
":"
+
code
.
Text
;
lock
(
codeList
)
{
if
(!
codeList
.
Contains
(
c
))
{
codeList
.
Add
(
c
);
r
=
r
+
"##"
+
c
.
CodeStr
;
}
}
}
}
}
}
//if (codeList.Count() == 0)
//if (codeList.Count() == 0)
//{
//{
bitmapfilename
=
SaveImageToFile
(
"mimo"
,
cameraName
,
bmp
);
bitmapfilename
=
SaveImageToFile
(
"mimo"
,
cameraName
,
bmp
);
...
@@ -276,6 +249,7 @@ namespace DeviceLibrary
...
@@ -276,6 +249,7 @@ namespace DeviceLibrary
{
{
Directory
.
CreateDirectory
(
dire
);
Directory
.
CreateDirectory
(
dire
);
}
}
DelOverDayFile
(
dire
,
"*.bmp"
,
7
);
bit
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bit
.
Save
(
dire
+
iamgeName
,
ImageFormat
.
Bmp
);
bit
.
Dispose
();
bit
.
Dispose
();
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成,保存图片到【"
+
dire
+
iamgeName
+
"】成功"
);
LogUtil
.
info
(
deviceName
+
" 【"
+
cameraName
+
"】扫码完成,保存图片到【"
+
dire
+
iamgeName
+
"】成功"
);
...
@@ -287,7 +261,27 @@ namespace DeviceLibrary
...
@@ -287,7 +261,27 @@ namespace DeviceLibrary
}
}
return
dire
+
iamgeName
;
return
dire
+
iamgeName
;
}
}
static
void
DelOverDayFile
(
string
path
,
string
ext
,
int
day
)
{
DateTime
n
=
DateTime
.
Now
;
if
(!
Directory
.
Exists
(
path
))
return
;
string
[]
files
=
Directory
.
GetFiles
(
path
,
ext
);
foreach
(
string
file
in
files
)
{
try
{
var
fi
=
new
FileInfo
(
file
);
var
t
=
n
-
fi
.
LastWriteTime
;
if
(
t
.
TotalDays
>
day
)
{
fi
.
Delete
();
}
}
catch
{
}
}
}
/// <summary>
/// <summary>
/// 处理接收后的二维码
/// 处理接收后的二维码
/// </summary>
/// </summary>
...
...
DeviceLibrary/DeviceLibrary/RemoteDecodeHelper.cs
0 → 100644
查看文件 @
31aa545
using
CodeLibrary
;
using
HalconDotNet
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.IO
;
using
System.Linq
;
using
System.Net
;
using
System.Runtime.Serialization.Formatters.Binary
;
using
System.Text
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Xml
;
using
System.Xml.Serialization
;
public
class
RemoteDecodeHelper_mod
{
static
int
webclienttimeout
=
30
*
1000
;
static
Process
p
=
new
Process
();
const
string
serverhost
=
"http://127.0.0.1:58137/"
;
public
static
WebResultCode
DecodeRequest
(
Bitmap
bitmap
,
RemoteDecodeParam
remoteDecodeParam
)
{
CheckAndRunServer
();
if
(
bitmap
==
null
)
return
null
;
byte
[]
requestdata
;
lock
(
bitmap
)
{
using
(
MemoryStream
mStream
=
new
MemoryStream
())
{
BinaryFormatter
bf
=
new
BinaryFormatter
();
bf
.
Serialize
(
mStream
,
bitmap
);
requestdata
=
mStream
.
ToArray
();
mStream
.
Close
();
}
}
return
DecodeRequest
(
requestdata
,
remoteDecodeParam
);
}
static
WebResultCode
DecodeRequest
(
byte
[]
requestdata
,
RemoteDecodeParam
remoteDecodeParam
,
bool
isHObject
=
false
)
{
//CheckAndRunServer();
string
param
;
using
(
MemoryStream
mStreamparam
=
new
MemoryStream
())
{
XmlSerializer
xf
=
new
XmlSerializer
(
typeof
(
RemoteDecodeParam
));
xf
.
Serialize
(
mStreamparam
,
remoteDecodeParam
);
param
=
base64UrlEncode
(
mStreamparam
.
ToArray
());
mStreamparam
.
Close
();
}
string
url
=
serverhost
+
"NeoScan/ProcessBitmap?param="
;
if
(
isHObject
)
url
=
serverhost
+
"NeoScan/Process?param="
;
byte
[]
resp
;
try
{
MyWebClient
webClient
=
new
MyWebClient
(
webclienttimeout
);
resp
=
webClient
.
UploadData
(
url
+
param
,
requestdata
);
requestdata
=
null
;
webClient
.
Dispose
();
}
catch
(
WebException
we
)
{
return
null
;
}
catch
{
return
null
;
}
WebResultCode
codeInfos
=
null
;
var
ss
=
Encoding
.
UTF8
.
GetString
(
resp
);
try
{
codeInfos
=
JsonConvert
.
DeserializeObject
<
WebResultCode
>(
ss
);
}
catch
(
Exception
ex
)
{
throw
new
Exception
(
"数据解析出错:"
+
ex
+
"\r\n"
+
ss
);
}
return
codeInfos
;
}
/// <summary>
/// 在url中传递base64字符串需要替换加号等符号
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
static
string
base64UrlEncode
(
byte
[]
input
)
{
return
Convert
.
ToBase64String
(
input
).
Replace
(
'+'
,
'-'
).
Replace
(
'/'
,
'_'
);
}
/// <summary>
/// 检查并自动启动服务器
/// </summary>
static
void
CheckAndRunServer
()
{
lock
(
p
)
{
var
pss
=
Process
.
GetProcessesByName
(
"SmartScan"
);
if
(
pss
.
Length
>
0
)
return
;
var
f
=
"SmartScan\\SmartScan.exe"
;
if
(!
File
.
Exists
(
f
))
throw
new
Exception
(
"找不到扫码服务器文件"
);
p
.
StartInfo
=
new
ProcessStartInfo
(
f
);
p
.
StartInfo
.
Arguments
=
"hide"
;
p
.
Start
();
int
checkcount
=
5
;
while
(
checkcount
>
0
)
{
checkcount
--;
Thread
.
Sleep
(
500
);
MyWebClient
webClient
=
new
MyWebClient
(
webclienttimeout
);
var
s
=
webClient
.
DownloadString
(
serverhost
+
"alive"
);
if
(
s
.
Trim
()
==
"\"1\""
)
return
;
}
throw
new
Exception
(
"扫码服务器打开失败"
);
}
}
[
Serializable
]
public
struct
RemoteDecodeParam
{
public
string
[]
codeTypeList
;
public
int
codeCount
;
public
int
timeout
;
}
[
Serializable
]
public
class
WebResultCode
{
public
int
ErrorCode
{
get
;
set
;
}
public
string
Msg
{
get
;
set
;
}
//public WebCodeText[] Data { get; set; }
public
List
<
KeyValuePair
<
string
,
string
>>
workCodeKeyword
;
public
List
<
BarcodeInfo
>
workCodeInfo
;
public
WebResultCode
()
{
ErrorCode
=
0
;
Msg
=
"OK"
;
}
}
//
// 摘要:
// 条码信息,1DBarcode、2DBarcode
[
Serializable
]
public
class
BarcodeInfo
{
//
// 摘要:
// 文本
public
string
Text
{
get
;
set
;
}
//
// 摘要:
// 条码类型
public
string
CodeType
{
get
;
set
;
}
//
// 摘要:
// 中心点
public
PointF
Center
{
get
;
set
;
}
//
// 摘要:
// 角度,3点钟方向0°,逆时针为正,顺时针为负。
public
float
Angle
{
get
;
set
;
}
//
// 摘要:
// 条码尺寸大小
//public SizeF Size { get; set; }
//
// 摘要:
// 原点垂直于经过中心点的直线的距离
public
float
Distance
{
get
;
set
;
}
}
public
class
MyWebClient
:
WebClient
{
private
int
_timeout
;
public
MyWebClient
(
int
timeout
)
{
this
.
_timeout
=
timeout
;
}
protected
override
WebRequest
GetWebRequest
(
Uri
address
)
{
var
result
=
base
.
GetWebRequest
(
address
);
result
.
Timeout
=
this
.
_timeout
;
return
result
;
}
}
}
DeviceLibrary/userControl/AxisMoveControl.cs
查看文件 @
31aa545
...
@@ -38,6 +38,9 @@ namespace DeviceLibrary
...
@@ -38,6 +38,9 @@ namespace DeviceLibrary
}
}
public
void
LoadData
(
IRobot
equipBase
,
bool
isHc
=
true
)
public
void
LoadData
(
IRobot
equipBase
,
bool
isHc
=
true
)
{
{
if
(
equipBase
==
null
)
return
;
this
.
boxBean
=
equipBase
;
this
.
boxBean
=
equipBase
;
axisList
=
new
List
<
ConfigMoveAxis
>(
equipBase
.
Config
.
moveAxisList
);
axisList
=
new
List
<
ConfigMoveAxis
>(
equipBase
.
Config
.
moveAxisList
);
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论